You are here

interface ApiTokenPluginInterface in API Tokens 8

Same name and namespace in other branches
  1. 8.2 src/ApiTokenPluginInterface.php \Drupal\api_tokens\ApiTokenPluginInterface

Defines the interface for the API token plugins.

API tokens are discovered through annotations, which may contain the following definition properties:

  • id: (required) The API token ID.
  • label: (required) The administrative label of the API token.
  • description: The administrative description of the API token.

Hierarchy

Expanded class hierarchy of ApiTokenPluginInterface

All classes that implement ApiTokenPluginInterface

File

src/ApiTokenPluginInterface.php, line 18

Namespace

Drupal\api_tokens
View source
interface ApiTokenPluginInterface extends ContainerFactoryPluginInterface, PluginInspectionInterface, RefinableCacheableDependencyInterface {

  /**
   * Returns the API token ID.
   *
   * @return string
   */
  public function id();

  /**
   * Returns the administrative label of the API token.
   *
   * @return string
   */
  public function label();

  /**
   * Returns the administrative description of the API token.
   *
   * @return string
   */
  public function description();

  /**
   * Returns the name of the provider that owns this API token.
   *
   * @return string
   */
  public function provider();

  /**
   * Returns the API token string.
   *
   * @return string
   */
  public function token();

  /**
   * Returns the API token parameter string.
   *
   * @return string
   */
  public function paramString();

  /**
   * Returns the API token parameters.
   *
   * @return array
   */
  public function params();

  /**
   * Returns the API token parameters hash.
   *
   * @return string
   */
  public function hash();

  /**
   * Returns the API token build method reflection object.
   *
   * @return \ReflectionMethod|null
   */
  public function reflector();

  /**
   * Performs one-time context-independent validation of the API token.
   *
   * @return bool
   */
  public function validateToken();

  /**
   * Returns processed API token build.
   *
   * @return array
   *   A renderable array for the API token output.
   */
  public function process();

  /**
   * Returns a build to replace the API token with in case of validation fail.
   *
   * @return array
   *   A renderable array.
   */
  public function fallback();

  /**
   * Returns a #lazy_builder placeholder for the API tokens filter.
   *
   * @return array
   *   A renderable array representing a placeholder.
   */
  public function placeholder();

  /**
   * The #lazy_builder callback.
   *
   * @param string $id
   *   The API token ID.
   * @param string $params
   *   Parameters part of the API token string.
   * @param bool $valid
   *   Whether the API token is valid.
   *
   * @return array
   *   A renderable array for the API token output.
   */
  public static function lazyBuilder($id, $params, $valid);

}

Members

Namesort descending Modifiers Type Description Overrides
ApiTokenPluginInterface::description public function Returns the administrative description of the API token. 1
ApiTokenPluginInterface::fallback public function Returns a build to replace the API token with in case of validation fail. 1
ApiTokenPluginInterface::hash public function Returns the API token parameters hash. 1
ApiTokenPluginInterface::id public function Returns the API token ID. 1
ApiTokenPluginInterface::label public function Returns the administrative label of the API token. 1
ApiTokenPluginInterface::lazyBuilder public static function The #lazy_builder callback. 1
ApiTokenPluginInterface::params public function Returns the API token parameters. 1
ApiTokenPluginInterface::paramString public function Returns the API token parameter string. 1
ApiTokenPluginInterface::placeholder public function Returns a #lazy_builder placeholder for the API tokens filter. 1
ApiTokenPluginInterface::process public function Returns processed API token build. 1
ApiTokenPluginInterface::provider public function Returns the name of the provider that owns this API token. 1
ApiTokenPluginInterface::reflector public function Returns the API token build method reflection object. 1
ApiTokenPluginInterface::token public function Returns the API token string. 1
ApiTokenPluginInterface::validateToken public function Performs one-time context-independent validation of the API token. 1
CacheableDependencyInterface::getCacheContexts public function The cache contexts associated with this object. 34
CacheableDependencyInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 34
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 27
ContainerFactoryPluginInterface::create public static function Creates an instance of the plugin. 112
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
RefinableCacheableDependencyInterface::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. 1
RefinableCacheableDependencyInterface::addCacheContexts public function Adds cache contexts. 1
RefinableCacheableDependencyInterface::addCacheTags public function Adds cache tags. 1
RefinableCacheableDependencyInterface::mergeCacheMaxAge public function Merges the maximum age (in seconds) with the existing maximum age. 1