Skip to content

Commit

Permalink
feat(tem): add email flags (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Jul 18, 2023
1 parent 3d219e5 commit cdcce1c
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/tem/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import DomainLastStatusRecordStatus
from .types import DomainStatus
from .types import EmailFlag
from .types import EmailRcptType
from .types import EmailStatus
from .types import ListEmailsRequestOrderBy
Expand All @@ -25,6 +26,7 @@
__all__ = [
"DomainLastStatusRecordStatus",
"DomainStatus",
"EmailFlag",
"EmailRcptType",
"EmailStatus",
"ListEmailsRequestOrderBy",
Expand Down
7 changes: 7 additions & 0 deletions scaleway-async/scaleway_async/tem/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)
from .types import (
DomainStatus,
EmailFlag,
EmailStatus,
ListEmailsRequestOrderBy,
CreateEmailRequestAddress,
Expand Down Expand Up @@ -208,6 +209,7 @@ async def list_emails(
subject: Optional[str] = None,
search: Optional[str] = None,
order_by: ListEmailsRequestOrderBy = ListEmailsRequestOrderBy.CREATED_AT_DESC,
flags: Optional[List[EmailFlag]] = None,
) -> ListEmailsResponse:
"""
List emails.
Expand All @@ -227,6 +229,7 @@ async def list_emails(
:param subject: (Optional) List emails with this subject.
:param search: (Optional) List emails by searching to all fields.
:param order_by: (Optional) List emails corresponding to specific criteria.
:param flags: (Optional) List emails containing only specific flags.
:return: :class:`ListEmailsResponse <ListEmailsResponse>`
Usage:
Expand All @@ -244,6 +247,7 @@ async def list_emails(
f"/transactional-email/v1alpha1/regions/{param_region}/emails",
params={
"domain_id": domain_id,
"flags": flags,
"mail_from": mail_from,
"mail_rcpt": mail_rcpt,
"mail_to": mail_to,
Expand Down Expand Up @@ -281,6 +285,7 @@ async def list_emails_all(
subject: Optional[str] = None,
search: Optional[str] = None,
order_by: Optional[ListEmailsRequestOrderBy] = None,
flags: Optional[List[EmailFlag]] = None,
) -> List[Email]:
"""
List emails.
Expand All @@ -300,6 +305,7 @@ async def list_emails_all(
:param subject: (Optional) List emails with this subject.
:param search: (Optional) List emails by searching to all fields.
:param order_by: (Optional) List emails corresponding to specific criteria.
:param flags: (Optional) List emails containing only specific flags.
:return: :class:`List[ListEmailsResponse] <List[ListEmailsResponse]>`
Usage:
Expand Down Expand Up @@ -328,6 +334,7 @@ async def list_emails_all(
"subject": subject,
"search": search,
"order_by": order_by,
"flags": flags,
},
)

Expand Down
3 changes: 3 additions & 0 deletions scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def unmarshal_Email(data: Any) -> Email:
field = data.get("created_at", None)
args["created_at"] = parser.isoparse(field) if type(field) is str else field

field = data.get("flags", None)
args["flags"] = field

field = data.get("id", None)
args["id"] = field

Expand Down
19 changes: 19 additions & 0 deletions scaleway-async/scaleway_async/tem/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ def __str__(self) -> str:
return str(self.value)


class EmailFlag(str, Enum):
UNKNOWN_FLAG = "unknown_flag"
SOFT_BOUNCE = "soft_bounce"
HARD_BOUNCE = "hard_bounce"

def __str__(self) -> str:
return str(self.value)


class EmailRcptType(str, Enum):
UNKNOWN_RCPT_TYPE = "unknown_rcpt_type"
TO = "to"
Expand Down Expand Up @@ -360,6 +369,11 @@ class Email:
Information about the last three attempts to send the email.
"""

flags: List[EmailFlag]
"""
Flags categorize emails. They allow you to obtain more information about recurring errors, for example.
"""


@dataclass
class EmailTry:
Expand Down Expand Up @@ -599,6 +613,11 @@ class ListEmailsRequest:
(Optional) List emails corresponding to specific criteria.
"""

flags: Optional[List[EmailFlag]]
"""
(Optional) List emails containing only specific flags.
"""


@dataclass
class GetStatisticsRequest:
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/tem/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import DomainLastStatusRecordStatus
from .types import DomainStatus
from .types import EmailFlag
from .types import EmailRcptType
from .types import EmailStatus
from .types import ListEmailsRequestOrderBy
Expand All @@ -25,6 +26,7 @@
__all__ = [
"DomainLastStatusRecordStatus",
"DomainStatus",
"EmailFlag",
"EmailRcptType",
"EmailStatus",
"ListEmailsRequestOrderBy",
Expand Down
7 changes: 7 additions & 0 deletions scaleway/scaleway/tem/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)
from .types import (
DomainStatus,
EmailFlag,
EmailStatus,
ListEmailsRequestOrderBy,
CreateEmailRequestAddress,
Expand Down Expand Up @@ -208,6 +209,7 @@ def list_emails(
subject: Optional[str] = None,
search: Optional[str] = None,
order_by: ListEmailsRequestOrderBy = ListEmailsRequestOrderBy.CREATED_AT_DESC,
flags: Optional[List[EmailFlag]] = None,
) -> ListEmailsResponse:
"""
List emails.
Expand All @@ -227,6 +229,7 @@ def list_emails(
:param subject: (Optional) List emails with this subject.
:param search: (Optional) List emails by searching to all fields.
:param order_by: (Optional) List emails corresponding to specific criteria.
:param flags: (Optional) List emails containing only specific flags.
:return: :class:`ListEmailsResponse <ListEmailsResponse>`
Usage:
Expand All @@ -244,6 +247,7 @@ def list_emails(
f"/transactional-email/v1alpha1/regions/{param_region}/emails",
params={
"domain_id": domain_id,
"flags": flags,
"mail_from": mail_from,
"mail_rcpt": mail_rcpt,
"mail_to": mail_to,
Expand Down Expand Up @@ -281,6 +285,7 @@ def list_emails_all(
subject: Optional[str] = None,
search: Optional[str] = None,
order_by: Optional[ListEmailsRequestOrderBy] = None,
flags: Optional[List[EmailFlag]] = None,
) -> List[Email]:
"""
List emails.
Expand All @@ -300,6 +305,7 @@ def list_emails_all(
:param subject: (Optional) List emails with this subject.
:param search: (Optional) List emails by searching to all fields.
:param order_by: (Optional) List emails corresponding to specific criteria.
:param flags: (Optional) List emails containing only specific flags.
:return: :class:`List[ListEmailsResponse] <List[ListEmailsResponse]>`
Usage:
Expand Down Expand Up @@ -328,6 +334,7 @@ def list_emails_all(
"subject": subject,
"search": search,
"order_by": order_by,
"flags": flags,
},
)

Expand Down
3 changes: 3 additions & 0 deletions scaleway/scaleway/tem/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def unmarshal_Email(data: Any) -> Email:
field = data.get("created_at", None)
args["created_at"] = parser.isoparse(field) if type(field) is str else field

field = data.get("flags", None)
args["flags"] = field

field = data.get("id", None)
args["id"] = field

Expand Down
19 changes: 19 additions & 0 deletions scaleway/scaleway/tem/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ def __str__(self) -> str:
return str(self.value)


class EmailFlag(str, Enum):
UNKNOWN_FLAG = "unknown_flag"
SOFT_BOUNCE = "soft_bounce"
HARD_BOUNCE = "hard_bounce"

def __str__(self) -> str:
return str(self.value)


class EmailRcptType(str, Enum):
UNKNOWN_RCPT_TYPE = "unknown_rcpt_type"
TO = "to"
Expand Down Expand Up @@ -360,6 +369,11 @@ class Email:
Information about the last three attempts to send the email.
"""

flags: List[EmailFlag]
"""
Flags categorize emails. They allow you to obtain more information about recurring errors, for example.
"""


@dataclass
class EmailTry:
Expand Down Expand Up @@ -599,6 +613,11 @@ class ListEmailsRequest:
(Optional) List emails corresponding to specific criteria.
"""

flags: Optional[List[EmailFlag]]
"""
(Optional) List emails containing only specific flags.
"""


@dataclass
class GetStatisticsRequest:
Expand Down

0 comments on commit cdcce1c

Please sign in to comment.