1 | <?php |
||
13 | class SmslabsClient |
||
14 | { |
||
15 | const SEND_SMS_URL = '/sendSms'; |
||
16 | const SENDERS_URL = '/senders'; |
||
17 | const SMS_STATUS_URL = '/smsStatus'; |
||
18 | const SMS_LIST_URL = '/sms'; |
||
19 | const SMS_IN_URL = '/smsIn'; |
||
20 | const ACCOUNT_URL = '/account'; |
||
21 | |||
22 | /** |
||
23 | * @var HttpClient |
||
24 | */ |
||
25 | private $client; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $isFlashMessage = false; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $senderId; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | private $expirationMinutes = 0; |
||
41 | |||
42 | /** |
||
43 | * @var \DateTime |
||
44 | */ |
||
45 | private $sendDateTime; |
||
46 | |||
47 | /** |
||
48 | * @var array[] |
||
49 | */ |
||
50 | private $smsToSend = []; |
||
51 | |||
52 | /** |
||
53 | * @var SmsSentResponse[] |
||
54 | */ |
||
55 | private $smsStatus = []; |
||
56 | |||
57 | /** |
||
58 | * Smslabs constructor. |
||
59 | * @param string $appKey |
||
60 | * @param string $secretKey |
||
61 | */ |
||
62 | public function __construct($appKey, $secretKey) |
||
66 | |||
67 | /** |
||
68 | * @param boolean $isFlashMessage |
||
69 | * @return SmslabsClient $this |
||
70 | */ |
||
71 | public function setIsFlashMessage($isFlashMessage) |
||
77 | |||
78 | /** |
||
79 | * @param string $senderId |
||
80 | * @return SmslabsClient $this |
||
81 | */ |
||
82 | public function setSenderId($senderId) |
||
88 | |||
89 | /** |
||
90 | * @param int $expirationMinutes |
||
91 | * @return SmslabsClient $this |
||
92 | */ |
||
93 | public function setExpiration($expirationMinutes) |
||
103 | |||
104 | /** |
||
105 | * @param \DateTime $sendDateTime |
||
106 | * @return SmslabsClient $this |
||
107 | */ |
||
108 | public function setSendDate(\DateTime $sendDateTime) |
||
114 | |||
115 | /** |
||
116 | * @param string $phoneNumber |
||
117 | * @param string $message |
||
118 | * @param bool $isFlashMessage |
||
119 | * @param int $expirationMinutes |
||
120 | * @param \DateTime $sendDateTime |
||
121 | * @return SmslabsClient $this |
||
122 | */ |
||
123 | public function add( |
||
152 | |||
153 | /** |
||
154 | * @param string $phoneNumber |
||
155 | * @return bool |
||
156 | */ |
||
157 | private function checkPhoneNumber($phoneNumber) |
||
161 | |||
162 | /** |
||
163 | * @return SmslabsClient $this |
||
164 | */ |
||
165 | public function send() |
||
185 | |||
186 | /** |
||
187 | * @return SmsSentResponse[] |
||
188 | */ |
||
189 | public function getSentStatus() |
||
193 | |||
194 | /** |
||
195 | * @return Sender[] |
||
196 | */ |
||
197 | public function getAvailableSenders() |
||
209 | |||
210 | /** |
||
211 | * @return AccountBalance |
||
212 | */ |
||
213 | public function getAccountBalance() |
||
219 | |||
220 | /** |
||
221 | * @return SmsIn[] |
||
222 | */ |
||
223 | public function getSmsIn() |
||
235 | |||
236 | /** |
||
237 | * @param int $offset |
||
238 | * @param int $limit |
||
239 | * @return SmsOut[] |
||
240 | */ |
||
241 | public function getSmsOut($offset = 0, $limit = 100) |
||
253 | |||
254 | /** |
||
255 | * @param string $smsId |
||
256 | * @return SmsDetails |
||
257 | */ |
||
258 | public function getSmsDetails($smsId) |
||
270 | |||
271 | /** |
||
272 | * @return array[] |
||
273 | */ |
||
274 | public function getSmsQueue() |
||
278 | } |
||
279 |