1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright (C) 2013-2016 Mailgun |
5
|
|
|
* |
6
|
|
|
* This software may be modified and distributed under the terms |
7
|
|
|
* of the MIT license. See the LICENSE file for details. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Mailgun\Api; |
11
|
|
|
|
12
|
|
|
use Http\Client\HttpClient; |
13
|
|
|
use Mailgun\Api\Supression\Bounce; |
14
|
|
|
use Mailgun\Api\Supression\Complaint; |
15
|
|
|
use Mailgun\Api\Supression\Unsubscribe; |
16
|
|
|
use Mailgun\Hydrator\Hydrator; |
17
|
|
|
use Mailgun\RequestBuilder; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @see https://documentation.mailgun.com/api-suppressions.html |
21
|
|
|
* |
22
|
|
|
* @author Sean Johnson <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class Suppression |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var HttpClient |
28
|
|
|
*/ |
29
|
|
|
private $httpClient; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var RequestBuilder |
33
|
|
|
*/ |
34
|
|
|
private $requestBuilder; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var Hydrator |
38
|
|
|
*/ |
39
|
|
|
private $hydrator; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param HttpClient $httpClient |
43
|
|
|
* @param RequestBuilder $requestBuilder |
44
|
|
|
* @param Hydrator $hydrator |
45
|
|
|
*/ |
46
|
|
|
public function __construct(HttpClient $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator) |
47
|
|
|
{ |
48
|
|
|
$this->httpClient = $httpClient; |
49
|
|
|
$this->requestBuilder = $requestBuilder; |
50
|
|
|
$this->hydrator = $hydrator; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return Bounce |
55
|
|
|
*/ |
56
|
|
|
public function bounces() |
57
|
|
|
{ |
58
|
|
|
return new Bounce($this->httpClient, $this->requestBuilder, $this->hydrator); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return Complaint |
63
|
|
|
*/ |
64
|
|
|
public function complaints() |
65
|
|
|
{ |
66
|
|
|
return new Complaint($this->httpClient, $this->requestBuilder, $this->hydrator); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return Unsubscribe |
71
|
|
|
*/ |
72
|
|
|
public function unsubscribes() |
73
|
|
|
{ |
74
|
|
|
return new Unsubscribe($this->httpClient, $this->requestBuilder, $this->hydrator); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|