File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/common-library/src/common_library Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,20 @@ def iter_pagination_params(
3434 offset : NonNegativeInt = 0 ,
3535 total_number_of_items : NonNegativeInt | None = None ,
3636) -> Iterable [PageParams ]:
37+ """Iterates through pages of a collection by yielding PageParams for each page.
38+
39+ Args:
40+ limit: The maximum number of items to return in a single page.
41+ offset: The number of items to skip before starting to collect the items for the current page.
42+ total_number_of_items: The total count of items in the collection being paginated.
43+ Must be set during the first iteration if not provided initially.
44+
45+ Yields:
46+ PageParams for each page in the collection.
47+
48+ Raises:
49+ RuntimeError: If total_number_of_items is not set before first iteration or if it changes between iterations.
50+ """
3751
3852 kwargs = {}
3953 if total_number_of_items :
You can’t perform that action at this time.
0 commit comments