summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/jsonapi/src/JsonApiResource/ResourceIdentifierInterface.php
blob: f2e5e6c42db6661446736eea41218c3a9d5235aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

namespace Drupal\jsonapi\JsonApiResource;

/**
 * An interface for identifying a related resource.
 *
 * Implement this interface when an object is a stand-in for an Entity object.
 * For example, \Drupal\jsonapi\Exception\EntityAccessDeniedHttpException
 * implements this interface because it often replaces an entity in a JSON:API
 * Data object.
 *
 * @internal JSON:API maintains no PHP API. The API is the HTTP API. This class
 *   may change at any time and could break any dependencies on it.
 *
 * @see https://www.drupal.org/project/drupal/issues/3032787
 * @see jsonapi.api.php
 */
interface ResourceIdentifierInterface {

  /**
   * Gets the resource identifier's ID.
   *
   * @return string
   *   A resource ID.
   */
  public function getId();

  /**
   * Gets the resource identifier's JSON:API resource type name.
   *
   * @return string
   *   The JSON:API resource type name.
   */
  public function getTypeName();

  /**
   * Gets the resource identifier's JSON:API resource type.
   *
   * @return \Drupal\jsonapi\ResourceType\ResourceType
   *   The JSON:API resource type.
   */
  public function getResourceType();

}