@@ -15,8 +15,8 @@ class Paginator:
15
15
16
16
def __init__ (
17
17
self ,
18
+ client : SeamHttpClient ,
18
19
request : Callable ,
19
- http_client : SeamHttpClient ,
20
20
params : Dict [str , Any ] = None ,
21
21
):
22
22
"""
@@ -28,17 +28,17 @@ def __init__(
28
28
params: Initial parameters to pass to the callable function.
29
29
"""
30
30
self ._request = request
31
- self ._http_client = http_client
31
+ self .client = client
32
32
self ._params = params or {}
33
33
self ._pagination_cache : Dict [str , Pagination ] = {}
34
34
35
35
def first_page (self ) -> Tuple [List [Any ], Pagination | None ]:
36
36
"""Fetches the first page of results."""
37
- self ._http_client .hooks ["response" ].append (
37
+ self .client .hooks ["response" ].append (
38
38
lambda response : self ._cache_pagination (response , self ._FIRST_PAGE )
39
39
)
40
40
data = self ._request (** self ._params )
41
- self ._http_client .hooks ["response" ].pop ()
41
+ self .client .hooks ["response" ].pop ()
42
42
43
43
pagination = self ._pagination_cache .get (self ._FIRST_PAGE )
44
44
@@ -54,11 +54,11 @@ def next_page(self, next_page_cursor: str) -> Tuple[List[Any], Pagination | None
54
54
"page_cursor" : next_page_cursor ,
55
55
}
56
56
57
- self ._http_client .hooks ["response" ].append (
57
+ self .client .hooks ["response" ].append (
58
58
lambda response : self ._cache_pagination (response , next_page_cursor )
59
59
)
60
60
data = self ._request (** params )
61
- self ._http_client .hooks ["response" ].pop ()
61
+ self .client .hooks ["response" ].pop ()
62
62
63
63
pagination = self ._pagination_cache .get (next_page_cursor )
64
64
0 commit comments