You are here

public function RestClient::__construct in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::__construct()
  2. 8.3 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::__construct()

Constructor which initializes the consumer.

Parameters

\GuzzleHttp\ClientInterface $http_client: The GuzzleHttp Client.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory service.

\Drupal\Core\State\StateInterface $state: The state service.

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache service.

\Drupal\Component\Serialization\Json $json: The JSON serializer service.

\Drupal\Component\Datetime\TimeInterface $time: The Time service.

\Drupal\salesforce\SalesforceAuthProviderPluginManagerInterface $authManager: Auth manager service.

File

src/Rest/RestClient.php, line 141

Class

RestClient
Objects, properties, and methods to communicate with the Salesforce REST API.

Namespace

Drupal\salesforce\Rest

Code

public function __construct(ClientInterface $http_client, ConfigFactoryInterface $config_factory, StateInterface $state, CacheBackendInterface $cache, Json $json, TimeInterface $time, SalesforceAuthProviderPluginManagerInterface $authManager) {
  $this->configFactory = $config_factory;
  $this->httpClient = $http_client;
  $this->immutableConfig = $this->configFactory
    ->get('salesforce.settings');
  $this->state = $state;
  $this->cache = $cache;
  $this->json = $json;
  $this->time = $time;
  $this->httpClientOptions = [];
  $this->authManager = $authManager;
  $this->authProvider = $authManager
    ->getProvider();
  $this->authConfig = $authManager
    ->getConfig();
  $this->authToken = $authManager
    ->getToken();
  return $this;
}