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