Skip to content

Entities

Postal letter domain types used by the emailing postal_letter subcomponent.

ListPostalLettersQuery dataclass

ListPostalLettersQuery(context, metadata, mode='live')

Metadata-scoped listing (seeuletter list API).

context instance-attribute

context

metadata instance-attribute

metadata

mode class-attribute instance-attribute

mode = 'live'

MySendingBoxSendOptions dataclass

MySendingBoxSendOptions(
    in_color=False,
    postage_type=PostageTypePriority.ecopli,
    insert_address_on_blank_page=False,
)

Full resolved option set for MySendingBox sends.

in_color class-attribute instance-attribute

in_color = False

insert_address_on_blank_page class-attribute instance-attribute

insert_address_on_blank_page = False

postage_type class-attribute instance-attribute

postage_type = ecopli

PostageTypePriority

Bases: StrEnum

Provider postage product codes (MySendingBox / La Poste scale).

ecopli class-attribute instance-attribute

ecopli = 'ecopli'

priority class-attribute instance-attribute

priority = 'prioritaire'

registered_letter class-attribute instance-attribute

registered_letter = 'lr'

registered_letter_with_receipt class-attribute instance-attribute

registered_letter_with_receipt = 'lrar'

PostalAccountKey

Bases: StrEnum

Postal provider account identifiers for API key routing.

mysendingbox_be_offline class-attribute instance-attribute

mysendingbox_be_offline = 'mysendingbox_be_offline'

mysendingbox_be_recovery class-attribute instance-attribute

mysendingbox_be_recovery = 'mysendingbox_be_recovery'

from_value classmethod

from_value(value)

Return a known member, or None for unknown string values.

Source code in components/emailing/subcomponents/postal_letter/protected/entities.py
@classmethod
def from_value(cls, value: str | PostalAccountKey) -> PostalAccountKey | None:
    """Return a known member, or None for unknown string values."""
    if isinstance(value, cls):
        return value
    try:
        return cls(value)
    except ValueError:
        return None

PostalAddress dataclass

PostalAddress(
    recipient_name, street, postal_code, city, country
)

Normalized recipient address for provider mapping layers.

city instance-attribute

city

country instance-attribute

country

postal_code instance-attribute

postal_code

recipient_name instance-attribute

recipient_name

street instance-attribute

street

__post_init__

__post_init__()

Strip fields and reject empty street, postal_code, city, or country.

Source code in components/emailing/subcomponents/postal_letter/protected/entities.py
def __post_init__(self) -> None:
    """Strip fields and reject empty street, postal_code, city, or country."""
    object.__setattr__(
        self,
        "street",
        _required_stripped_postal_field(self.street, field_name="street"),
    )
    object.__setattr__(
        self,
        "postal_code",
        _required_stripped_postal_field(self.postal_code, field_name="postal_code"),
    )
    object.__setattr__(
        self,
        "city",
        _required_stripped_postal_field(self.city, field_name="city"),
    )
    object.__setattr__(
        self,
        "country",
        _required_stripped_postal_field(self.country, field_name="country"),
    )
    object.__setattr__(
        self,
        "recipient_name",
        self.recipient_name.strip(),
    )

PostalContext dataclass

PostalContext(
    country_code, use_case_key, provider_mode="live"
)

Country / environment metadata for provider routing and auditing.

country_code instance-attribute

country_code

provider_mode class-attribute instance-attribute

provider_mode = 'live'

use_case_key instance-attribute

use_case_key

PostalLetterResult dataclass

PostalLetterResult(
    letter_id,
    file_url=None,
    file_page_count=None,
    postal_request_id=None,
)

Provider-neutral outcome of send, retrieve, or list postal operations.

file_page_count class-attribute instance-attribute

file_page_count = None

file_url class-attribute instance-attribute

file_url = None

letter_id instance-attribute

letter_id

postal_request_id class-attribute instance-attribute

postal_request_id = None

PostalRequestStatus dataclass

PostalRequestStatus(
    forced_requested_at,
    requested_at,
    shipped_at,
    error_code,
    error_message,
)

Read-only snapshot of one emailing.postal_request row.

error_code instance-attribute

error_code

error_message instance-attribute

error_message

forced_requested_at instance-attribute

forced_requested_at

requested_at instance-attribute

requested_at

shipped_at instance-attribute

shipped_at

PostalSendOptionsOverrides dataclass

PostalSendOptionsOverrides(
    in_color=NOT_SET,
    postage_type=NOT_SET,
    insert_address_on_blank_page=NOT_SET,
)

Use-case partial overrides. Resolver merges onto provider defaults.

in_color class-attribute instance-attribute

in_color = NOT_SET

insert_address_on_blank_page class-attribute instance-attribute

insert_address_on_blank_page = NOT_SET

postage_type class-attribute instance-attribute

postage_type = NOT_SET

PostalUseCaseKey

Bases: StrEnum

Supported postal letter use-case identifiers.

be_billing_recovery class-attribute instance-attribute

be_billing_recovery = 'be_billing_recovery'

be_claims_reimbursement_request_blocked class-attribute instance-attribute

be_claims_reimbursement_request_blocked = (
    "be_claims_reimbursement_request_blocked"
)

be_claims_severe_illness_approved class-attribute instance-attribute

be_claims_severe_illness_approved = (
    "be_claims_severe_illness_approved"
)

be_confirmation_pack class-attribute instance-attribute

be_confirmation_pack = 'be_confirmation_pack'

from_value classmethod

from_value(value)

Return a known member, or None for unknown string values.

Source code in components/emailing/subcomponents/postal_letter/protected/entities.py
@classmethod
def from_value(cls, value: str | PostalUseCaseKey) -> PostalUseCaseKey | None:
    """Return a known member, or None for unknown string values."""
    if isinstance(value, cls):
        return value
    try:
        return cls(value)
    except ValueError:
        return None

SendPostalLetterRequest dataclass

SendPostalLetterRequest(
    context,
    description,
    postal_address,
    source_file,
    in_color,
    postage_type,
    metadata,
    insert_address_on_blank_page=False,
    dry_run=False,
    store_pdf_locally=False,
)

Single send operation input for the postal provider.

context instance-attribute

context

description instance-attribute

description

dry_run class-attribute instance-attribute

dry_run = False

in_color instance-attribute

in_color

insert_address_on_blank_page class-attribute instance-attribute

insert_address_on_blank_page = False

metadata instance-attribute

metadata

postage_type instance-attribute

postage_type

postal_address instance-attribute

postal_address

source_file instance-attribute

source_file

store_pdf_locally class-attribute instance-attribute

store_pdf_locally = False

SourceFilePayload dataclass

SourceFilePayload(source_file_type, content)

Letter body input (file, template, remote URL, or HTML).

content instance-attribute

content

source_file_type instance-attribute

source_file_type

SourceFileType

Bases: StrEnum

How the PDF / HTML payload is provided to the provider API.

file class-attribute instance-attribute

file = 'file'

html class-attribute instance-attribute

html = 'html'

remote_url class-attribute instance-attribute

remote_url = 'remote'

template_id class-attribute instance-attribute

template_id = 'template_id'