hostinger-mail-api 1.0.3__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_mail_api/__init__.py +76 -0
- hostinger_mail_api/api/__init__.py +10 -0
- hostinger_mail_api/api/account_api.py +284 -0
- hostinger_mail_api/api/folders_api.py +1271 -0
- hostinger_mail_api/api/messages_api.py +4237 -0
- hostinger_mail_api/api/quota_api.py +304 -0
- hostinger_mail_api/api/send_api.py +336 -0
- hostinger_mail_api/api/webhooks_api.py +2154 -0
- hostinger_mail_api/api_client.py +795 -0
- hostinger_mail_api/api_response.py +21 -0
- hostinger_mail_api/configuration.py +579 -0
- hostinger_mail_api/exceptions.py +214 -0
- hostinger_mail_api/models/__init__.py +54 -0
- hostinger_mail_api/models/error.py +89 -0
- hostinger_mail_api/models/pagination.py +91 -0
- hostinger_mail_api/models/v1_folder_messages_collection.py +99 -0
- hostinger_mail_api/models/v1_folder_messages_delete_bulk_request.py +86 -0
- hostinger_mail_api/models/v1_folder_messages_flags_bulk_request.py +90 -0
- hostinger_mail_api/models/v1_folder_messages_flags_request.py +88 -0
- hostinger_mail_api/models/v1_folder_messages_message.py +165 -0
- hostinger_mail_api/models/v1_folder_messages_message_address.py +87 -0
- hostinger_mail_api/models/v1_folder_messages_message_attachment.py +105 -0
- hostinger_mail_api/models/v1_folder_messages_message_text.py +87 -0
- hostinger_mail_api/models/v1_folder_messages_message_text_resource.py +89 -0
- hostinger_mail_api/models/v1_folder_messages_move_bulk_request.py +88 -0
- hostinger_mail_api/models/v1_folder_messages_move_request.py +86 -0
- hostinger_mail_api/models/v1_folder_messages_resource.py +89 -0
- hostinger_mail_api/models/v1_folder_messages_search_request.py +111 -0
- hostinger_mail_api/models/v1_folder_messages_update_flags_result.py +89 -0
- hostinger_mail_api/models/v1_folder_messages_update_flags_result_data.py +95 -0
- hostinger_mail_api/models/v1_folder_messages_update_flags_result_data_failed_inner.py +87 -0
- hostinger_mail_api/models/v1_folders_collection.py +99 -0
- hostinger_mail_api/models/v1_folders_create_request.py +86 -0
- hostinger_mail_api/models/v1_folders_folder.py +100 -0
- hostinger_mail_api/models/v1_folders_resource.py +89 -0
- hostinger_mail_api/models/v1_folders_update_request.py +86 -0
- hostinger_mail_api/models/v1_me_mailbox.py +95 -0
- hostinger_mail_api/models/v1_me_resource.py +89 -0
- hostinger_mail_api/models/v1_me_resource_data.py +103 -0
- hostinger_mail_api/models/v1_quota_quota.py +101 -0
- hostinger_mail_api/models/v1_quota_quota_resource.py +91 -0
- hostinger_mail_api/models/v1_quota_resource.py +89 -0
- hostinger_mail_api/models/v1_send_attachment.py +93 -0
- hostinger_mail_api/models/v1_send_request.py +92 -0
- hostinger_mail_api/models/v1_webhooks_collection.py +99 -0
- hostinger_mail_api/models/v1_webhooks_create_request.py +117 -0
- hostinger_mail_api/models/v1_webhooks_resource.py +89 -0
- hostinger_mail_api/models/v1_webhooks_resource_with_secret.py +89 -0
- hostinger_mail_api/models/v1_webhooks_test_result.py +89 -0
- hostinger_mail_api/models/v1_webhooks_test_result_data.py +94 -0
- hostinger_mail_api/models/v1_webhooks_update_request.py +120 -0
- hostinger_mail_api/models/v1_webhooks_webhook.py +132 -0
- hostinger_mail_api/models/v1_webhooks_webhook_with_secret.py +134 -0
- hostinger_mail_api/py.typed +0 -0
- hostinger_mail_api/rest.py +256 -0
- hostinger_mail_api-1.0.3.dist-info/METADATA +180 -0
- hostinger_mail_api-1.0.3.dist-info/RECORD +59 -0
- hostinger_mail_api-1.0.3.dist-info/WHEEL +5 -0
- hostinger_mail_api-1.0.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hostinger Email API Python SDK
|
|
5
|
+
|
|
6
|
+
API Version: 1.0.0
|
|
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
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from typing_extensions import Annotated
|
|
21
|
+
from typing import Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
class V1FolderMessagesFlagsBulkRequest(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
Add and/or remove flags on multiple messages. At least one of addFlags or removeFlags must be set.
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
uids: Annotated[List[Annotated[int, Field(strict=True, ge=1)]], Field(min_length=1, max_length=100)] = Field(description="Message UIDs to update. 1-100 entries, each > 0.")
|
|
29
|
+
add_flags: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=255)]]] = Field(default=None, alias="addFlags")
|
|
30
|
+
remove_flags: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=255)]]] = Field(default=None, alias="removeFlags")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["uids", "addFlags", "removeFlags"]
|
|
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 V1FolderMessagesFlagsBulkRequest 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
|
+
return _dict
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
+
"""Create an instance of V1FolderMessagesFlagsBulkRequest from a dict"""
|
|
77
|
+
if obj is None:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
if not isinstance(obj, dict):
|
|
81
|
+
return cls.model_validate(obj)
|
|
82
|
+
|
|
83
|
+
_obj = cls.model_validate({
|
|
84
|
+
"uids": obj.get("uids"),
|
|
85
|
+
"addFlags": obj.get("addFlags"),
|
|
86
|
+
"removeFlags": obj.get("removeFlags")
|
|
87
|
+
})
|
|
88
|
+
return _obj
|
|
89
|
+
|
|
90
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hostinger Email API Python SDK
|
|
5
|
+
|
|
6
|
+
API Version: 1.0.0
|
|
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
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from typing_extensions import Annotated
|
|
21
|
+
from typing import Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
class V1FolderMessagesFlagsRequest(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
Add and/or remove flags on a message. At least one of addFlags or removeFlags must be set.
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
add_flags: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=255)]]] = Field(default=None, alias="addFlags")
|
|
29
|
+
remove_flags: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=255)]]] = Field(default=None, alias="removeFlags")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["addFlags", "removeFlags"]
|
|
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 V1FolderMessagesFlagsRequest 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 V1FolderMessagesFlagsRequest 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
|
+
"addFlags": obj.get("addFlags"),
|
|
84
|
+
"removeFlags": obj.get("removeFlags")
|
|
85
|
+
})
|
|
86
|
+
return _obj
|
|
87
|
+
|
|
88
|
+
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hostinger Email API Python SDK
|
|
5
|
+
|
|
6
|
+
API Version: 1.0.0
|
|
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_mail_api.models.v1_folder_messages_message_address import V1FolderMessagesMessageAddress
|
|
22
|
+
from hostinger_mail_api.models.v1_folder_messages_message_attachment import V1FolderMessagesMessageAttachment
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class V1FolderMessagesMessage(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
A message in a folder of the managed mailbox.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
uid: StrictInt
|
|
31
|
+
path: StrictStr
|
|
32
|
+
var_date: datetime = Field(alias="date")
|
|
33
|
+
flags: List[StrictStr]
|
|
34
|
+
unseen: StrictBool
|
|
35
|
+
size: StrictInt
|
|
36
|
+
subject: Optional[StrictStr]
|
|
37
|
+
var_from: Optional[V1FolderMessagesMessageAddress] = Field(alias="from")
|
|
38
|
+
to: List[V1FolderMessagesMessageAddress]
|
|
39
|
+
cc: List[V1FolderMessagesMessageAddress]
|
|
40
|
+
bcc: List[V1FolderMessagesMessageAddress]
|
|
41
|
+
message_id: Optional[StrictStr] = Field(alias="messageId")
|
|
42
|
+
in_reply_to: Optional[StrictStr] = Field(alias="inReplyTo")
|
|
43
|
+
attachments: List[V1FolderMessagesMessageAttachment]
|
|
44
|
+
__properties: ClassVar[List[str]] = ["uid", "path", "date", "flags", "unseen", "size", "subject", "from", "to", "cc", "bcc", "messageId", "inReplyTo", "attachments"]
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
populate_by_name=True,
|
|
48
|
+
validate_assignment=True,
|
|
49
|
+
protected_namespaces=(),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def to_str(self) -> str:
|
|
54
|
+
"""Returns the string representation of the model using alias"""
|
|
55
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
56
|
+
|
|
57
|
+
def to_json(self) -> str:
|
|
58
|
+
"""Returns the JSON representation of the model using alias"""
|
|
59
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
60
|
+
return json.dumps(self.to_dict())
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
64
|
+
"""Create an instance of V1FolderMessagesMessage from a JSON string"""
|
|
65
|
+
return cls.from_dict(json.loads(json_str))
|
|
66
|
+
|
|
67
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
68
|
+
"""Return the dictionary representation of the model using alias.
|
|
69
|
+
|
|
70
|
+
This has the following differences from calling pydantic's
|
|
71
|
+
`self.model_dump(by_alias=True)`:
|
|
72
|
+
|
|
73
|
+
* `None` is only added to the output dict for nullable fields that
|
|
74
|
+
were set at model initialization. Other fields with value `None`
|
|
75
|
+
are ignored.
|
|
76
|
+
"""
|
|
77
|
+
excluded_fields: Set[str] = set([
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
_dict = self.model_dump(
|
|
81
|
+
by_alias=True,
|
|
82
|
+
exclude=excluded_fields,
|
|
83
|
+
exclude_none=True,
|
|
84
|
+
)
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of var_from
|
|
86
|
+
if self.var_from:
|
|
87
|
+
_dict['from'] = self.var_from.to_dict()
|
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of each item in to (list)
|
|
89
|
+
_items = []
|
|
90
|
+
if self.to:
|
|
91
|
+
for _item_to in self.to:
|
|
92
|
+
if _item_to:
|
|
93
|
+
_items.append(_item_to.to_dict())
|
|
94
|
+
_dict['to'] = _items
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of each item in cc (list)
|
|
96
|
+
_items = []
|
|
97
|
+
if self.cc:
|
|
98
|
+
for _item_cc in self.cc:
|
|
99
|
+
if _item_cc:
|
|
100
|
+
_items.append(_item_cc.to_dict())
|
|
101
|
+
_dict['cc'] = _items
|
|
102
|
+
# override the default output from pydantic by calling `to_dict()` of each item in bcc (list)
|
|
103
|
+
_items = []
|
|
104
|
+
if self.bcc:
|
|
105
|
+
for _item_bcc in self.bcc:
|
|
106
|
+
if _item_bcc:
|
|
107
|
+
_items.append(_item_bcc.to_dict())
|
|
108
|
+
_dict['bcc'] = _items
|
|
109
|
+
# override the default output from pydantic by calling `to_dict()` of each item in attachments (list)
|
|
110
|
+
_items = []
|
|
111
|
+
if self.attachments:
|
|
112
|
+
for _item_attachments in self.attachments:
|
|
113
|
+
if _item_attachments:
|
|
114
|
+
_items.append(_item_attachments.to_dict())
|
|
115
|
+
_dict['attachments'] = _items
|
|
116
|
+
# set to None if subject (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.subject is None and "subject" in self.model_fields_set:
|
|
119
|
+
_dict['subject'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if var_from (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.var_from is None and "var_from" in self.model_fields_set:
|
|
124
|
+
_dict['from'] = None
|
|
125
|
+
|
|
126
|
+
# set to None if message_id (nullable) is None
|
|
127
|
+
# and model_fields_set contains the field
|
|
128
|
+
if self.message_id is None and "message_id" in self.model_fields_set:
|
|
129
|
+
_dict['messageId'] = None
|
|
130
|
+
|
|
131
|
+
# set to None if in_reply_to (nullable) is None
|
|
132
|
+
# and model_fields_set contains the field
|
|
133
|
+
if self.in_reply_to is None and "in_reply_to" in self.model_fields_set:
|
|
134
|
+
_dict['inReplyTo'] = None
|
|
135
|
+
|
|
136
|
+
return _dict
|
|
137
|
+
|
|
138
|
+
@classmethod
|
|
139
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
140
|
+
"""Create an instance of V1FolderMessagesMessage from a dict"""
|
|
141
|
+
if obj is None:
|
|
142
|
+
return None
|
|
143
|
+
|
|
144
|
+
if not isinstance(obj, dict):
|
|
145
|
+
return cls.model_validate(obj)
|
|
146
|
+
|
|
147
|
+
_obj = cls.model_validate({
|
|
148
|
+
"uid": obj.get("uid"),
|
|
149
|
+
"path": obj.get("path"),
|
|
150
|
+
"date": obj.get("date"),
|
|
151
|
+
"flags": obj.get("flags"),
|
|
152
|
+
"unseen": obj.get("unseen"),
|
|
153
|
+
"size": obj.get("size"),
|
|
154
|
+
"subject": obj.get("subject"),
|
|
155
|
+
"from": V1FolderMessagesMessageAddress.from_dict(obj["from"]) if obj.get("from") is not None else None,
|
|
156
|
+
"to": [V1FolderMessagesMessageAddress.from_dict(_item) for _item in obj["to"]] if obj.get("to") is not None else None,
|
|
157
|
+
"cc": [V1FolderMessagesMessageAddress.from_dict(_item) for _item in obj["cc"]] if obj.get("cc") is not None else None,
|
|
158
|
+
"bcc": [V1FolderMessagesMessageAddress.from_dict(_item) for _item in obj["bcc"]] if obj.get("bcc") is not None else None,
|
|
159
|
+
"messageId": obj.get("messageId"),
|
|
160
|
+
"inReplyTo": obj.get("inReplyTo"),
|
|
161
|
+
"attachments": [V1FolderMessagesMessageAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None
|
|
162
|
+
})
|
|
163
|
+
return _obj
|
|
164
|
+
|
|
165
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hostinger Email API Python SDK
|
|
5
|
+
|
|
6
|
+
API Version: 1.0.0
|
|
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 V1FolderMessagesMessageAddress(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
A single email address with optional display name.
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
name: StrictStr
|
|
28
|
+
address: StrictStr
|
|
29
|
+
__properties: ClassVar[List[str]] = ["name", "address"]
|
|
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 V1FolderMessagesMessageAddress 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 V1FolderMessagesMessageAddress 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
|
+
"name": obj.get("name"),
|
|
83
|
+
"address": obj.get("address")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hostinger Email API Python SDK
|
|
5
|
+
|
|
6
|
+
API Version: 1.0.0
|
|
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, StrictBool, 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 V1FolderMessagesMessageAttachment(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
Attachment metadata attached to a message.
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
id: StrictStr = Field(description="Opaque attachment identifier. Use as the {attachmentId} path parameter on the download endpoint.")
|
|
28
|
+
content_type: StrictStr = Field(alias="contentType")
|
|
29
|
+
size_bytes: StrictInt = Field(alias="sizeBytes")
|
|
30
|
+
inline: StrictBool
|
|
31
|
+
filename: Optional[StrictStr]
|
|
32
|
+
content_id: Optional[StrictStr] = Field(alias="contentId")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["id", "contentType", "sizeBytes", "inline", "filename", "contentId"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of V1FolderMessagesMessageAttachment from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# set to None if filename (nullable) is None
|
|
75
|
+
# and model_fields_set contains the field
|
|
76
|
+
if self.filename is None and "filename" in self.model_fields_set:
|
|
77
|
+
_dict['filename'] = None
|
|
78
|
+
|
|
79
|
+
# set to None if content_id (nullable) is None
|
|
80
|
+
# and model_fields_set contains the field
|
|
81
|
+
if self.content_id is None and "content_id" in self.model_fields_set:
|
|
82
|
+
_dict['contentId'] = None
|
|
83
|
+
|
|
84
|
+
return _dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
88
|
+
"""Create an instance of V1FolderMessagesMessageAttachment from a dict"""
|
|
89
|
+
if obj is None:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
if not isinstance(obj, dict):
|
|
93
|
+
return cls.model_validate(obj)
|
|
94
|
+
|
|
95
|
+
_obj = cls.model_validate({
|
|
96
|
+
"id": obj.get("id"),
|
|
97
|
+
"contentType": obj.get("contentType"),
|
|
98
|
+
"sizeBytes": obj.get("sizeBytes"),
|
|
99
|
+
"inline": obj.get("inline"),
|
|
100
|
+
"filename": obj.get("filename"),
|
|
101
|
+
"contentId": obj.get("contentId")
|
|
102
|
+
})
|
|
103
|
+
return _obj
|
|
104
|
+
|
|
105
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hostinger Email API Python SDK
|
|
5
|
+
|
|
6
|
+
API Version: 1.0.0
|
|
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 V1FolderMessagesMessageText(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
Rendered text and HTML parts of a message.
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
text: StrictStr
|
|
28
|
+
html: StrictStr
|
|
29
|
+
__properties: ClassVar[List[str]] = ["text", "html"]
|
|
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 V1FolderMessagesMessageText 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 V1FolderMessagesMessageText 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
|
+
"text": obj.get("text"),
|
|
83
|
+
"html": obj.get("html")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|