-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDomainResult.php
173 lines (157 loc) · 4.61 KB
/
DomainResult.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
<?php
declare(strict_types=1);
namespace Upmind\ProvisionProviders\DomainNames\Data;
use DateTimeInterface;
use Upmind\ProvisionBase\Provider\DataSet\ResultData;
use Upmind\ProvisionBase\Provider\DataSet\Rules;
/**
* Domain response data.
*
* @property-read string $id Domain ID
* @property-read string $domain Domain
* @property-read string[] $statuses Active domain statuses
* @property-read bool|null $locked Transfer and/or update lock enabled
* @property-read bool|null $whois_privacy WHOIS privacy/protection enabled
* @property-read bool|null $auto_renew Auto renew enabled
* @property-read ContactData|null $registrant Registrant contact
* @property-read ContactData|null $billing Billing contact
* @property-read ContactData|null $tech Tech contact
* @property-read ContactData|null $admin Admin contact
* @property-read NameserversParams $ns Nameservers
* @property-read string $created_at Date of creation in format - Y-m-d H:i:s
* @property-read string $updated_at Date of last update in format - Y-m-d H:i:s
* @property-read string $expires_at Date of domain renewing in format - Y-m-d H:i:s
*/
class DomainResult extends ResultData
{
public static function rules(): Rules
{
return new Rules([
// 'sld' => ['required', 'alpha-dash'],
// 'tld' => ['required', 'alpha-dash-dot'],
'id' => ['required', 'string'],
'domain' => ['required', 'string'],
'statuses' => ['present', 'array'],
'statuses.*' => ['filled', 'string'],
'locked' => ['nullable', 'boolean'],
'whois_privacy' => ['nullable', 'boolean'],
'auto_renew' => ['nullable', 'boolean'],
'registrant' => ['nullable', ContactData::class],
'billing' => ['nullable', ContactData::class],
'tech' => ['nullable', ContactData::class],
'admin' => ['nullable', ContactData::class],
'ns' => ['present', NameserversParams::class],
'created_at' => ['present', 'nullable', 'date_format:Y-m-d H:i:s'],
'updated_at' => ['present', 'nullable', 'date_format:Y-m-d H:i:s'],
'expires_at' => ['present', 'nullable', 'date_format:Y-m-d H:i:s'],
]);
}
/**
* @return static $this
*/
public function setId($id)
{
$this->setValue('id', $id);
return $this;
}
/**
* @return static $this
*/
public function setDomain(string $domain)
{
$this->setValue('domain', $domain);
return $this;
}
/**
* @param string[] $statuses
*
* @return static $this
*/
public function setStatuses(array $statuses)
{
$this->setValue('statuses', $statuses);
return $this;
}
/**
* @return static $this
*/
public function setLocked(?bool $locked)
{
$this->setValue('locked', $locked);
return $this;
}
/**
* @param array|ContactData|null $registrant
*
* @return static $this
*/
public function setRegistrant($registrant)
{
$this->setValue('registrant', $registrant);
return $this;
}
/**
* @param array|ContactData|null $billing
*
* @return static $this
*/
public function setBilling($billing)
{
$this->setValue('billing', $billing);
return $this;
}
/**
* @param array|ContactData|null $tech
*
* @return static $this
*/
public function setTech($tech)
{
$this->setValue('tech', $tech);
return $this;
}
/**
* @param array|ContactData|null $admin
*
* @return static $this
*/
public function setAdmin($admin)
{
$this->setValue('admin', $admin);
return $this;
}
/**
* @param array|NameserversParams $ns
*
* @return static $this
*/
public function setNs($ns)
{
$this->setValue('ns', $ns);
return $this;
}
/**
* @return static $this
*/
public function setCreatedAt(?DateTimeInterface $createdAt)
{
$this->setValue('created_at', $createdAt ? $createdAt->format('Y-m-d H:i:s') : null);
return $this;
}
/**
* @return static $this
*/
public function setUpdatedAt(?DateTimeInterface $updatedAt)
{
$this->setValue('updated_at', $updatedAt ? $updatedAt->format('Y-m-d H:i:s') : null);
return $this;
}
/**
* @return static $this
*/
public function setExpiresAt(?DateTimeInterface $expiresAt)
{
$this->setValue('expires_at', $expiresAt ? $expiresAt->format('Y-m-d H:i:s') : null);
return $this;
}
}