SilverWare\MailChimp\API\MailChimpAPI
A singleton wrapper providing access to the MailChimp API.
- Author: Colin Tucker <colin@praxis.net.au>
- Copyright: 2017 Praxis Interactive
- License: https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
Synopsis
class MailChimpAPI
{
- // members
- private static integer $default_timeout = 10;
- protected MailChimp $api;
- protected $timeout;
- // methods
- public void __construct()
- public $this setTimeout()
- public integer getTimeout()
- public string getAPIKey()
- public boolean hasAPIKey()
- public boolean isAPIKeyValid()
- public array delete()
- public array get()
- public array patch()
- public array post()
- public array put()
- public string hash()
- public boolean success()
- public string error()
- public array response()
- protected array request()
- protected MailChimp api()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
- SilverStripe\Core\Config\Configurable
Members
private
- $default_timeout
—
integer
Defines the default API timeout period in seconds.
protected
- $api
—
SilverWare\MailChimp\API\DrewM\MailChimp\MailChimp
Holds the MailChimp API instance. - $timeout
—
integer
Defines the API timeout period in seconds.
Methods
protected
- api() — Answers the API instance or throws an exception if the API is unavailable.
- request() — Issues an HTTP request of the specified type and passes the method and parameters.
public
- __construct() — Constructs the object upon instantiation.
- delete() — Issues an HTTP DELETE request on the API and answers the response.
- error() — Answers the last error message returned by the API.
- get() — Issues an HTTP GET request on the API and answers the response.
- getAPIKey() — Answers the API key from site or YAML configuration.
- getTimeout() — Answers the value of the timeout attribute.
- hasAPIKey() — Answers true if the receiver has an API key.
- hash() — Answers an MD5 hash for the given email address (used for API actions).
- isAPIKeyValid() — Answers true if the receiver has an API key and the key is valid.
- patch() — Issues an HTTP PATCH request on the API and answers the response.
- post() — Issues an HTTP POST request on the API and answers the response.
- put() — Issues an HTTP PUT request on the API and answers the response.
- response() — Answers the last response returned by the API.
- setTimeout() — Defines the value of the timeout attribute.
- success() — Answers true if the last request was successful.