1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace keika299\ConohaAPI\Mail; |
4
|
|
|
|
5
|
|
|
use keika299\ConohaAPI\Common\Network\Request; |
6
|
|
|
use keika299\ConohaAPI\Common\Service\AbstractService; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class Service |
10
|
|
|
* |
11
|
|
|
* This class connect to ConoHa mail service. |
12
|
|
|
* |
13
|
|
|
* @package keika299\ConohaAPI\Mail |
14
|
|
|
*/ |
15
|
|
|
class Service extends AbstractService |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Get version detail. |
19
|
|
|
* |
20
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-version-detail.html |
21
|
|
|
* |
22
|
|
|
* @return mixed |
23
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
24
|
|
|
*/ |
25
|
1 |
|
public function getVersionDetail() |
26
|
|
|
{ |
27
|
1 |
|
$request = (new Request()) |
28
|
1 |
|
->setMethod('GET') |
29
|
1 |
|
->setBaseURI($this->baseURI) |
30
|
1 |
|
->setURI('/v1') |
31
|
1 |
|
->setAccept('application/json') |
32
|
1 |
|
->setToken($this->token->getToken()); |
33
|
|
|
|
34
|
1 |
|
$response = $request->exec(); |
35
|
1 |
|
return $response->getJson(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Create mail service. |
40
|
|
|
* |
41
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-mail-service.html |
42
|
|
|
* |
43
|
|
|
* @param string $serviceName |
44
|
|
|
* @param string $subDomain |
45
|
|
|
* @return mixed |
46
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
47
|
|
|
*/ |
48
|
1 |
|
public function postService($serviceName, $subDomain) |
49
|
|
|
{ |
50
|
|
|
$data = array( |
51
|
1 |
|
'service_name' => $serviceName, |
52
|
|
|
'default_sub_domain' => $subDomain |
53
|
1 |
|
); |
54
|
|
|
|
55
|
1 |
|
$request = (new Request()) |
56
|
1 |
|
->setMethod('POST') |
57
|
1 |
|
->setBaseURI($this->baseURI) |
58
|
1 |
|
->setURI('/v1/services') |
59
|
1 |
|
->setAccept('application/json') |
60
|
1 |
|
->setContentType('application/json') |
61
|
1 |
|
->setToken($this->token->getToken()) |
62
|
1 |
|
->setJson($data); |
63
|
|
|
|
64
|
1 |
|
$response = $request->exec(); |
65
|
1 |
|
return $response->getJson(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Get mail service list. |
70
|
|
|
* |
71
|
|
|
* $option can set offset, limit, sort_key, and sort_type. |
72
|
|
|
* 'offset' is list offset (int value). |
73
|
|
|
* 'limit' is list limit (int value). |
74
|
|
|
* 'sort_key is crate_date, service_name, and status. |
75
|
|
|
* 'sort_type' is asc or desc. |
76
|
|
|
* |
77
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-mail-service.html |
78
|
|
|
* |
79
|
|
|
* @param array $options |
80
|
|
|
* @return mixed |
81
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
82
|
|
|
*/ |
83
|
1 |
|
public function getServiceList($options = array()) |
84
|
|
|
{ |
85
|
1 |
|
$request = (new Request()) |
86
|
1 |
|
->setMethod('GET') |
87
|
1 |
|
->setBaseURI($this->baseURI) |
88
|
1 |
|
->setURI('/v1/services') |
89
|
1 |
|
->setAccept('application/json') |
90
|
1 |
|
->setQuery($options) |
91
|
1 |
|
->setToken($this->token->getToken()); |
92
|
|
|
|
93
|
1 |
|
$response = $request->exec(); |
94
|
1 |
|
return $response->getJson(); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Get mail service information. |
99
|
|
|
* |
100
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-service.html |
101
|
|
|
* |
102
|
|
|
* @param string $serviceId |
103
|
|
|
* @return mixed |
104
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
105
|
|
|
*/ |
106
|
1 |
|
public function getServiceInfo($serviceId) |
107
|
|
|
{ |
108
|
1 |
|
$request = (new Request()) |
109
|
1 |
|
->setMethod('GET') |
110
|
1 |
|
->setBaseURI($this->baseURI) |
111
|
1 |
|
->setURI('/v1/services/' . $serviceId) |
112
|
1 |
|
->setAccept('application/json') |
113
|
1 |
|
->setToken($this->token->getToken()); |
114
|
|
|
|
115
|
1 |
|
$response = $request->exec(); |
116
|
1 |
|
return $response->getJson(); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Change service informaiton. |
121
|
|
|
* |
122
|
|
|
* See https://www.conoha.jp/docs/paas-mail-update-mail-service.html |
123
|
|
|
* |
124
|
|
|
* @param string $serviceId |
125
|
|
|
* @param string $serviceName |
126
|
|
|
* @return mixed |
127
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
128
|
|
|
*/ |
129
|
1 |
|
public function putServiceInfo($serviceId, $serviceName) |
130
|
|
|
{ |
131
|
1 |
|
$data = array('service_name' => $serviceName); |
132
|
|
|
|
133
|
1 |
|
$request = (new Request()) |
134
|
1 |
|
->setMethod('PUT') |
135
|
1 |
|
->setBaseURI($this->baseURI) |
136
|
1 |
|
->setURI('/v1/services/' . $serviceId) |
137
|
1 |
|
->setAccept('application/json') |
138
|
1 |
|
->setToken($this->token->getToken()) |
139
|
1 |
|
->setJson($data); |
140
|
|
|
|
141
|
1 |
|
$response = $request->exec(); |
142
|
1 |
|
return $response->getJson(); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Change backup state. |
147
|
|
|
* |
148
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-backup.html |
149
|
|
|
* |
150
|
|
|
* @param string $serviceId |
151
|
|
|
* @param bool $isBackup |
152
|
|
|
* @return mixed |
153
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
154
|
|
|
*/ |
155
|
1 |
|
public function putBackupState($serviceId, $isBackup) |
156
|
|
|
{ |
157
|
1 |
|
$isBackupState = $isBackup ? 'enable' : 'disable'; |
158
|
|
|
|
159
|
|
|
$data = array( |
160
|
|
|
'backup' => [ |
161
|
|
|
'status' => $isBackupState |
162
|
1 |
|
] |
163
|
1 |
|
); |
164
|
|
|
|
165
|
1 |
|
$request = (new Request()) |
166
|
1 |
|
->setMethod('PUT') |
167
|
1 |
|
->setBaseURI($this->baseURI) |
168
|
1 |
|
->setURI('/v1/services/' . $serviceId . '/action') |
169
|
1 |
|
->setAccept('application/json') |
170
|
1 |
|
->setToken($this->token->getToken()) |
171
|
1 |
|
->setJson($data); |
172
|
|
|
|
173
|
1 |
|
$response = $request->exec(); |
174
|
1 |
|
return $response->getJson(); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Delete mail service. |
179
|
|
|
* |
180
|
|
|
* See https://www.conoha.jp/docs/paas-mail-delete-mail-service.html |
181
|
|
|
* |
182
|
|
|
* @param string $serviceId |
183
|
|
|
* @return null |
184
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
185
|
|
|
*/ |
186
|
1 |
|
public function deleteService($serviceId) |
187
|
|
|
{ |
188
|
1 |
|
$request = (new Request()) |
189
|
1 |
|
->setMethod('DELETE') |
190
|
1 |
|
->setBaseURI($this->baseURI) |
191
|
1 |
|
->setURI('/v1/services/' . $serviceId) |
192
|
1 |
|
->setAccept('application/json') |
193
|
1 |
|
->setToken($this->token->getToken()); |
194
|
|
|
|
195
|
1 |
|
$request->exec(); |
196
|
|
|
|
197
|
1 |
|
return null; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* Get service quota value. |
202
|
|
|
* |
203
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-email-quotas.html |
204
|
|
|
* |
205
|
|
|
* @param string $serviceId |
206
|
|
|
* @return mixed |
207
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
208
|
|
|
*/ |
209
|
1 |
|
public function getQuota($serviceId) |
210
|
|
|
{ |
211
|
1 |
|
$request = (new Request()) |
212
|
1 |
|
->setMethod('GET') |
213
|
1 |
|
->setBaseURI($this->baseURI) |
214
|
1 |
|
->setURI('/v1/services/' . $serviceId . '/quotas') |
215
|
1 |
|
->setAccept('application/json') |
216
|
1 |
|
->setToken($this->token->getToken()); |
217
|
|
|
|
218
|
1 |
|
$response = $request->exec(); |
219
|
1 |
|
return $response->getJson(); |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* Change quota value. |
224
|
|
|
* |
225
|
|
|
* See https://www.conoha.jp/docs/paas-mail-update-email-quotas.html |
226
|
|
|
* |
227
|
|
|
* @param string $serviceId |
228
|
|
|
* @param int $quota |
229
|
|
|
* @return mixed |
230
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
231
|
|
|
*/ |
232
|
1 |
|
public function putQuota($serviceId, $quota) |
233
|
|
|
{ |
234
|
1 |
|
$data = array('quota' => $quota); |
235
|
|
|
|
236
|
1 |
|
$request = (new Request()) |
237
|
1 |
|
->setMethod('PUT') |
238
|
1 |
|
->setBaseURI($this->baseURI) |
239
|
1 |
|
->setURI('/v1/services/' . $serviceId . '/quotas') |
240
|
1 |
|
->setAccept('application/json') |
241
|
1 |
|
->setToken($this->token->getToken()) |
242
|
1 |
|
->setJson($data); |
243
|
|
|
|
244
|
1 |
|
$response = $request->exec(); |
245
|
1 |
|
return $response->getJson(); |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* Create domain information. |
250
|
|
|
* |
251
|
|
|
* https://www.conoha.jp/docs/paas-mail-create-domain.html |
252
|
|
|
* |
253
|
|
|
* @param string $serviceId |
254
|
|
|
* @param string $domainName |
255
|
|
|
* @return mixed |
256
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
257
|
|
|
*/ |
258
|
1 |
|
public function postDomain($serviceId, $domainName) |
259
|
|
|
{ |
260
|
|
|
$data = array( |
261
|
1 |
|
'service_id' => $serviceId, |
262
|
|
|
'domain_name' => $domainName |
263
|
1 |
|
); |
264
|
|
|
|
265
|
1 |
|
$request = (new Request()) |
266
|
1 |
|
->setMethod('POST') |
267
|
1 |
|
->setBaseURI($this->baseURI) |
268
|
1 |
|
->setURI('/v1/domains') |
269
|
1 |
|
->setAccept('application/json') |
270
|
1 |
|
->setToken($this->token->getToken()) |
271
|
1 |
|
->setJson($data); |
272
|
|
|
|
273
|
1 |
|
$response = $request->exec(); |
274
|
1 |
|
return $response->getJson(); |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* Get domains list. |
279
|
|
|
* |
280
|
|
|
* $option can set service_id, offset, limit, sort_key, and sort_type. |
281
|
|
|
* 'service_id' is target service UUID. |
282
|
|
|
* 'offset' is list offset (int value). |
283
|
|
|
* 'limit' is list limit (int value). |
284
|
|
|
* 'sort_key is crate_date, service_name, and status. |
285
|
|
|
* 'sort_type' is asc or desc. |
286
|
|
|
* |
287
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-domain.html |
288
|
|
|
* |
289
|
|
|
* @param array $options |
290
|
|
|
* @return mixed |
291
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
292
|
|
|
*/ |
293
|
1 |
|
public function getDomainList($options = array()) |
294
|
|
|
{ |
295
|
1 |
|
$request = (new Request()) |
296
|
1 |
|
->setMethod('GET') |
297
|
1 |
|
->setBaseURI($this->baseURI) |
298
|
1 |
|
->setURI('/v1/domains') |
299
|
1 |
|
->setQuery($options) |
300
|
1 |
|
->setAccept('application/json') |
301
|
1 |
|
->setToken($this->token->getToken()); |
302
|
|
|
|
303
|
1 |
|
$response = $request->exec(); |
304
|
1 |
|
return $response->getJson(); |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* Delete domain. |
309
|
|
|
* |
310
|
|
|
* See https://www.conoha.jp/docs/paas-mail-delete-domain.html |
311
|
|
|
* |
312
|
|
|
* @param string $serviceId |
313
|
|
|
* @return null |
314
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
315
|
|
|
*/ |
316
|
1 |
|
public function deleteDomain($serviceId) |
317
|
1 |
|
{$request = (new Request()) |
318
|
1 |
|
->setMethod('DELETE') |
319
|
1 |
|
->setBaseURI($this->baseURI) |
320
|
1 |
|
->setURI('/v1/domains/' . $serviceId) |
321
|
1 |
|
->setAccept('application/json') |
322
|
1 |
|
->setToken($this->token->getToken()); |
323
|
|
|
|
324
|
1 |
|
$request->exec(); |
325
|
|
|
|
326
|
1 |
|
return null; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* Get domain's dedicated ip. |
331
|
|
|
* |
332
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-dedicated-ip.html |
333
|
|
|
* |
334
|
|
|
* @param string $domainId |
335
|
|
|
* @return mixed |
336
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
337
|
|
|
*/ |
338
|
1 |
|
public function getDedicatedIp($domainId) |
339
|
|
|
{ |
340
|
1 |
|
$request = (new Request()) |
341
|
1 |
|
->setMethod('GET') |
342
|
1 |
|
->setBaseURI($this->baseURI) |
343
|
1 |
|
->setURI('/v1/domains/' . $domainId . '/dedicatedip') |
344
|
1 |
|
->setAccept('application/json') |
345
|
1 |
|
->setToken($this->token->getToken()); |
346
|
|
|
|
347
|
1 |
|
$response = $request->exec(); |
348
|
1 |
|
return $response->getJson(); |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* Change domain's dedicated ip. |
353
|
|
|
* |
354
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-dedicated-ip.html |
355
|
|
|
* |
356
|
|
|
* @param string $domainId |
357
|
|
|
* @param bool $isDedicate |
358
|
|
|
* @return mixed |
359
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
360
|
|
|
*/ |
361
|
1 |
|
public function putDedicatedIp($domainId, $isDedicate) |
362
|
|
|
{ |
363
|
1 |
|
$isDedicateState = $isDedicate ? 'enable' : 'disable'; |
364
|
|
|
|
365
|
|
|
$data = array( |
366
|
|
|
'dedicatedip' => [ |
367
|
|
|
'status' => $isDedicateState |
368
|
1 |
|
] |
369
|
1 |
|
); |
370
|
|
|
|
371
|
1 |
|
$request = (new Request()) |
372
|
1 |
|
->setMethod('PUT') |
373
|
1 |
|
->setBaseURI($this->baseURI) |
374
|
1 |
|
->setURI('/v1/domains/' . $domainId . '/action') |
375
|
1 |
|
->setAccept('application/json') |
376
|
1 |
|
->setToken($this->token->getToken()) |
377
|
1 |
|
->setJson($data); |
378
|
|
|
|
379
|
1 |
|
$response = $request->exec(); |
380
|
1 |
|
return $response->getJson(); |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* Create email address. |
385
|
|
|
* |
386
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-email.html |
387
|
|
|
* |
388
|
|
|
* @param string $domainId |
389
|
|
|
* @param string $email |
390
|
|
|
* @param string $password |
391
|
|
|
* @return mixed |
392
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
393
|
|
|
*/ |
394
|
1 |
|
public function postEmail($domainId, $email, $password) |
395
|
|
|
{ |
396
|
|
|
$data = array( |
397
|
1 |
|
'domain_id' => $domainId, |
398
|
1 |
|
'email' => $email, |
399
|
|
|
'password' => $password |
400
|
1 |
|
); |
401
|
|
|
|
402
|
1 |
|
$request = (new Request()) |
403
|
1 |
|
->setMethod('POST') |
404
|
1 |
|
->setBaseURI($this->baseURI) |
405
|
1 |
|
->setURI('/v1/emails') |
406
|
1 |
|
->setAccept('application/json') |
407
|
1 |
|
->setToken($this->token->getToken()) |
408
|
1 |
|
->setJson($data); |
409
|
|
|
|
410
|
1 |
|
$response = $request->exec(); |
411
|
1 |
|
return $response->getJson(); |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* Get email list. |
416
|
|
|
* |
417
|
|
|
* $option can set domain_id, offset, limit, sort_key, and sort_type. |
418
|
|
|
* 'domain_id' is target domain UUID. |
419
|
|
|
* 'offset' is list offset (int value). |
420
|
|
|
* 'limit' is list limit (int value). |
421
|
|
|
* 'sort_key is crate_date, service_name, and status. |
422
|
|
|
* 'sort_type' is asc or desc. |
423
|
|
|
* |
424
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-email-domains.html |
425
|
|
|
* |
426
|
|
|
* @param array $options |
427
|
|
|
* @return mixed |
428
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
429
|
|
|
*/ |
430
|
1 |
|
public function getEmailList($options = array()) |
431
|
|
|
{ |
432
|
1 |
|
$request = (new Request()) |
433
|
1 |
|
->setMethod('GET') |
434
|
1 |
|
->setBaseURI($this->baseURI) |
435
|
1 |
|
->setURI('/v1/emails') |
436
|
1 |
|
->setQuery($options) |
437
|
1 |
|
->setAccept('application/json') |
438
|
1 |
|
->setToken($this->token->getToken()); |
439
|
|
|
|
440
|
1 |
|
$response = $request->exec(); |
441
|
1 |
|
return $response->getJson(); |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
/** |
445
|
|
|
* Get email info. |
446
|
|
|
* |
447
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-email.html |
448
|
|
|
* |
449
|
|
|
* @param string $emailId |
450
|
|
|
* @return mixed |
451
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
452
|
|
|
*/ |
453
|
1 |
|
public function getEmailInfo($emailId) |
454
|
|
|
{ |
455
|
1 |
|
$request = (new Request()) |
456
|
1 |
|
->setMethod('GET') |
457
|
1 |
|
->setBaseURI($this->baseURI) |
458
|
1 |
|
->setURI('/v1/emails/' . $emailId) |
459
|
1 |
|
->setAccept('application/json') |
460
|
1 |
|
->setToken($this->token->getToken()); |
461
|
|
|
|
462
|
1 |
|
$response = $request->exec(); |
463
|
1 |
|
return $response->getJson(); |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* Delete email. |
468
|
|
|
* |
469
|
|
|
* See https://www.conoha.jp/docs/paas-mail-delete-email.html |
470
|
|
|
* |
471
|
|
|
* @param string $emailId |
472
|
|
|
* @return null |
473
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
474
|
|
|
*/ |
475
|
1 |
|
public function deleteEmail($emailId) |
476
|
|
|
{ |
477
|
1 |
|
$request = (new Request()) |
478
|
1 |
|
->setMethod('DELETE') |
479
|
1 |
|
->setBaseURI($this->baseURI) |
480
|
1 |
|
->setURI('/v1/emails/' . $emailId) |
481
|
1 |
|
->setAccept('application/json') |
482
|
1 |
|
->setToken($this->token->getToken()); |
483
|
|
|
|
484
|
1 |
|
$request->exec(); |
485
|
1 |
|
return null; |
486
|
|
|
} |
487
|
|
|
|
488
|
|
|
/** |
489
|
|
|
* Change email password. |
490
|
|
|
* |
491
|
|
|
* See https://www.conoha.jp/docs/paas-mail-update-email-password.html |
492
|
|
|
* |
493
|
|
|
* @param string $emailId |
494
|
|
|
* @param string $newPassword |
495
|
|
|
* @return mixed |
496
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
497
|
|
|
*/ |
498
|
1 |
|
public function putEmailPassword($emailId, $newPassword) |
499
|
|
|
{ |
500
|
1 |
|
$data = array('password' => $newPassword); |
501
|
1 |
|
$request = (new Request()) |
502
|
1 |
|
->setMethod('PUT') |
503
|
1 |
|
->setBaseURI($this->baseURI) |
504
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/password') |
505
|
1 |
|
->setAccept('application/json') |
506
|
1 |
|
->setToken($this->token->getToken()) |
507
|
1 |
|
->setJson($data); |
508
|
|
|
|
509
|
1 |
|
$response = $request->exec(); |
510
|
1 |
|
return $response->getJson(); |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
/** |
514
|
|
|
* Change email filter states. |
515
|
|
|
* |
516
|
|
|
* $filterType can select tray or subject. |
517
|
|
|
* |
518
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-email-spam-filter.html |
519
|
|
|
* |
520
|
|
|
* @param string $emailId |
521
|
|
|
* @param bool $isFilter |
522
|
|
|
* @param string $filterType |
523
|
|
|
* @return mixed |
524
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
525
|
|
|
*/ |
526
|
1 |
|
public function putEmailFilterState($emailId, $isFilter, $filterType) |
527
|
|
|
{ |
528
|
1 |
|
$isFilterStatus = $isFilter ? 'enable' : 'disable'; |
529
|
|
|
|
530
|
|
|
$data = array( |
531
|
|
|
'spam' => [ |
532
|
1 |
|
'status' => $isFilterStatus, |
533
|
|
|
'type' => $filterType |
534
|
1 |
|
] |
535
|
1 |
|
); |
536
|
|
|
|
537
|
1 |
|
$request = (new Request()) |
538
|
1 |
|
->setMethod('PUT') |
539
|
1 |
|
->setBaseURI($this->baseURI) |
540
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/action') |
541
|
1 |
|
->setAccept('application/json') |
542
|
1 |
|
->setToken($this->token->getToken()) |
543
|
1 |
|
->setJson($data); |
544
|
|
|
|
545
|
1 |
|
$response = $request->exec(); |
546
|
1 |
|
return $response->getJson(); |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
/** |
550
|
|
|
* Change email forwarding copy state. |
551
|
|
|
* |
552
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-email-forwarding-copy.html |
553
|
|
|
* |
554
|
|
|
* @param string $emailId |
555
|
|
|
* @param bool $isCopy |
556
|
|
|
* @return mixed |
557
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
558
|
|
|
*/ |
559
|
1 |
|
public function putEmailForwardingCopyState($emailId, $isCopy) |
560
|
|
|
{ |
561
|
1 |
|
$isCopyStatus = $isCopy ? 'enable' : 'disable'; |
562
|
|
|
|
563
|
|
|
$data = array( |
564
|
|
|
'forwarding_copy' => [ |
565
|
|
|
'status' => $isCopyStatus |
566
|
1 |
|
] |
567
|
1 |
|
); |
568
|
|
|
|
569
|
1 |
|
$request = (new Request()) |
570
|
1 |
|
->setMethod('PUT') |
571
|
1 |
|
->setBaseURI($this->baseURI) |
572
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/action') |
573
|
1 |
|
->setAccept('application/json') |
574
|
1 |
|
->setToken($this->token->getToken()) |
575
|
1 |
|
->setJson($data); |
576
|
|
|
|
577
|
1 |
|
$response = $request->exec(); |
578
|
1 |
|
return $response->getJson(); |
579
|
|
|
} |
580
|
|
|
|
581
|
|
|
/** |
582
|
|
|
* Get messages list. |
583
|
|
|
* |
584
|
|
|
* $option can set offset, limit, sort_key, and sort_type. |
585
|
|
|
* 'offset' is list offset (int value). |
586
|
|
|
* 'limit' is list limit (int value). |
587
|
|
|
* 'sort_key is crate_date, service_name, and status. |
588
|
|
|
* 'sort_type' is asc or desc. |
589
|
|
|
* |
590
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-messages.html |
591
|
|
|
* |
592
|
|
|
* @param string $emailId |
593
|
|
|
* @param array $options |
594
|
|
|
* @return mixed |
595
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
596
|
|
|
*/ |
597
|
1 |
|
public function getMessageList($emailId, $options = array()) |
598
|
|
|
{ |
599
|
1 |
|
$request = (new Request()) |
600
|
1 |
|
->setMethod('GET') |
601
|
1 |
|
->setBaseURI($this->baseURI) |
602
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/messages') |
603
|
1 |
|
->setQuery($options) |
604
|
1 |
|
->setAccept('application/json') |
605
|
1 |
|
->setToken($this->token->getToken()); |
606
|
|
|
|
607
|
1 |
|
$response = $request->exec(); |
608
|
1 |
|
return $response->getJson(); |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* Get message information. |
613
|
|
|
* |
614
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-messages.html |
615
|
|
|
* |
616
|
|
|
* @param string $emailId |
617
|
|
|
* @param string $messageId |
618
|
|
|
* @return mixed |
619
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
620
|
|
|
*/ |
621
|
1 |
|
public function getMessage($emailId, $messageId) |
622
|
|
|
{ |
623
|
1 |
|
$request = (new Request()) |
624
|
1 |
|
->setMethod('GET') |
625
|
1 |
|
->setBaseURI($this->baseURI) |
626
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/messages/' . $messageId) |
627
|
1 |
|
->setAccept('application/json') |
628
|
1 |
|
->setToken($this->token->getToken()); |
629
|
|
|
|
630
|
1 |
|
$response = $request->exec(); |
631
|
1 |
|
return $response->getJson(); |
632
|
|
|
} |
633
|
|
|
|
634
|
|
|
/** |
635
|
|
|
* Get message's attachment. |
636
|
|
|
* |
637
|
|
|
* This return value contain binary data. |
638
|
|
|
* |
639
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-messages-attachments.html |
640
|
|
|
* |
641
|
|
|
* @param string $emailId |
642
|
|
|
* @param string $messageId |
643
|
|
|
* @param string $attachmentId |
644
|
|
|
* @return mixed |
645
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
646
|
|
|
*/ |
647
|
1 |
|
public function getMessageAttachment($emailId, $messageId, $attachmentId) |
648
|
|
|
{ |
649
|
1 |
|
$request = (new Request()) |
650
|
1 |
|
->setMethod('GET') |
651
|
1 |
|
->setBaseURI($this->baseURI) |
652
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/messages/' . $messageId . '/attachments/' . $attachmentId) |
653
|
1 |
|
->setAccept('application/json') |
654
|
1 |
|
->setToken($this->token->getToken()); |
655
|
|
|
|
656
|
1 |
|
$response = $request->exec(); |
657
|
1 |
|
return $response->getJson(); |
658
|
|
|
} |
659
|
|
|
|
660
|
|
|
|
661
|
|
|
/** |
662
|
|
|
* Delete message. |
663
|
|
|
* |
664
|
|
|
* See https://www.conoha.jp/docs/paas-mail-delete-messages.html |
665
|
|
|
* |
666
|
|
|
* @param string $emailId |
667
|
|
|
* @param string $messageId |
668
|
|
|
* @return null |
669
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
670
|
|
|
*/ |
671
|
1 |
|
public function deleteMessage($emailId, $messageId) |
672
|
|
|
{ |
673
|
1 |
|
$request = (new Request()) |
674
|
1 |
|
->setMethod('DELETE') |
675
|
1 |
|
->setBaseURI($this->baseURI) |
676
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/messages/' . $messageId) |
677
|
1 |
|
->setAccept('application/json') |
678
|
1 |
|
->setToken($this->token->getToken()); |
679
|
|
|
|
680
|
1 |
|
$request->exec(); |
681
|
|
|
|
682
|
1 |
|
return null; |
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* Create webhook. |
687
|
|
|
* |
688
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-email-webhook.html |
689
|
|
|
* |
690
|
|
|
* @param string $emailId |
691
|
|
|
* @param string $webhookURI |
692
|
|
|
* @param string $webhookKeyword |
693
|
|
|
* @return mixed |
694
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
695
|
|
|
*/ |
696
|
1 |
|
public function postWebhook($emailId, $webhookURI, $webhookKeyword) |
697
|
|
|
{ |
698
|
|
|
$data = array( |
699
|
1 |
|
'webhook_url' => $webhookURI, |
700
|
|
|
'webhook_keyword' => $webhookKeyword |
701
|
1 |
|
); |
702
|
|
|
|
703
|
1 |
|
$request = (new Request()) |
704
|
1 |
|
->setMethod('POST') |
705
|
1 |
|
->setBaseURI($this->baseURI) |
706
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/webhook') |
707
|
1 |
|
->setAccept('application/json') |
708
|
1 |
|
->setToken($this->token->getToken()) |
709
|
1 |
|
->setJson($data); |
710
|
|
|
|
711
|
1 |
|
$response = $request->exec(); |
712
|
1 |
|
return $response->getJson(); |
713
|
|
|
} |
714
|
|
|
|
715
|
|
|
/** |
716
|
|
|
* Get webhook. |
717
|
|
|
* |
718
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-email-filter.html |
719
|
|
|
* |
720
|
|
|
* @param string $emailId |
721
|
|
|
* @return mixed |
722
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
723
|
|
|
*/ |
724
|
1 |
|
public function getWebhook($emailId) |
725
|
|
|
{ |
726
|
1 |
|
$request = (new Request()) |
727
|
1 |
|
->setMethod('GET') |
728
|
1 |
|
->setBaseURI($this->baseURI) |
729
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/webhook') |
730
|
1 |
|
->setAccept('application/json') |
731
|
1 |
|
->setToken($this->token->getToken()); |
732
|
|
|
|
733
|
1 |
|
$response = $request->exec(); |
734
|
1 |
|
return $response->getJson(); |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
/** |
738
|
|
|
* Change webhook. |
739
|
|
|
* |
740
|
|
|
* See https://www.conoha.jp/docs/paas-mail-update-email-filter.html |
741
|
|
|
* |
742
|
|
|
* @param string $emailId |
743
|
|
|
* @param string $webhookURI |
744
|
|
|
* @param string $webhookKeyword |
745
|
|
|
* @return mixed |
746
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
747
|
|
|
*/ |
748
|
1 |
|
public function putWebhook($emailId, $webhookURI, $webhookKeyword) |
749
|
|
|
{ |
750
|
|
|
$data = array( |
751
|
1 |
|
'webhook_url' => $webhookURI, |
752
|
|
|
'webhook_keyword' => $webhookKeyword |
753
|
1 |
|
); |
754
|
|
|
|
755
|
1 |
|
$request = (new Request()) |
756
|
1 |
|
->setMethod('PUT') |
757
|
1 |
|
->setBaseURI($this->baseURI) |
758
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/webhook') |
759
|
1 |
|
->setAccept('application/json') |
760
|
1 |
|
->setToken($this->token->getToken()) |
761
|
1 |
|
->setJson($data); |
762
|
|
|
|
763
|
1 |
|
$response = $request->exec(); |
764
|
1 |
|
return $response->getJson(); |
765
|
|
|
} |
766
|
|
|
|
767
|
|
|
/** |
768
|
|
|
* Delete webhook. |
769
|
|
|
* |
770
|
|
|
* See https://www.conoha.jp/docs/paas-mail-delete-email-filter.html |
771
|
|
|
* |
772
|
|
|
* @param string $emailId |
773
|
|
|
* @return null |
774
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
775
|
|
|
*/ |
776
|
1 |
|
public function deleteWebhook($emailId) |
777
|
|
|
{ |
778
|
1 |
|
$request = (new Request()) |
779
|
1 |
|
->setMethod('DELETE') |
780
|
1 |
|
->setBaseURI($this->baseURI) |
781
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/webhook') |
782
|
1 |
|
->setAccept('application/json') |
783
|
1 |
|
->setToken($this->token->getToken()); |
784
|
|
|
|
785
|
1 |
|
$request->exec(); |
786
|
1 |
|
return null; |
787
|
|
|
} |
788
|
|
|
|
789
|
|
|
/** |
790
|
|
|
* Get white list. |
791
|
|
|
* |
792
|
|
|
* $option can set offset, limit, sort_key, and sort_type. |
793
|
|
|
* 'offset' is list offset (int value). |
794
|
|
|
* 'limit' is list limit (int value). |
795
|
|
|
* 'sort_key is crate_date, service_name, and status. |
796
|
|
|
* 'sort_type' is asc or desc. |
797
|
|
|
* |
798
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-email-whitelist.html |
799
|
|
|
* |
800
|
|
|
* @param string $emailId |
801
|
|
|
* @param array $options |
802
|
|
|
* @return mixed |
803
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
804
|
|
|
*/ |
805
|
1 |
|
public function getWhiteList($emailId, $options = array()) |
806
|
|
|
{ |
807
|
1 |
|
$request = (new Request()) |
808
|
1 |
|
->setMethod('GET') |
809
|
1 |
|
->setBaseURI($this->baseURI) |
810
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/whitelist') |
811
|
1 |
|
->setQuery($options) |
812
|
1 |
|
->setAccept('application/json') |
813
|
1 |
|
->setToken($this->token->getToken()); |
814
|
|
|
|
815
|
1 |
|
$response = $request->exec(); |
816
|
1 |
|
return $response->getJson(); |
817
|
|
|
} |
818
|
|
|
|
819
|
|
|
/** |
820
|
|
|
* Change white list. |
821
|
|
|
* |
822
|
|
|
* See https://www.conoha.jp/docs/paas-mail-update-email-whitelist.html |
823
|
|
|
* |
824
|
|
|
* @param string $emailId |
825
|
|
|
* @param array $mailList |
826
|
|
|
* @return mixed |
827
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
828
|
|
|
*/ |
829
|
1 |
|
public function putWhiteList($emailId, array $mailList) |
830
|
|
|
{ |
831
|
1 |
|
$request = (new Request()) |
832
|
1 |
|
->setMethod('PUT') |
833
|
1 |
|
->setBaseURI($this->baseURI) |
834
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/whitelist') |
835
|
1 |
|
->setAccept('application/json') |
836
|
1 |
|
->setToken($this->token->getToken()) |
837
|
1 |
|
->setJson($this->createTargetMailArray($mailList)); |
838
|
|
|
|
839
|
1 |
|
$response = $request->exec(); |
840
|
1 |
|
return $response->getJson(); |
841
|
|
|
} |
842
|
|
|
|
843
|
|
|
/** |
844
|
|
|
* Get black list. |
845
|
|
|
* |
846
|
|
|
* $option can set offset, limit, sort_key, and sort_type. |
847
|
|
|
* 'offset' is list offset (int value). |
848
|
|
|
* 'limit' is list limit (int value). |
849
|
|
|
* 'sort_key is crate_date, service_name, and status. |
850
|
|
|
* 'sort_type' is asc or desc. |
851
|
|
|
* |
852
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-email-blacklist.html |
853
|
|
|
* |
854
|
|
|
* @param string $emailId |
855
|
|
|
* @param array $options |
856
|
|
|
* @return mixed |
857
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
858
|
|
|
*/ |
859
|
1 |
|
public function getBlackList($emailId, $options = array()) |
860
|
|
|
{ |
861
|
1 |
|
$request = (new Request()) |
862
|
1 |
|
->setMethod('GET') |
863
|
1 |
|
->setBaseURI($this->baseURI) |
864
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/blacklist') |
865
|
1 |
|
->setQuery($options) |
866
|
1 |
|
->setAccept('application/json') |
867
|
1 |
|
->setToken($this->token->getToken()); |
868
|
|
|
|
869
|
1 |
|
$response = $request->exec(); |
870
|
1 |
|
return $response->getJson(); |
871
|
|
|
} |
872
|
|
|
|
873
|
|
|
/** |
874
|
|
|
* Change black list. |
875
|
|
|
* |
876
|
|
|
* See https://www.conoha.jp/docs/paas-mail-update-email-blacklist.html |
877
|
|
|
* |
878
|
|
|
* @param string $emailId |
879
|
|
|
* @param array $mailList |
880
|
|
|
* @return mixed |
881
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
882
|
|
|
*/ |
883
|
1 |
|
public function putBlackList($emailId, array $mailList) |
884
|
|
|
{ |
885
|
1 |
|
$request = (new Request()) |
886
|
1 |
|
->setMethod('PUT') |
887
|
1 |
|
->setBaseURI($this->baseURI) |
888
|
1 |
|
->setURI('/v1/emails/' . $emailId . '/blacklist') |
889
|
1 |
|
->setAccept('application/json') |
890
|
1 |
|
->setToken($this->token->getToken()) |
891
|
1 |
|
->setJson($this->createTargetMailArray($mailList)); |
892
|
|
|
|
893
|
1 |
|
$response = $request->exec(); |
894
|
1 |
|
return $response->getJson(); |
895
|
|
|
} |
896
|
|
|
|
897
|
|
|
/** |
898
|
|
|
* Create forwarding setting. |
899
|
|
|
* |
900
|
|
|
* See https://www.conoha.jp/docs/paas-mail-create-email-forwarding.html |
901
|
|
|
* |
902
|
|
|
* @param string $emailId |
903
|
|
|
* @param string $address |
904
|
|
|
* @return mixed |
905
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
906
|
|
|
*/ |
907
|
1 |
|
public function postForwarding($emailId, $address) |
908
|
|
|
{ |
909
|
|
|
$data = array( |
910
|
1 |
|
'email_id' => $emailId, |
911
|
|
|
'address' => $address |
912
|
1 |
|
); |
913
|
|
|
|
914
|
1 |
|
$request = (new Request()) |
915
|
1 |
|
->setMethod('POST') |
916
|
1 |
|
->setBaseURI($this->baseURI) |
917
|
1 |
|
->setURI('/v1/forwarding') |
918
|
1 |
|
->setAccept('application/json') |
919
|
1 |
|
->setToken($this->token->getToken()) |
920
|
1 |
|
->setJson($data); |
921
|
|
|
|
922
|
1 |
|
$response = $request->exec(); |
923
|
1 |
|
return $response->getJson(); |
924
|
|
|
} |
925
|
|
|
|
926
|
|
|
/** |
927
|
|
|
* Get forwarding setting. |
928
|
|
|
* |
929
|
|
|
* $option can set offset, limit, sort_key, and sort_type. |
930
|
|
|
* 'offset' is list offset (int value). |
931
|
|
|
* 'limit' is list limit (int value). |
932
|
|
|
* 'sort_key is crate_date, service_name, and status. |
933
|
|
|
* 'sort_type' is asc or desc. |
934
|
|
|
* |
935
|
|
|
* See https://www.conoha.jp/docs/paas-mail-list-email-forwarding.html |
936
|
|
|
* |
937
|
|
|
* @param array $options |
938
|
|
|
* @return mixed |
939
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
940
|
|
|
*/ |
941
|
1 |
|
public function getForwardingList($options = array()) |
942
|
|
|
{ |
943
|
1 |
|
$request = (new Request()) |
944
|
1 |
|
->setMethod('GET') |
945
|
1 |
|
->setBaseURI($this->baseURI) |
946
|
1 |
|
->setURI('/v1/forwarding') |
947
|
1 |
|
->setQuery($options) |
948
|
1 |
|
->setAccept('application/json') |
949
|
1 |
|
->setToken($this->token->getToken()); |
950
|
|
|
|
951
|
1 |
|
$response = $request->exec(); |
952
|
1 |
|
return $response->getJson(); |
953
|
|
|
} |
954
|
|
|
|
955
|
|
|
/** |
956
|
|
|
* Get forwarding setting. |
957
|
|
|
* |
958
|
|
|
* See https://www.conoha.jp/docs/paas-mail-get-email-forwarding.html |
959
|
|
|
* |
960
|
|
|
* @param string $forwardingId |
961
|
|
|
* @return mixed |
962
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
963
|
|
|
*/ |
964
|
1 |
|
public function getForwarding($forwardingId) |
965
|
|
|
{ |
966
|
1 |
|
$request = (new Request()) |
967
|
1 |
|
->setMethod('GET') |
968
|
1 |
|
->setBaseURI($this->baseURI) |
969
|
1 |
|
->setURI('/v1/forwarding/' . $forwardingId) |
970
|
1 |
|
->setAccept('application/json') |
971
|
1 |
|
->setToken($this->token->getToken()); |
972
|
|
|
|
973
|
1 |
|
$response = $request->exec(); |
974
|
1 |
|
return $response->getJson(); |
975
|
|
|
} |
976
|
|
|
|
977
|
|
|
/** |
978
|
|
|
* Change forwarding setting. |
979
|
|
|
* |
980
|
|
|
* See https://www.conoha.jp/docs/paas-mail-update-email-forwarding.html |
981
|
|
|
* |
982
|
|
|
* @param string $forwardingId |
983
|
|
|
* @param string $address |
984
|
|
|
* @return mixed |
985
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
986
|
|
|
*/ |
987
|
1 |
|
public function putForwarding($forwardingId, $address) |
988
|
|
|
{ |
989
|
1 |
|
$data = array('address' => $address); |
990
|
|
|
|
991
|
1 |
|
$request = (new Request()) |
992
|
1 |
|
->setMethod('PUT') |
993
|
1 |
|
->setBaseURI($this->baseURI) |
994
|
1 |
|
->setURI('/v1/forwarding/' . $forwardingId) |
995
|
1 |
|
->setAccept('application/json') |
996
|
1 |
|
->setToken($this->token->getToken()) |
997
|
1 |
|
->setJson($data); |
998
|
|
|
|
999
|
1 |
|
$response = $request->exec(); |
1000
|
1 |
|
return $response->getJson(); |
1001
|
|
|
} |
1002
|
|
|
|
1003
|
|
|
/** |
1004
|
|
|
* Delete forwarding setting |
1005
|
|
|
* |
1006
|
|
|
* See https://www.conoha.jp/docs/paas-mail-delete-email-forwarding.html |
1007
|
|
|
* |
1008
|
|
|
* @param string $forwardingId |
1009
|
|
|
* @return null |
1010
|
|
|
* @throws \keika299\ConohaAPI\Common\Exceptions\IConohaAPIException |
1011
|
|
|
*/ |
1012
|
1 |
|
public function deleteForwarding($forwardingId) |
1013
|
|
|
{ |
1014
|
1 |
|
$request = (new Request()) |
1015
|
1 |
|
->setMethod('DELETE') |
1016
|
1 |
|
->setBaseURI($this->baseURI) |
1017
|
1 |
|
->setURI('/v1/forwarding/' . $forwardingId) |
1018
|
1 |
|
->setAccept('application/json') |
1019
|
1 |
|
->setToken($this->token->getToken()); |
1020
|
|
|
|
1021
|
1 |
|
$request->exec(); |
1022
|
|
|
|
1023
|
1 |
|
return null; |
1024
|
|
|
} |
1025
|
|
|
|
1026
|
|
|
/** |
1027
|
|
|
* Create target mail array. |
1028
|
|
|
* |
1029
|
|
|
* @param array $targetArray |
1030
|
|
|
* @return array |
1031
|
|
|
*/ |
1032
|
2 |
|
private function createTargetMailArray(array $targetArray) |
1033
|
|
|
{ |
1034
|
2 |
|
$target = array(); |
1035
|
|
|
|
1036
|
2 |
|
foreach ($targetArray as $value) { |
1037
|
2 |
|
array_push($target, ['target' => $value]); |
1038
|
2 |
|
} |
1039
|
|
|
|
1040
|
2 |
|
return array('targets' => $target); |
1041
|
|
|
} |
1042
|
|
|
} |
1043
|
|
|
|