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,113 @@
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 VPSV1DataCenterDataCenterResource(BaseModel):
24
+ """
25
+ VPSV1DataCenterDataCenterResource
26
+ """ # noqa: E501
27
+ id: Optional[StrictInt] = Field(default=None, description="Data center ID")
28
+ name: Optional[StrictStr] = Field(default=None, description="Data center name")
29
+ location: Optional[StrictStr] = Field(default=None, description="Data center location country (two letter code)")
30
+ city: Optional[StrictStr] = Field(default=None, description="Data center location city")
31
+ continent: Optional[StrictStr] = Field(default=None, description="Data center location continent")
32
+ __properties: ClassVar[List[str]] = ["id", "name", "location", "city", "continent"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of VPSV1DataCenterDataCenterResource from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # set to None if name (nullable) is None
74
+ # and model_fields_set contains the field
75
+ if self.name is None and "name" in self.model_fields_set:
76
+ _dict['name'] = None
77
+
78
+ # set to None if location (nullable) is None
79
+ # and model_fields_set contains the field
80
+ if self.location is None and "location" in self.model_fields_set:
81
+ _dict['location'] = None
82
+
83
+ # set to None if city (nullable) is None
84
+ # and model_fields_set contains the field
85
+ if self.city is None and "city" in self.model_fields_set:
86
+ _dict['city'] = None
87
+
88
+ # set to None if continent (nullable) is None
89
+ # and model_fields_set contains the field
90
+ if self.continent is None and "continent" in self.model_fields_set:
91
+ _dict['continent'] = None
92
+
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of VPSV1DataCenterDataCenterResource from a dict"""
98
+ if obj is None:
99
+ return None
100
+
101
+ if not isinstance(obj, dict):
102
+ return cls.model_validate(obj)
103
+
104
+ _obj = cls.model_validate({
105
+ "id": obj.get("id"),
106
+ "name": obj.get("name"),
107
+ "location": obj.get("location"),
108
+ "city": obj.get("city"),
109
+ "continent": obj.get("continent")
110
+ })
111
+ return _obj
112
+
113
+
@@ -0,0 +1,104 @@
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 hostinger_api.models.vpsv1_firewall_firewall_rule_resource import VPSV1FirewallFirewallRuleResource
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class VPSV1FirewallFirewallResource(BaseModel):
26
+ """
27
+ VPSV1FirewallFirewallResource
28
+ """ # noqa: E501
29
+ id: Optional[StrictInt] = Field(default=None, description="Firewall ID")
30
+ name: Optional[StrictStr] = Field(default=None, description="Firewall name")
31
+ synced: Optional[StrictBool] = Field(default=None, description="Is current firewall synced with VPS")
32
+ rules: Optional[List[VPSV1FirewallFirewallRuleResource]] = Field(default=None, description="Array of [`VPS.V1.Firewall.FirewallRuleResource`](#model/vpsv1firewallfirewallruleresource)")
33
+ created_at: Optional[datetime] = None
34
+ updated_at: Optional[datetime] = None
35
+ __properties: ClassVar[List[str]] = ["id", "name", "synced", "rules", "created_at", "updated_at"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of VPSV1FirewallFirewallResource from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of each item in rules (list)
77
+ _items = []
78
+ if self.rules:
79
+ for _item_rules in self.rules:
80
+ if _item_rules:
81
+ _items.append(_item_rules.to_dict())
82
+ _dict['rules'] = _items
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of VPSV1FirewallFirewallResource from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "id": obj.get("id"),
96
+ "name": obj.get("name"),
97
+ "synced": obj.get("synced"),
98
+ "rules": [VPSV1FirewallFirewallRuleResource.from_dict(_item) for _item in obj["rules"]] if obj.get("rules") is not None else None,
99
+ "created_at": obj.get("created_at"),
100
+ "updated_at": obj.get("updated_at")
101
+ })
102
+ return _obj
103
+
104
+
@@ -0,0 +1,115 @@
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, 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 VPSV1FirewallFirewallRuleResource(BaseModel):
24
+ """
25
+ VPSV1FirewallFirewallRuleResource
26
+ """ # noqa: E501
27
+ id: Optional[StrictInt] = Field(default=None, description="Firewall rule ID")
28
+ action: Optional[StrictStr] = Field(default=None, description="Firewall rule action")
29
+ protocol: Optional[StrictStr] = Field(default=None, description="Firewall rule protocol")
30
+ port: Optional[StrictStr] = Field(default=None, description="Firewall rule destination port: single or port range")
31
+ source: Optional[StrictStr] = Field(default=None, description="Firewall rule source. Can be `any` or `custom`")
32
+ source_detail: Optional[StrictStr] = Field(default=None, description="Firewall rule source detail. Can be `any` or IP address, CIDR or range")
33
+ __properties: ClassVar[List[str]] = ["id", "action", "protocol", "port", "source", "source_detail"]
34
+
35
+ @field_validator('action')
36
+ def action_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value is None:
39
+ return value
40
+
41
+ if value not in set(['accept', 'drop']):
42
+ raise ValueError("must be one of enum values ('accept', 'drop')")
43
+ return value
44
+
45
+ @field_validator('protocol')
46
+ def protocol_validate_enum(cls, value):
47
+ """Validates the enum"""
48
+ if value is None:
49
+ return value
50
+
51
+ if value not in set(['TCP', 'UDP', 'ICMP', 'GRE', 'any', 'ESP', 'AH', 'ICMPv6', 'SSH', 'HTTP', 'HTTPS', 'MySQL', 'PostgreSQL']):
52
+ raise ValueError("must be one of enum values ('TCP', 'UDP', 'ICMP', 'GRE', 'any', 'ESP', 'AH', 'ICMPv6', 'SSH', 'HTTP', 'HTTPS', 'MySQL', 'PostgreSQL')")
53
+ return value
54
+
55
+ model_config = ConfigDict(
56
+ populate_by_name=True,
57
+ validate_assignment=True,
58
+ protected_namespaces=(),
59
+ )
60
+
61
+
62
+ def to_str(self) -> str:
63
+ """Returns the string representation of the model using alias"""
64
+ return pprint.pformat(self.model_dump(by_alias=True))
65
+
66
+ def to_json(self) -> str:
67
+ """Returns the JSON representation of the model using alias"""
68
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
+ return json.dumps(self.to_dict())
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of VPSV1FirewallFirewallRuleResource from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([
87
+ ])
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of VPSV1FirewallFirewallRuleResource from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate({
106
+ "id": obj.get("id"),
107
+ "action": obj.get("action"),
108
+ "protocol": obj.get("protocol"),
109
+ "port": obj.get("port"),
110
+ "source": obj.get("source"),
111
+ "source_detail": obj.get("source_detail")
112
+ })
113
+ return _obj
114
+
115
+
@@ -0,0 +1,105 @@
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
20
+ from typing import Optional, Set
21
+ from typing_extensions import Self
22
+
23
+ class VPSV1FirewallRulesStoreRequest(BaseModel):
24
+ """
25
+ VPSV1FirewallRulesStoreRequest
26
+ """ # noqa: E501
27
+ protocol: StrictStr
28
+ port: StrictStr = Field(description="Port or port range, ex: 1024:2048")
29
+ source: StrictStr
30
+ source_detail: StrictStr = Field(description="IP range, CIDR, single IP or `any`")
31
+ __properties: ClassVar[List[str]] = ["protocol", "port", "source", "source_detail"]
32
+
33
+ @field_validator('protocol')
34
+ def protocol_validate_enum(cls, value):
35
+ """Validates the enum"""
36
+ if value not in set(['TCP', 'UDP', 'ICMP', 'GRE', 'any', 'ESP', 'AH', 'ICMPv6', 'SSH', 'HTTP', 'HTTPS', 'MySQL', 'PostgreSQL']):
37
+ raise ValueError("must be one of enum values ('TCP', 'UDP', 'ICMP', 'GRE', 'any', 'ESP', 'AH', 'ICMPv6', 'SSH', 'HTTP', 'HTTPS', 'MySQL', 'PostgreSQL')")
38
+ return value
39
+
40
+ @field_validator('source')
41
+ def source_validate_enum(cls, value):
42
+ """Validates the enum"""
43
+ if value not in set(['any', 'custom']):
44
+ raise ValueError("must be one of enum values ('any', 'custom')")
45
+ return value
46
+
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of VPSV1FirewallRulesStoreRequest from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of VPSV1FirewallRulesStoreRequest from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "protocol": obj.get("protocol"),
99
+ "port": obj.get("port"),
100
+ "source": obj.get("source"),
101
+ "source_detail": obj.get("source_detail")
102
+ })
103
+ return _obj
104
+
105
+
@@ -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
20
+ from typing import Optional, Set
21
+ from typing_extensions import Self
22
+
23
+ class VPSV1FirewallStoreRequest(BaseModel):
24
+ """
25
+ VPSV1FirewallStoreRequest
26
+ """ # noqa: E501
27
+ name: StrictStr
28
+ __properties: ClassVar[List[str]] = ["name"]
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 VPSV1FirewallStoreRequest 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 VPSV1FirewallStoreRequest 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
+ "name": obj.get("name")
82
+ })
83
+ return _obj
84
+
85
+
@@ -0,0 +1,94 @@
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 VPSV1IPAddressIPAddressResource(BaseModel):
24
+ """
25
+ VPSV1IPAddressIPAddressResource
26
+ """ # noqa: E501
27
+ id: Optional[StrictInt] = Field(default=None, description="IP address ID")
28
+ address: Optional[StrictStr] = Field(default=None, description="IP address: IPv4 or IPv6")
29
+ ptr: Optional[StrictStr] = Field(default=None, description="IP address PTR record")
30
+ __properties: ClassVar[List[str]] = ["id", "address", "ptr"]
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 VPSV1IPAddressIPAddressResource 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
+ # set to None if ptr (nullable) is None
72
+ # and model_fields_set contains the field
73
+ if self.ptr is None and "ptr" in self.model_fields_set:
74
+ _dict['ptr'] = None
75
+
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of VPSV1IPAddressIPAddressResource from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "id": obj.get("id"),
89
+ "address": obj.get("address"),
90
+ "ptr": obj.get("ptr")
91
+ })
92
+ return _obj
93
+
94
+