PHP Class Mailgun\Connection\RestClient

显示文件 Open project: mailgun/mailgun-php Class Usage Examples

Protected Properties

Property Type Description
$apiHost string
$apiVersion string The version of the API to use.
$httpClient Http\Client\HttpClient
$sslEnabled boolean If we should use SSL or not.

Public Methods

Method Description
__construct ( string $apiKey, string $apiHost, Http\Client\HttpClient $httpClient = null )
delete ( string $endpointUrl ) : stdClass
get ( string $endpointUrl, array $queryString = [] ) : stdClass
post ( string $endpointUrl, array $postData = [], array $files = [] ) : stdClass
put ( string $endpointUrl, mixed $putData ) : stdClass
responseHandler ( Psr\Http\Message\ResponseInterface $responseObj ) : stdClass
setApiVersion ( string $apiVersion ) : RestClient
setSslEnabled ( boolean $sslEnabled ) : RestClient

Protected Methods

Method Description
getHttpClient ( ) : Http\Client\HttpClient
getResponseExceptionMessage ( Psr\Http\Message\ResponseInterface $responseObj ) : string
prepareFile ( string $fieldName, string | array $filePath, integer $fileIndex ) : array Prepare a file for the postBody.
send ( string $method, string $uri, mixed $body = null, array $files = [], array $headers = [] ) : stdClass

Private Methods

Method Description
generateEndpoint ( string $apiEndpoint, string $apiVersion, boolean $ssl ) : string
getApiUrl ( $uri ) : string

Method Details

__construct() public method

public __construct ( string $apiKey, string $apiHost, Http\Client\HttpClient $httpClient = null )
$apiKey string
$apiHost string
$httpClient Http\Client\HttpClient

delete() public method

public delete ( string $endpointUrl ) : stdClass
$endpointUrl string
return stdClass

get() public method

public get ( string $endpointUrl, array $queryString = [] ) : stdClass
$endpointUrl string
$queryString array
return stdClass

getHttpClient() protected method

protected getHttpClient ( ) : Http\Client\HttpClient
return Http\Client\HttpClient

getResponseExceptionMessage() protected method

protected getResponseExceptionMessage ( Psr\Http\Message\ResponseInterface $responseObj ) : string
$responseObj Psr\Http\Message\ResponseInterface
return string

post() public method

public post ( string $endpointUrl, array $postData = [], array $files = [] ) : stdClass
$endpointUrl string
$postData array
$files array
return stdClass

prepareFile() protected method

Prepare a file for the postBody.
protected prepareFile ( string $fieldName, string | array $filePath, integer $fileIndex ) : array
$fieldName string
$filePath string | array
$fileIndex integer
return array

put() public method

public put ( string $endpointUrl, mixed $putData ) : stdClass
$endpointUrl string
$putData mixed
return stdClass

responseHandler() public method

public responseHandler ( Psr\Http\Message\ResponseInterface $responseObj ) : stdClass
$responseObj Psr\Http\Message\ResponseInterface
return stdClass

send() protected method

protected send ( string $method, string $uri, mixed $body = null, array $files = [], array $headers = [] ) : stdClass
$method string
$uri string
$body mixed
$files array
$headers array
return stdClass

setApiVersion() public method

public setApiVersion ( string $apiVersion ) : RestClient
$apiVersion string
return RestClient

setSslEnabled() public method

Deprecation: To be removed in 3.0
public setSslEnabled ( boolean $sslEnabled ) : RestClient
$sslEnabled boolean
return RestClient

Property Details

$apiHost protected_oe property

protected string $apiHost
return string

$apiVersion protected_oe property

The version of the API to use.
protected string $apiVersion
return string

$httpClient protected_oe property

protected HttpClient,Http\Client $httpClient
return Http\Client\HttpClient

$sslEnabled protected_oe property

If we should use SSL or not.
Deprecation: To be removed in 3.0
protected bool $sslEnabled
return boolean