symphony.bdk.core.service.pagination.offset_based_pagination#

async symphony.bdk.core.service.pagination.offset_based_pagination(func: Callable[[int, int], Awaitable[symphony.bdk.core.service.pagination.T]], chunk_size=50, max_number=None) AsyncGenerator[symphony.bdk.core.service.pagination.T, None]#

Creates an asynchronous generator from a paginated 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. func is None or empty).

Parameters
  • func – a coroutine taking two int parameters: skip (a.k.a offset) and limit (max number for items to retrieve in one call) and returning a list.

  • 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.

Returns

an asynchronous generator of elements which makes the calls to func with the correct parameters.