1 | <?php |
||
17 | class MailxpertClient |
||
18 | { |
||
19 | /** |
||
20 | * @const string Production API URL. |
||
21 | */ |
||
22 | const BASE_API_URL = 'https://api.mailxpert.ch'; |
||
23 | |||
24 | /** |
||
25 | * @const string API Version |
||
26 | */ |
||
27 | const API_VERSION = 'v2.0'; |
||
28 | |||
29 | /** |
||
30 | * @const int The timeout in seconds for a normal request. |
||
31 | */ |
||
32 | const DEFAULT_REQUEST_TIMEOUT = 60; |
||
33 | |||
34 | /** |
||
35 | * @var string|null |
||
36 | */ |
||
37 | protected $apiBaseUrl; |
||
38 | |||
39 | /** |
||
40 | * @var MailxpertHttpClientInterface |
||
41 | */ |
||
42 | protected $httpClientHandler; |
||
43 | |||
44 | /** |
||
45 | * @param MailxpertHttpClientInterface|null $httpClientHandler |
||
46 | * @param string|null $apiBaseUrl |
||
47 | */ |
||
48 | public function __construct(MailxpertHttpClientInterface $httpClientHandler = null, $apiBaseUrl = null) |
||
58 | |||
59 | /** |
||
60 | * @param MailxpertHttpClientInterface $httpClientHandler |
||
61 | */ |
||
62 | public function setHttpClientHandler(MailxpertHttpClientInterface $httpClientHandler) |
||
66 | |||
67 | /** |
||
68 | * @return MailxpertHttpClientInterface |
||
69 | */ |
||
70 | public function getHttpClientHandler() |
||
74 | |||
75 | /** |
||
76 | * @return MailxpertCurlHttpClient|MailxpertStreamHttpClient |
||
77 | */ |
||
78 | public function detectHttpClientHandler() |
||
82 | |||
83 | /** |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getAPIUrl() |
||
90 | |||
91 | /** |
||
92 | * @param MailxpertRequest $request |
||
93 | * |
||
94 | * @return MailxpertResponse |
||
95 | * @throws Exceptions\MailxpertSDKException |
||
96 | */ |
||
97 | public function sendRequest(MailxpertRequest $request) |
||
118 | |||
119 | private function prepareRequestMessage(MailxpertRequest $request) |
||
141 | } |
||
142 |