ds_protocol_graphql_py_lib.dataset.pagination.settings ====================================================== .. py:module:: ds_protocol_graphql_py_lib.dataset.pagination.settings .. autoapi-nested-parse:: **File:** ``settings.py`` **Region:** ``ds_protocol_graphql_py_lib/dataset/pagination/settings`` Pagination settings nests for GraphqlDataset read configuration. Example (Visma Business NXT style, ``pageInfo.endCursor``): >>> PaginationSettings( ... strategy=PaginationStrategy.CURSOR, ... items_path="data.useCompany.associate.items", ... cursor=CursorPaginationSettings( ... cursor_path="data.useCompany.associate.pageInfo.endCursor", ... has_next_path="data.useCompany.associate.pageInfo.hasNextPage", ... ), ... ) Example (Xledger style, cursor on last edge): >>> PaginationSettings( ... strategy=PaginationStrategy.CURSOR, ... items_path="data.customers.edges", ... cursor=CursorPaginationSettings( ... cursor_path="data.customers.edges.-1.cursor", ... has_next_path="data.customers.pageInfo.hasNextPage", ... ), ... ) Classes ------- .. autoapisummary:: ds_protocol_graphql_py_lib.dataset.pagination.settings.CursorPaginationSettings ds_protocol_graphql_py_lib.dataset.pagination.settings.PaginationSettings Module Contents --------------- .. py:class:: CursorPaginationSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` Configuration for cursor pagination via GraphQL variables. .. py:attribute:: cursor_path :type: str Dotted path on the full response body to the next cursor. Examples: ``data.x.pageInfo.endCursor`` (Relay ``endCursor``), or ``data.x.edges.-1.cursor`` for the cursor on the last edge when the API has no ``endCursor`` (e.g. Xledger). ``-1`` is the last list element; on an empty page it resolves to no cursor. .. py:attribute:: cursor_variable :type: str :value: 'after' GraphQL variable that receives the cursor. .. py:attribute:: page_size_variable :type: str | None :value: 'first' GraphQL variable that receives the page size. ``None`` to not send one. .. py:attribute:: page_size :type: int | None :value: 100 Requested page size. Never clamped; server rejections surface as errors. .. py:attribute:: has_next_path :type: str | None :value: None Optional path on the full response to a boolean "more pages" flag (e.g. ``data.x.pageInfo.hasNextPage``). When set, traversal stops when it is ``false``. When unset, traversal stops on an empty page or a missing / empty next cursor. .. py:class:: PaginationSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` Declared pagination mechanism and strategy-specific nest. Provide the nest matching ``strategy``. Absence of ``PaginationSettings`` on ``GraphqlReadSettings`` means a single request. .. py:attribute:: strategy :type: ds_protocol_graphql_py_lib.dataset.pagination.enums.PaginationStrategy Pagination mechanism. Declared explicitly; never inferred. .. py:attribute:: items_path :type: str Path on the full response to the page's record list, used for paging control (empty-page checks). Missing or null is an error. Also the default ``records_path`` for output when that is unset. .. py:attribute:: max_pages :type: int | None :value: None Optional safety ceiling on pages fetched per ``read()``. Exceeding it raises. Counted per call: a read that resumes from ``checkpoint["pagination"]`` may fetch up to ``max_pages`` more pages, so a large source drains over several runs. .. py:attribute:: cursor :type: CursorPaginationSettings | None :value: None Required when ``strategy`` is ``cursor``. .. py:method:: __post_init__() -> None .. py:method:: _selected_nest() -> CursorPaginationSettings | None .. py:property:: strategy_config :type: CursorPaginationSettings Strategy-specific nest for ``strategy`` (guaranteed by ``__post_init__``).