forked from KnpLabs/mailjet-api-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.php
127 lines (112 loc) · 3.28 KB
/
User.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
namespace Mailjet\Api\Request;
use Mailjet\Api\MailjetClientInterface;
use Mailjet\Api\RequestApi;
/**
* Higher-level OOP wrapper over Mailjet Client for User related requests
*
* @link http://www.mailjet.com/docs/api/user
*
* Based on https://github.com/dguyon/Mailjet
*/
class User
{
private $client;
public function __construct(MailjetClientInterface $client)
{
$this->client = $client;
}
/**
* @link http://www.mailjet.com/docs/api/user/domainadd
*/
public function addDomain($domain)
{
return $this->client->post(RequestApi::USER_DOMAIN_ADD, array(
'domain' => $domain
));
}
/**
* @link http://www.mailjet.com/docs/api/user/domainlist
*/
public function getDomains()
{
return $this->client->get(RequestApi::USER_DOMAIN_LIST);
}
/**
* @link http://www.mailjet.com/docs/api/user/domainlist
*/
public function getDomainStatus($domain, $forceVerification = false)
{
$options = array('domain' => $domain);
if ($forceVerification) {
$options['check'] = 1;
}
return $this->client->post(RequestApi::USER_DOMAIN_STATUS, $options);
}
/**
* @link http://www.mailjet.com/docs/api/user/infos
*/
public function getInfo()
{
return $this->client->get(RequestApi::USER_INFOS);
}
/**
* @link http://www.mailjet.com/docs/api/user/senderadd
*/
public function addSender($email)
{
return $this->client->post(RequestApi::USER_SENDER_ADD, array(
'email' => $email
));
}
/**
* @link http://www.mailjet.com/docs/api/user/senderlist
*/
public function getSenders()
{
return $this->client->get(RequestApi::USER_SENDER_LIST);
}
/**
* @link http://www.mailjet.com/docs/api/user/senderstatus
*/
public function getSenderStatus($email)
{
return $this->client->post(RequestApi::USER_SENDER_STATUS, array(
'email' => $email
));
}
/**
* @link http://www.mailjet.com/docs/api/user/trackingcheck
*/
public function getTrackingSettings()
{
return $this->client->get(RequestApi::USER_TRACKING_CHECK);
}
/**
* @link http://www.mailjet.com/docs/api/user/trackingupdate
*/
public function updateTrackingSettings($click, $open)
{
return $this->client->post(RequestApi::USER_TRACKING_UPDATE, array(
'click' => $click,
'open' => $open
));
}
/**
* @link http://www.mailjet.com/docs/api/user/update
*/
public function updateInfo($country = '', $city = '', $street = '', $postalCode = '', $companyName = '', $contactEmail = '', $firstName = '', $lastName = '', $locale = '')
{
return $this->client->post(RequestApi::USER_UPDATE, array(
'address_country' => $country,
'address_city' => $city,
'address_street' => $street,
'address_postal_code' => $postalCode,
'company_name' => $companyName,
'contact_email' => $contactEmail,
'firstname' => $firstName,
'lastname' => $lastName,
'locale' => $locale
));
}
}