SilverCart\API\Client\Client
Main handler for CURL client calls.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2019 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class Client
{
- // members
- private static string $api_url = '';
- private static string $api_proxy_url = '';
- private static string $api_username = '';
- private static string $api_password = '';
- private static string $api_error_recipient = '';
- private static integer $api_timeout = 30;
- private static bool $disable_ssl_verification = false;
- protected array $errorList = ;
- protected $logFileName = NULL;
- // methods
- public void __construct()
- public bool isActive()
- public static bool isEnabled()
- public bool disableSSLVerification()
- public bool getAPIProxyURL()
- public bool getDisableSSLVerification()
- public bool useAPIProxy()
- public bool errorOccurred()
- public Client sendErrorNotificationEmail()
- public $this addError()
- public $this addErrorList()
- public array getErrorList()
- public $this setErrorList()
- public string getAPIURL()
- public string getAPIUsername()
- public string getAPIPassword()
- public string getAPIErrorRecipient()
- public int getAPITimeout()
- protected Response getErrorResponse()
- protected Response getSuccessResponse()
- protected Response getUnknownErrorResponse()
- public string getLogFileName()
- public Client setLogFileName()
- protected void log()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
- SilverStripe\Core\Injector\Injectable
Members
private
- $api_error_recipient
—
string
API error recipient email address. - $api_password
—
string
API password. - $api_proxy_url
—
string
API proxy URL (optional). - $api_timeout
—
int
API timeout in seconds. - $api_url
—
string
API target URL. - $api_username
—
string
API user name. - $disable_ssl_verification
—
SilverCart\API\Client\bool
Set to true to disable the server SSL certificate verification.
protected
- $errorList
—
array
List of occurred errors responded by the API - $logFileName
—
string
File name to use for logging.
Methods
protected
- getErrorResponse() — Returns the default error response object.
- getSuccessResponse() — Returns the default success response object.
- getUnknownErrorResponse() — Returns the default unknown error response object.
- log() — Logs the given message.
public
- __construct() — Constructor.
- addError() — Adds a single error message to the list of occurred errors responded by the API.
- addErrorList() — Adds an error list to the list of occurred errors responded by the API.
- disableSSLVerification() — Returns whether to disable the SSL verification.
- errorOccurred() — Returns whether one or more errors occurred.
- getAPIErrorRecipient() — Returns the API password.
- getAPIPassword() — Returns the API password.
- getAPIProxyURL() — Returns whether to use a proxy.
- getAPITimeout() — Returns the API timeout.
- getAPIURL() — Returns the API URL.
- getAPIUsername() — Returns the API user name.
- getDisableSSLVerification() — Returns whether to disable the SSL verification.
- getErrorList() — Returns the list of occurred errors responded by the API.
- getLogFileName() — Returns the log file name.
- isActive() — Returns whether the API is enabled.
- isEnabled() — Returns whether the API is enabled.
- sendErrorNotificationEmail() — Sends an error notification email.
- setErrorList() — Sets the list of occurred errors responded by the API.
- setLogFileName() — Sets the log file name.
- useAPIProxy() — Returns whether to use a proxy.