@@ -34,17 +34,6 @@ def __init__(self, request: Callable, params: Dict[str, Any] = None):
34
34
self ._params = params or {}
35
35
self ._pagination_cache : Dict [str , Pagination ] = {}
36
36
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
-
48
37
def first_page (self ) -> Tuple [List [Any ], Pagination | None ]:
49
38
"""Fetches the first page of results."""
50
39
params = {
@@ -102,3 +91,14 @@ def flatten(self) -> Generator[Any, None, None]:
102
91
current_items , pagination = self .next_page (pagination .next_page_cursor )
103
92
if current_items :
104
93
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