You are here

public function SDKConnector::buildClient in Apigee Edge 8

Same name in this branch
  1. 8 src/SDKConnector.php \Drupal\apigee_edge\SDKConnector::buildClient()
  2. 8 tests/modules/apigee_edge_test/src/SDKConnector.php \Drupal\apigee_edge_test\SDKConnector::buildClient()

Returns a pre-configured API client with the provided credentials.

Parameters

\Http\Message\Authentication $authentication: Authentication.

null|string $endpoint: API endpoint, default is https://api.enterprise.apigee.com/v1.

array $options: Client configuration option.

Return value

\Apigee\Edge\ClientInterface Configured API client.

Overrides SDKConnectorInterface::buildClient

2 calls to SDKConnector::buildClient()
SDKConnector::getClient in src/SDKConnector.php
Returns the http client.
SDKConnector::testConnection in src/SDKConnector.php
Test connection with the Edge Management Server.
1 method overrides SDKConnector::buildClient()
SDKConnector::buildClient in tests/modules/apigee_edge_test/src/SDKConnector.php
Returns a pre-configured API client with the provided credentials.

File

src/SDKConnector.php, line 182

Class

SDKConnector
Provides an Apigee Edge SDK connector.

Namespace

Drupal\apigee_edge

Code

public function buildClient(Authentication $authentication, ?string $endpoint = NULL, array $options = []) : ClientInterface {
  $options += [
    Client::CONFIG_HTTP_CLIENT_BUILDER => new Builder(new GuzzleClientAdapter($this->clientFactory
      ->fromOptions($this
      ->httpClientConfiguration()))),
    Client::CONFIG_USER_AGENT_PREFIX => $this
      ->userAgentPrefix(),
  ];
  return new Client($authentication, $endpoint, $options);
}