You are here

interface HandlerInterface in JSON-RPC 2.x

Same name and namespace in other branches
  1. 8 src/HandlerInterface.php \Drupal\jsonrpc\HandlerInterface

Interface for the handler.

Hierarchy

Expanded class hierarchy of HandlerInterface

All classes that implement HandlerInterface

4 files declare their use of HandlerInterface
DiscoveryController.php in modules/jsonrpc_discovery/src/Controller/DiscoveryController.php
JsonRpcMethodBase.php in src/Plugin/JsonRpcMethodBase.php
Plugins.php in modules/jsonrpc_core/src/Plugin/jsonrpc/Method/Plugins.php
RpcRequestFactory.php in src/Shaper/RpcRequestFactory.php

File

src/HandlerInterface.php, line 10

Namespace

Drupal\jsonrpc
View source
interface HandlerInterface {

  /**
   * The configuration array key for the JSON-RPC request object.
   *
   * @var string
   */
  const JSONRPC_REQUEST_KEY = 'jsonrpc_request';

  /**
   * Executes a batch of remote procedure calls.
   *
   * @param \Drupal\jsonrpc\Object\Request[] $requests
   *   The JSON-RPC requests.
   *
   * @return array
   *   The JSON-RPC responses, if any. Notifications are not returned.
   *
   * @throws \Drupal\jsonrpc\Exception\JsonRpcException
   */
  public function batch(array $requests);

  /**
   * Gets a method definition by method name.
   *
   * @param string $name
   *   The method name for which support should be determined.
   *
   * @return \Drupal\jsonrpc\MethodInterface|null
   *   The method definition.
   */
  public function getMethod($name);

  /**
   * The methods which are available to the given account.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   (optional). The account for which to get available methods. Defaults to
   *   the current user.
   *
   * @return \Drupal\jsonrpc\MethodInterface[]
   *   The methods.
   */
  public function availableMethods(AccountInterface $account = NULL);

  /**
   * The methods supported by the handler.
   *
   * @return \Drupal\jsonrpc\MethodInterface[]
   *   The methods.
   */
  public function supportedMethods();

  /**
   * Whether the given method is supported.
   *
   * @param string $name
   *   The method name for which support should be determined.
   *
   * @return bool
   *   Whether the handler supports the given method name.
   */
  public function supportsMethod($name);

  /**
   * The supported JSON-RPC version.
   *
   * @return string
   *   The version.
   */
  public static function supportedVersion();

}

Members

Namesort descending Modifiers Type Description Overrides
HandlerInterface::availableMethods public function The methods which are available to the given account. 1
HandlerInterface::batch public function Executes a batch of remote procedure calls. 1
HandlerInterface::getMethod public function Gets a method definition by method name. 1
HandlerInterface::JSONRPC_REQUEST_KEY constant The configuration array key for the JSON-RPC request object.
HandlerInterface::supportedMethods public function The methods supported by the handler. 1
HandlerInterface::supportedVersion public static function The supported JSON-RPC version. 1
HandlerInterface::supportsMethod public function Whether the given method is supported. 1