You are here

public function ClientService::sendRequest in Sparkpost email 8

Same name and namespace in other branches
  1. 8.2 src/ClientService.php \Drupal\sparkpost\ClientService::sendRequest()

Parameters

string $endpoint:

array $data:

string $method:

Return value

array

Throws

\SparkPost\SparkPostException

Overrides ClientServiceInterface::sendRequest

File

src/ClientService.php, line 72

Class

ClientService
Class ClientService.

Namespace

Drupal\sparkpost

Code

public function sendRequest($endpoint, array $data, $method = 'GET') {
  $client = $this
    ->getClient();
  $promise = $client
    ->request($method, $endpoint, $data);
  $response = $promise
    ->wait();
  return $response
    ->getBody();
}