ds_protocol_http_py_lib.dataset.pagination.settings =================================================== .. py:module:: ds_protocol_http_py_lib.dataset.pagination.settings .. autoapi-nested-parse:: **File:** ``settings.py`` **Region:** ``ds_protocol_http_py_lib/dataset/pagination/settings`` Pagination settings nests for HttpDataset read configuration. .. rubric:: Example >>> PaginationSettings( ... strategy=PaginationStrategy.OFFSET, ... items_path="data", ... offset=OffsetPaginationSettings(page_size=100, total_path="meta.total"), ... ) Attributes ---------- .. autoapisummary:: ds_protocol_http_py_lib.dataset.pagination.settings.StrategyConfig Classes ------- .. autoapisummary:: ds_protocol_http_py_lib.dataset.pagination.settings.OffsetPaginationSettings ds_protocol_http_py_lib.dataset.pagination.settings.PageNumberPaginationSettings ds_protocol_http_py_lib.dataset.pagination.settings.CursorPaginationSettings ds_protocol_http_py_lib.dataset.pagination.settings.PaginationSettings Module Contents --------------- .. py:data:: StrategyConfig .. py:class:: OffsetPaginationSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` Configuration for offset / limit pagination. .. py:attribute:: offset_param :type: str :value: 'offset' Query/body/header parameter name for the offset. .. py:attribute:: limit_param :type: str :value: 'limit' Query/body/header parameter name for the page size. .. py:attribute:: page_size :type: int :value: 100 Number of records requested per page. .. py:attribute:: initial_offset :type: int :value: 0 Offset used for the first page when no checkpoint exists. .. py:attribute:: total_path :type: str | None :value: None Optional body path to a total record count. When the path resolves, a non-empty page stops once ``offset + len(items) >= total``. The next offset advances by the rows returned, and the request still asks for ``page_size``. An empty page stops immediately. A short page ends the read only when this path is unset or missing. .. py:attribute:: inject_location :type: ds_protocol_http_py_lib.utils.http.request.InjectLocation Where offset and limit are injected on the request. .. py:class:: PageNumberPaginationSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` Configuration for page-number / page-size pagination. .. py:attribute:: page_param :type: str :value: 'page' Parameter name for the page ordinal. .. py:attribute:: page_size_param :type: str :value: 'per_page' Parameter name for the page size. .. py:attribute:: page_size :type: int :value: 100 Number of records requested per page. .. py:attribute:: start_page :type: int :value: 1 First page ordinal (0- or 1-based, must match the API). .. py:attribute:: total_pages_path :type: str | None :value: None Optional body path to a total page count. When the path resolves, a non-empty page stops on the last ordinal. An empty page stops immediately. A short page ends the read only when this path is unset or missing. .. py:attribute:: inject_location :type: ds_protocol_http_py_lib.utils.http.request.InjectLocation Where page and page size are injected on the request. .. py:class:: CursorPaginationSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` Configuration for opaque cursor / token pagination. .. py:attribute:: cursor_path :type: str Body path or header name where the next cursor is read. .. py:attribute:: cursor_source :type: ds_protocol_http_py_lib.dataset.pagination.enums.ExtractSource Whether the cursor is extracted from the response body or a header. .. py:attribute:: cursor_param :type: str :value: 'cursor' Parameter / header / body key used to inject the cursor. .. py:attribute:: cursor_location :type: ds_protocol_http_py_lib.utils.http.request.InjectLocation Where the cursor is injected on the next request. .. py:attribute:: page_size_param :type: str | None :value: None Optional page-size query parameter name (always injected as QUERY). .. py:attribute:: page_size :type: int | None :value: None Optional requested page size (sent with ``page_size_param``). .. py:class:: PaginationSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` Declared pagination mechanism and strategy-specific nests. Provide the nest matching ``strategy`` (same pattern as auth nests on ``HttpLinkedServiceSettings``). Other nests should be omitted from the payload; only the selected nest is read at runtime. .. py:attribute:: strategy :type: ds_protocol_http_py_lib.dataset.pagination.enums.PaginationStrategy Pagination mechanism. Declared explicitly; never inferred. .. py:attribute:: max_pages :type: int | None :value: None Optional client-side safety ceiling on pages fetched per ``read()``. ``None`` (default) means no ceiling — keep paging until the strategy signals stop (short page, total count, empty cursor, …). Set an ``int`` only when you want a hard guard against runaway loops. .. py:attribute:: items_path :type: str :value: 'data' Path to the record array used for paging control (stop / advance). Use ``$`` for a root array. Does not select what the deserializer sees. Each page frame is ``dataset.deserializer(response.content)``. .. py:attribute:: offset :type: OffsetPaginationSettings | None :value: None Required when ``strategy`` is ``offset``. .. py:attribute:: page_number :type: PageNumberPaginationSettings | None :value: None Required when ``strategy`` is ``page_number``. .. py:attribute:: cursor :type: CursorPaginationSettings | None :value: None Required when ``strategy`` is ``cursor``. .. py:method:: __post_init__() -> None .. py:method:: _selected_nest() -> StrategyConfig | None .. py:property:: strategy_config :type: StrategyConfig Strategy-specific nest for ``strategy`` (guaranteed by ``__post_init__``).