reminix.client.collect_all

async reminix.client.collect_all(fetch_page, initial_cursor=None)[source]

Collect all items from paginated endpoint into a list.

Parameters:
Return type:

list[TypeVar(T)]

Returns:

List of all items from all pages

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),
    )

all_events = await collect_all(fetch_events)