limitry.client.paginate_all

async limitry.client.paginate_all(fetch_page, initial_cursor=None)[source]

Iterator helper for auto-pagination.

Automatically fetches all pages using cursor-based pagination.

Parameters:
Yields:

Individual items from all pages

Return type:

AsyncGenerator[TypeVar(T), None]

Example:

async def fetch_events(cursor: Optional[str] = None):
    response = await client.request("GET", "/events", params={"cursor": cursor})
    return PaginatedResponse(
        data=response["data"],
        next_cursor=response.get("nextCursor"),
        has_more=response.get("hasMore", False),
    )

async for event in paginate_all(fetch_events):
    print(event.id)