|
2 | 2 |
|
3 | 3 | namespace Lettermint\Endpoints; |
4 | 4 |
|
| 5 | +use Lettermint\Responses\DeleteDomainResponse; |
| 6 | +use Lettermint\Responses\DomainListResponse; |
| 7 | +use Lettermint\Responses\DomainResponse; |
| 8 | +use Lettermint\Responses\UpdateDomainProjectsResponse; |
| 9 | +use Lettermint\Responses\VerifyDnsRecordResponse; |
| 10 | +use Lettermint\Responses\VerifyDnsRecordsResponse; |
| 11 | + |
5 | 12 | /** |
6 | | - * @phpstan-import-type CursorPage from \Lettermint\Types\ApiTypes |
7 | | - * @phpstan-import-type ApiObject from \Lettermint\Types\ApiTypes |
8 | 13 | * @phpstan-import-type StoreDomainData from \Lettermint\Types\ApiTypes |
9 | 14 | * @phpstan-import-type UpdateDomainProjectsData from \Lettermint\Types\ApiTypes |
10 | 15 | */ |
11 | 16 | class DomainsEndpoint extends Endpoint |
12 | 17 | { |
13 | | - /** @phpstan-return CursorPage */ |
14 | | - public function list(array $query = []): array |
| 18 | + public function list(array $query = []): DomainListResponse |
15 | 19 | { |
16 | | - return $this->getArray($this->path('/domains'), $query); |
| 20 | + return $this->hydrate(DomainListResponse::class, $this->getArray($this->path('/domains'), $query)); |
17 | 21 | } |
18 | 22 |
|
19 | 23 | /** |
20 | 24 | * @phpstan-param StoreDomainData $data |
21 | | - * |
22 | | - * @phpstan-return ApiObject |
23 | 25 | */ |
24 | | - public function create(array $data): array |
| 26 | + public function create(array $data): DomainResponse |
25 | 27 | { |
26 | | - return $this->postArray($this->path('/domains'), $data, []); |
| 28 | + return $this->hydrate(DomainResponse::class, $this->postArray($this->path('/domains'), $data, [])); |
27 | 29 | } |
28 | 30 |
|
29 | | - /** @phpstan-return ApiObject */ |
30 | | - public function retrieve(string $domainId, array $query = []): array |
| 31 | + public function retrieve(string $domainId, array $query = []): DomainResponse |
31 | 32 | { |
32 | | - return $this->getArray($this->path('/domains/{domainId}', ['domainId' => $domainId]), $query); |
| 33 | + return $this->hydrate(DomainResponse::class, $this->getArray($this->path('/domains/{domainId}', ['domainId' => $domainId]), $query)); |
33 | 34 | } |
34 | 35 |
|
35 | | - /** @phpstan-return ApiObject */ |
36 | | - public function delete(string $domainId): array |
| 36 | + public function delete(string $domainId): DeleteDomainResponse |
37 | 37 | { |
38 | | - return $this->deleteArray($this->path('/domains/{domainId}', ['domainId' => $domainId]), []); |
| 38 | + return $this->hydrate(DeleteDomainResponse::class, $this->deleteArray($this->path('/domains/{domainId}', ['domainId' => $domainId]), [])); |
39 | 39 | } |
40 | 40 |
|
41 | | - /** @phpstan-return ApiObject */ |
42 | | - public function verifyDnsRecords(string $domainId): array |
| 41 | + public function verifyDnsRecords(string $domainId): VerifyDnsRecordsResponse |
43 | 42 | { |
44 | | - return $this->postArray($this->path('/domains/{domainId}/dns-records/verify', ['domainId' => $domainId]), [], []); |
| 43 | + return $this->hydrate(VerifyDnsRecordsResponse::class, $this->postArray($this->path('/domains/{domainId}/dns-records/verify', ['domainId' => $domainId]), [], [])); |
45 | 44 | } |
46 | 45 |
|
47 | | - /** @phpstan-return ApiObject */ |
48 | | - public function verifyDnsRecord(string $domainId, string $recordId): array |
| 46 | + public function verifyDnsRecord(string $domainId, string $recordId): VerifyDnsRecordResponse |
49 | 47 | { |
50 | | - return $this->postArray($this->path('/domains/{domainId}/dns-records/{recordId}/verify', [ |
| 48 | + return $this->hydrate(VerifyDnsRecordResponse::class, $this->postArray($this->path('/domains/{domainId}/dns-records/{recordId}/verify', [ |
51 | 49 | 'domainId' => $domainId, |
52 | 50 | 'recordId' => $recordId, |
53 | | - ]), [], []); |
| 51 | + ]), [], [])); |
54 | 52 | } |
55 | 53 |
|
56 | 54 | /** |
57 | 55 | * @phpstan-param UpdateDomainProjectsData $data |
58 | | - * |
59 | | - * @phpstan-return ApiObject |
60 | 56 | */ |
61 | | - public function updateProjects(string $domainId, array $data): array |
| 57 | + public function updateProjects(string $domainId, array $data): UpdateDomainProjectsResponse |
62 | 58 | { |
63 | | - return $this->putArray($this->path('/domains/{domainId}/projects', ['domainId' => $domainId]), $data, []); |
| 59 | + return $this->hydrate(UpdateDomainProjectsResponse::class, $this->putArray($this->path('/domains/{domainId}/projects', ['domainId' => $domainId]), $data, [])); |
64 | 60 | } |
65 | 61 | } |
0 commit comments