Pagination¶
The Compliance API uses two pagination shapes. Cursor pages (Activity
Feed, Chats, Messages) and offset pages (everything else). Both are
modelled here as generic dataclasses, and every paginated resource
ships a .list() method returning one page and a .iter() method
that auto-paginates.
pagination ¶
Pagination primitives for the Compliance API.
The Compliance API uses two pagination shapes:
CursorPage— used by Activity Feed, Chats, and Messages. Each page payload carriesfirst_id,last_id, andhas_more. Forward viaafter_id=last_id; backward viabefore_id=first_id.OffsetPage— used by everything else paginated. Each page payload carries an opaquenext_pagetoken; pass it back as thepagequery parameter to fetch the next page.
Both page classes are plain dataclasses (no Pydantic)
parameterised over the item type T. They are used identically by
sync and async resources.
Each paginated resource also exposes an .iter() method that drives
these pages for you: it fetches consecutive pages and yields items one
at a time, so you rarely need to construct a page object yourself.
CursorPage
dataclass
¶
Bases: Generic[T]
A single cursor-paginated page.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
list[T]
|
Decoded items from the page's |
first_id |
str | None
|
ID of the first item in the page (server-side).
|
last_id |
str | None
|
ID of the last item in the page. Pass as |
has_more |
bool
|
Server-supplied flag indicating whether further pages exist after this one. |
from_dict
classmethod
¶
Build a CursorPage from a decoded response body.
OffsetPage
dataclass
¶
Bases: Generic[T]
A single offset-paginated page.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
list[T]
|
Decoded items from the page's |
has_more |
bool
|
Server-supplied flag indicating whether further pages
exist after this one. Equivalent to
|
next_page |
str | None
|
Opaque pagination token returned by the server.
Pass it as the |
from_dict
classmethod
¶
Build an OffsetPage from a decoded response body.