forked from knownhost/Blesta-Namesilo
/
domains.php
253 lines (233 loc) · 6.23 KB
/
domains.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<?php
/**
* Namesilo Domain Management
*
* @copyright Copyright (c) 2013, Phillips Data, Inc.
* @license http://opensource.org/licenses/mit-license.php MIT License
* @package namesilo.commands
*/
class NamesiloDomains
{
/**
* @var NamesiloApi
*/
private $api;
/**
* Sets the API to use for communication
*
* @param NamesiloApi $api The API to use for communication
*/
public function __construct(NamesiloApi $api)
{
$this->api = $api;
}
/**
* Returns a list of domains for the particular user.
*
* @param array $vars An array of input params including:
*
* - portfolio (optional) portfolio to fetch domains for
* @return NamesiloResponse
*/
public function getList(array $vars)
{
return $this->api->submit('listDomains', $vars);
}
/**
* Returns a list of tlds
*
* @return NamesiloResponse
*/
public function getTldList()
{
return $this->api->submit('namesilo.domains.getTldList');
}
/**
* Registers a new domain name.
*
* https://www.namesilo.com/api_reference.php#registerDomain
*/
public function create(array $vars)
{
return $this->api->submit('registerDomain', array_merge($vars, ['auto_renew' => 0]));
}
/**
* Get essential information on a particular domain, including the expiration date, creation date, status,
* locked status and nameservers.
*
* https://www.namesilo.com/api_reference.php#getDomainInfo
*/
public function getDomainInfo(array $vars)
{
return $this->api->submit('getDomainInfo', $vars);
}
/**
* Gets contact information for the requested domain.
*
* @param array $vars An array of input params including:
*
* - DomainName Domain to get contacts
* @return NamesiloResponse
*/
public function getContacts(array $vars)
{
return $this->api->submit('contactList', $vars);
}
/**
* Adds a contact
*
* @param array $vars An array of contact information
* @return NamesiloResponse
*/
public function addContacts(array $vars)
{
return $this->api->submit('contactAdd', $vars);
}
/**
* Sets contact information for the requested domain.
*
* @return NamesiloResponse
*/
public function setContacts(array $vars)
{
return $this->api->submit('contactDomainAssociate', $vars);
}
/**
* Delete a contact profile in your account. Please remember
* that the only contact profiles that can be deleted are those
* that are not the account default and are not associated with
* any active domains or order profiles.
*
* https://www.namesilo.com/api_reference.php#contactDelete
*/
public function deleteContacts(array $vars)
{
return $this->api->submit('contactDelete', $vars);
}
/**
* Checks the availability of a domain name.
*
* https://www.namesilo.com/api_reference.php#checkRegisterAvailability
*/
public function check(array $vars)
{
return $this->api->submit('checkRegisterAvailability', $vars);
}
/**
* Reactivates an expired domain.
*
* @param array $vars An array of input params including:
*
* - DomainName DomainName to reactivate
* @return NamesiloResponse
*/
public function reactivate(array $vars)
{
return $this->api->submit('namesilo.domains.reactivate', $vars);
}
/**
* Renews a domain.
*
* @param array $vars An array of input params including:
*
* - domain DomainName to renew
* - years Number of years to renew
* - coupon Promotional (coupon) code for renewing the domain
* @return NamesiloResponse
*
* https://www.namesilo.com/api_reference.php#renewDomain
*/
public function renew(array $vars)
{
return $this->api->submit('renewDomain', $vars);
}
/**
* Sets the RegistrarLock status for a domain.
*
* @param array $vars An array of input params including:
*
* - domain Domain name to set status
* - LockAction Possible values are LOCK and UNLOCK
* @return NamesiloResponse
*/
public function setRegistrarLock($lock_action, array $vars)
{
return $this->api->submit('domain' . $lock_action, $vars);
}
/**
* Sets the Auto Renew for a domain.
*
* @param array $vars An array of input params including:
*
* - domain Domain name to set status
* - autorenew (boolean) true to enable auto renewal, (boolean) false to disable
* @return NamesiloResponse
*/
public function setAutoRenewal($domain, $autorenew = false)
{
if (!$autorenew) {
$action = 'remove';
} else {
$action = 'add';
}
return $this->api->submit($action . 'AutoRenewal', ['domain' => $domain]);
}
/**
* Adds privacy
*
* @param array $vars An array of data
*
* - domain
* @return NamesiloResponse
*/
public function addPrivacy(array $vars)
{
return $this->api->submit('addPrivacy', $vars);
}
/**
* Removes privacy
*
* @param array $vars An array of data
*
* - domain
* @return NamesiloResponse
*/
public function removePrivacy(array $vars)
{
return $this->api->submit('removePrivacy', $vars);
}
/**
* @param array $vars An array of data
* @return NamesiloResponse
*/
public function portfolioList()
{
return $this->api->submit('portfolioList');
}
/**
* @return NamesiloResponse
*/
public function getPrices()
{
return $this->api->submit('getPrices');
}
/**
* @return NamesiloResponse
*/
public function registrantVerificationStatus()
{
return $this->api->submit('registrantVerificationStatus');
}
/**
* Performs email verification
*
* @param array $vars An array of data
*
* - email string email address to verify
* @return NamesiloResponse
*/
public function emailVerification(array $vars)
{
return $this->api->submit('emailVerification', $vars);
}
}