PHP 클래스 SparkPost\SparkPost

파일 보기 프로젝트 열기: sparkpost/php-sparkpost 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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 = [] ) : SparkPostPromise 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 = [] ) : SparkPostPromise | SparkPostResponse 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 ) : SparkPost
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 = [] ) : SparkPostResponse Sends sync request to SparkPost API.

비공개 메소드들

메소드 설명
getMessageFactory ( ) : Http\Message\RequestFactory
setupEndpoints ( ) Sets up any endpoints to custom classes e.g. $this->transmissions.

메소드 상세

__construct() 공개 메소드

Sets up the SparkPost instance.
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

asyncRequest() 공개 메소드

Sends async request to SparkPost API.
public asyncRequest ( string $method = 'GET', string $uri = '', array $payload = [], array $headers = [] ) : SparkPostPromise
$method string
$uri string
$payload array
$headers array
리턴 SparkPostPromise

buildRequest() 공개 메소드

Builds request from given params.
public buildRequest ( string $method, string $uri, array $payload, array $headers ) : Psr\Http\Message\RequestInterface
$method string
$uri string
$payload array
$headers array
리턴 Psr\Http\Message\RequestInterface

getHttpHeaders() 공개 메소드

Returns an array for the request headers.
public getHttpHeaders ( array $headers = [] ) : array
$headers array - any custom headers for the request
리턴 array $headers - headers for the request

getUrl() 공개 메소드

Builds the request url from the options and given params.
public getUrl ( string $path, array $params = [] ) : string
$path string - the path in the url to hit
$params array - query parameters to be encoded into the url
리턴 string $url - the url to send the desired request to

request() 공개 메소드

Sends either sync or async request based on async option.
public request ( string $method = 'GET', string $uri = '', array $payload = [], array $headers = [] ) : SparkPostPromise | SparkPostResponse
$method string
$uri string
$payload array - either used as the request body or url query params
$headers array
리턴 SparkPostPromise | SparkPostResponse Promise or Response depending on sync or async request

setHttpClient() 공개 메소드

Sets $httpClient to be used for request.
public setHttpClient ( Http\Client\HttpClient | Http\Client\HttpAsyncClient $httpClient )
$httpClient Http\Client\HttpClient | Http\Client\HttpAsyncClient - the client to be used for request

setMessageFactory() 공개 메소드

public setMessageFactory ( Http\Message\RequestFactory $messageFactory ) : SparkPost
$messageFactory Http\Message\RequestFactory
리턴 SparkPost

setOptions() 공개 메소드

Sets the options from the param and defaults for the SparkPost object.
public setOptions ( array $options )
$options array - either an string API key or an array of options

syncRequest() 공개 메소드

Sends sync request to SparkPost API.
public syncRequest ( string $method = 'GET', string $uri = '', array $payload = [], array $headers = [] ) : SparkPostResponse
$method string
$uri string
$payload array
$headers array
리턴 SparkPostResponse

프로퍼티 상세

$transmissions 공개적으로 프로퍼티

Instance of Transmission class.
public $transmissions