Свойство | Тип | Описание | |
---|---|---|---|
$transmissions | Instance of Transmission class. |
Метод | Описание | |
---|---|---|
__construct ( Http\Client\HttpClient $httpClient, array $options ) | Sets up the SparkPost instance. | |
asyncRequest ( string $method = 'GET', string $uri = '', array $payload = [], array $headers = [] ) : |
Sends async request to SparkPost API. | |
buildRequest ( string $method, string $uri, array $payload, array $headers ) : Psr\Http\Message\RequestInterface | Builds request from given params. | |
getHttpHeaders ( array $headers = [] ) : array | Returns an array for the request headers. | |
getUrl ( string $path, array $params = [] ) : string | Builds the request url from the options and given params. | |
request ( string $method = 'GET', string $uri = '', array $payload = [], array $headers = [] ) : |
Sends either sync or async request based on async option. | |
setHttpClient ( Http\Client\HttpClient | Http\Client\HttpAsyncClient $httpClient ) | Sets $httpClient to be used for request. | |
setMessageFactory ( Http\Message\RequestFactory $messageFactory ) : |
||
setOptions ( array $options ) | Sets the options from the param and defaults for the SparkPost object. | |
syncRequest ( string $method = 'GET', string $uri = '', array $payload = [], array $headers = [] ) : |
Sends sync request to SparkPost API. |
Метод | Описание | |
---|---|---|
getMessageFactory ( ) : Http\Message\RequestFactory | ||
setupEndpoints ( ) | Sets up any endpoints to custom classes e.g. $this->transmissions. |
public __construct ( Http\Client\HttpClient $httpClient, array $options ) | ||
$httpClient | Http\Client\HttpClient | - An httplug client or adapter |
$options | array | - An array to overide default options or a string to be used as an API key |
public getHttpHeaders ( array $headers = [] ) : array | ||
$headers | array | - any custom headers for the request |
Результат | array | $headers - headers for the request |
public request ( string $method = 'GET', string $uri = '', array $payload = [], array $headers = [] ) : |
||
$method | string | |
$uri | string | |
$payload | array | - either used as the request body or url query params |
$headers | array | |
Результат | Promise or Response depending on sync or async request |
public setHttpClient ( Http\Client\HttpClient | Http\Client\HttpAsyncClient $httpClient ) | ||
$httpClient | Http\Client\HttpClient | Http\Client\HttpAsyncClient | - the client to be used for request |
public setMessageFactory ( Http\Message\RequestFactory $messageFactory ) : |
||
$messageFactory | Http\Message\RequestFactory | |
Результат |
public setOptions ( array $options ) | ||
$options | array | - either an string API key or an array of options |