You are here

interface SpecFetcherInterface in Apigee API Catalog 8

Same name and namespace in other branches
  1. 8.2 src/SpecFetcherInterface.php \Drupal\apigee_api_catalog\SpecFetcherInterface

Interface SpecFetcherInterface.

Hierarchy

Expanded class hierarchy of SpecFetcherInterface

All classes that implement SpecFetcherInterface

1 file declares its use of SpecFetcherInterface
ApiDocReimportSpecForm.php in src/Entity/Form/ApiDocReimportSpecForm.php

File

src/SpecFetcherInterface.php, line 30

Namespace

Drupal\apigee_api_catalog
View source
interface SpecFetcherInterface {
  public const LOG_LEVEL_MAP = [
    LogLevel::ALERT => MessengerInterface::TYPE_WARNING,
    LogLevel::WARNING => MessengerInterface::TYPE_WARNING,
    LogLevel::NOTICE => MessengerInterface::TYPE_STATUS,
    LogLevel::INFO => MessengerInterface::TYPE_STATUS,
    LogLevel::DEBUG => MessengerInterface::TYPE_STATUS,
  ];

  /**
   * The status when an error happened during the fetch operation.
   *
   * @var string
   */
  public const STATUS_ERROR = 'status_error';

  /**
   * The status when a spec update completed successfully.
   *
   * @var string
   */
  public const STATUS_UPDATED = 'status_updated';

  /**
   * The status when a spec update finds the remote file unchanged.
   *
   * @var string
   */
  public const STATUS_UNCHANGED = 'status_unchanged';

  /**
   * Fetch OpenAPI specification file from URL.
   *
   * Takes care of updating an ApiDoc file entity with the updated spec file. If
   * "spec_file_source" uses a URL, it will fetch the specified file and put it
   * in the "spec" file field. If it uses a "file", it won't change it.
   * This method only updates the file entity if it completed without error (if
   * it returns STATUS_UPDATED or STATUS_UNCHANGED), it does not save
   * the ApiDoc entity.
   *
   * @param \Drupal\apigee_api_catalog\Entity\ApiDocInterface $apidoc
   *   The ApiDoc entity.
   *
   * @return string
   *   Returns the status of the operation. If it is STATUS_UPDATED or
   *   STATUS_UNCHANGED, the ApiDoc entity will need to be saved to store the
   *   changes.
   */
  public function fetchSpec(ApiDocInterface $apidoc) : string;

}

Members

Namesort descending Modifiers Type Description Overrides
SpecFetcherInterface::fetchSpec public function Fetch OpenAPI specification file from URL. 1
SpecFetcherInterface::LOG_LEVEL_MAP public constant
SpecFetcherInterface::STATUS_ERROR public constant The status when an error happened during the fetch operation.
SpecFetcherInterface::STATUS_UNCHANGED public constant The status when a spec update finds the remote file unchanged.
SpecFetcherInterface::STATUS_UPDATED public constant The status when a spec update completed successfully.