limitry.client.collect_all¶
- async limitry.client.collect_all(fetch_page, initial_cursor=None)[source]¶
Collect all items from paginated endpoint into a list.
- Parameters:
- Return type:
- 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)