parseur.export_config ===================== .. py:module:: parseur.export_config Classes ------- .. autoapisummary:: parseur.export_config.ExportConfig Functions --------- .. autoapisummary:: parseur.export_config._export_type_value Module Contents --------------- .. py:function:: _export_type_value(value: Union[str, parseur.schemas.export_config.ExportType]) -> str .. py:class:: ExportConfig Manage a mailbox's export configurations and download their exports. An export config selects which columns (``items``) to export for the mailbox (``PARSER``) or one of its table fields (``PARSER_FIELD``). Use :meth:`available_fields` to discover the columns you can include, and :meth:`download` to fetch the resulting CSV/XLSX. .. py:method:: from_response(data: Dict) -> Dict :classmethod: Validate/deserialize an export config and resolve its download URLs. .. py:method:: iter(mailbox_id: int, *, api_key: Optional[str] = None) -> Iterable[Dict] :classmethod: Yield all export configurations of a mailbox (handles pagination). .. py:method:: list(mailbox_id: int, *, api_key: Optional[str] = None) -> List[Dict[str, Any]] :classmethod: Retrieve all export configurations of a mailbox as a list. .. py:method:: retrieve(mailbox_id: int, export_config_id: int, *, api_key: Optional[str] = None) -> Dict[str, Any] :classmethod: Retrieve a single export configuration by its ID. .. py:method:: create(mailbox_id: int, name: str, items: List[str], *, export_type: Union[str, parseur.schemas.export_config.ExportType] = ExportType.PARSER.value, parser_field_id: Optional[str] = None, api_key: Optional[str] = None) -> Dict[str, Any] :classmethod: Create an export configuration. :param mailbox_id: ID of the mailbox. :param name: Name of the export configuration. :param items: Columns to export (see :meth:`available_fields`). :param export_type: ``PARSER`` (document-level) or ``PARSER_FIELD`` (a table field). See :class:`ExportType`. :param parser_field_id: The table field id, required for ``PARSER_FIELD`` exports (e.g. "PF1"). :param api_key: Optional API key overriding the global one for this call. :return: The created export configuration. :raises marshmallow.ValidationError: If a value is invalid. .. py:method:: update(mailbox_id: int, export_config_id: int, *, api_key: Optional[str] = None, **fields: Any) -> Dict[str, Any] :classmethod: Update an export configuration. Only the fields you pass are changed. :param fields: Writable fields (``name``, ``type``, ``items``, ``parser_field_id``). :raises marshmallow.ValidationError: If a value is invalid or an unknown field is provided. .. py:method:: delete(mailbox_id: int, export_config_id: int, *, api_key: Optional[str] = None) -> bool :classmethod: Delete an export configuration. Returns True on success. .. py:method:: available_fields(mailbox_id: int, *, api_key: Optional[str] = None) -> List[Dict[str, Any]] :classmethod: List the groups of columns that can be exported for a mailbox. Returns one entry for the document-level export (``PARSER``) and one per table field (``PARSER_FIELD``), each with the ``items`` you can pass to :meth:`create`. .. py:method:: download(mailbox_id: int, export_config_id: int, fmt: str = 'csv', *, api_key: Optional[str] = None) -> bytes :classmethod: Download the configured export and return its raw bytes. :param fmt: ``"csv"`` (default) or ``"xlsx"`` (``"xls"`` is accepted). :return: The export file content as bytes.