3 namespace Drupal\rest\Plugin;
5 use Drupal\Component\Plugin\PluginInspectionInterface;
8 * Specifies the publicly available methods of a resource plugin.
10 * @see \Drupal\rest\Annotation\RestResource
11 * @see \Drupal\rest\Plugin\Type\ResourcePluginManager
12 * @see \Drupal\rest\Plugin\ResourceBase
15 * @ingroup third_party
17 interface ResourceInterface extends PluginInspectionInterface {
20 * Returns a collection of routes with URL path information for the resource.
22 * This method determines where a resource is reachable, what path
23 * replacements are used, the required HTTP method for the operation etc.
25 * @return \Symfony\Component\Routing\RouteCollection
26 * A collection of routes that should be registered for this resource.
28 public function routes();
31 * Provides an array of permissions suitable for .permissions.yml files.
33 * A resource plugin can define a set of user permissions that are used on the
34 * routes for this resource or for other purposes.
36 * It is not required for a resource plugin to specify permissions: if they
37 * have their own access control mechanism, they can use that, and return the
41 * The permission array.
43 public function permissions();
46 * Returns the available HTTP request methods on this plugin.
49 * The list of supported methods. Example: array('GET', 'POST', 'PATCH').
51 public function availableMethods();