Skip to content

Commit c1a1b06

Browse files
committed
chore: SDK update
1 parent 01fee57 commit c1a1b06

22 files changed

+476
-661
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ To install the bindings via [Composer](https://getcomposer.org/), add the follow
5959
}
6060
],
6161
"require": {
62-
"hostinger/api-php-sdk": "*@main"
62+
"hostinger/api-php-sdk": "dev-main"
6363
}
6464
}
6565
```
@@ -92,8 +92,8 @@ $config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YO
9292
$apiInstance = new Hostinger\Api\BillingCatalogApi(
9393
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
9494
// This is optional, `GuzzleHttp\Client` will be used as default.
95-
new GuzzleHttp\Client(),
96-
$config
95+
client: new GuzzleHttp\Client(),
96+
config: $config
9797
);
9898

9999
try {

src/Api/BillingCatalogApi.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use GuzzleHttp\Client;
1717
use GuzzleHttp\ClientInterface;
1818
use GuzzleHttp\Exception\ConnectException;
19+
use GuzzleHttp\Exception\GuzzleException;
1920
use GuzzleHttp\Exception\RequestException;
2021
use GuzzleHttp\Psr7\Request;
2122
use GuzzleHttp\RequestOptions;
@@ -52,10 +53,10 @@ public function getConfig(): Configuration
5253
*
5354
* Get catalog item list
5455
*
55-
*
56+
* @return \Hostinger\Model\BillingV1CatalogCatalogItemResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
5657
* @throws ApiException on non-2xx response or if the response body is not in the expected format
5758
* @throws InvalidArgumentException
58-
* @return \Hostinger\Model\BillingV1CatalogCatalogItemResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
59+
* @throws GuzzleException
5960
*/
6061
public function getCatalogItemListV1(): array|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
6162
{
@@ -64,7 +65,11 @@ public function getCatalogItemListV1(): array|\Hostinger\Model\CommonSchemaUnaut
6465
try {
6566
$response = $this->client->send($request, $this->createHttpClientOption());
6667
} catch (RequestException $e) {
67-
throw ApiException::fromRequestException($e);
68+
if ($this->config->shouldThrowException()) {
69+
throw ApiException::fromRequestException($e);
70+
} else {
71+
$response = $e->getResponse();
72+
}
6873
} catch (ConnectException $e) {
6974
throw ApiException::fromConnectException($e);
7075
}

src/Api/BillingOrdersApi.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use GuzzleHttp\Client;
1717
use GuzzleHttp\ClientInterface;
1818
use GuzzleHttp\Exception\ConnectException;
19+
use GuzzleHttp\Exception\GuzzleException;
1920
use GuzzleHttp\Exception\RequestException;
2021
use GuzzleHttp\Psr7\Request;
2122
use GuzzleHttp\RequestOptions;
@@ -52,11 +53,10 @@ public function getConfig(): Configuration
5253
*
5354
* Create new service order
5455
*
55-
* @param \Hostinger\Model\BillingV1OrderStoreRequest $billingV1OrderStoreRequest billingV1OrderStoreRequest (required)
56-
*
56+
* @return \Hostinger\Model\BillingV1OrderOrderResource|\Hostinger\Model\CommonSchemaUnprocessableContentResponseSchema|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
5757
* @throws ApiException on non-2xx response or if the response body is not in the expected format
5858
* @throws InvalidArgumentException
59-
* @return \Hostinger\Model\BillingV1OrderOrderResource|\Hostinger\Model\CommonSchemaUnprocessableContentResponseSchema|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
59+
* @throws GuzzleException
6060
*/
6161
public function createNewServiceOrderV1(\Hostinger\Model\BillingV1OrderStoreRequest $billingV1OrderStoreRequest, ): \Hostinger\Model\BillingV1OrderOrderResource|\Hostinger\Model\CommonSchemaUnprocessableContentResponseSchema|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
6262
{
@@ -65,7 +65,11 @@ public function createNewServiceOrderV1(\Hostinger\Model\BillingV1OrderStoreRequ
6565
try {
6666
$response = $this->client->send($request, $this->createHttpClientOption());
6767
} catch (RequestException $e) {
68-
throw ApiException::fromRequestException($e);
68+
if ($this->config->shouldThrowException()) {
69+
throw ApiException::fromRequestException($e);
70+
} else {
71+
$response = $e->getResponse();
72+
}
6973
} catch (ConnectException $e) {
7074
throw ApiException::fromConnectException($e);
7175
}
@@ -95,7 +99,6 @@ public function createNewServiceOrderV1(\Hostinger\Model\BillingV1OrderStoreRequ
9599
/**
96100
* Create request for operation 'createNewServiceOrderV1'
97101
*
98-
* @param \Hostinger\Model\BillingV1OrderStoreRequest $billingV1OrderStoreRequest (required)
99102
* @throws InvalidArgumentException
100103
*/
101104
protected function createNewServiceOrderV1Request(\Hostinger\Model\BillingV1OrderStoreRequest $billingV1OrderStoreRequest,): Request

src/Api/BillingPaymentMethodsApi.php

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use GuzzleHttp\Client;
1717
use GuzzleHttp\ClientInterface;
1818
use GuzzleHttp\Exception\ConnectException;
19+
use GuzzleHttp\Exception\GuzzleException;
1920
use GuzzleHttp\Exception\RequestException;
2021
use GuzzleHttp\Psr7\Request;
2122
use GuzzleHttp\RequestOptions;
@@ -52,11 +53,10 @@ public function getConfig(): Configuration
5253
*
5354
* Delete payment method
5455
*
55-
* @param int $paymentMethodId Payment method ID (required)
56-
*
56+
* @return \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
5757
* @throws ApiException on non-2xx response or if the response body is not in the expected format
5858
* @throws InvalidArgumentException
59-
* @return \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
59+
* @throws GuzzleException
6060
*/
6161
public function deletePaymentMethodV1(int $paymentMethodId, ): \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
6262
{
@@ -65,7 +65,11 @@ public function deletePaymentMethodV1(int $paymentMethodId, ): \Hostinger\Model\
6565
try {
6666
$response = $this->client->send($request, $this->createHttpClientOption());
6767
} catch (RequestException $e) {
68-
throw ApiException::fromRequestException($e);
68+
if ($this->config->shouldThrowException()) {
69+
throw ApiException::fromRequestException($e);
70+
} else {
71+
$response = $e->getResponse();
72+
}
6973
} catch (ConnectException $e) {
7074
throw ApiException::fromConnectException($e);
7175
}
@@ -92,7 +96,6 @@ public function deletePaymentMethodV1(int $paymentMethodId, ): \Hostinger\Model\
9296
/**
9397
* Create request for operation 'deletePaymentMethodV1'
9498
*
95-
* @param int $paymentMethodId Payment method ID (required)
9699
* @throws InvalidArgumentException
97100
*/
98101
protected function deletePaymentMethodV1Request(int $paymentMethodId,): Request
@@ -117,10 +120,10 @@ protected function deletePaymentMethodV1Request(int $paymentMethodId,): Request
117120
*
118121
* Get payment method list
119122
*
120-
*
123+
* @return \Hostinger\Model\BillingV1PaymentMethodPaymentMethodResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
121124
* @throws ApiException on non-2xx response or if the response body is not in the expected format
122125
* @throws InvalidArgumentException
123-
* @return \Hostinger\Model\BillingV1PaymentMethodPaymentMethodResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
126+
* @throws GuzzleException
124127
*/
125128
public function getPaymentMethodListV1(): array|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
126129
{
@@ -129,7 +132,11 @@ public function getPaymentMethodListV1(): array|\Hostinger\Model\CommonSchemaUna
129132
try {
130133
$response = $this->client->send($request, $this->createHttpClientOption());
131134
} catch (RequestException $e) {
132-
throw ApiException::fromRequestException($e);
135+
if ($this->config->shouldThrowException()) {
136+
throw ApiException::fromRequestException($e);
137+
} else {
138+
$response = $e->getResponse();
139+
}
133140
} catch (ConnectException $e) {
134141
throw ApiException::fromConnectException($e);
135142
}
@@ -173,11 +180,10 @@ protected function getPaymentMethodListV1Request(): Request
173180
*
174181
* Set default payment method
175182
*
176-
* @param int $paymentMethodId Payment method ID (required)
177-
*
183+
* @return \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
178184
* @throws ApiException on non-2xx response or if the response body is not in the expected format
179185
* @throws InvalidArgumentException
180-
* @return \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
186+
* @throws GuzzleException
181187
*/
182188
public function setDefaultPaymentMethodV1(int $paymentMethodId, ): \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
183189
{
@@ -186,7 +192,11 @@ public function setDefaultPaymentMethodV1(int $paymentMethodId, ): \Hostinger\Mo
186192
try {
187193
$response = $this->client->send($request, $this->createHttpClientOption());
188194
} catch (RequestException $e) {
189-
throw ApiException::fromRequestException($e);
195+
if ($this->config->shouldThrowException()) {
196+
throw ApiException::fromRequestException($e);
197+
} else {
198+
$response = $e->getResponse();
199+
}
190200
} catch (ConnectException $e) {
191201
throw ApiException::fromConnectException($e);
192202
}
@@ -213,7 +223,6 @@ public function setDefaultPaymentMethodV1(int $paymentMethodId, ): \Hostinger\Mo
213223
/**
214224
* Create request for operation 'setDefaultPaymentMethodV1'
215225
*
216-
* @param int $paymentMethodId Payment method ID (required)
217226
* @throws InvalidArgumentException
218227
*/
219228
protected function setDefaultPaymentMethodV1Request(int $paymentMethodId,): Request

src/Api/BillingSubscriptionsApi.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use GuzzleHttp\Client;
1717
use GuzzleHttp\ClientInterface;
1818
use GuzzleHttp\Exception\ConnectException;
19+
use GuzzleHttp\Exception\GuzzleException;
1920
use GuzzleHttp\Exception\RequestException;
2021
use GuzzleHttp\Psr7\Request;
2122
use GuzzleHttp\RequestOptions;
@@ -52,12 +53,10 @@ public function getConfig(): Configuration
5253
*
5354
* Cancel subscription
5455
*
55-
* @param string $subscriptionId Subscription ID (required)
56-
* @param \Hostinger\Model\BillingV1SubscriptionCancelRequest $billingV1SubscriptionCancelRequest billingV1SubscriptionCancelRequest (required)
57-
*
56+
* @return \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnprocessableContentResponseSchema|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
5857
* @throws ApiException on non-2xx response or if the response body is not in the expected format
5958
* @throws InvalidArgumentException
60-
* @return \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnprocessableContentResponseSchema|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
59+
* @throws GuzzleException
6160
*/
6261
public function cancelSubscriptionV1(string $subscriptionId, \Hostinger\Model\BillingV1SubscriptionCancelRequest $billingV1SubscriptionCancelRequest, ): \Hostinger\Model\CommonSuccessEmptyResource|\Hostinger\Model\CommonSchemaUnprocessableContentResponseSchema|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
6362
{
@@ -66,7 +65,11 @@ public function cancelSubscriptionV1(string $subscriptionId, \Hostinger\Model\Bi
6665
try {
6766
$response = $this->client->send($request, $this->createHttpClientOption());
6867
} catch (RequestException $e) {
69-
throw ApiException::fromRequestException($e);
68+
if ($this->config->shouldThrowException()) {
69+
throw ApiException::fromRequestException($e);
70+
} else {
71+
$response = $e->getResponse();
72+
}
7073
} catch (ConnectException $e) {
7174
throw ApiException::fromConnectException($e);
7275
}
@@ -96,8 +99,6 @@ public function cancelSubscriptionV1(string $subscriptionId, \Hostinger\Model\Bi
9699
/**
97100
* Create request for operation 'cancelSubscriptionV1'
98101
*
99-
* @param string $subscriptionId Subscription ID (required)
100-
* @param \Hostinger\Model\BillingV1SubscriptionCancelRequest $billingV1SubscriptionCancelRequest (required)
101102
* @throws InvalidArgumentException
102103
*/
103104
protected function cancelSubscriptionV1Request(string $subscriptionId,\Hostinger\Model\BillingV1SubscriptionCancelRequest $billingV1SubscriptionCancelRequest,): Request
@@ -124,10 +125,10 @@ protected function cancelSubscriptionV1Request(string $subscriptionId,\Hostinger
124125
*
125126
* Get subscription list
126127
*
127-
*
128+
* @return \Hostinger\Model\BillingV1SubscriptionSubscriptionResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
128129
* @throws ApiException on non-2xx response or if the response body is not in the expected format
129130
* @throws InvalidArgumentException
130-
* @return \Hostinger\Model\BillingV1SubscriptionSubscriptionResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
131+
* @throws GuzzleException
131132
*/
132133
public function getSubscriptionListV1(): array|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
133134
{
@@ -136,7 +137,11 @@ public function getSubscriptionListV1(): array|\Hostinger\Model\CommonSchemaUnau
136137
try {
137138
$response = $this->client->send($request, $this->createHttpClientOption());
138139
} catch (RequestException $e) {
139-
throw ApiException::fromRequestException($e);
140+
if ($this->config->shouldThrowException()) {
141+
throw ApiException::fromRequestException($e);
142+
} else {
143+
$response = $e->getResponse();
144+
}
140145
} catch (ConnectException $e) {
141146
throw ApiException::fromConnectException($e);
142147
}

src/Api/DomainsPortfolioApi.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use GuzzleHttp\Client;
1717
use GuzzleHttp\ClientInterface;
1818
use GuzzleHttp\Exception\ConnectException;
19+
use GuzzleHttp\Exception\GuzzleException;
1920
use GuzzleHttp\Exception\RequestException;
2021
use GuzzleHttp\Psr7\Request;
2122
use GuzzleHttp\RequestOptions;
@@ -52,10 +53,10 @@ public function getConfig(): Configuration
5253
*
5354
* Get domain list
5455
*
55-
*
56+
* @return \Hostinger\Model\DomainsV1DomainDomainResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
5657
* @throws ApiException on non-2xx response or if the response body is not in the expected format
5758
* @throws InvalidArgumentException
58-
* @return \Hostinger\Model\DomainsV1DomainDomainResource[]|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
59+
* @throws GuzzleException
5960
*/
6061
public function getDomainListV1(): array|\Hostinger\Model\CommonSchemaUnauthorizedResponseSchema|\Hostinger\Model\CommonSchemaErrorResponseSchema
6162
{
@@ -64,7 +65,11 @@ public function getDomainListV1(): array|\Hostinger\Model\CommonSchemaUnauthoriz
6465
try {
6566
$response = $this->client->send($request, $this->createHttpClientOption());
6667
} catch (RequestException $e) {
67-
throw ApiException::fromRequestException($e);
68+
if ($this->config->shouldThrowException()) {
69+
throw ApiException::fromRequestException($e);
70+
} else {
71+
$response = $e->getResponse();
72+
}
6873
} catch (ConnectException $e) {
6974
throw ApiException::fromConnectException($e);
7075
}

0 commit comments

Comments
 (0)