- async symphony.bdk.core.service.pagination.cursor_based_pagination(func: Callable[[int, str], Awaitable[Tuple[symphony.bdk.core.service.pagination.T, str]]], chunk_size=100, max_number=None) AsyncGenerator[symphony.bdk.core.service.pagination.T, None] #
Creates an asynchronous generator from a cursor based endpoint. The generator makes the call to the underlying endpoint func until the max_number of items is reached or results are exhausted (i.e. cursor returned by func is None).
func – a coroutine taking two int parameters: limit (max number for items to retrieve in one call) and after (for cursor based pagination). It must return a tuple (result, after) where result is a list containing the actual results in the chunk and after is the new cursor which will be passed to the next call to func.
chunk_size – the maximum number of elements to retrieve in one call.
max_number – the maximum total number of items to retrieve. If not specified or set to None, it will fetch all items until we retrieved all elements.
an asynchronous generator of elements which makes the calls to func with the correct parameters.