public function ClientService::getClient in Sparkpost email 8.2
Same name and namespace in other branches
- 8 src/ClientService.php \Drupal\sparkpost\ClientService::getClient()
Gets the client.
Return value
\SparkPost\SparkPost The client.
Overrides ClientServiceInterface::getClient
2 calls to ClientService::getClient()
- ClientService::sendMessage in src/
ClientService.php - Sends the message.
- ClientService::sendRequest in src/
ClientService.php - Sends the request.
File
- src/
ClientService.php, line 47
Class
- ClientService
- Client service that sends the mails.
Namespace
Drupal\sparkpostCode
public function getClient() {
$config = $this->configFactory
->get('sparkpost.settings');
$httpClient = new GuzzleAdapter($this->client);
$options = [
'key' => $config
->get('api_key'),
];
if (!empty($config
->get('api_hostname'))) {
$options['host'] = $config
->get('api_hostname');
}
return new SparkPost($httpClient, $options);
}