Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\rest\Plugin;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Component\Plugin\PluginInspectionInterface;
|
Chris@0
|
6
|
Chris@0
|
7 /**
|
Chris@0
|
8 * Specifies the publicly available methods of a resource plugin.
|
Chris@0
|
9 *
|
Chris@0
|
10 * @see \Drupal\rest\Annotation\RestResource
|
Chris@0
|
11 * @see \Drupal\rest\Plugin\Type\ResourcePluginManager
|
Chris@0
|
12 * @see \Drupal\rest\Plugin\ResourceBase
|
Chris@0
|
13 * @see plugin_api
|
Chris@0
|
14 *
|
Chris@0
|
15 * @ingroup third_party
|
Chris@0
|
16 */
|
Chris@0
|
17 interface ResourceInterface extends PluginInspectionInterface {
|
Chris@0
|
18
|
Chris@0
|
19 /**
|
Chris@0
|
20 * Returns a collection of routes with URL path information for the resource.
|
Chris@0
|
21 *
|
Chris@0
|
22 * This method determines where a resource is reachable, what path
|
Chris@0
|
23 * replacements are used, the required HTTP method for the operation etc.
|
Chris@0
|
24 *
|
Chris@0
|
25 * @return \Symfony\Component\Routing\RouteCollection
|
Chris@0
|
26 * A collection of routes that should be registered for this resource.
|
Chris@0
|
27 */
|
Chris@0
|
28 public function routes();
|
Chris@0
|
29
|
Chris@0
|
30 /**
|
Chris@0
|
31 * Provides an array of permissions suitable for .permissions.yml files.
|
Chris@0
|
32 *
|
Chris@0
|
33 * A resource plugin can define a set of user permissions that are used on the
|
Chris@0
|
34 * routes for this resource or for other purposes.
|
Chris@0
|
35 *
|
Chris@0
|
36 * It is not required for a resource plugin to specify permissions: if they
|
Chris@0
|
37 * have their own access control mechanism, they can use that, and return the
|
Chris@0
|
38 * empty array.
|
Chris@0
|
39 *
|
Chris@0
|
40 * @return array
|
Chris@0
|
41 * The permission array.
|
Chris@0
|
42 */
|
Chris@0
|
43 public function permissions();
|
Chris@0
|
44
|
Chris@0
|
45 /**
|
Chris@0
|
46 * Returns the available HTTP request methods on this plugin.
|
Chris@0
|
47 *
|
Chris@0
|
48 * @return array
|
Chris@0
|
49 * The list of supported methods. Example: array('GET', 'POST', 'PATCH').
|
Chris@0
|
50 */
|
Chris@0
|
51 public function availableMethods();
|
Chris@0
|
52
|
Chris@0
|
53 }
|