Skip to content

Commit b23985c

Browse files
committed
fix: updated php-sdk
1 parent 1f42190 commit b23985c

25 files changed

+377
-254
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hostinger/api-php-sdk",
3-
"version": "0.0.30",
3+
"version": "0.0.31",
44
"description": "Hostinger API PHP SDK",
55
"keywords": [
66
"hostinger",

src/Api/BillingCatalogApi.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function getConfig(): Configuration
5555
/**
5656
* @return \Hostinger\Model\BillingV1CatalogCatalogItemResource[]
5757
*
58-
* @throws ExceptionInterface
5958
* @throws ApiException
6059
* @throws GuzzleException
6160
*/
@@ -85,7 +84,10 @@ public function getCatalogItemListV1(?string $category = null, ?string $name = n
8584
return $this->serializer->deserialize($response->getBody()->getContents(), '\Hostinger\Model\BillingV1CatalogCatalogItemResource[]', JsonEncoder::FORMAT);
8685
}
8786

88-
private function buildResourcePath(string $path, mixed ...$values): string
87+
/**
88+
* @param array<string, mixed> $values
89+
*/
90+
private function buildResourcePath(string $path, array $values): string
8991
{
9092
foreach ($values as $key => $value) {
9193
if (is_array($value)) {

src/Api/BillingOrdersApi.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,13 @@ public function getConfig(): Configuration
5555
/**
5656
* @return \Hostinger\Model\BillingV1OrderOrderResource
5757
*
58-
* @throws ExceptionInterface
5958
* @throws ApiException
6059
* @throws GuzzleException
6160
*/
6261
public function createServiceOrderV1(\Hostinger\Model\BillingV1OrderStoreRequest $billingV1OrderStoreRequest)
6362
{
6463
$request = new Request(
65-
method: 'GET',
64+
method: 'POST',
6665
uri: '/api/billing/v1/orders',
6766
headers: $this->getHeaders(),
6867
body: $this->serializer->serialize($billingV1OrderStoreRequest, JsonEncoder::FORMAT),
@@ -79,7 +78,10 @@ public function createServiceOrderV1(\Hostinger\Model\BillingV1OrderStoreRequest
7978
return $this->serializer->deserialize($response->getBody()->getContents(), '\Hostinger\Model\BillingV1OrderOrderResource', JsonEncoder::FORMAT);
8079
}
8180

82-
private function buildResourcePath(string $path, mixed ...$values): string
81+
/**
82+
* @param array<string, mixed> $values
83+
*/
84+
private function buildResourcePath(string $path, array $values): string
8385
{
8486
foreach ($values as $key => $value) {
8587
if (is_array($value)) {

src/Api/BillingPaymentMethodsApi.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@ public function getConfig(): Configuration
5555
/**
5656
* @return \Hostinger\Model\CommonSuccessEmptyResource
5757
*
58-
* @throws ExceptionInterface
5958
* @throws ApiException
6059
* @throws GuzzleException
6160
*/
6261
public function deletePaymentMethodV1(int $paymentMethodId)
6362
{
6463
$request = new Request(
65-
method: 'GET',
66-
uri: $this->buildResourcePath('/api/billing/v1/payment-methods/{paymentMethodId}', $paymentMethodId),
64+
method: 'DELETE',
65+
uri: $this->buildResourcePath('/api/billing/v1/payment-methods/{paymentMethodId}', [
66+
'paymentMethodId' => $paymentMethodId
67+
]),
6768
headers: $this->getHeaders(),
6869
);
6970

@@ -81,7 +82,6 @@ public function deletePaymentMethodV1(int $paymentMethodId)
8182
/**
8283
* @return \Hostinger\Model\BillingV1PaymentMethodPaymentMethodResource[]
8384
*
84-
* @throws ExceptionInterface
8585
* @throws ApiException
8686
* @throws GuzzleException
8787
*/
@@ -107,15 +107,16 @@ public function getPaymentMethodListV1()
107107
/**
108108
* @return \Hostinger\Model\CommonSuccessEmptyResource
109109
*
110-
* @throws ExceptionInterface
111110
* @throws ApiException
112111
* @throws GuzzleException
113112
*/
114113
public function setDefaultPaymentMethodV1(int $paymentMethodId)
115114
{
116115
$request = new Request(
117-
method: 'GET',
118-
uri: $this->buildResourcePath('/api/billing/v1/payment-methods/{paymentMethodId}', $paymentMethodId),
116+
method: 'POST',
117+
uri: $this->buildResourcePath('/api/billing/v1/payment-methods/{paymentMethodId}', [
118+
'paymentMethodId' => $paymentMethodId
119+
]),
119120
headers: $this->getHeaders(),
120121
);
121122

@@ -130,7 +131,10 @@ public function setDefaultPaymentMethodV1(int $paymentMethodId)
130131
return $this->serializer->deserialize($response->getBody()->getContents(), '\Hostinger\Model\CommonSuccessEmptyResource', JsonEncoder::FORMAT);
131132
}
132133

133-
private function buildResourcePath(string $path, mixed ...$values): string
134+
/**
135+
* @param array<string, mixed> $values
136+
*/
137+
private function buildResourcePath(string $path, array $values): string
134138
{
135139
foreach ($values as $key => $value) {
136140
if (is_array($value)) {

src/Api/BillingSubscriptionsApi.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@ public function getConfig(): Configuration
5555
/**
5656
* @return \Hostinger\Model\CommonSuccessEmptyResource
5757
*
58-
* @throws ExceptionInterface
5958
* @throws ApiException
6059
* @throws GuzzleException
6160
*/
6261
public function cancelSubscriptionV1(string $subscriptionId, \Hostinger\Model\BillingV1SubscriptionCancelRequest $billingV1SubscriptionCancelRequest)
6362
{
6463
$request = new Request(
65-
method: 'GET',
66-
uri: $this->buildResourcePath('/api/billing/v1/subscriptions/{subscriptionId}', $subscriptionId),
64+
method: 'DELETE',
65+
uri: $this->buildResourcePath('/api/billing/v1/subscriptions/{subscriptionId}', [
66+
'subscriptionId' => $subscriptionId
67+
]),
6768
headers: $this->getHeaders(),
6869
body: $this->serializer->serialize($billingV1SubscriptionCancelRequest, JsonEncoder::FORMAT),
6970
);
@@ -82,7 +83,6 @@ public function cancelSubscriptionV1(string $subscriptionId, \Hostinger\Model\Bi
8283
/**
8384
* @return \Hostinger\Model\BillingV1SubscriptionSubscriptionResource[]
8485
*
85-
* @throws ExceptionInterface
8686
* @throws ApiException
8787
* @throws GuzzleException
8888
*/
@@ -105,7 +105,10 @@ public function getSubscriptionListV1()
105105
return $this->serializer->deserialize($response->getBody()->getContents(), '\Hostinger\Model\BillingV1SubscriptionSubscriptionResource[]', JsonEncoder::FORMAT);
106106
}
107107

108-
private function buildResourcePath(string $path, mixed ...$values): string
108+
/**
109+
* @param array<string, mixed> $values
110+
*/
111+
private function buildResourcePath(string $path, array $values): string
109112
{
110113
foreach ($values as $key => $value) {
111114
if (is_array($value)) {

src/Api/DNSSnapshotApi.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@ public function getConfig(): Configuration
5555
/**
5656
* @return \Hostinger\Model\DNSV1SnapshotSnapshotResource[]
5757
*
58-
* @throws ExceptionInterface
5958
* @throws ApiException
6059
* @throws GuzzleException
6160
*/
6261
public function getDNSSnapshotListV1(string $domain)
6362
{
6463
$request = new Request(
6564
method: 'GET',
66-
uri: $this->buildResourcePath('/api/dns/v1/snapshots/{domain}', $domain),
65+
uri: $this->buildResourcePath('/api/dns/v1/snapshots/{domain}', [
66+
'domain' => $domain
67+
]),
6768
headers: $this->getHeaders(),
6869
);
6970

@@ -81,15 +82,16 @@ public function getDNSSnapshotListV1(string $domain)
8182
/**
8283
* @return \Hostinger\Model\DNSV1SnapshotSnapshotWithContentResource
8384
*
84-
* @throws ExceptionInterface
8585
* @throws ApiException
8686
* @throws GuzzleException
8787
*/
8888
public function getDNSSnapshotV1(string $domain, int $snapshotId)
8989
{
9090
$request = new Request(
9191
method: 'GET',
92-
uri: $this->buildResourcePath('/api/dns/v1/snapshots/{domain}/{snapshotId}', $domain, $snapshotId),
92+
uri: $this->buildResourcePath('/api/dns/v1/snapshots/{domain}/{snapshotId}', [
93+
'domain' => $domain, 'snapshotId' => $snapshotId
94+
]),
9395
headers: $this->getHeaders(),
9496
);
9597

@@ -107,15 +109,16 @@ public function getDNSSnapshotV1(string $domain, int $snapshotId)
107109
/**
108110
* @return \Hostinger\Model\CommonSuccessEmptyResource
109111
*
110-
* @throws ExceptionInterface
111112
* @throws ApiException
112113
* @throws GuzzleException
113114
*/
114115
public function restoreDNSSnapshotV1(string $domain, int $snapshotId)
115116
{
116117
$request = new Request(
117-
method: 'GET',
118-
uri: $this->buildResourcePath('/api/dns/v1/snapshots/{domain}/{snapshotId}/restore', $domain, $snapshotId),
118+
method: 'POST',
119+
uri: $this->buildResourcePath('/api/dns/v1/snapshots/{domain}/{snapshotId}/restore', [
120+
'domain' => $domain, 'snapshotId' => $snapshotId
121+
]),
119122
headers: $this->getHeaders(),
120123
);
121124

@@ -130,7 +133,10 @@ public function restoreDNSSnapshotV1(string $domain, int $snapshotId)
130133
return $this->serializer->deserialize($response->getBody()->getContents(), '\Hostinger\Model\CommonSuccessEmptyResource', JsonEncoder::FORMAT);
131134
}
132135

133-
private function buildResourcePath(string $path, mixed ...$values): string
136+
/**
137+
* @param array<string, mixed> $values
138+
*/
139+
private function buildResourcePath(string $path, array $values): string
134140
{
135141
foreach ($values as $key => $value) {
136142
if (is_array($value)) {

src/Api/DNSZoneApi.php

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@ public function getConfig(): Configuration
5555
/**
5656
* @return \Hostinger\Model\CommonSuccessEmptyResource
5757
*
58-
* @throws ExceptionInterface
5958
* @throws ApiException
6059
* @throws GuzzleException
6160
*/
6261
public function deleteDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneDestroyRequest $dNSV1ZoneDestroyRequest)
6362
{
6463
$request = new Request(
65-
method: 'GET',
66-
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}', $domain),
64+
method: 'DELETE',
65+
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}', [
66+
'domain' => $domain
67+
]),
6768
headers: $this->getHeaders(),
6869
body: $this->serializer->serialize($dNSV1ZoneDestroyRequest, JsonEncoder::FORMAT),
6970
);
@@ -82,15 +83,16 @@ public function deleteDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneDes
8283
/**
8384
* @return \Hostinger\Model\DNSV1ZoneRecordResource[]
8485
*
85-
* @throws ExceptionInterface
8686
* @throws ApiException
8787
* @throws GuzzleException
8888
*/
8989
public function getDNSRecordsV1(string $domain)
9090
{
9191
$request = new Request(
9292
method: 'GET',
93-
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}', $domain),
93+
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}', [
94+
'domain' => $domain
95+
]),
9496
headers: $this->getHeaders(),
9597
);
9698

@@ -108,15 +110,16 @@ public function getDNSRecordsV1(string $domain)
108110
/**
109111
* @return \Hostinger\Model\CommonSuccessEmptyResource
110112
*
111-
* @throws ExceptionInterface
112113
* @throws ApiException
113114
* @throws GuzzleException
114115
*/
115116
public function resetDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneResetRequest $dNSV1ZoneResetRequest)
116117
{
117118
$request = new Request(
118-
method: 'GET',
119-
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}/reset', $domain),
119+
method: 'POST',
120+
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}/reset', [
121+
'domain' => $domain
122+
]),
120123
headers: $this->getHeaders(),
121124
body: $this->serializer->serialize($dNSV1ZoneResetRequest, JsonEncoder::FORMAT),
122125
);
@@ -135,15 +138,16 @@ public function resetDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneRese
135138
/**
136139
* @return \Hostinger\Model\CommonSuccessEmptyResource
137140
*
138-
* @throws ExceptionInterface
139141
* @throws ApiException
140142
* @throws GuzzleException
141143
*/
142144
public function updateDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneUpdateRequest $dNSV1ZoneUpdateRequest)
143145
{
144146
$request = new Request(
145-
method: 'GET',
146-
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}', $domain),
147+
method: 'PUT',
148+
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}', [
149+
'domain' => $domain
150+
]),
147151
headers: $this->getHeaders(),
148152
body: $this->serializer->serialize($dNSV1ZoneUpdateRequest, JsonEncoder::FORMAT),
149153
);
@@ -162,15 +166,16 @@ public function updateDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneUpd
162166
/**
163167
* @return \Hostinger\Model\CommonSuccessEmptyResource
164168
*
165-
* @throws ExceptionInterface
166169
* @throws ApiException
167170
* @throws GuzzleException
168171
*/
169172
public function validateDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneUpdateRequest $dNSV1ZoneUpdateRequest)
170173
{
171174
$request = new Request(
172-
method: 'GET',
173-
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}/validate', $domain),
175+
method: 'POST',
176+
uri: $this->buildResourcePath('/api/dns/v1/zones/{domain}/validate', [
177+
'domain' => $domain
178+
]),
174179
headers: $this->getHeaders(),
175180
body: $this->serializer->serialize($dNSV1ZoneUpdateRequest, JsonEncoder::FORMAT),
176181
);
@@ -186,7 +191,10 @@ public function validateDNSRecordsV1(string $domain, \Hostinger\Model\DNSV1ZoneU
186191
return $this->serializer->deserialize($response->getBody()->getContents(), '\Hostinger\Model\CommonSuccessEmptyResource', JsonEncoder::FORMAT);
187192
}
188193

189-
private function buildResourcePath(string $path, mixed ...$values): string
194+
/**
195+
* @param array<string, mixed> $values
196+
*/
197+
private function buildResourcePath(string $path, array $values): string
190198
{
191199
foreach ($values as $key => $value) {
192200
if (is_array($value)) {

src/Api/DomainsAvailabilityApi.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,13 @@ public function getConfig(): Configuration
5555
/**
5656
* @return \Hostinger\Model\DomainsV1AvailabilityAvailabilityResource[]
5757
*
58-
* @throws ExceptionInterface
5958
* @throws ApiException
6059
* @throws GuzzleException
6160
*/
6261
public function checkDomainAvailabilityV1(\Hostinger\Model\DomainsV1AvailabilityAvailabilityRequest $domainsV1AvailabilityAvailabilityRequest)
6362
{
6463
$request = new Request(
65-
method: 'GET',
64+
method: 'POST',
6665
uri: '/api/domains/v1/availability',
6766
headers: $this->getHeaders(),
6867
body: $this->serializer->serialize($domainsV1AvailabilityAvailabilityRequest, JsonEncoder::FORMAT),
@@ -79,7 +78,10 @@ public function checkDomainAvailabilityV1(\Hostinger\Model\DomainsV1Availability
7978
return $this->serializer->deserialize($response->getBody()->getContents(), '\Hostinger\Model\DomainsV1AvailabilityAvailabilityResource[]', JsonEncoder::FORMAT);
8079
}
8180

82-
private function buildResourcePath(string $path, mixed ...$values): string
81+
/**
82+
* @param array<string, mixed> $values
83+
*/
84+
private function buildResourcePath(string $path, array $values): string
8385
{
8486
foreach ($values as $key => $value) {
8587
if (is_array($value)) {

0 commit comments

Comments
 (0)