hostinger-api 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. hostinger_api/__init__.py +105 -0
  2. hostinger_api/api/__init__.py +21 -0
  3. hostinger_api/api/billing_catalog_api.py +282 -0
  4. hostinger_api/api/billing_orders_api.py +313 -0
  5. hostinger_api/api/billing_payment_methods_api.py +819 -0
  6. hostinger_api/api/billing_subscriptions_api.py +584 -0
  7. hostinger_api/api/domains_portfolio_api.py +282 -0
  8. hostinger_api/api/vps_actions_api.py +599 -0
  9. hostinger_api/api/vps_backups_api.py +882 -0
  10. hostinger_api/api/vps_data_centers_api.py +282 -0
  11. hostinger_api/api/vps_firewall_api.py +2872 -0
  12. hostinger_api/api/vps_malware_scanner_api.py +842 -0
  13. hostinger_api/api/vps_post_install_scripts_api.py +1419 -0
  14. hostinger_api/api/vps_public_keys_api.py +1154 -0
  15. hostinger_api/api/vps_recovery_api.py +597 -0
  16. hostinger_api/api/vps_snapshots_api.py +1100 -0
  17. hostinger_api/api/vps_virtual_machine_api.py +3714 -0
  18. hostinger_api/api/vpsos_templates_api.py +551 -0
  19. hostinger_api/api/vpsptr_records_api.py +565 -0
  20. hostinger_api/api_client.py +795 -0
  21. hostinger_api/api_response.py +21 -0
  22. hostinger_api/configuration.py +579 -0
  23. hostinger_api/exceptions.py +214 -0
  24. hostinger_api/models/__init__.py +72 -0
  25. hostinger_api/models/billing_v1_catalog_catalog_item_price_resource.py +107 -0
  26. hostinger_api/models/billing_v1_catalog_catalog_item_resource.py +99 -0
  27. hostinger_api/models/billing_v1_order_order_billing_address_resource.py +145 -0
  28. hostinger_api/models/billing_v1_order_order_resource.py +116 -0
  29. hostinger_api/models/billing_v1_order_store_request.py +97 -0
  30. hostinger_api/models/billing_v1_order_store_request_items_inner.py +87 -0
  31. hostinger_api/models/billing_v1_payment_method_payment_method_resource.py +102 -0
  32. hostinger_api/models/billing_v1_subscription_cancel_request.py +117 -0
  33. hostinger_api/models/billing_v1_subscription_subscription_resource.py +130 -0
  34. hostinger_api/models/common_schema_error_response_schema.py +87 -0
  35. hostinger_api/models/common_schema_pagination_meta_schema.py +89 -0
  36. hostinger_api/models/common_schema_unauthorized_response_schema.py +87 -0
  37. hostinger_api/models/common_schema_unprocessable_content_response_schema.py +93 -0
  38. hostinger_api/models/common_schema_unprocessable_content_response_schema_errors.py +87 -0
  39. hostinger_api/models/common_success_empty_resource.py +85 -0
  40. hostinger_api/models/domains_v1_domain_domain_resource.py +126 -0
  41. hostinger_api/models/vps_get_action_list_v1200_response.py +99 -0
  42. hostinger_api/models/vps_get_backup_list_v1200_response.py +99 -0
  43. hostinger_api/models/vps_get_firewall_list_v1200_response.py +99 -0
  44. hostinger_api/models/vps_get_post_install_script_list_v1200_response.py +99 -0
  45. hostinger_api/models/vps_get_public_key_list_v1200_response.py +99 -0
  46. hostinger_api/models/vpsv1_action_action_resource.py +104 -0
  47. hostinger_api/models/vpsv1_backup_backup_resource.py +90 -0
  48. hostinger_api/models/vpsv1_data_center_data_center_resource.py +113 -0
  49. hostinger_api/models/vpsv1_firewall_firewall_resource.py +104 -0
  50. hostinger_api/models/vpsv1_firewall_firewall_rule_resource.py +115 -0
  51. hostinger_api/models/vpsv1_firewall_rules_store_request.py +105 -0
  52. hostinger_api/models/vpsv1_firewall_store_request.py +85 -0
  53. hostinger_api/models/vpsv1_ip_address_ip_address_resource.py +94 -0
  54. hostinger_api/models/vpsv1_malware_metrics_resource.py +101 -0
  55. hostinger_api/models/vpsv1_metrics_metrics_collection.py +149 -0
  56. hostinger_api/models/vpsv1_metrics_metrics_collection_cpu_usage.py +127 -0
  57. hostinger_api/models/vpsv1_metrics_metrics_collection_disk_space.py +127 -0
  58. hostinger_api/models/vpsv1_metrics_metrics_collection_incoming_traffic.py +127 -0
  59. hostinger_api/models/vpsv1_metrics_metrics_collection_outgoing_traffic.py +127 -0
  60. hostinger_api/models/vpsv1_metrics_metrics_collection_ram_usage.py +127 -0
  61. hostinger_api/models/vpsv1_metrics_metrics_collection_uptime.py +127 -0
  62. hostinger_api/models/vpsv1_metrics_metrics_resource.py +87 -0
  63. hostinger_api/models/vpsv1_post_install_script_post_install_script_resource.py +94 -0
  64. hostinger_api/models/vpsv1_post_install_script_store_request.py +87 -0
  65. hostinger_api/models/vpsv1_public_key_attach_request.py +85 -0
  66. hostinger_api/models/vpsv1_public_key_public_key_resource.py +89 -0
  67. hostinger_api/models/vpsv1_public_key_store_request.py +87 -0
  68. hostinger_api/models/vpsv1_snapshot_snapshot_resource.py +90 -0
  69. hostinger_api/models/vpsv1_template_template_resource.py +96 -0
  70. hostinger_api/models/vpsv1_virtual_machine_hostname_update_request.py +85 -0
  71. hostinger_api/models/vpsv1_virtual_machine_metric_get_request.py +88 -0
  72. hostinger_api/models/vpsv1_virtual_machine_nameservers_update_request.py +87 -0
  73. hostinger_api/models/vpsv1_virtual_machine_panel_password_update_request.py +86 -0
  74. hostinger_api/models/vpsv1_virtual_machine_recovery_start_request.py +85 -0
  75. hostinger_api/models/vpsv1_virtual_machine_recreate_request.py +90 -0
  76. hostinger_api/models/vpsv1_virtual_machine_root_password_update_request.py +86 -0
  77. hostinger_api/models/vpsv1_virtual_machine_setup_request.py +108 -0
  78. hostinger_api/models/vpsv1_virtual_machine_setup_request_public_key.py +87 -0
  79. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource.py +190 -0
  80. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv4.py +131 -0
  81. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv6.py +131 -0
  82. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_template.py +127 -0
  83. hostinger_api/py.typed +0 -0
  84. hostinger_api/rest.py +256 -0
  85. hostinger_api-1.0.0.dist-info/METADATA +26 -0
  86. hostinger_api-1.0.0.dist-info/RECORD +88 -0
  87. hostinger_api-1.0.0.dist-info/WHEEL +5 -0
  88. hostinger_api-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,819 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hostinger API Python SDK
5
+
6
+ API Version: 0.0.1-beta
7
+
8
+ NOTE: This file is auto-generated, DO NOT EDIT THIS FILE MANUALLY!
9
+ If you want to contribute or request a new feature, please create an issue or pull request on https://github.com/hostinger/api
10
+ """ # noqa: E501
11
+
12
+ import warnings
13
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
14
+ from typing import Any, Dict, List, Optional, Tuple, Union
15
+ from typing_extensions import Annotated
16
+
17
+ from pydantic import Field, StrictInt
18
+ from typing import List
19
+ from typing_extensions import Annotated
20
+ from hostinger_api.models.billing_v1_payment_method_payment_method_resource import BillingV1PaymentMethodPaymentMethodResource
21
+ from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
22
+
23
+ from hostinger_api.api_client import ApiClient, RequestSerialized
24
+ from hostinger_api.api_response import ApiResponse
25
+ from hostinger_api.rest import RESTResponseType
26
+
27
+
28
+ class BillingPaymentMethodsApi:
29
+
30
+ def __init__(self, api_client=None) -> None:
31
+ if api_client is None:
32
+ api_client = ApiClient.get_default()
33
+ self.api_client = api_client
34
+
35
+
36
+ @validate_call
37
+ def delete_payment_method_v1(
38
+ self,
39
+ payment_method_id: Annotated[StrictInt, Field(description="Payment method ID")],
40
+ _request_timeout: Union[
41
+ None,
42
+ Annotated[StrictFloat, Field(gt=0)],
43
+ Tuple[
44
+ Annotated[StrictFloat, Field(gt=0)],
45
+ Annotated[StrictFloat, Field(gt=0)]
46
+ ]
47
+ ] = None,
48
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
49
+ _content_type: Optional[StrictStr] = None,
50
+ _headers: Optional[Dict[StrictStr, Any]] = None,
51
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
52
+ ) -> CommonSuccessEmptyResource:
53
+ """Delete payment method
54
+
55
+ This endpoint deletes a payment method from your account.
56
+
57
+ :param payment_method_id: Payment method ID (required)
58
+ :type payment_method_id: int
59
+ :param _request_timeout: timeout setting for this request. If one
60
+ number provided, it will be total request
61
+ timeout. It can also be a pair (tuple) of
62
+ (connection, read) timeouts.
63
+ :type _request_timeout: int, tuple(int, int), optional
64
+ :param _request_auth: set to override the auth_settings for an a single
65
+ request; this effectively ignores the
66
+ authentication in the spec for a single request.
67
+ :type _request_auth: dict, optional
68
+ :param _content_type: force content-type for the request.
69
+ :type _content_type: str, Optional
70
+ :param _headers: set to override the headers for a single
71
+ request; this effectively ignores the headers
72
+ in the spec for a single request.
73
+ :type _headers: dict, optional
74
+ :param _host_index: set to override the host_index for a single
75
+ request; this effectively ignores the host_index
76
+ in the spec for a single request.
77
+ :type _host_index: int, optional
78
+ :return: Returns the result object.
79
+ """ # noqa: E501
80
+
81
+ _param = self._delete_payment_method_v1_serialize(
82
+ payment_method_id=payment_method_id,
83
+ _request_auth=_request_auth,
84
+ _content_type=_content_type,
85
+ _headers=_headers,
86
+ _host_index=_host_index
87
+ )
88
+
89
+ _response_types_map: Dict[str, Optional[str]] = {
90
+ '200': "CommonSuccessEmptyResource",
91
+ '401': "CommonSchemaUnauthorizedResponseSchema",
92
+ '500': "CommonSchemaErrorResponseSchema",
93
+ }
94
+ response_data = self.api_client.call_api(
95
+ *_param,
96
+ _request_timeout=_request_timeout
97
+ )
98
+ response_data.read()
99
+ return self.api_client.response_deserialize(
100
+ response_data=response_data,
101
+ response_types_map=_response_types_map,
102
+ ).data
103
+
104
+
105
+ @validate_call
106
+ def delete_payment_method_v1_with_http_info(
107
+ self,
108
+ payment_method_id: Annotated[StrictInt, Field(description="Payment method ID")],
109
+ _request_timeout: Union[
110
+ None,
111
+ Annotated[StrictFloat, Field(gt=0)],
112
+ Tuple[
113
+ Annotated[StrictFloat, Field(gt=0)],
114
+ Annotated[StrictFloat, Field(gt=0)]
115
+ ]
116
+ ] = None,
117
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
118
+ _content_type: Optional[StrictStr] = None,
119
+ _headers: Optional[Dict[StrictStr, Any]] = None,
120
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
121
+ ) -> ApiResponse[CommonSuccessEmptyResource]:
122
+ """Delete payment method
123
+
124
+ This endpoint deletes a payment method from your account.
125
+
126
+ :param payment_method_id: Payment method ID (required)
127
+ :type payment_method_id: int
128
+ :param _request_timeout: timeout setting for this request. If one
129
+ number provided, it will be total request
130
+ timeout. It can also be a pair (tuple) of
131
+ (connection, read) timeouts.
132
+ :type _request_timeout: int, tuple(int, int), optional
133
+ :param _request_auth: set to override the auth_settings for an a single
134
+ request; this effectively ignores the
135
+ authentication in the spec for a single request.
136
+ :type _request_auth: dict, optional
137
+ :param _content_type: force content-type for the request.
138
+ :type _content_type: str, Optional
139
+ :param _headers: set to override the headers for a single
140
+ request; this effectively ignores the headers
141
+ in the spec for a single request.
142
+ :type _headers: dict, optional
143
+ :param _host_index: set to override the host_index for a single
144
+ request; this effectively ignores the host_index
145
+ in the spec for a single request.
146
+ :type _host_index: int, optional
147
+ :return: Returns the result object.
148
+ """ # noqa: E501
149
+
150
+ _param = self._delete_payment_method_v1_serialize(
151
+ payment_method_id=payment_method_id,
152
+ _request_auth=_request_auth,
153
+ _content_type=_content_type,
154
+ _headers=_headers,
155
+ _host_index=_host_index
156
+ )
157
+
158
+ _response_types_map: Dict[str, Optional[str]] = {
159
+ '200': "CommonSuccessEmptyResource",
160
+ '401': "CommonSchemaUnauthorizedResponseSchema",
161
+ '500': "CommonSchemaErrorResponseSchema",
162
+ }
163
+ response_data = self.api_client.call_api(
164
+ *_param,
165
+ _request_timeout=_request_timeout
166
+ )
167
+ response_data.read()
168
+ return self.api_client.response_deserialize(
169
+ response_data=response_data,
170
+ response_types_map=_response_types_map,
171
+ )
172
+
173
+
174
+ @validate_call
175
+ def delete_payment_method_v1_without_preload_content(
176
+ self,
177
+ payment_method_id: Annotated[StrictInt, Field(description="Payment method ID")],
178
+ _request_timeout: Union[
179
+ None,
180
+ Annotated[StrictFloat, Field(gt=0)],
181
+ Tuple[
182
+ Annotated[StrictFloat, Field(gt=0)],
183
+ Annotated[StrictFloat, Field(gt=0)]
184
+ ]
185
+ ] = None,
186
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
187
+ _content_type: Optional[StrictStr] = None,
188
+ _headers: Optional[Dict[StrictStr, Any]] = None,
189
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
190
+ ) -> RESTResponseType:
191
+ """Delete payment method
192
+
193
+ This endpoint deletes a payment method from your account.
194
+
195
+ :param payment_method_id: Payment method ID (required)
196
+ :type payment_method_id: int
197
+ :param _request_timeout: timeout setting for this request. If one
198
+ number provided, it will be total request
199
+ timeout. It can also be a pair (tuple) of
200
+ (connection, read) timeouts.
201
+ :type _request_timeout: int, tuple(int, int), optional
202
+ :param _request_auth: set to override the auth_settings for an a single
203
+ request; this effectively ignores the
204
+ authentication in the spec for a single request.
205
+ :type _request_auth: dict, optional
206
+ :param _content_type: force content-type for the request.
207
+ :type _content_type: str, Optional
208
+ :param _headers: set to override the headers for a single
209
+ request; this effectively ignores the headers
210
+ in the spec for a single request.
211
+ :type _headers: dict, optional
212
+ :param _host_index: set to override the host_index for a single
213
+ request; this effectively ignores the host_index
214
+ in the spec for a single request.
215
+ :type _host_index: int, optional
216
+ :return: Returns the result object.
217
+ """ # noqa: E501
218
+
219
+ _param = self._delete_payment_method_v1_serialize(
220
+ payment_method_id=payment_method_id,
221
+ _request_auth=_request_auth,
222
+ _content_type=_content_type,
223
+ _headers=_headers,
224
+ _host_index=_host_index
225
+ )
226
+
227
+ _response_types_map: Dict[str, Optional[str]] = {
228
+ '200': "CommonSuccessEmptyResource",
229
+ '401': "CommonSchemaUnauthorizedResponseSchema",
230
+ '500': "CommonSchemaErrorResponseSchema",
231
+ }
232
+ response_data = self.api_client.call_api(
233
+ *_param,
234
+ _request_timeout=_request_timeout
235
+ )
236
+ return response_data.response
237
+
238
+
239
+ def _delete_payment_method_v1_serialize(
240
+ self,
241
+ payment_method_id,
242
+ _request_auth,
243
+ _content_type,
244
+ _headers,
245
+ _host_index,
246
+ ) -> RequestSerialized:
247
+
248
+ _host = None
249
+
250
+ _collection_formats: Dict[str, str] = {
251
+ }
252
+
253
+ _path_params: Dict[str, str] = {}
254
+ _query_params: List[Tuple[str, str]] = []
255
+ _header_params: Dict[str, Optional[str]] = _headers or {}
256
+ _form_params: List[Tuple[str, str]] = []
257
+ _files: Dict[
258
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
259
+ ] = {}
260
+ _body_params: Optional[bytes] = None
261
+
262
+ # process the path parameters
263
+ if payment_method_id is not None:
264
+ _path_params['paymentMethodId'] = payment_method_id
265
+ # process the query parameters
266
+ # process the header parameters
267
+ # process the form parameters
268
+ # process the body parameter
269
+
270
+
271
+ # set the HTTP header `Accept`
272
+ if 'Accept' not in _header_params:
273
+ _header_params['Accept'] = self.api_client.select_header_accept(
274
+ [
275
+ 'application/json'
276
+ ]
277
+ )
278
+
279
+
280
+ # authentication setting
281
+ _auth_settings: List[str] = [
282
+ 'apiToken'
283
+ ]
284
+
285
+ return self.api_client.param_serialize(
286
+ method='DELETE',
287
+ resource_path='/api/billing/v1/payment-methods/{paymentMethodId}',
288
+ path_params=_path_params,
289
+ query_params=_query_params,
290
+ header_params=_header_params,
291
+ body=_body_params,
292
+ post_params=_form_params,
293
+ files=_files,
294
+ auth_settings=_auth_settings,
295
+ collection_formats=_collection_formats,
296
+ _host=_host,
297
+ _request_auth=_request_auth
298
+ )
299
+
300
+
301
+
302
+
303
+ @validate_call
304
+ def get_payment_method_list_v1(
305
+ self,
306
+ _request_timeout: Union[
307
+ None,
308
+ Annotated[StrictFloat, Field(gt=0)],
309
+ Tuple[
310
+ Annotated[StrictFloat, Field(gt=0)],
311
+ Annotated[StrictFloat, Field(gt=0)]
312
+ ]
313
+ ] = None,
314
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
315
+ _content_type: Optional[StrictStr] = None,
316
+ _headers: Optional[Dict[StrictStr, Any]] = None,
317
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
318
+ ) -> List[BillingV1PaymentMethodPaymentMethodResource]:
319
+ """Get payment method list
320
+
321
+ This endpoint retrieves a list of available payment methods that can be used for placing new orders. If you want to add new payment method, please use [hPanel](https://hpanel.hostinger.com/billing/payment-methods).
322
+
323
+ :param _request_timeout: timeout setting for this request. If one
324
+ number provided, it will be total request
325
+ timeout. It can also be a pair (tuple) of
326
+ (connection, read) timeouts.
327
+ :type _request_timeout: int, tuple(int, int), optional
328
+ :param _request_auth: set to override the auth_settings for an a single
329
+ request; this effectively ignores the
330
+ authentication in the spec for a single request.
331
+ :type _request_auth: dict, optional
332
+ :param _content_type: force content-type for the request.
333
+ :type _content_type: str, Optional
334
+ :param _headers: set to override the headers for a single
335
+ request; this effectively ignores the headers
336
+ in the spec for a single request.
337
+ :type _headers: dict, optional
338
+ :param _host_index: set to override the host_index for a single
339
+ request; this effectively ignores the host_index
340
+ in the spec for a single request.
341
+ :type _host_index: int, optional
342
+ :return: Returns the result object.
343
+ """ # noqa: E501
344
+
345
+ _param = self._get_payment_method_list_v1_serialize(
346
+ _request_auth=_request_auth,
347
+ _content_type=_content_type,
348
+ _headers=_headers,
349
+ _host_index=_host_index
350
+ )
351
+
352
+ _response_types_map: Dict[str, Optional[str]] = {
353
+ '200': "List[BillingV1PaymentMethodPaymentMethodResource]",
354
+ '401': "CommonSchemaUnauthorizedResponseSchema",
355
+ '500': "CommonSchemaErrorResponseSchema",
356
+ }
357
+ response_data = self.api_client.call_api(
358
+ *_param,
359
+ _request_timeout=_request_timeout
360
+ )
361
+ response_data.read()
362
+ return self.api_client.response_deserialize(
363
+ response_data=response_data,
364
+ response_types_map=_response_types_map,
365
+ ).data
366
+
367
+
368
+ @validate_call
369
+ def get_payment_method_list_v1_with_http_info(
370
+ self,
371
+ _request_timeout: Union[
372
+ None,
373
+ Annotated[StrictFloat, Field(gt=0)],
374
+ Tuple[
375
+ Annotated[StrictFloat, Field(gt=0)],
376
+ Annotated[StrictFloat, Field(gt=0)]
377
+ ]
378
+ ] = None,
379
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
380
+ _content_type: Optional[StrictStr] = None,
381
+ _headers: Optional[Dict[StrictStr, Any]] = None,
382
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
383
+ ) -> ApiResponse[List[BillingV1PaymentMethodPaymentMethodResource]]:
384
+ """Get payment method list
385
+
386
+ This endpoint retrieves a list of available payment methods that can be used for placing new orders. If you want to add new payment method, please use [hPanel](https://hpanel.hostinger.com/billing/payment-methods).
387
+
388
+ :param _request_timeout: timeout setting for this request. If one
389
+ number provided, it will be total request
390
+ timeout. It can also be a pair (tuple) of
391
+ (connection, read) timeouts.
392
+ :type _request_timeout: int, tuple(int, int), optional
393
+ :param _request_auth: set to override the auth_settings for an a single
394
+ request; this effectively ignores the
395
+ authentication in the spec for a single request.
396
+ :type _request_auth: dict, optional
397
+ :param _content_type: force content-type for the request.
398
+ :type _content_type: str, Optional
399
+ :param _headers: set to override the headers for a single
400
+ request; this effectively ignores the headers
401
+ in the spec for a single request.
402
+ :type _headers: dict, optional
403
+ :param _host_index: set to override the host_index for a single
404
+ request; this effectively ignores the host_index
405
+ in the spec for a single request.
406
+ :type _host_index: int, optional
407
+ :return: Returns the result object.
408
+ """ # noqa: E501
409
+
410
+ _param = self._get_payment_method_list_v1_serialize(
411
+ _request_auth=_request_auth,
412
+ _content_type=_content_type,
413
+ _headers=_headers,
414
+ _host_index=_host_index
415
+ )
416
+
417
+ _response_types_map: Dict[str, Optional[str]] = {
418
+ '200': "List[BillingV1PaymentMethodPaymentMethodResource]",
419
+ '401': "CommonSchemaUnauthorizedResponseSchema",
420
+ '500': "CommonSchemaErrorResponseSchema",
421
+ }
422
+ response_data = self.api_client.call_api(
423
+ *_param,
424
+ _request_timeout=_request_timeout
425
+ )
426
+ response_data.read()
427
+ return self.api_client.response_deserialize(
428
+ response_data=response_data,
429
+ response_types_map=_response_types_map,
430
+ )
431
+
432
+
433
+ @validate_call
434
+ def get_payment_method_list_v1_without_preload_content(
435
+ self,
436
+ _request_timeout: Union[
437
+ None,
438
+ Annotated[StrictFloat, Field(gt=0)],
439
+ Tuple[
440
+ Annotated[StrictFloat, Field(gt=0)],
441
+ Annotated[StrictFloat, Field(gt=0)]
442
+ ]
443
+ ] = None,
444
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
445
+ _content_type: Optional[StrictStr] = None,
446
+ _headers: Optional[Dict[StrictStr, Any]] = None,
447
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
448
+ ) -> RESTResponseType:
449
+ """Get payment method list
450
+
451
+ This endpoint retrieves a list of available payment methods that can be used for placing new orders. If you want to add new payment method, please use [hPanel](https://hpanel.hostinger.com/billing/payment-methods).
452
+
453
+ :param _request_timeout: timeout setting for this request. If one
454
+ number provided, it will be total request
455
+ timeout. It can also be a pair (tuple) of
456
+ (connection, read) timeouts.
457
+ :type _request_timeout: int, tuple(int, int), optional
458
+ :param _request_auth: set to override the auth_settings for an a single
459
+ request; this effectively ignores the
460
+ authentication in the spec for a single request.
461
+ :type _request_auth: dict, optional
462
+ :param _content_type: force content-type for the request.
463
+ :type _content_type: str, Optional
464
+ :param _headers: set to override the headers for a single
465
+ request; this effectively ignores the headers
466
+ in the spec for a single request.
467
+ :type _headers: dict, optional
468
+ :param _host_index: set to override the host_index for a single
469
+ request; this effectively ignores the host_index
470
+ in the spec for a single request.
471
+ :type _host_index: int, optional
472
+ :return: Returns the result object.
473
+ """ # noqa: E501
474
+
475
+ _param = self._get_payment_method_list_v1_serialize(
476
+ _request_auth=_request_auth,
477
+ _content_type=_content_type,
478
+ _headers=_headers,
479
+ _host_index=_host_index
480
+ )
481
+
482
+ _response_types_map: Dict[str, Optional[str]] = {
483
+ '200': "List[BillingV1PaymentMethodPaymentMethodResource]",
484
+ '401': "CommonSchemaUnauthorizedResponseSchema",
485
+ '500': "CommonSchemaErrorResponseSchema",
486
+ }
487
+ response_data = self.api_client.call_api(
488
+ *_param,
489
+ _request_timeout=_request_timeout
490
+ )
491
+ return response_data.response
492
+
493
+
494
+ def _get_payment_method_list_v1_serialize(
495
+ self,
496
+ _request_auth,
497
+ _content_type,
498
+ _headers,
499
+ _host_index,
500
+ ) -> RequestSerialized:
501
+
502
+ _host = None
503
+
504
+ _collection_formats: Dict[str, str] = {
505
+ }
506
+
507
+ _path_params: Dict[str, str] = {}
508
+ _query_params: List[Tuple[str, str]] = []
509
+ _header_params: Dict[str, Optional[str]] = _headers or {}
510
+ _form_params: List[Tuple[str, str]] = []
511
+ _files: Dict[
512
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
513
+ ] = {}
514
+ _body_params: Optional[bytes] = None
515
+
516
+ # process the path parameters
517
+ # process the query parameters
518
+ # process the header parameters
519
+ # process the form parameters
520
+ # process the body parameter
521
+
522
+
523
+ # set the HTTP header `Accept`
524
+ if 'Accept' not in _header_params:
525
+ _header_params['Accept'] = self.api_client.select_header_accept(
526
+ [
527
+ 'application/json'
528
+ ]
529
+ )
530
+
531
+
532
+ # authentication setting
533
+ _auth_settings: List[str] = [
534
+ 'apiToken'
535
+ ]
536
+
537
+ return self.api_client.param_serialize(
538
+ method='GET',
539
+ resource_path='/api/billing/v1/payment-methods',
540
+ path_params=_path_params,
541
+ query_params=_query_params,
542
+ header_params=_header_params,
543
+ body=_body_params,
544
+ post_params=_form_params,
545
+ files=_files,
546
+ auth_settings=_auth_settings,
547
+ collection_formats=_collection_formats,
548
+ _host=_host,
549
+ _request_auth=_request_auth
550
+ )
551
+
552
+
553
+
554
+
555
+ @validate_call
556
+ def set_default_payment_method_v1(
557
+ self,
558
+ payment_method_id: Annotated[StrictInt, Field(description="Payment method ID")],
559
+ _request_timeout: Union[
560
+ None,
561
+ Annotated[StrictFloat, Field(gt=0)],
562
+ Tuple[
563
+ Annotated[StrictFloat, Field(gt=0)],
564
+ Annotated[StrictFloat, Field(gt=0)]
565
+ ]
566
+ ] = None,
567
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
568
+ _content_type: Optional[StrictStr] = None,
569
+ _headers: Optional[Dict[StrictStr, Any]] = None,
570
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
571
+ ) -> CommonSuccessEmptyResource:
572
+ """Set default payment method
573
+
574
+ This endpoint sets default payment method for your account.
575
+
576
+ :param payment_method_id: Payment method ID (required)
577
+ :type payment_method_id: int
578
+ :param _request_timeout: timeout setting for this request. If one
579
+ number provided, it will be total request
580
+ timeout. It can also be a pair (tuple) of
581
+ (connection, read) timeouts.
582
+ :type _request_timeout: int, tuple(int, int), optional
583
+ :param _request_auth: set to override the auth_settings for an a single
584
+ request; this effectively ignores the
585
+ authentication in the spec for a single request.
586
+ :type _request_auth: dict, optional
587
+ :param _content_type: force content-type for the request.
588
+ :type _content_type: str, Optional
589
+ :param _headers: set to override the headers for a single
590
+ request; this effectively ignores the headers
591
+ in the spec for a single request.
592
+ :type _headers: dict, optional
593
+ :param _host_index: set to override the host_index for a single
594
+ request; this effectively ignores the host_index
595
+ in the spec for a single request.
596
+ :type _host_index: int, optional
597
+ :return: Returns the result object.
598
+ """ # noqa: E501
599
+
600
+ _param = self._set_default_payment_method_v1_serialize(
601
+ payment_method_id=payment_method_id,
602
+ _request_auth=_request_auth,
603
+ _content_type=_content_type,
604
+ _headers=_headers,
605
+ _host_index=_host_index
606
+ )
607
+
608
+ _response_types_map: Dict[str, Optional[str]] = {
609
+ '200': "CommonSuccessEmptyResource",
610
+ '401': "CommonSchemaUnauthorizedResponseSchema",
611
+ '500': "CommonSchemaErrorResponseSchema",
612
+ }
613
+ response_data = self.api_client.call_api(
614
+ *_param,
615
+ _request_timeout=_request_timeout
616
+ )
617
+ response_data.read()
618
+ return self.api_client.response_deserialize(
619
+ response_data=response_data,
620
+ response_types_map=_response_types_map,
621
+ ).data
622
+
623
+
624
+ @validate_call
625
+ def set_default_payment_method_v1_with_http_info(
626
+ self,
627
+ payment_method_id: Annotated[StrictInt, Field(description="Payment method ID")],
628
+ _request_timeout: Union[
629
+ None,
630
+ Annotated[StrictFloat, Field(gt=0)],
631
+ Tuple[
632
+ Annotated[StrictFloat, Field(gt=0)],
633
+ Annotated[StrictFloat, Field(gt=0)]
634
+ ]
635
+ ] = None,
636
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
637
+ _content_type: Optional[StrictStr] = None,
638
+ _headers: Optional[Dict[StrictStr, Any]] = None,
639
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
640
+ ) -> ApiResponse[CommonSuccessEmptyResource]:
641
+ """Set default payment method
642
+
643
+ This endpoint sets default payment method for your account.
644
+
645
+ :param payment_method_id: Payment method ID (required)
646
+ :type payment_method_id: int
647
+ :param _request_timeout: timeout setting for this request. If one
648
+ number provided, it will be total request
649
+ timeout. It can also be a pair (tuple) of
650
+ (connection, read) timeouts.
651
+ :type _request_timeout: int, tuple(int, int), optional
652
+ :param _request_auth: set to override the auth_settings for an a single
653
+ request; this effectively ignores the
654
+ authentication in the spec for a single request.
655
+ :type _request_auth: dict, optional
656
+ :param _content_type: force content-type for the request.
657
+ :type _content_type: str, Optional
658
+ :param _headers: set to override the headers for a single
659
+ request; this effectively ignores the headers
660
+ in the spec for a single request.
661
+ :type _headers: dict, optional
662
+ :param _host_index: set to override the host_index for a single
663
+ request; this effectively ignores the host_index
664
+ in the spec for a single request.
665
+ :type _host_index: int, optional
666
+ :return: Returns the result object.
667
+ """ # noqa: E501
668
+
669
+ _param = self._set_default_payment_method_v1_serialize(
670
+ payment_method_id=payment_method_id,
671
+ _request_auth=_request_auth,
672
+ _content_type=_content_type,
673
+ _headers=_headers,
674
+ _host_index=_host_index
675
+ )
676
+
677
+ _response_types_map: Dict[str, Optional[str]] = {
678
+ '200': "CommonSuccessEmptyResource",
679
+ '401': "CommonSchemaUnauthorizedResponseSchema",
680
+ '500': "CommonSchemaErrorResponseSchema",
681
+ }
682
+ response_data = self.api_client.call_api(
683
+ *_param,
684
+ _request_timeout=_request_timeout
685
+ )
686
+ response_data.read()
687
+ return self.api_client.response_deserialize(
688
+ response_data=response_data,
689
+ response_types_map=_response_types_map,
690
+ )
691
+
692
+
693
+ @validate_call
694
+ def set_default_payment_method_v1_without_preload_content(
695
+ self,
696
+ payment_method_id: Annotated[StrictInt, Field(description="Payment method ID")],
697
+ _request_timeout: Union[
698
+ None,
699
+ Annotated[StrictFloat, Field(gt=0)],
700
+ Tuple[
701
+ Annotated[StrictFloat, Field(gt=0)],
702
+ Annotated[StrictFloat, Field(gt=0)]
703
+ ]
704
+ ] = None,
705
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
706
+ _content_type: Optional[StrictStr] = None,
707
+ _headers: Optional[Dict[StrictStr, Any]] = None,
708
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
709
+ ) -> RESTResponseType:
710
+ """Set default payment method
711
+
712
+ This endpoint sets default payment method for your account.
713
+
714
+ :param payment_method_id: Payment method ID (required)
715
+ :type payment_method_id: int
716
+ :param _request_timeout: timeout setting for this request. If one
717
+ number provided, it will be total request
718
+ timeout. It can also be a pair (tuple) of
719
+ (connection, read) timeouts.
720
+ :type _request_timeout: int, tuple(int, int), optional
721
+ :param _request_auth: set to override the auth_settings for an a single
722
+ request; this effectively ignores the
723
+ authentication in the spec for a single request.
724
+ :type _request_auth: dict, optional
725
+ :param _content_type: force content-type for the request.
726
+ :type _content_type: str, Optional
727
+ :param _headers: set to override the headers for a single
728
+ request; this effectively ignores the headers
729
+ in the spec for a single request.
730
+ :type _headers: dict, optional
731
+ :param _host_index: set to override the host_index for a single
732
+ request; this effectively ignores the host_index
733
+ in the spec for a single request.
734
+ :type _host_index: int, optional
735
+ :return: Returns the result object.
736
+ """ # noqa: E501
737
+
738
+ _param = self._set_default_payment_method_v1_serialize(
739
+ payment_method_id=payment_method_id,
740
+ _request_auth=_request_auth,
741
+ _content_type=_content_type,
742
+ _headers=_headers,
743
+ _host_index=_host_index
744
+ )
745
+
746
+ _response_types_map: Dict[str, Optional[str]] = {
747
+ '200': "CommonSuccessEmptyResource",
748
+ '401': "CommonSchemaUnauthorizedResponseSchema",
749
+ '500': "CommonSchemaErrorResponseSchema",
750
+ }
751
+ response_data = self.api_client.call_api(
752
+ *_param,
753
+ _request_timeout=_request_timeout
754
+ )
755
+ return response_data.response
756
+
757
+
758
+ def _set_default_payment_method_v1_serialize(
759
+ self,
760
+ payment_method_id,
761
+ _request_auth,
762
+ _content_type,
763
+ _headers,
764
+ _host_index,
765
+ ) -> RequestSerialized:
766
+
767
+ _host = None
768
+
769
+ _collection_formats: Dict[str, str] = {
770
+ }
771
+
772
+ _path_params: Dict[str, str] = {}
773
+ _query_params: List[Tuple[str, str]] = []
774
+ _header_params: Dict[str, Optional[str]] = _headers or {}
775
+ _form_params: List[Tuple[str, str]] = []
776
+ _files: Dict[
777
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
778
+ ] = {}
779
+ _body_params: Optional[bytes] = None
780
+
781
+ # process the path parameters
782
+ if payment_method_id is not None:
783
+ _path_params['paymentMethodId'] = payment_method_id
784
+ # process the query parameters
785
+ # process the header parameters
786
+ # process the form parameters
787
+ # process the body parameter
788
+
789
+
790
+ # set the HTTP header `Accept`
791
+ if 'Accept' not in _header_params:
792
+ _header_params['Accept'] = self.api_client.select_header_accept(
793
+ [
794
+ 'application/json'
795
+ ]
796
+ )
797
+
798
+
799
+ # authentication setting
800
+ _auth_settings: List[str] = [
801
+ 'apiToken'
802
+ ]
803
+
804
+ return self.api_client.param_serialize(
805
+ method='POST',
806
+ resource_path='/api/billing/v1/payment-methods/{paymentMethodId}',
807
+ path_params=_path_params,
808
+ query_params=_query_params,
809
+ header_params=_header_params,
810
+ body=_body_params,
811
+ post_params=_form_params,
812
+ files=_files,
813
+ auth_settings=_auth_settings,
814
+ collection_formats=_collection_formats,
815
+ _host=_host,
816
+ _request_auth=_request_auth
817
+ )
818
+
819
+