Models
mail_intake.models
Summary
Domain models for Mail Intake.
This package defines the canonical, provider-agnostic data models used throughout the Mail Intake ingestion pipeline.
Models in this package:
- Represent fully parsed and normalized mail data.
- Are safe to persist, serialize, and index.
- Contain no provider-specific payloads or API semantics.
- Serve as stable inputs for downstream processing and analysis.
These models form the core internal data contract of the library.
Public API
MailIntakeMessageMailIntakeThread
Classes
MailIntakeMessage
dataclass
Canonical internal representation of a single email message.
Notes
Guarantees:
1 2 3 | |
Constraints:
1 2 | |
Attributes
raw_headers
instance-attribute
Normalized mapping of message headers (header name → value).
thread_id
instance-attribute
Provider-specific thread identifier to which this message belongs.
timestamp
instance-attribute
Message timestamp as a timezone-naive UTC datetime.
MailIntakeThread
dataclass
Canonical internal representation of an email thread.
Notes
Guarantees:
1 2 3 4 5 | |
Attributes
last_activity_at
class-attribute
instance-attribute
Timestamp of the most recent message in the thread.
messages
class-attribute
instance-attribute
Ordered list of messages belonging to this thread.
normalized_subject
instance-attribute
Normalized subject line used to group related messages.
participants
class-attribute
instance-attribute
Set of unique participant email addresses observed in the thread.
Functions
add_message
Add a message to the thread and update derived fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message |
MailIntakeMessage
|
Parsed mail message to add to the thread. |
required |
Notes
Responsibilities:
1 2 3 | |