# ovok_sdk.paging

Canonical page: https://docs.ovok.com/python-sdk/reference/paging

Paged results and the loaders for each list format Ovok returns.

## Page [#page]

```python
Page(data: list[T], total: int | None, _load_next: NextPage[T] | None = None)
```

Bases: `Generic[T]`

One page of a list, able to load the pages after it.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `data` | `list[T]` | Items on this page. |
| `total` | `int \| None` | Total number of items across all pages, when the API reports it. |

**Examples**

```python
>>> for patient in ovok.fhir.search("Patient").auto_paging_iter():
...     print(patient["id"])
```

### has_more [#has_more]

```python
has_more: bool
```

Whether a later page exists.

### next_page() [#next_page]

```python
next_page() -> Page[T] | None
```

Load the next page.

**Returns**

- `Page[T] | None`: The next page, or None when this is the last one.

### auto_paging_iter() [#auto_paging_iter]

```python
auto_paging_iter() -> Iterator[T]
```

Every item from this page on, loading each later page as the walk reaches it.

**Yields**

- `T`: Each item, in order.

## bundle_page() [#bundle_page]

```python
bundle_page(bundle: Json, load_next: Callable[[str], Page[Any]]) -> Page[Any]
```

Follows the next link by its query only: Medplum writes its own host there, and Ovok is the only door.

## numbered_pages() [#numbered_pages]

```python
numbered_pages(
    load: Callable[[int], Json],
    first_page: int = FIRST_NUMBERED_PAGE,
) -> Page[Any]
```

Ovok's page-numbered lists: `{total, page, count, resources}` with `page` 0-based.

## numbered_route_pages() [#numbered_route_pages]

```python
numbered_route_pages(
    read: Callable[[str], Json],
    path: str,
    query: Mapping[str, QueryValue],
) -> Page[Any]
```

Lists a page-numbered route with Ovok's query encoding; `query["page"]` is the first page loaded.

## cursor_pages() [#cursor_pages]

```python
cursor_pages(load: Callable[[str | None], Json]) -> Page[Any]
```

Ovok's cursor lists: `{items, nextCursor}`, with the cursor passed back unchanged.

## payload_pages() [#payload_pages]

```python
payload_pages(
    load: Callable[[int | None], Json],
    first_page: int | None = None,
) -> Page[Any]
```

Payload CMS lists: `{docs, totalDocs, nextPage}` with 1-based pages.
