You are here

interface ImportServiceInterface in Entity Share 8.3

Import service interface methods.

Hierarchy

Expanded class hierarchy of ImportServiceInterface

All classes that implement ImportServiceInterface

3 files declare their use of ImportServiceInterface
EntityShareAsyncWorker.php in modules/entity_share_async/src/Plugin/QueueWorker/EntityShareAsyncWorker.php
PullForm.php in modules/entity_share_client/src/Form/PullForm.php
RuntimeImportContext.php in modules/entity_share_client/src/RuntimeImportContext.php

File

modules/entity_share_client/src/Service/ImportServiceInterface.php, line 12

Namespace

Drupal\entity_share_client\Service
View source
interface ImportServiceInterface {

  /**
   * Import a list of entities.
   *
   * 50 Max.
   *
   * @param \Drupal\entity_share_client\ImportContext $context
   *   The import context.
   * @param array $uuids
   *   The list of UUID's to import.
   * @param bool $is_batched
   *   Whether to import using batch API.
   *
   * @return array|void
   *   The list of entity IDs imported keyed by UUIDs, if not batched.
   *   If batched, the method doesn't return.
   *
   * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
   */
  public function importEntities(ImportContext $context, array $uuids, bool $is_batched = TRUE);

  /**
   * Import all the entities on a channel.
   *
   * @param \Drupal\entity_share_client\ImportContext $context
   *   The import context.
   */
  public function importChannel(ImportContext $context);

  /**
   * Import the entities from a prepared JSON:API URL.
   *
   * @param string $url
   *   The JSON:API URL.
   *
   * @return int[]
   *   The list of entity IDs imported keyed by UUIDs.
   */
  public function importFromUrl(string $url);

  /**
   * Use data from the JSON:API to import content.
   *
   * @param array $entity_list_data
   *   An array of data from a JSON:API endpoint.
   *
   * @return int[]
   *   The list of entity IDs imported keyed by UUIDs.
   */
  public function importEntityListData(array $entity_list_data);

  /**
   * Prepare runtime import context and import processors.
   *
   * Originally this method is meant to be protected. But as Batch API can't
   * pass complex objects in batch's context or as batch operation's argument,
   * and instead of creating a dedicated method for that, it has been put as a
   * public method.
   *
   * @param \Drupal\entity_share_client\ImportContext $context
   *   The import context.
   *
   * @return bool
   *   TRUE if the import information can be gathered.
   */
  public function prepareImport(ImportContext $context);

  /**
   * Getter.
   *
   * @return \Drupal\entity_share_client\RuntimeImportContext
   *   The import service's runtime import context.
   */
  public function getRuntimeImportContext();

  /**
   * Performs a HTTP request.
   *
   * Pass the request to the injected remote manager using RuntimeImportContext
   * data.
   *
   * @param string $method
   *   HTTP method.
   * @param string $url
   *   URL to request.
   *
   * @return \Psr\Http\Message\ResponseInterface
   *   The response.
   *
   * @see \GuzzleHttp\ClientInterface::request()
   */
  public function request($method, $url);

  /**
   * Performs a HTTP request on a JSON:API endpoint.
   *
   * Pass the request to the injected remote manager using RuntimeImportContext
   * data.
   *
   * @param string $method
   *   HTTP method.
   * @param string $url
   *   URL to request.
   *
   * @return \Psr\Http\Message\ResponseInterface
   *   The response.
   *
   * @see \GuzzleHttp\ClientInterface::request()
   */
  public function jsonApiRequest($method, $url);

}

Members

Namesort descending Modifiers Type Description Overrides
ImportServiceInterface::getRuntimeImportContext public function Getter. 1
ImportServiceInterface::importChannel public function Import all the entities on a channel. 1
ImportServiceInterface::importEntities public function Import a list of entities. 1
ImportServiceInterface::importEntityListData public function Use data from the JSON:API to import content. 1
ImportServiceInterface::importFromUrl public function Import the entities from a prepared JSON:API URL. 1
ImportServiceInterface::jsonApiRequest public function Performs a HTTP request on a JSON:API endpoint. 1
ImportServiceInterface::prepareImport public function Prepare runtime import context and import processors. 1
ImportServiceInterface::request public function Performs a HTTP request. 1