You are here

interface RestWSFormatInterface in RESTful Web Services 7.2

Same name and namespace in other branches
  1. 7 restws.formats.inc \RestWSFormatInterface

Interface implemented by formatter implementations for the http client.

Hierarchy

Expanded class hierarchy of RestWSFormatInterface

All classes that implement RestWSFormatInterface

File

./restws.formats.inc, line 11
RESTful web services module formats.

View source
interface RestWSFormatInterface {

  /**
   * Gets the representation of a resource.
   *
   * @param RestWSResourceControllerInterface $resourceController
   *   The controller used to retrieve the resource.
   * @param int|string $id
   *   The id of the resource that should be returned.
   *
   * @return string
   *   The representation of the resource.
   */
  public function viewResource($resourceController, $id);

  /**
   * Create a resource.
   *
   * @param RestWSResourceControllerInterface $resourceController
   *   The controller used to create the resource.
   * @param string $data
   *   The representation of the resource.
   *
   * @return int|string
   *   The id of the newly created resource.
   */
  public function createResource($resourceController, $data);

  /**
   * Update a resource.
   *
   * @param RestWSResourceControllerInterface $resourceController
   *   The controller used to update the resource.
   * @param int|string $id
   *   The id of the resource that should be updated.
   * @param string $data
   *   The representation of the resource.
   */
  public function updateResource($resourceController, $id, $data);

  /**
   * Delete a resource.
   *
   * @param RestWSResourceControllerInterface $resourceController
   *   The controller used to update the resource.
   * @param int|string $id
   *   The id of the resource that should be deleted.
   */
  public function deleteResource($resourceController, $id);

  /**
   * Query for a resource.
   *
   * If a format doesn't want to implement querying, then it should throw an
   * RestWSException with the 501 HTTP status code.
   *
   * @param RestWSResourceControllerInterface $resourceController
   *   The controller used to query the resource.
   * @param array $payload
   *   An optional way to pass the query parameters.
   *
   * @return string
   *   The serialized representation of a list of resources.
   */
  public function queryResource($resourceController, $payload);

  /**
   * Returns the mime type of this format, e.g. 'application/json' or
   * 'application/xml'.
   */
  public function mimeType();

  /**
   * Returns the short name of this format.
   *
   * @return string
   *   The format name, example: "json".
   */
  public function getName();

}

Members

Namesort descending Modifiers Type Description Overrides
RestWSFormatInterface::createResource public function Create a resource. 1
RestWSFormatInterface::deleteResource public function Delete a resource. 1
RestWSFormatInterface::getName public function Returns the short name of this format. 1
RestWSFormatInterface::mimeType public function Returns the mime type of this format, e.g. 'application/json' or 'application/xml'. 1
RestWSFormatInterface::queryResource public function Query for a resource. 1
RestWSFormatInterface::updateResource public function Update a resource. 1
RestWSFormatInterface::viewResource public function Gets the representation of a resource. 1