@@ -34,17 +34,6 @@ def __init__(self, request: Callable, params: Dict[str, Any] = None):
3434 self ._params = params or {}
3535 self ._pagination_cache : Dict [str , Pagination ] = {}
3636
37- def _cache_pagination (self , response : Dict [str , Any ], page_key : str ) -> None :
38- """Extracts pagination dict from response, creates Pagination object, and caches it."""
39- pagination = response .get ("pagination" , {})
40-
41- if isinstance (pagination , dict ):
42- self ._pagination_cache [page_key ] = Pagination (
43- has_next_page = pagination .get ("has_next_page" , False ),
44- next_page_cursor = pagination .get ("next_page_cursor" ),
45- next_page_url = pagination .get ("next_page_url" ),
46- )
47-
4837 def first_page (self ) -> Tuple [List [Any ], Pagination | None ]:
4938 """Fetches the first page of results."""
5039 params = {
@@ -102,3 +91,14 @@ def flatten(self) -> Generator[Any, None, None]:
10291 current_items , pagination = self .next_page (pagination .next_page_cursor )
10392 if current_items :
10493 yield from current_items
94+
95+ def _cache_pagination (self , response : Dict [str , Any ], page_key : str ) -> None :
96+ """Extracts pagination dict from response, creates Pagination object, and caches it."""
97+ pagination = response .get ("pagination" , {})
98+
99+ if isinstance (pagination , dict ):
100+ self ._pagination_cache [page_key ] = Pagination (
101+ has_next_page = pagination .get ("has_next_page" , False ),
102+ next_page_cursor = pagination .get ("next_page_cursor" ),
103+ next_page_url = pagination .get ("next_page_url" ),
104+ )
0 commit comments