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.
- hostinger_api/__init__.py +105 -0
- hostinger_api/api/__init__.py +21 -0
- hostinger_api/api/billing_catalog_api.py +282 -0
- hostinger_api/api/billing_orders_api.py +313 -0
- hostinger_api/api/billing_payment_methods_api.py +819 -0
- hostinger_api/api/billing_subscriptions_api.py +584 -0
- hostinger_api/api/domains_portfolio_api.py +282 -0
- hostinger_api/api/vps_actions_api.py +599 -0
- hostinger_api/api/vps_backups_api.py +882 -0
- hostinger_api/api/vps_data_centers_api.py +282 -0
- hostinger_api/api/vps_firewall_api.py +2872 -0
- hostinger_api/api/vps_malware_scanner_api.py +842 -0
- hostinger_api/api/vps_post_install_scripts_api.py +1419 -0
- hostinger_api/api/vps_public_keys_api.py +1154 -0
- hostinger_api/api/vps_recovery_api.py +597 -0
- hostinger_api/api/vps_snapshots_api.py +1100 -0
- hostinger_api/api/vps_virtual_machine_api.py +3714 -0
- hostinger_api/api/vpsos_templates_api.py +551 -0
- hostinger_api/api/vpsptr_records_api.py +565 -0
- hostinger_api/api_client.py +795 -0
- hostinger_api/api_response.py +21 -0
- hostinger_api/configuration.py +579 -0
- hostinger_api/exceptions.py +214 -0
- hostinger_api/models/__init__.py +72 -0
- hostinger_api/models/billing_v1_catalog_catalog_item_price_resource.py +107 -0
- hostinger_api/models/billing_v1_catalog_catalog_item_resource.py +99 -0
- hostinger_api/models/billing_v1_order_order_billing_address_resource.py +145 -0
- hostinger_api/models/billing_v1_order_order_resource.py +116 -0
- hostinger_api/models/billing_v1_order_store_request.py +97 -0
- hostinger_api/models/billing_v1_order_store_request_items_inner.py +87 -0
- hostinger_api/models/billing_v1_payment_method_payment_method_resource.py +102 -0
- hostinger_api/models/billing_v1_subscription_cancel_request.py +117 -0
- hostinger_api/models/billing_v1_subscription_subscription_resource.py +130 -0
- hostinger_api/models/common_schema_error_response_schema.py +87 -0
- hostinger_api/models/common_schema_pagination_meta_schema.py +89 -0
- hostinger_api/models/common_schema_unauthorized_response_schema.py +87 -0
- hostinger_api/models/common_schema_unprocessable_content_response_schema.py +93 -0
- hostinger_api/models/common_schema_unprocessable_content_response_schema_errors.py +87 -0
- hostinger_api/models/common_success_empty_resource.py +85 -0
- hostinger_api/models/domains_v1_domain_domain_resource.py +126 -0
- hostinger_api/models/vps_get_action_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_backup_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_firewall_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_post_install_script_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_public_key_list_v1200_response.py +99 -0
- hostinger_api/models/vpsv1_action_action_resource.py +104 -0
- hostinger_api/models/vpsv1_backup_backup_resource.py +90 -0
- hostinger_api/models/vpsv1_data_center_data_center_resource.py +113 -0
- hostinger_api/models/vpsv1_firewall_firewall_resource.py +104 -0
- hostinger_api/models/vpsv1_firewall_firewall_rule_resource.py +115 -0
- hostinger_api/models/vpsv1_firewall_rules_store_request.py +105 -0
- hostinger_api/models/vpsv1_firewall_store_request.py +85 -0
- hostinger_api/models/vpsv1_ip_address_ip_address_resource.py +94 -0
- hostinger_api/models/vpsv1_malware_metrics_resource.py +101 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection.py +149 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_cpu_usage.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_disk_space.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_incoming_traffic.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_outgoing_traffic.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_ram_usage.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_uptime.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_resource.py +87 -0
- hostinger_api/models/vpsv1_post_install_script_post_install_script_resource.py +94 -0
- hostinger_api/models/vpsv1_post_install_script_store_request.py +87 -0
- hostinger_api/models/vpsv1_public_key_attach_request.py +85 -0
- hostinger_api/models/vpsv1_public_key_public_key_resource.py +89 -0
- hostinger_api/models/vpsv1_public_key_store_request.py +87 -0
- hostinger_api/models/vpsv1_snapshot_snapshot_resource.py +90 -0
- hostinger_api/models/vpsv1_template_template_resource.py +96 -0
- hostinger_api/models/vpsv1_virtual_machine_hostname_update_request.py +85 -0
- hostinger_api/models/vpsv1_virtual_machine_metric_get_request.py +88 -0
- hostinger_api/models/vpsv1_virtual_machine_nameservers_update_request.py +87 -0
- hostinger_api/models/vpsv1_virtual_machine_panel_password_update_request.py +86 -0
- hostinger_api/models/vpsv1_virtual_machine_recovery_start_request.py +85 -0
- hostinger_api/models/vpsv1_virtual_machine_recreate_request.py +90 -0
- hostinger_api/models/vpsv1_virtual_machine_root_password_update_request.py +86 -0
- hostinger_api/models/vpsv1_virtual_machine_setup_request.py +108 -0
- hostinger_api/models/vpsv1_virtual_machine_setup_request_public_key.py +87 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource.py +190 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv4.py +131 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv6.py +131 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_template.py +127 -0
- hostinger_api/py.typed +0 -0
- hostinger_api/rest.py +256 -0
- hostinger_api-1.0.0.dist-info/METADATA +26 -0
- hostinger_api-1.0.0.dist-info/RECORD +88 -0
- hostinger_api-1.0.0.dist-info/WHEEL +5 -0
- hostinger_api-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
21
|
+
from hostinger_api.models.billing_v1_order_order_billing_address_resource import BillingV1OrderOrderBillingAddressResource
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class BillingV1OrderOrderResource(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
BillingV1OrderOrderResource
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
id: Optional[StrictInt] = Field(default=None, description="Order ID")
|
|
30
|
+
subscription_id: Optional[StrictStr] = Field(default=None, description="Subscription ID")
|
|
31
|
+
status: Optional[StrictStr] = None
|
|
32
|
+
currency: Optional[StrictStr] = Field(default=None, description="Currency code")
|
|
33
|
+
subtotal: Optional[StrictInt] = Field(default=None, description="Subtotal price (exc. VAT) in cents")
|
|
34
|
+
total: Optional[StrictInt] = Field(default=None, description="Total price (inc. VAT) in cents")
|
|
35
|
+
billing_address: Optional[BillingV1OrderOrderBillingAddressResource] = None
|
|
36
|
+
created_at: Optional[datetime] = None
|
|
37
|
+
updated_at: Optional[datetime] = None
|
|
38
|
+
__properties: ClassVar[List[str]] = ["id", "subscription_id", "status", "currency", "subtotal", "total", "billing_address", "created_at", "updated_at"]
|
|
39
|
+
|
|
40
|
+
@field_validator('status')
|
|
41
|
+
def status_validate_enum(cls, value):
|
|
42
|
+
"""Validates the enum"""
|
|
43
|
+
if value is None:
|
|
44
|
+
return value
|
|
45
|
+
|
|
46
|
+
if value not in set(['completed', 'pending', 'processing', 'failed', 'refunded', 'cancelled', 'awaiting_payment', 'payment_initiated', 'fraud_refund']):
|
|
47
|
+
raise ValueError("must be one of enum values ('completed', 'pending', 'processing', 'failed', 'refunded', 'cancelled', 'awaiting_payment', 'payment_initiated', 'fraud_refund')")
|
|
48
|
+
return value
|
|
49
|
+
|
|
50
|
+
model_config = ConfigDict(
|
|
51
|
+
populate_by_name=True,
|
|
52
|
+
validate_assignment=True,
|
|
53
|
+
protected_namespaces=(),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def to_str(self) -> str:
|
|
58
|
+
"""Returns the string representation of the model using alias"""
|
|
59
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
60
|
+
|
|
61
|
+
def to_json(self) -> str:
|
|
62
|
+
"""Returns the JSON representation of the model using alias"""
|
|
63
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
64
|
+
return json.dumps(self.to_dict())
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
68
|
+
"""Create an instance of BillingV1OrderOrderResource from a JSON string"""
|
|
69
|
+
return cls.from_dict(json.loads(json_str))
|
|
70
|
+
|
|
71
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
72
|
+
"""Return the dictionary representation of the model using alias.
|
|
73
|
+
|
|
74
|
+
This has the following differences from calling pydantic's
|
|
75
|
+
`self.model_dump(by_alias=True)`:
|
|
76
|
+
|
|
77
|
+
* `None` is only added to the output dict for nullable fields that
|
|
78
|
+
were set at model initialization. Other fields with value `None`
|
|
79
|
+
are ignored.
|
|
80
|
+
"""
|
|
81
|
+
excluded_fields: Set[str] = set([
|
|
82
|
+
])
|
|
83
|
+
|
|
84
|
+
_dict = self.model_dump(
|
|
85
|
+
by_alias=True,
|
|
86
|
+
exclude=excluded_fields,
|
|
87
|
+
exclude_none=True,
|
|
88
|
+
)
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of billing_address
|
|
90
|
+
if self.billing_address:
|
|
91
|
+
_dict['billing_address'] = self.billing_address.to_dict()
|
|
92
|
+
return _dict
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
96
|
+
"""Create an instance of BillingV1OrderOrderResource from a dict"""
|
|
97
|
+
if obj is None:
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
if not isinstance(obj, dict):
|
|
101
|
+
return cls.model_validate(obj)
|
|
102
|
+
|
|
103
|
+
_obj = cls.model_validate({
|
|
104
|
+
"id": obj.get("id"),
|
|
105
|
+
"subscription_id": obj.get("subscription_id"),
|
|
106
|
+
"status": obj.get("status"),
|
|
107
|
+
"currency": obj.get("currency"),
|
|
108
|
+
"subtotal": obj.get("subtotal"),
|
|
109
|
+
"total": obj.get("total"),
|
|
110
|
+
"billing_address": BillingV1OrderOrderBillingAddressResource.from_dict(obj["billing_address"]) if obj.get("billing_address") is not None else None,
|
|
111
|
+
"created_at": obj.get("created_at"),
|
|
112
|
+
"updated_at": obj.get("updated_at")
|
|
113
|
+
})
|
|
114
|
+
return _obj
|
|
115
|
+
|
|
116
|
+
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from hostinger_api.models.billing_v1_order_store_request_items_inner import BillingV1OrderStoreRequestItemsInner
|
|
21
|
+
from typing import Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
class BillingV1OrderStoreRequest(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
BillingV1OrderStoreRequest
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
payment_method_id: StrictInt = Field(description="Payment method ID")
|
|
29
|
+
items: List[BillingV1OrderStoreRequestItemsInner]
|
|
30
|
+
coupons: Optional[List[Any]] = None
|
|
31
|
+
__properties: ClassVar[List[str]] = ["payment_method_id", "items", "coupons"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of BillingV1OrderStoreRequest from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.items:
|
|
75
|
+
for _item_items in self.items:
|
|
76
|
+
if _item_items:
|
|
77
|
+
_items.append(_item_items.to_dict())
|
|
78
|
+
_dict['items'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of BillingV1OrderStoreRequest from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"payment_method_id": obj.get("payment_method_id"),
|
|
92
|
+
"items": [BillingV1OrderStoreRequestItemsInner.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
|
|
93
|
+
"coupons": obj.get("coupons")
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from typing import Optional, Set
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
class BillingV1OrderStoreRequestItemsInner(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
BillingV1OrderStoreRequestItemsInner
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
item_id: Optional[StrictStr] = Field(default=None, description="Price Item ID")
|
|
28
|
+
quantity: Optional[StrictInt] = None
|
|
29
|
+
__properties: ClassVar[List[str]] = ["item_id", "quantity"]
|
|
30
|
+
|
|
31
|
+
model_config = ConfigDict(
|
|
32
|
+
populate_by_name=True,
|
|
33
|
+
validate_assignment=True,
|
|
34
|
+
protected_namespaces=(),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def to_str(self) -> str:
|
|
39
|
+
"""Returns the string representation of the model using alias"""
|
|
40
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
41
|
+
|
|
42
|
+
def to_json(self) -> str:
|
|
43
|
+
"""Returns the JSON representation of the model using alias"""
|
|
44
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
45
|
+
return json.dumps(self.to_dict())
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
49
|
+
"""Create an instance of BillingV1OrderStoreRequestItemsInner from a JSON string"""
|
|
50
|
+
return cls.from_dict(json.loads(json_str))
|
|
51
|
+
|
|
52
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
53
|
+
"""Return the dictionary representation of the model using alias.
|
|
54
|
+
|
|
55
|
+
This has the following differences from calling pydantic's
|
|
56
|
+
`self.model_dump(by_alias=True)`:
|
|
57
|
+
|
|
58
|
+
* `None` is only added to the output dict for nullable fields that
|
|
59
|
+
were set at model initialization. Other fields with value `None`
|
|
60
|
+
are ignored.
|
|
61
|
+
"""
|
|
62
|
+
excluded_fields: Set[str] = set([
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
_dict = self.model_dump(
|
|
66
|
+
by_alias=True,
|
|
67
|
+
exclude=excluded_fields,
|
|
68
|
+
exclude_none=True,
|
|
69
|
+
)
|
|
70
|
+
return _dict
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of BillingV1OrderStoreRequestItemsInner from a dict"""
|
|
75
|
+
if obj is None:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
if not isinstance(obj, dict):
|
|
79
|
+
return cls.model_validate(obj)
|
|
80
|
+
|
|
81
|
+
_obj = cls.model_validate({
|
|
82
|
+
"item_id": obj.get("item_id"),
|
|
83
|
+
"quantity": obj.get("quantity")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
21
|
+
from typing import Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
class BillingV1PaymentMethodPaymentMethodResource(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
BillingV1PaymentMethodPaymentMethodResource
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
id: Optional[StrictInt] = Field(default=None, description="Payment method ID")
|
|
29
|
+
name: Optional[StrictStr] = None
|
|
30
|
+
identifier: Optional[StrictStr] = None
|
|
31
|
+
payment_method: Optional[StrictStr] = None
|
|
32
|
+
is_default: Optional[StrictBool] = None
|
|
33
|
+
is_expired: Optional[StrictBool] = None
|
|
34
|
+
is_suspended: Optional[StrictBool] = None
|
|
35
|
+
created_at: Optional[datetime] = None
|
|
36
|
+
expires_at: Optional[datetime] = None
|
|
37
|
+
__properties: ClassVar[List[str]] = ["id", "name", "identifier", "payment_method", "is_default", "is_expired", "is_suspended", "created_at", "expires_at"]
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
populate_by_name=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of BillingV1PaymentMethodPaymentMethodResource from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of BillingV1PaymentMethodPaymentMethodResource from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"id": obj.get("id"),
|
|
91
|
+
"name": obj.get("name"),
|
|
92
|
+
"identifier": obj.get("identifier"),
|
|
93
|
+
"payment_method": obj.get("payment_method"),
|
|
94
|
+
"is_default": obj.get("is_default"),
|
|
95
|
+
"is_expired": obj.get("is_expired"),
|
|
96
|
+
"is_suspended": obj.get("is_suspended"),
|
|
97
|
+
"created_at": obj.get("created_at"),
|
|
98
|
+
"expires_at": obj.get("expires_at")
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from typing import Optional, Set
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
class BillingV1SubscriptionCancelRequest(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
BillingV1SubscriptionCancelRequest
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
reason_code: Optional[StrictStr] = Field(default=None, description="Cancellation reason code")
|
|
28
|
+
cancel_option: Optional[StrictStr] = Field(default=None, description="Cancellation option")
|
|
29
|
+
__properties: ClassVar[List[str]] = ["reason_code", "cancel_option"]
|
|
30
|
+
|
|
31
|
+
@field_validator('reason_code')
|
|
32
|
+
def reason_code_validate_enum(cls, value):
|
|
33
|
+
"""Validates the enum"""
|
|
34
|
+
if value is None:
|
|
35
|
+
return value
|
|
36
|
+
|
|
37
|
+
if value not in set(['other']):
|
|
38
|
+
raise ValueError("must be one of enum values ('other')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
@field_validator('cancel_option')
|
|
42
|
+
def cancel_option_validate_enum(cls, value):
|
|
43
|
+
"""Validates the enum"""
|
|
44
|
+
if value is None:
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
if value not in set(['immediately']):
|
|
48
|
+
raise ValueError("must be one of enum values ('immediately')")
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
model_config = ConfigDict(
|
|
52
|
+
populate_by_name=True,
|
|
53
|
+
validate_assignment=True,
|
|
54
|
+
protected_namespaces=(),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of BillingV1SubscriptionCancelRequest from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
"""
|
|
82
|
+
excluded_fields: Set[str] = set([
|
|
83
|
+
])
|
|
84
|
+
|
|
85
|
+
_dict = self.model_dump(
|
|
86
|
+
by_alias=True,
|
|
87
|
+
exclude=excluded_fields,
|
|
88
|
+
exclude_none=True,
|
|
89
|
+
)
|
|
90
|
+
# set to None if reason_code (nullable) is None
|
|
91
|
+
# and model_fields_set contains the field
|
|
92
|
+
if self.reason_code is None and "reason_code" in self.model_fields_set:
|
|
93
|
+
_dict['reason_code'] = None
|
|
94
|
+
|
|
95
|
+
# set to None if cancel_option (nullable) is None
|
|
96
|
+
# and model_fields_set contains the field
|
|
97
|
+
if self.cancel_option is None and "cancel_option" in self.model_fields_set:
|
|
98
|
+
_dict['cancel_option'] = None
|
|
99
|
+
|
|
100
|
+
return _dict
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
104
|
+
"""Create an instance of BillingV1SubscriptionCancelRequest from a dict"""
|
|
105
|
+
if obj is None:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
if not isinstance(obj, dict):
|
|
109
|
+
return cls.model_validate(obj)
|
|
110
|
+
|
|
111
|
+
_obj = cls.model_validate({
|
|
112
|
+
"reason_code": obj.get("reason_code"),
|
|
113
|
+
"cancel_option": obj.get("cancel_option")
|
|
114
|
+
})
|
|
115
|
+
return _obj
|
|
116
|
+
|
|
117
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
21
|
+
from typing import Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
class BillingV1SubscriptionSubscriptionResource(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
BillingV1SubscriptionSubscriptionResource
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
id: Optional[StrictStr] = Field(default=None, description="Subscription ID")
|
|
29
|
+
name: Optional[StrictStr] = None
|
|
30
|
+
status: Optional[StrictStr] = None
|
|
31
|
+
billing_period: Optional[StrictInt] = None
|
|
32
|
+
billing_period_unit: Optional[StrictStr] = None
|
|
33
|
+
currency_code: Optional[StrictStr] = None
|
|
34
|
+
total_price: Optional[StrictInt] = Field(default=None, description="Total price in cents")
|
|
35
|
+
renewal_price: Optional[StrictInt] = Field(default=None, description="Renewal price in cents")
|
|
36
|
+
auto_renew: Optional[StrictBool] = None
|
|
37
|
+
created_at: Optional[datetime] = None
|
|
38
|
+
expires_at: Optional[datetime] = None
|
|
39
|
+
next_billing_at: Optional[datetime] = None
|
|
40
|
+
canceled_at: Optional[datetime] = None
|
|
41
|
+
__properties: ClassVar[List[str]] = ["id", "name", "status", "billing_period", "billing_period_unit", "currency_code", "total_price", "renewal_price", "auto_renew", "created_at", "expires_at", "next_billing_at", "canceled_at"]
|
|
42
|
+
|
|
43
|
+
@field_validator('status')
|
|
44
|
+
def status_validate_enum(cls, value):
|
|
45
|
+
"""Validates the enum"""
|
|
46
|
+
if value is None:
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
if value not in set(['active', 'paused', 'cancelled', 'not_renewing', 'transferred', 'in_trial', 'future']):
|
|
50
|
+
raise ValueError("must be one of enum values ('active', 'paused', 'cancelled', 'not_renewing', 'transferred', 'in_trial', 'future')")
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
populate_by_name=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def to_str(self) -> str:
|
|
61
|
+
"""Returns the string representation of the model using alias"""
|
|
62
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
63
|
+
|
|
64
|
+
def to_json(self) -> str:
|
|
65
|
+
"""Returns the JSON representation of the model using alias"""
|
|
66
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
67
|
+
return json.dumps(self.to_dict())
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
71
|
+
"""Create an instance of BillingV1SubscriptionSubscriptionResource from a JSON string"""
|
|
72
|
+
return cls.from_dict(json.loads(json_str))
|
|
73
|
+
|
|
74
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
75
|
+
"""Return the dictionary representation of the model using alias.
|
|
76
|
+
|
|
77
|
+
This has the following differences from calling pydantic's
|
|
78
|
+
`self.model_dump(by_alias=True)`:
|
|
79
|
+
|
|
80
|
+
* `None` is only added to the output dict for nullable fields that
|
|
81
|
+
were set at model initialization. Other fields with value `None`
|
|
82
|
+
are ignored.
|
|
83
|
+
"""
|
|
84
|
+
excluded_fields: Set[str] = set([
|
|
85
|
+
])
|
|
86
|
+
|
|
87
|
+
_dict = self.model_dump(
|
|
88
|
+
by_alias=True,
|
|
89
|
+
exclude=excluded_fields,
|
|
90
|
+
exclude_none=True,
|
|
91
|
+
)
|
|
92
|
+
# set to None if next_billing_at (nullable) is None
|
|
93
|
+
# and model_fields_set contains the field
|
|
94
|
+
if self.next_billing_at is None and "next_billing_at" in self.model_fields_set:
|
|
95
|
+
_dict['next_billing_at'] = None
|
|
96
|
+
|
|
97
|
+
# set to None if canceled_at (nullable) is None
|
|
98
|
+
# and model_fields_set contains the field
|
|
99
|
+
if self.canceled_at is None and "canceled_at" in self.model_fields_set:
|
|
100
|
+
_dict['canceled_at'] = None
|
|
101
|
+
|
|
102
|
+
return _dict
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
106
|
+
"""Create an instance of BillingV1SubscriptionSubscriptionResource from a dict"""
|
|
107
|
+
if obj is None:
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
if not isinstance(obj, dict):
|
|
111
|
+
return cls.model_validate(obj)
|
|
112
|
+
|
|
113
|
+
_obj = cls.model_validate({
|
|
114
|
+
"id": obj.get("id"),
|
|
115
|
+
"name": obj.get("name"),
|
|
116
|
+
"status": obj.get("status"),
|
|
117
|
+
"billing_period": obj.get("billing_period"),
|
|
118
|
+
"billing_period_unit": obj.get("billing_period_unit"),
|
|
119
|
+
"currency_code": obj.get("currency_code"),
|
|
120
|
+
"total_price": obj.get("total_price"),
|
|
121
|
+
"renewal_price": obj.get("renewal_price"),
|
|
122
|
+
"auto_renew": obj.get("auto_renew"),
|
|
123
|
+
"created_at": obj.get("created_at"),
|
|
124
|
+
"expires_at": obj.get("expires_at"),
|
|
125
|
+
"next_billing_at": obj.get("next_billing_at"),
|
|
126
|
+
"canceled_at": obj.get("canceled_at")
|
|
127
|
+
})
|
|
128
|
+
return _obj
|
|
129
|
+
|
|
130
|
+
|