Skip to content

Commit cdcce1c

Browse files
authored
feat(tem): add email flags (#261)
1 parent 3d219e5 commit cdcce1c

File tree

8 files changed

+62
-0
lines changed

8 files changed

+62
-0
lines changed

scaleway-async/scaleway_async/tem/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import DomainLastStatusRecordStatus
44
from .types import DomainStatus
5+
from .types import EmailFlag
56
from .types import EmailRcptType
67
from .types import EmailStatus
78
from .types import ListEmailsRequestOrderBy
@@ -25,6 +26,7 @@
2526
__all__ = [
2627
"DomainLastStatusRecordStatus",
2728
"DomainStatus",
29+
"EmailFlag",
2830
"EmailRcptType",
2931
"EmailStatus",
3032
"ListEmailsRequestOrderBy",

scaleway-async/scaleway_async/tem/v1alpha1/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
)
1717
from .types import (
1818
DomainStatus,
19+
EmailFlag,
1920
EmailStatus,
2021
ListEmailsRequestOrderBy,
2122
CreateEmailRequestAddress,
@@ -208,6 +209,7 @@ async def list_emails(
208209
subject: Optional[str] = None,
209210
search: Optional[str] = None,
210211
order_by: ListEmailsRequestOrderBy = ListEmailsRequestOrderBy.CREATED_AT_DESC,
212+
flags: Optional[List[EmailFlag]] = None,
211213
) -> ListEmailsResponse:
212214
"""
213215
List emails.
@@ -227,6 +229,7 @@ async def list_emails(
227229
:param subject: (Optional) List emails with this subject.
228230
:param search: (Optional) List emails by searching to all fields.
229231
:param order_by: (Optional) List emails corresponding to specific criteria.
232+
:param flags: (Optional) List emails containing only specific flags.
230233
:return: :class:`ListEmailsResponse <ListEmailsResponse>`
231234
232235
Usage:
@@ -244,6 +247,7 @@ async def list_emails(
244247
f"/transactional-email/v1alpha1/regions/{param_region}/emails",
245248
params={
246249
"domain_id": domain_id,
250+
"flags": flags,
247251
"mail_from": mail_from,
248252
"mail_rcpt": mail_rcpt,
249253
"mail_to": mail_to,
@@ -281,6 +285,7 @@ async def list_emails_all(
281285
subject: Optional[str] = None,
282286
search: Optional[str] = None,
283287
order_by: Optional[ListEmailsRequestOrderBy] = None,
288+
flags: Optional[List[EmailFlag]] = None,
284289
) -> List[Email]:
285290
"""
286291
List emails.
@@ -300,6 +305,7 @@ async def list_emails_all(
300305
:param subject: (Optional) List emails with this subject.
301306
:param search: (Optional) List emails by searching to all fields.
302307
:param order_by: (Optional) List emails corresponding to specific criteria.
308+
:param flags: (Optional) List emails containing only specific flags.
303309
:return: :class:`List[ListEmailsResponse] <List[ListEmailsResponse]>`
304310
305311
Usage:
@@ -328,6 +334,7 @@ async def list_emails_all(
328334
"subject": subject,
329335
"search": search,
330336
"order_by": order_by,
337+
"flags": flags,
331338
},
332339
)
333340

scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def unmarshal_Email(data: Any) -> Email:
176176
field = data.get("created_at", None)
177177
args["created_at"] = parser.isoparse(field) if type(field) is str else field
178178

179+
field = data.get("flags", None)
180+
args["flags"] = field
181+
179182
field = data.get("id", None)
180183
args["id"] = field
181184

scaleway-async/scaleway_async/tem/v1alpha1/types.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def __str__(self) -> str:
3535
return str(self.value)
3636

3737

38+
class EmailFlag(str, Enum):
39+
UNKNOWN_FLAG = "unknown_flag"
40+
SOFT_BOUNCE = "soft_bounce"
41+
HARD_BOUNCE = "hard_bounce"
42+
43+
def __str__(self) -> str:
44+
return str(self.value)
45+
46+
3847
class EmailRcptType(str, Enum):
3948
UNKNOWN_RCPT_TYPE = "unknown_rcpt_type"
4049
TO = "to"
@@ -360,6 +369,11 @@ class Email:
360369
Information about the last three attempts to send the email.
361370
"""
362371

372+
flags: List[EmailFlag]
373+
"""
374+
Flags categorize emails. They allow you to obtain more information about recurring errors, for example.
375+
"""
376+
363377

364378
@dataclass
365379
class EmailTry:
@@ -599,6 +613,11 @@ class ListEmailsRequest:
599613
(Optional) List emails corresponding to specific criteria.
600614
"""
601615

616+
flags: Optional[List[EmailFlag]]
617+
"""
618+
(Optional) List emails containing only specific flags.
619+
"""
620+
602621

603622
@dataclass
604623
class GetStatisticsRequest:

scaleway/scaleway/tem/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import DomainLastStatusRecordStatus
44
from .types import DomainStatus
5+
from .types import EmailFlag
56
from .types import EmailRcptType
67
from .types import EmailStatus
78
from .types import ListEmailsRequestOrderBy
@@ -25,6 +26,7 @@
2526
__all__ = [
2627
"DomainLastStatusRecordStatus",
2728
"DomainStatus",
29+
"EmailFlag",
2830
"EmailRcptType",
2931
"EmailStatus",
3032
"ListEmailsRequestOrderBy",

scaleway/scaleway/tem/v1alpha1/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
)
1717
from .types import (
1818
DomainStatus,
19+
EmailFlag,
1920
EmailStatus,
2021
ListEmailsRequestOrderBy,
2122
CreateEmailRequestAddress,
@@ -208,6 +209,7 @@ def list_emails(
208209
subject: Optional[str] = None,
209210
search: Optional[str] = None,
210211
order_by: ListEmailsRequestOrderBy = ListEmailsRequestOrderBy.CREATED_AT_DESC,
212+
flags: Optional[List[EmailFlag]] = None,
211213
) -> ListEmailsResponse:
212214
"""
213215
List emails.
@@ -227,6 +229,7 @@ def list_emails(
227229
:param subject: (Optional) List emails with this subject.
228230
:param search: (Optional) List emails by searching to all fields.
229231
:param order_by: (Optional) List emails corresponding to specific criteria.
232+
:param flags: (Optional) List emails containing only specific flags.
230233
:return: :class:`ListEmailsResponse <ListEmailsResponse>`
231234
232235
Usage:
@@ -244,6 +247,7 @@ def list_emails(
244247
f"/transactional-email/v1alpha1/regions/{param_region}/emails",
245248
params={
246249
"domain_id": domain_id,
250+
"flags": flags,
247251
"mail_from": mail_from,
248252
"mail_rcpt": mail_rcpt,
249253
"mail_to": mail_to,
@@ -281,6 +285,7 @@ def list_emails_all(
281285
subject: Optional[str] = None,
282286
search: Optional[str] = None,
283287
order_by: Optional[ListEmailsRequestOrderBy] = None,
288+
flags: Optional[List[EmailFlag]] = None,
284289
) -> List[Email]:
285290
"""
286291
List emails.
@@ -300,6 +305,7 @@ def list_emails_all(
300305
:param subject: (Optional) List emails with this subject.
301306
:param search: (Optional) List emails by searching to all fields.
302307
:param order_by: (Optional) List emails corresponding to specific criteria.
308+
:param flags: (Optional) List emails containing only specific flags.
303309
:return: :class:`List[ListEmailsResponse] <List[ListEmailsResponse]>`
304310
305311
Usage:
@@ -328,6 +334,7 @@ def list_emails_all(
328334
"subject": subject,
329335
"search": search,
330336
"order_by": order_by,
337+
"flags": flags,
331338
},
332339
)
333340

scaleway/scaleway/tem/v1alpha1/marshalling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def unmarshal_Email(data: Any) -> Email:
176176
field = data.get("created_at", None)
177177
args["created_at"] = parser.isoparse(field) if type(field) is str else field
178178

179+
field = data.get("flags", None)
180+
args["flags"] = field
181+
179182
field = data.get("id", None)
180183
args["id"] = field
181184

scaleway/scaleway/tem/v1alpha1/types.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def __str__(self) -> str:
3535
return str(self.value)
3636

3737

38+
class EmailFlag(str, Enum):
39+
UNKNOWN_FLAG = "unknown_flag"
40+
SOFT_BOUNCE = "soft_bounce"
41+
HARD_BOUNCE = "hard_bounce"
42+
43+
def __str__(self) -> str:
44+
return str(self.value)
45+
46+
3847
class EmailRcptType(str, Enum):
3948
UNKNOWN_RCPT_TYPE = "unknown_rcpt_type"
4049
TO = "to"
@@ -360,6 +369,11 @@ class Email:
360369
Information about the last three attempts to send the email.
361370
"""
362371

372+
flags: List[EmailFlag]
373+
"""
374+
Flags categorize emails. They allow you to obtain more information about recurring errors, for example.
375+
"""
376+
363377

364378
@dataclass
365379
class EmailTry:
@@ -599,6 +613,11 @@ class ListEmailsRequest:
599613
(Optional) List emails corresponding to specific criteria.
600614
"""
601615

616+
flags: Optional[List[EmailFlag]]
617+
"""
618+
(Optional) List emails containing only specific flags.
619+
"""
620+
602621

603622
@dataclass
604623
class GetStatisticsRequest:

0 commit comments

Comments
 (0)