Skip to content

common_reports.schemas.emails.records

Normalized data produced by mailbox providers.

Classes

EmailAttachmentRecord

Bases: BaseModel

Metadata for one attachment; bytes are fetched separately.

Fields and properties declared here; inherited members belong to the bases above.

content_id

content_id: Optional[str] = None

disposition

disposition: Optional[str] = None

filename

filename: str = ''

inline

inline: bool = False

mime_type

mime_type: str = 'application/octet-stream'

provider_id

provider_id: Optional[str] = None

ref

ref: Optional[AttachmentRef] = None

size

size: Optional[int] = Field(default=None, ge=0)

EmailDeliveryRecord

Bases: BaseModel

Provider acknowledgement for a sent message.

Fields and properties declared here; inherited members belong to the bases above.

labels

labels: list[str] = Field(default_factory=list)

message_id

message_id: Optional[str] = Field(default=None, description='RFC Message-ID')

provider_message_id

provider_message_id: Optional[str] = None

thread_id

thread_id: Optional[str] = None

EmailHistoryChange

Bases: BaseModel

One normalized mailbox-history fact.

Fields and properties declared here; inherited members belong to the bases above.

history_id

history_id: str = Field(min_length=1)

kind

kind: EmailHistoryChangeKind

label_ids

label_ids: list[str] = Field(default_factory=list)

message_id

message_id: str = Field(min_length=1)

thread_id

thread_id: Optional[str] = None

EmailHistoryChangeKind

Bases: StrEnum

Fields and properties declared here; inherited members belong to the bases above.

LABEL_ADDED

LABEL_ADDED = 'label_added'

LABEL_REMOVED

LABEL_REMOVED = 'label_removed'

MESSAGE_ADDED

MESSAGE_ADDED = 'message_added'

MESSAGE_DELETED

MESSAGE_DELETED = 'message_deleted'

EmailLabelRecord

Bases: BaseModel

One provider mailbox label.

Fields and properties declared here; inherited members belong to the bases above.

label_list_visibility

label_list_visibility: Optional[str] = None

label_type

label_type: Optional[str] = None

message_list_visibility

message_list_visibility: Optional[str] = None

messages_total

messages_total: Optional[int] = Field(default=None, ge=0)

messages_unread

messages_unread: Optional[int] = Field(default=None, ge=0)

name

name: str = Field(min_length=1)

provider_id

provider_id: str = Field(min_length=1)

threads_total

threads_total: Optional[int] = Field(default=None, ge=0)

threads_unread

threads_unread: Optional[int] = Field(default=None, ge=0)

EmailMessageRecord

Bases: BaseModel

Provider-neutral, loss-conscious representation of one message.

The body, the snippet and the raw headers are read by attribute; a repr shows who, when and what about, never the content.

Fields and properties declared here; inherited members belong to the bases above.

attachments

attachments: list[EmailAttachmentRecord] = Field(default_factory=list)

bcc

bcc: str = ''

body_html

body_html: Optional[str] = Field(default=None, repr=False)

body_text

body_text: Optional[str] = Field(default=None, repr=False)

cc

cc: str = ''

date

date: str = ''

from_

from_: str = Field(default='', alias='from')

headers

headers: dict[str, str] = Field(default_factory=dict, repr=False)

history_id

history_id: Optional[str] = None

in_reply_to

in_reply_to: Optional[str] = None

internal_at

internal_at: Optional[datetime] = None

labels

labels: list[str] = Field(default_factory=list)

mailbox

mailbox: Optional[MailboxRef] = None

provider_id

provider_id: Optional[str] = Field(default=None, validation_alias=(AliasChoices('provider_id', 'uid')))

ref

Read-only property.

ref: Optional[MessageRef]

The exact cascading reference when mailbox identity is known.

references

references: tuple[str, ...] = ()

reply_to

reply_to: str = ''

rfc_message_id

rfc_message_id: Optional[str] = None

sent_at

sent_at: Optional[datetime] = None

size_bytes

size_bytes: Optional[int] = Field(default=None, ge=0)

snippet

snippet: str = Field(default='', repr=False)

subject

subject: str = ''

thread_id

thread_id: Optional[str] = None

to

to: str = ''

uid

Read-only property.

uid: Optional[str]

Compatibility alias for the former ReadResult field.

EmailThreadRecord

Bases: BaseModel

One provider thread with its ordered normalized messages.

Fields and properties declared here; inherited members belong to the bases above.

history_id

history_id: Optional[str] = None

messages

messages: list[EmailMessageRecord] = Field(default_factory=list)

ref

ref: ThreadRef

snippet

snippet: str = ''

MailboxProfile

Bases: BaseModel

Current mailbox identity, counts, and authoritative history cursor.

Fields and properties declared here; inherited members belong to the bases above.

history_id

history_id: str = Field(min_length=1)

mailbox

mailbox: MailboxRef

messages_total

messages_total: int = Field(default=0, ge=0)

threads_total

threads_total: int = Field(default=0, ge=0)