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,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, 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 CommonSchemaErrorResponseSchema(BaseModel):
24
+ """
25
+ CommonSchemaErrorResponseSchema
26
+ """ # noqa: E501
27
+ message: Optional[StrictStr] = None
28
+ correlation_id: Optional[StrictStr] = None
29
+ __properties: ClassVar[List[str]] = ["message", "correlation_id"]
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 CommonSchemaErrorResponseSchema 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 CommonSchemaErrorResponseSchema 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
+ "message": obj.get("message"),
83
+ "correlation_id": obj.get("correlation_id")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,89 @@
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, StrictInt
19
+ from typing import Any, ClassVar, Dict, List, Optional
20
+ from typing import Optional, Set
21
+ from typing_extensions import Self
22
+
23
+ class CommonSchemaPaginationMetaSchema(BaseModel):
24
+ """
25
+ CommonSchemaPaginationMetaSchema
26
+ """ # noqa: E501
27
+ current_page: Optional[StrictInt] = None
28
+ per_page: Optional[StrictInt] = None
29
+ total: Optional[StrictInt] = None
30
+ __properties: ClassVar[List[str]] = ["current_page", "per_page", "total"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of CommonSchemaPaginationMetaSchema from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of CommonSchemaPaginationMetaSchema from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "current_page": obj.get("current_page"),
84
+ "per_page": obj.get("per_page"),
85
+ "total": obj.get("total")
86
+ })
87
+ return _obj
88
+
89
+
@@ -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, 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 CommonSchemaUnauthorizedResponseSchema(BaseModel):
24
+ """
25
+ CommonSchemaUnauthorizedResponseSchema
26
+ """ # noqa: E501
27
+ message: Optional[StrictStr] = None
28
+ correlation_id: Optional[StrictStr] = None
29
+ __properties: ClassVar[List[str]] = ["message", "correlation_id"]
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 CommonSchemaUnauthorizedResponseSchema 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 CommonSchemaUnauthorizedResponseSchema 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
+ "message": obj.get("message"),
83
+ "correlation_id": obj.get("correlation_id")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,93 @@
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
19
+ from typing import Any, ClassVar, Dict, List, Optional
20
+ from hostinger_api.models.common_schema_unprocessable_content_response_schema_errors import CommonSchemaUnprocessableContentResponseSchemaErrors
21
+ from typing import Optional, Set
22
+ from typing_extensions import Self
23
+
24
+ class CommonSchemaUnprocessableContentResponseSchema(BaseModel):
25
+ """
26
+ CommonSchemaUnprocessableContentResponseSchema
27
+ """ # noqa: E501
28
+ message: Optional[StrictStr] = Field(default=None, description="Validation error message")
29
+ errors: Optional[CommonSchemaUnprocessableContentResponseSchemaErrors] = None
30
+ correlation_id: Optional[StrictStr] = None
31
+ __properties: ClassVar[List[str]] = ["message", "errors", "correlation_id"]
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 CommonSchemaUnprocessableContentResponseSchema 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 errors
73
+ if self.errors:
74
+ _dict['errors'] = self.errors.to_dict()
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of CommonSchemaUnprocessableContentResponseSchema from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "message": obj.get("message"),
88
+ "errors": CommonSchemaUnprocessableContentResponseSchemaErrors.from_dict(obj["errors"]) if obj.get("errors") is not None else None,
89
+ "correlation_id": obj.get("correlation_id")
90
+ })
91
+ return _obj
92
+
93
+
@@ -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
19
+ from typing import Any, ClassVar, Dict, List, Optional
20
+ from typing import Optional, Set
21
+ from typing_extensions import Self
22
+
23
+ class CommonSchemaUnprocessableContentResponseSchemaErrors(BaseModel):
24
+ """
25
+ CommonSchemaUnprocessableContentResponseSchemaErrors
26
+ """ # noqa: E501
27
+ field_1: Optional[List[Any]] = None
28
+ field_2: Optional[List[Any]] = None
29
+ __properties: ClassVar[List[str]] = ["field_1", "field_2"]
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 CommonSchemaUnprocessableContentResponseSchemaErrors 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 CommonSchemaUnprocessableContentResponseSchemaErrors 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
+ "field_1": obj.get("field_1"),
83
+ "field_2": obj.get("field_2")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,85 @@
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, 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 CommonSuccessEmptyResource(BaseModel):
24
+ """
25
+ CommonSuccessEmptyResource
26
+ """ # noqa: E501
27
+ message: Optional[StrictStr] = None
28
+ __properties: ClassVar[List[str]] = ["message"]
29
+
30
+ model_config = ConfigDict(
31
+ populate_by_name=True,
32
+ validate_assignment=True,
33
+ protected_namespaces=(),
34
+ )
35
+
36
+
37
+ def to_str(self) -> str:
38
+ """Returns the string representation of the model using alias"""
39
+ return pprint.pformat(self.model_dump(by_alias=True))
40
+
41
+ def to_json(self) -> str:
42
+ """Returns the JSON representation of the model using alias"""
43
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
44
+ return json.dumps(self.to_dict())
45
+
46
+ @classmethod
47
+ def from_json(cls, json_str: str) -> Optional[Self]:
48
+ """Create an instance of CommonSuccessEmptyResource from a JSON string"""
49
+ return cls.from_dict(json.loads(json_str))
50
+
51
+ def to_dict(self) -> Dict[str, Any]:
52
+ """Return the dictionary representation of the model using alias.
53
+
54
+ This has the following differences from calling pydantic's
55
+ `self.model_dump(by_alias=True)`:
56
+
57
+ * `None` is only added to the output dict for nullable fields that
58
+ were set at model initialization. Other fields with value `None`
59
+ are ignored.
60
+ """
61
+ excluded_fields: Set[str] = set([
62
+ ])
63
+
64
+ _dict = self.model_dump(
65
+ by_alias=True,
66
+ exclude=excluded_fields,
67
+ exclude_none=True,
68
+ )
69
+ return _dict
70
+
71
+ @classmethod
72
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
73
+ """Create an instance of CommonSuccessEmptyResource from a dict"""
74
+ if obj is None:
75
+ return None
76
+
77
+ if not isinstance(obj, dict):
78
+ return cls.model_validate(obj)
79
+
80
+ _obj = cls.model_validate({
81
+ "message": obj.get("message")
82
+ })
83
+ return _obj
84
+
85
+
@@ -0,0 +1,126 @@
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 typing import Optional, Set
22
+ from typing_extensions import Self
23
+
24
+ class DomainsV1DomainDomainResource(BaseModel):
25
+ """
26
+ DomainsV1DomainDomainResource
27
+ """ # noqa: E501
28
+ id: Optional[StrictInt] = Field(default=None, description="Domain ID")
29
+ name: Optional[StrictStr] = Field(default=None, description="Domain name, `null` when not claimed free domain")
30
+ type: Optional[StrictStr] = None
31
+ status: Optional[StrictStr] = None
32
+ created_at: Optional[datetime] = None
33
+ expires_at: Optional[datetime] = None
34
+ __properties: ClassVar[List[str]] = ["id", "name", "type", "status", "created_at", "expires_at"]
35
+
36
+ @field_validator('type')
37
+ def type_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value is None:
40
+ return value
41
+
42
+ if value not in set(['domain', 'free_domain']):
43
+ raise ValueError("must be one of enum values ('domain', 'free_domain')")
44
+ return value
45
+
46
+ @field_validator('status')
47
+ def status_validate_enum(cls, value):
48
+ """Validates the enum"""
49
+ if value is None:
50
+ return value
51
+
52
+ if value not in set(['active', 'pending_setup', 'expired']):
53
+ raise ValueError("must be one of enum values ('active', 'pending_setup', 'expired')")
54
+ return value
55
+
56
+ model_config = ConfigDict(
57
+ populate_by_name=True,
58
+ validate_assignment=True,
59
+ protected_namespaces=(),
60
+ )
61
+
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of DomainsV1DomainDomainResource from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # set to None if name (nullable) is None
96
+ # and model_fields_set contains the field
97
+ if self.name is None and "name" in self.model_fields_set:
98
+ _dict['name'] = None
99
+
100
+ # set to None if expires_at (nullable) is None
101
+ # and model_fields_set contains the field
102
+ if self.expires_at is None and "expires_at" in self.model_fields_set:
103
+ _dict['expires_at'] = None
104
+
105
+ return _dict
106
+
107
+ @classmethod
108
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
109
+ """Create an instance of DomainsV1DomainDomainResource from a dict"""
110
+ if obj is None:
111
+ return None
112
+
113
+ if not isinstance(obj, dict):
114
+ return cls.model_validate(obj)
115
+
116
+ _obj = cls.model_validate({
117
+ "id": obj.get("id"),
118
+ "name": obj.get("name"),
119
+ "type": obj.get("type"),
120
+ "status": obj.get("status"),
121
+ "created_at": obj.get("created_at"),
122
+ "expires_at": obj.get("expires_at")
123
+ })
124
+ return _obj
125
+
126
+