interface TopLevelDataInterface

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/JsonApiResource/TopLevelDataInterface.php \Drupal\jsonapi\JsonApiResource\TopLevelDataInterface
  2. 10 core/modules/jsonapi/src/JsonApiResource/TopLevelDataInterface.php \Drupal\jsonapi\JsonApiResource\TopLevelDataInterface
  3. 11.x core/modules/jsonapi/src/JsonApiResource/TopLevelDataInterface.php \Drupal\jsonapi\JsonApiResource\TopLevelDataInterface

Interface for objects that can appear as top-level object data.

@internal JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.

Hierarchy

Expanded class hierarchy of TopLevelDataInterface

All classes that implement TopLevelDataInterface

See also

https://www.drupal.org/project/drupal/issues/3032787

jsonapi.api.php

1 file declares its use of TopLevelDataInterface
EntityResource.php in core/modules/jsonapi/src/Controller/EntityResource.php

File

core/modules/jsonapi/src/JsonApiResource/TopLevelDataInterface.php, line 14

Namespace

Drupal\jsonapi\JsonApiResource
View source
interface TopLevelDataInterface {
    
    /**
     * Returns the data for the top-level data member of a JSON:API document.
     *
     * @return \Drupal\jsonapi\JsonApiResource\Data
     *   The top-level data.
     */
    public function getData();
    
    /**
     * Returns the data that was omitted from the JSON:API document.
     *
     * @return \Drupal\jsonapi\JsonApiResource\OmittedData
     *   The omitted data.
     */
    public function getOmissions();
    
    /**
     * Merges the object's links with the top-level links.
     *
     * @param \Drupal\jsonapi\JsonApiResource\LinkCollection $top_level_links
     *   The top-level links to merge.
     *
     * @return \Drupal\jsonapi\JsonApiResource\LinkCollection
     *   The merged links.
     */
    public function getMergedLinks(LinkCollection $top_level_links);
    
    /**
     * Merges the object's meta member with the top-level meta member.
     *
     * @param array $top_level_meta
     *   The top-level links to merge.
     *
     * @return array
     *   The merged meta member.
     */
    public function getMergedMeta(array $top_level_meta);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
TopLevelDataInterface::getData public function Returns the data for the top-level data member of a JSON:API document. 2
TopLevelDataInterface::getMergedLinks public function Merges the object's links with the top-level links. 2
TopLevelDataInterface::getMergedMeta public function Merges the object's meta member with the top-level meta member. 2
TopLevelDataInterface::getOmissions public function Returns the data that was omitted from the JSON:API document. 2

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.