parseur.document¶
Classes¶
Enumeration of supported document sorting keys. |
|
Document resource providing class-based API access. |
Module Contents¶
- class parseur.document.DocumentOrderKey[source]¶
Bases:
str,enum.EnumEnumeration of supported document sorting keys.
Used with the order_by parameter to specify sorting in list_documents and yield_documents.
Members:
NAME: Sort by document name.
CREATED: Sort by created/received date.
PROCESSED: Sort by processed date.
STATUS: Sort by document status.
- class parseur.document.Document[source]¶
Document resource providing class-based API access.
- classmethod from_response(data: Dict) Dict[source]¶
Validate and deserialize a single document dict.
- classmethod log_from_response(data: Dict) Dict[source]¶
Validate and deserialize a single document log dict.
- classmethod upload_from_response(data: Dict) Dict[source]¶
Validate and deserialize a single document log dict.
- classmethod iter(mailbox_id: int, *, search: str | None = None, order_by: DocumentOrderKey | None = None, ascending: bool = True, received_after: datetime.datetime | None = None, received_before: datetime.datetime | None = None, with_result: bool = False) Iterable[Dict][source]¶
Yield all documents in a mailbox with pagination and filtering.
- Parameters:
mailbox_id – The mailbox ID to retrieve documents from.
search (str) –
Search string to filter documents. The search query parameter searches the following properties:
document id (exact match)
document name
template name
from, to, cc, and bcc email addresses
document metadata header
order_by (DocumentOrderKey) – Enum value specifying the sorting field.
ascending (bool) – Whether to sort in ascending order (True) or descending order (False).
received_after (datetime.datetime) – Filter for documents received after this date (converted to UTC YYYY-MM-DD).
received_before (datetime.datetime) – Filter for documents received before this date (converted to UTC YYYY-MM-DD).
with_result (bool) – Whether to include the parsed result in the returned documents.
- Yield dict:
Each yielded dictionary represents a document.
- classmethod list(mailbox_id: int, *, search: str | None = None, order_by: DocumentOrderKey | None = None, ascending: bool = True, received_after: datetime.datetime | None = None, received_before: datetime.datetime | None = None, with_result: bool = False) List[Dict][source]¶