You are here

public function RemoteManager::prepareJsonApiClient in Entity Share 8

Same name and namespace in other branches
  1. 8.2 modules/entity_share_client/src/Service/RemoteManager.php \Drupal\entity_share_client\Service\RemoteManager::prepareJsonApiClient()

Prepare an HTTP client for the JSON API endpoints.

Parameters

\Drupal\entity_share_client\Entity\RemoteInterface $remote: The remote website on which to prepare the client.

Return value

\GuzzleHttp\Client An HTTP client with some info from the remote.

Overrides RemoteManagerInterface::prepareJsonApiClient

1 call to RemoteManager::prepareJsonApiClient()
RemoteManager::getChannelsInfos in modules/entity_share_client/src/Service/RemoteManager.php
Get the channels infos of a remote website.

File

modules/entity_share_client/src/Service/RemoteManager.php, line 59

Class

RemoteManager
Class RemoteManager.

Namespace

Drupal\entity_share_client\Service

Code

public function prepareJsonApiClient(RemoteInterface $remote) {
  return $this->httpClientFactory
    ->fromOptions([
    'base_uri' => $remote
      ->get('url'),
    'auth' => [
      $remote
        ->get('basic_auth_username'),
      $remote
        ->get('basic_auth_password'),
    ],
    'headers' => [
      'Content-type' => 'application/vnd.api+json',
    ],
  ]);
}