PHP Class Mailjet\Client

Author: Guillaume Badi ([email protected])
显示文件 Open project: mailjet/mailjet-apiv3-php Class Usage Examples

Public Methods

Method Description
__construct ( string $key, string $secret, boolean $call = true ) Client constructor requires:
delete ( array $resource, array $args = [] ) : Response Trigger a GET request
get ( array $resource, array $args = [] ) : Response Trigger a GET request
post ( array $resource, array $args = [] ) : Response Trigger a POST request
put ( array $resource, array $args = [] ) : Response Trigger a POST request
setSecureProtocol ( boolean $bIsSecured ) : boolean Sets if we need to use https or http protocol while using API Url

Private Methods

Method Description
_call ( string $method, string $resource, string $action, array $args ) : Response Magic method to call a mailjet resource
buildURL ( string $resource, string $action, string $id, string $actionid ) : string Build the final call url without query strings
getApiUrl ( ) : string Build the base API url depending on wether user need a secure connection or not

Method Details

__construct() public method

Client constructor requires:
public __construct ( string $key, string $secret, boolean $call = true )
$key string Mailjet API Key
$secret string Mailjet API Secret
$call boolean performs the call or not

delete() public method

Trigger a GET request
public delete ( array $resource, array $args = [] ) : Response
$resource array Mailjet Resource/Action pair
$args array Request arguments
return Response

get() public method

Trigger a GET request
public get ( array $resource, array $args = [] ) : Response
$resource array Mailjet Resource/Action pair
$args array Request arguments
return Response

post() public method

Trigger a POST request
public post ( array $resource, array $args = [] ) : Response
$resource array Mailjet Resource/Action pair
$args array Request arguments
return Response

put() public method

Trigger a POST request
public put ( array $resource, array $args = [] ) : Response
$resource array Mailjet Resource/Action pair
$args array Request arguments
return Response

setSecureProtocol() public method

Sets if we need to use https or http protocol while using API Url
public setSecureProtocol ( boolean $bIsSecured ) : boolean
$bIsSecured boolean True use https / false use http
return boolean true if we set value false otherwise