parseur.document ================ .. py:module:: parseur.document Classes ------- .. autoapisummary:: parseur.document.DocumentOrderKey parseur.document.Document Module Contents --------------- .. py:class:: DocumentOrderKey Bases: :py:obj:`str`, :py:obj:`enum.Enum` Enumeration 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. .. py:attribute:: NAME :value: 'name' .. py:attribute:: CREATED :value: 'created' .. py:attribute:: PROCESSED :value: 'processed' .. py:attribute:: STATUS :value: 'status' .. py:class:: Document Document resource providing class-based API access. .. py:method:: from_response(data: Dict) -> Dict :classmethod: Validate and deserialize a single document dict. .. py:method:: log_from_response(data: Dict) -> Dict :classmethod: Validate and deserialize a single document log dict. .. py:method:: upload_from_response(data: Dict) -> Dict :classmethod: Validate and deserialize a single document log dict. .. py:method:: iter(mailbox_id: int, *, search: Optional[str] = None, order_by: Optional[DocumentOrderKey] = None, ascending: bool = True, received_after: Optional[datetime.datetime] = None, received_before: Optional[datetime.datetime] = None, with_result: bool = False) -> Iterable[Dict] :classmethod: Yield all documents in a mailbox with pagination and filtering. :param mailbox_id: The mailbox ID to retrieve documents from. :param str search: 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 :param DocumentOrderKey order_by: Enum value specifying the sorting field. :param bool ascending: Whether to sort in ascending order (True) or descending order (False). :param datetime.datetime received_after: Filter for documents received after this date (converted to UTC YYYY-MM-DD). :param datetime.datetime received_before: Filter for documents received before this date (converted to UTC YYYY-MM-DD). :param bool with_result: Whether to include the parsed result in the returned documents. :yield dict: Each yielded dictionary represents a document. .. py:method:: list(mailbox_id: int, *, search: Optional[str] = None, order_by: Optional[DocumentOrderKey] = None, ascending: bool = True, received_after: Optional[datetime.datetime] = None, received_before: Optional[datetime.datetime] = None, with_result: bool = False) -> List[Dict] :classmethod: .. py:method:: retrieve(document_id: str) -> Dict :classmethod: Retrieve document details, deserialized. .. py:method:: reprocess(document_id: str) -> Dict :classmethod: .. py:method:: skip(document_id: str) -> Dict :classmethod: .. py:method:: copy(document_id: str, target_mailbox_id: int) -> Dict :classmethod: .. py:method:: logs(document_id: str) -> List[Dict] :classmethod: .. py:method:: delete(document_id: str) -> bool :classmethod: .. py:method:: upload_file(mailbox_id: int, file_path: str) -> Dict :classmethod: .. py:method:: batch_upload_files(file_paths: List[str], mailbox_id: int) -> Iterable[Dict] :classmethod: .. py:method:: upload_folder(mailbox_id: int, folder_path: str) -> Iterable[Dict] :classmethod: .. py:method:: upload_text(recipient: str, subject: str, sender: Optional[str] = None, body_html: Optional[str] = None, body_plain: Optional[str] = None) -> Dict :classmethod: