sedai.pagination

class PaginationConfig:

The pagination configuration for retrieving elements from a paginated API. Functions that support pagination accept this configuration as a named argument and return a PageIterator object that iterates over elements in the collection, by retrieving pages from the API based on the parameters set in this configuration.

page_size: int | None

The number of elements to fetch in a single page. Defaults to 20.

start: int | None

The page number to start fetching from.

order_by: str | None

The field to order the results by.

order_dir: str | None

The direction to order the results by. Can be either ASC or DESC.

num_pages: int | None

The number of pages to fetch. If None, all pages are fetched.

DEFAULT_PAGINATION_CONFIG = <PaginationConfig object>

The default pagination configuration. Fetches 20 elements per page until all pages are fetched.

class PageIterator(typing.Generic[~T]):

An iterator that fetches collections of elements in pages. The iterator makes subsequent API requests to fetch pages of elements until your code hits 'break', the end of the collection is reached, or the specified number of pages are fetched.

total_pages: int

The total number of pages in the collection.

def has_next(self):