Skip to main content

Module pagination

Module pagination 

Source
Expand description

Cursor-based pagination primitives.

WorkOS list endpoints return a JSON envelope of the form { "data": [...], "list_metadata": { "before": ..., "after": ... } }. The two structs in this module model that envelope; auto_paginate drives a paginated endpoint to exhaustion as an async stream so callers don’t have to manage the cursor manually.

Structs§

ListMetadata
Cursor pair attached to every list response. Pass Self::after (or Self::before) back as the after/before query parameter on the next request to advance through the result set.
Page
One page of a paginated list response. data holds the items and list_metadata carries the cursor used to fetch the next page.

Functions§

auto_paginate
Drive a paginated endpoint to exhaustion as an async stream of items.