PHP Class SparkPost\ResourceBase

Show file Open project: sparkpost/php-sparkpost

Protected Properties

Property Type Description
$endpoint The api endpoint that gets prepended to all requests send through this resource.
$sparkpost SparkPost object used to make requests.

Public Methods

Method Description
__construct ( SparkPost $sparkpost, string $endpoint ) Sets up the Resource.
delete ( $uri = '', $payload = [], $headers = [] ) Sends delete request to API at the set endpoint.
get ( $uri = '', $payload = [], $headers = [] ) Sends get request to API at the set endpoint.
post ( $payload = [], $headers = [] ) Sends post request to API at the set endpoint.
put ( $uri = '', $payload = [], $headers = [] ) Sends put request to API at the set endpoint.
request ( $method = 'GET', $uri = '', $payload = [], $headers = [] ) : SparkPostPromise Sends requests to SparkPost object to the resource endpoint.

Method Details

__construct() public method

Sets up the Resource.
public __construct ( SparkPost $sparkpost, string $endpoint )
$sparkpost SparkPost - the sparkpost instance that this resource is attached to
$endpoint string - the endpoint that this resource wraps

delete() public method

Sends delete request to API at the set endpoint.
public delete ( $uri = '', $payload = [], $headers = [] )

get() public method

Sends get request to API at the set endpoint.
public get ( $uri = '', $payload = [], $headers = [] )

post() public method

Sends post request to API at the set endpoint.
public post ( $payload = [], $headers = [] )

put() public method

Sends put request to API at the set endpoint.
public put ( $uri = '', $payload = [], $headers = [] )

request() public method

Sends requests to SparkPost object to the resource endpoint.
public request ( $method = 'GET', $uri = '', $payload = [], $headers = [] ) : SparkPostPromise
return SparkPostPromise or SparkPostResponse depending on sync or async request

Property Details

$endpoint protected property

The api endpoint that gets prepended to all requests send through this resource.
protected $endpoint

$sparkpost protected property

SparkPost object used to make requests.
protected $sparkpost