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] = Nonedisposition
disposition: Optional[str] = Nonefilename
filename: str = ''inline
inline: bool = Falsemime_type
mime_type: str = 'application/octet-stream'provider_id
provider_id: Optional[str] = Noneref
ref: Optional[AttachmentRef] = Nonesize
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] = Nonethread_id
thread_id: Optional[str] = NoneEmailHistoryChange
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: EmailHistoryChangeKindlabel_ids
label_ids: list[str] = Field(default_factory=list)message_id
message_id: str = Field(min_length=1)thread_id
thread_id: Optional[str] = NoneEmailHistoryChangeKind
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] = Nonelabel_type
label_type: Optional[str] = Nonemessage_list_visibility
message_list_visibility: Optional[str] = Nonemessages_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] = Nonein_reply_to
in_reply_to: Optional[str] = Noneinternal_at
internal_at: Optional[datetime] = Nonelabels
labels: list[str] = Field(default_factory=list)mailbox
mailbox: Optional[MailboxRef] = Noneprovider_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] = Nonesent_at
sent_at: Optional[datetime] = Nonesize_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] = Noneto
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] = Nonemessages
messages: list[EmailMessageRecord] = Field(default_factory=list)ref
ref: ThreadRefsnippet
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: MailboxRefmessages_total
messages_total: int = Field(default=0, ge=0)threads_total
threads_total: int = Field(default=0, ge=0)