Skip to content

ABCs#

How do we use this ?

We utilize this abstract base class to define a structured way of representing and interacting with data objects. By defining classes that inherit from these ABCs, we can create objects that not only provide a clear understanding of their contents, but also enable convenient and efficient data manipulation and traversal.

General Objects#

  • These abstract base classes (ABCs) serve as a foundation for the modal classes, providing a structured way to interact with data objects.
  • While they won't be directly used for data manipulation, they will be inherited by the modal classes, which will then utilize their functionality to provide a clear understanding of their contents and enable convenient and efficient data manipulation and traversal.

This module provides the following classes for type-safe and msgspec-based handling of the Mail.tm API data types.

  • MessageFrom: Represents a data class containing details of messages.
  • MessageTo: Represents a data class containing details of recipients.
  • MessageAttachment: Represents a data class containing details of attachments.
  • ViewDetails: Represents a data class containing details of search results.
  • ViewSearch: Represents a data class containing details of search queries.

These classes are designed to be used with the 'msgspec' library to facilitate quick and efficient data serialization and deserialization.

MessageFrom #

Bases: msgspec.Struct

Represents a data class containing details of messages.

name class-attribute instance-attribute #

name: str = msgspec.field(name='name')

Name of the Account by which the Message was sent.

RETURNS DESCRIPTION
name

Name of the account message is sent from.

TYPE: str

address class-attribute instance-attribute #

address: str = msgspec.field(name='address')

Email address of the Account by which the Message was sent.

RETURNS DESCRIPTION
address

Email address of the account message is sent from.

TYPE: str

MessageTo #

Bases: msgspec.Struct

name class-attribute instance-attribute #

name: str = msgspec.field(name='name')

Name of the Account to which the Message was sent.

RETURNS DESCRIPTION
name

Name of the account message is sent to.

TYPE: str

address class-attribute instance-attribute #

address: str = msgspec.field(name='address')

Email address of the Account to which the Message was sent.

RETURNS DESCRIPTION
address

Email address of the account message is sent to.

TYPE: str

MessageAttachment #

Bases: msgspec.Struct

id class-attribute instance-attribute #

id: str = msgspec.field(name='id')

ID of the message attachment.

RETURNS DESCRIPTION
id

ID of the message attachment.

TYPE: str

filename class-attribute instance-attribute #

filename: str = msgspec.field(name='filename')

The name of the attachment file.

RETURNS DESCRIPTION
filename

The name of the attachment file.

TYPE: str

content_type class-attribute instance-attribute #

content_type: str = msgspec.field(name='contentType')

The MIME type of the attachment.

RETURNS DESCRIPTION
content_type

The MIME type of the attachment.

TYPE: str

disposition class-attribute instance-attribute #

disposition: str = msgspec.field(name='disposition')

The Content-Disposition header of the attachment.

RETURNS DESCRIPTION
disposition

The Content-Disposition header of the attachment.

TYPE: str

transfer_encoding class-attribute instance-attribute #

transfer_encoding: str = msgspec.field(
    name="transferEncoding"
)

The Transfer-Encoding header of the attachment.

RETURNS DESCRIPTION
transfer_encoding

The Transfer-Encoding header of the attachment.

TYPE: str

related class-attribute instance-attribute #

related: bool = msgspec.field(name='related')

Whether the attachment is related to the main body of the message.

RETURNS DESCRIPTION
related

Whether the attachment is related to the main body of the message.

TYPE: bool

size class-attribute instance-attribute #

size: int = msgspec.field(name='size')

The size of the attachment in bytes.

RETURNS DESCRIPTION
size

The size of the attachment in bytes.

TYPE: int

download_url class-attribute instance-attribute #

download_url: str = msgspec.field(name='downloadUrl')

The URL where the attachment can be downloaded from.

RETURNS DESCRIPTION
download_url

The URL where the attachment can be downloaded from.

TYPE: str

Token #

Bases: msgspec.Struct

id class-attribute instance-attribute #

id: str = msgspec.field(name='id')

ID of the account.

RETURNS DESCRIPTION
id

ID of the account.

TYPE: str

token class-attribute instance-attribute #

token: str = msgspec.field(name='token')

Token of the account.

RETURNS DESCRIPTION
token

Token of the account.

TYPE: str

ViewDetails #

Bases: msgspec.Struct

Struct representing the details of a view.

first class-attribute instance-attribute #

first: str = msgspec.field(name='hydra:first')

The URL of the first page in the view.

RETURNS DESCRIPTION
first

The URL of the first page in the view.

TYPE: str

last class-attribute instance-attribute #

last: str = msgspec.field(name='hydra:last')

The URL of the last page in the view.

RETURNS DESCRIPTION
last

The URL of the last page in the view.

TYPE: str

previous class-attribute instance-attribute #

previous: str = msgspec.field(name='hydra:previous')

The URL of the previous page in the view.

RETURNS DESCRIPTION
previous

The URL of the previous page in the view.

TYPE: str

next class-attribute instance-attribute #

next: str = msgspec.field(name='hydra:next')

The URL of the next page in the view.

RETURNS DESCRIPTION
next

The URL of the next page in the view.

TYPE: str

ViewMapping #

Bases: msgspec.Struct

Struct representing a mapping between a variable and a property.

variable class-attribute instance-attribute #

variable: str = msgspec.field(name='variable')

The variable of the mapping.

RETURNS DESCRIPTION
variable

The variable of the mapping.

TYPE: str

property class-attribute instance-attribute #

property: str = msgspec.field(name='property')

The property of the mapping.

RETURNS DESCRIPTION
property

The property of the mapping.

TYPE: str

required class-attribute instance-attribute #

required: bool = msgspec.field(name='required')

Whether the mapping is required.

RETURNS DESCRIPTION
required

Whether the mapping is required.

TYPE: bool

ViewSearch #

Bases: msgspec.Struct

A view search system.

template class-attribute instance-attribute #

template: str = msgspec.field(name='hydra:template')

The URL template of the view.

RETURNS DESCRIPTION
template

The URL template of the view.

TYPE: str

variable_representation class-attribute instance-attribute #

variable_representation: str = msgspec.field(
    name="hydra:variableRepresentation"
)

The representation of variables in the view.

RETURNS DESCRIPTION
variable_representation

The representation of variables in the view.

TYPE: str

mappings class-attribute instance-attribute #

mappings: t.List[ViewMapping] = msgspec.field(
    name="hydra:mapping"
)

A list of mappings for the view.

RETURNS DESCRIPTION
mappings

A list of mappings for the view.

TYPE: List[ViewMapping]

  • Modal objects contain the classes that the user directly interacts with while using the SDK.
  • These modals contain the data objects that the user interacts with while using the SDK.

Domain #

Bases: msgspec.Struct

The domain of the email account.

id class-attribute instance-attribute #

id: t.Optional[str] = msgspec.field(
    name="id", default=None
)

Not documented: ID of the interaction.

RETURNS DESCRIPTION
id

ID of the interaction.

TYPE: str

domain_name class-attribute instance-attribute #

domain_name: t.Optional[str] = msgspec.field(
    name="domain", default=None
)

Name of the domain provided by mail.tm

RETURNS DESCRIPTION
domain

Name of the domain provided by mail.tm

TYPE: str

Examples:

@gmail.com, @goster.com

is_active class-attribute instance-attribute #

is_active: t.Optional[bool] = msgspec.field(
    name="isActive", default=None
)

If the domain is still active.

RETURNS DESCRIPTION
is_active

If the domain is still active.

TYPE: bool

is_private class-attribute instance-attribute #

is_private: t.Optional[bool] = msgspec.field(
    name="isPrivate", default=None
)

If the domain is private. Private domains are not visible to the public.

RETURNS DESCRIPTION
is_private

If the domain is private. Private domains are not visible to the public.

TYPE: bool

created_at class-attribute instance-attribute #

created_at: t.Optional[datetime.datetime] = msgspec.field(
    name="createdAt", default=None
)

The datetime object of creation date of the domain.

RETURNS DESCRIPTION
created_at

The datetime object of creation date of the domain.

TYPE: datetime

updated_at class-attribute instance-attribute #

updated_at: t.Optional[datetime.datetime] = msgspec.field(
    name="updatedAt", default=None
)

The datetime object of update date of the domain from the latest point of reference.

RETURNS DESCRIPTION
updated_at

The datetime object of update date of the domain from the latest point of reference.

TYPE: datetime

Account #

Bases: msgspec.Struct

id class-attribute instance-attribute #

id: t.Optional[str] = msgspec.field(
    name="id", default=None
)

Not documented: ID of the account.

RETURNS DESCRIPTION
id

ID of the account.

TYPE: str

address class-attribute instance-attribute #

address: t.Optional[str] = msgspec.field(
    name="address", default=None
)

Email address of the account.

RETURNS DESCRIPTION
address

Email address of the account.

TYPE: str

quota class-attribute instance-attribute #

quota: t.Optional[int] = msgspec.field(
    name="quota", default=None
)

The quota of the account.

RETURNS DESCRIPTION
quota

The quota of the account.

TYPE: int

used class-attribute instance-attribute #

used: t.Optional[int] = msgspec.field(
    name="used", default=None
)

The amount of quota used by the account.

RETURNS DESCRIPTION
used

The amount of quota used by the account.

TYPE: int

is_disabled class-attribute instance-attribute #

is_disabled: t.Optional[bool] = msgspec.field(
    name="isDisabled", default=None
)

If the account is disabled.

RETURNS DESCRIPTION
is_disabled

If the account is disabled.

TYPE: bool

is_deleted class-attribute instance-attribute #

is_deleted: t.Optional[bool] = msgspec.field(
    name="isDeleted", default=None
)

If the account is deleted.

RETURNS DESCRIPTION
is_deleted

If the account is deleted.

TYPE: bool

created_at class-attribute instance-attribute #

created_at: t.Optional[datetime.datetime] = msgspec.field(
    name="createdAt", default=None
)

The datetime object of creation date of the account.

RETURNS DESCRIPTION
created_at

The datetime object of creation date of the account.

TYPE: datetime

updated_at class-attribute instance-attribute #

updated_at: t.Optional[datetime.datetime] = msgspec.field(
    name="updatedAt", default=None
)

The datetime object of update date of the account from the latest point of reference.

RETURNS DESCRIPTION
updated_at

The datetime object of update date of the account from the latest point of reference.

TYPE: datetime

Message #

Bases: msgspec.Struct

id class-attribute instance-attribute #

id: t.Optional[str] = msgspec.field(
    name="id", default=None
)

ID of the message.

RETURNS DESCRIPTION
id

ID of the message.

TYPE: str

account_id class-attribute instance-attribute #

account_id: t.Optional[str] = msgspec.field(
    name="accountId", default=None
)

ID of the account to which the message belongs.

RETURNS DESCRIPTION
account_id

ID of the account to which the message belongs.

TYPE: str

message_id class-attribute instance-attribute #

message_id: t.Optional[str] = msgspec.field(
    name="msgid", default=None
)

The ID associated with the message.

RETURNS DESCRIPTION
message_id

Message ID.

TYPE: str

message_from class-attribute instance-attribute #

message_from: t.Optional[MessageFrom] = msgspec.field(
    name="from", default=None
)

Details of the sender of the message.

RETURNS DESCRIPTION
message_from

Details of the sender of the message.

TYPE: MessageFrom

message_to class-attribute instance-attribute #

message_to: t.Optional[t.List[MessageTo]] = msgspec.field(
    name="to", default=None
)

Details of the recipients of the message.

RETURNS DESCRIPTION
message_to

Details of the recipients of the message.

TYPE: MessageTo

subject class-attribute instance-attribute #

subject: t.Optional[str] = msgspec.field(
    name="subject", default=None
)

Subject of the message.

RETURNS DESCRIPTION
subject

Subject of the message.

TYPE: str

seen class-attribute instance-attribute #

seen: t.Optional[bool] = msgspec.field(
    name="seen", default=None
)

If the message has been seen by the recipient.

RETURNS DESCRIPTION
seen

If the message has been seen by the recipient.

TYPE: bool

is_deleted class-attribute instance-attribute #

is_deleted: t.Optional[bool] = msgspec.field(
    name="isDeleted", default=None
)

If the message is deleted.

RETURNS DESCRIPTION
is_deleted

If the message is deleted.

TYPE: bool

html class-attribute instance-attribute #

html: t.Optional[t.List[str]] = msgspec.field(
    name="html", default=None
)

HTML content of the message.

RETURNS DESCRIPTION
html

HTML content of the message.

TYPE: str

has_attachments class-attribute instance-attribute #

has_attachments: t.Optional[bool] = msgspec.field(
    name="hasAttachments", default=None
)

If the message has attachments.

RETURNS DESCRIPTION
has_attachments

If the message has attachments.

TYPE: bool

attachments class-attribute instance-attribute #

attachments: t.Optional[t.List[MessageAttachment]] = (
    msgspec.field(name="attachments", default=None)
)

Attachments associated with the message.

RETURNS DESCRIPTION
attachments

Attachments associated with the message.

TYPE: MessageAttachment

size class-attribute instance-attribute #

size: t.Optional[int] = msgspec.field(
    name="size", default=None
)

Size of the message in bytes.

RETURNS DESCRIPTION
size

Size of the message in bytes.

TYPE: int

downloadUrl class-attribute instance-attribute #

downloadUrl: t.Optional[str] = msgspec.field(
    name="downloadUrl", default=None
)

URL to download the message.

RETURNS DESCRIPTION
downloadUrl

URL to download the message.

TYPE: str

created_at class-attribute instance-attribute #

created_at: t.Optional[datetime.datetime] = msgspec.field(
    name="createdAt", default=None
)

Date and time of creation of the message.

RETURNS DESCRIPTION
created_at

Date and time of creation of the message.

TYPE: datetime

updated_at class-attribute instance-attribute #

updated_at: t.Optional[datetime.datetime] = msgspec.field(
    name="updatedAt", default=None
)

Date and time of last update of the message.

RETURNS DESCRIPTION
updated_at

Date and time of last update of the message.

TYPE: datetime

cc class-attribute instance-attribute #

cc: t.Optional[t.List[str]] = msgspec.field(
    name="cc", default=None
)

Carbon Copy (CC) recipients of the message.

RETURNS DESCRIPTION
cc

Carbon Copy (CC) recipients of the message.

TYPE: str

bcc class-attribute instance-attribute #

bcc: t.Optional[t.List[str]] = msgspec.field(
    name="bcc", default=None
)

Blind Carbon Copy (BCC) recipients of the message.

RETURNS DESCRIPTION
bcc

Blind Carbon Copy (BCC) recipients of the message.

TYPE: str

flagged class-attribute instance-attribute #

flagged: t.Optional[bool] = msgspec.field(
    name="flagged", default=None
)

If the message is flagged by the recipient.

RETURNS DESCRIPTION
flagged

If the message is flagged by the recipient.

TYPE: bool

verifications class-attribute instance-attribute #

verifications: t.Optional[t.List[str]] = msgspec.field(
    name="verifications", default=None
)

Verifications associated with the message.

RETURNS DESCRIPTION
verifications

Verifications associated with the message.

TYPE: str

retention_date class-attribute instance-attribute #

retention_date: t.Optional[datetime.datetime] = (
    msgspec.field(name="retentionDate", default=None)
)

Date of retention for the message.

RETURNS DESCRIPTION
retention_date

Date of retention for the message.

TYPE: datetime

retention class-attribute instance-attribute #

retention: t.Optional[bool] = msgspec.field(
    name="retention", default=None
)

If the message is subject to retention.

RETURNS DESCRIPTION
retention

If the message is subject to retention.

TYPE: bool

text class-attribute instance-attribute #

text: t.Optional[str] = msgspec.field(
    name="text", default=None
)

Plain text content of the message.

RETURNS DESCRIPTION
text

Plain text content of the message.

TYPE: str

Source #

id class-attribute instance-attribute #

id: t.Optional[str] = msgspec.field(
    name="id", default=None
)

The id attribute of the Source.

RETURNS DESCRIPTION
id

The id attribute of the Source.

TYPE: str

download_url class-attribute instance-attribute #

download_url: t.Optional[str] = msgspec.field(
    name="downloadUrl", default=None
)

The download URL attribute of the Source.

RETURNS DESCRIPTION
download_url

The download URL attribute of the Source.

TYPE: str

data class-attribute instance-attribute #

data: t.Optional[str] = msgspec.field(
    name="data", default=None
)

The data attribute of the Source.

RETURNS DESCRIPTION
data

The data attribute of the Source.

TYPE: str

MessagePageView #

Bases: msgspec.Struct

Page view for messages under a page.

messages class-attribute instance-attribute #

messages: t.Optional[t.List[Message]] = msgspec.field(
    name="hydra:member", default=None
)

List of messages in the view.

RETURNS DESCRIPTION
messages

List of messages in the view.

TYPE: Message

total_items class-attribute instance-attribute #

total_items: t.Optional[int] = msgspec.field(
    name="hydra:totalItems", default=None
)

Total number of items in the view.

RETURNS DESCRIPTION
total_items

Total number of items in the view.

TYPE: int

view_search: t.Optional[ViewSearch] = msgspec.field(
    name="hydra:search", default=None
)

Search parameters of the view.

RETURNS DESCRIPTION
view_search

Search parameters of the view.

TYPE: ViewSearch

view_details class-attribute instance-attribute #

view_details: t.Optional[ViewDetails] = msgspec.field(
    name="hydra:view", default=None
)

Details of the view.

RETURNS DESCRIPTION
view_details

Details of the view.

TYPE: ViewDetails

DomainPageView #

Bases: msgspec.Struct

Page view for domains under a page.

domains class-attribute instance-attribute #

domains: t.Optional[t.List[Domain]] = msgspec.field(
    name="hydra:member", default=None
)

List of domains in the view.

RETURNS DESCRIPTION
domains

List of domains in the view.

TYPE: Domain

total_items class-attribute instance-attribute #

total_items: t.Optional[int] = msgspec.field(
    name="hydra:totalItems", default=None
)

Total number of domains in the view.

RETURNS DESCRIPTION
total_items

Total number of domains in the view.

TYPE: int

view_details class-attribute instance-attribute #

view_details: t.Optional[ViewDetails] = msgspec.field(
    name="hydra:view", default=None
)

Details of the domain view.

RETURNS DESCRIPTION
view_details

Details of the domain view.

TYPE: ViewDetails

view_search: t.Optional[ViewSearch] = msgspec.field(
    name="hydra:search", default=None
)

Search parameters of the domain view.

RETURNS DESCRIPTION
view_search

Search parameters of the domain view.

TYPE: ViewSearch