@@ -144,7 +144,17 @@ def next_page_info(self) -> Optional[PageInfo]:
144
144
length = len (self ._get_page_items ())
145
145
current_count = offset + length
146
146
147
- return PageInfo (params = {"offset" : current_count })
147
+ count = None
148
+ if self .paging is not None : # pyright: ignore[reportUnnecessaryComparison]
149
+ if self .paging .count is not None :
150
+ count = self .paging .count
151
+ if count is None :
152
+ return None
153
+
154
+ if current_count < count :
155
+ return PageInfo (params = {"offset" : current_count })
156
+
157
+ return None
148
158
149
159
150
160
class AsyncIndividualsPage (BaseAsyncPage [_T ], BasePage [_T ], Generic [_T ]):
@@ -171,7 +181,17 @@ def next_page_info(self) -> Optional[PageInfo]:
171
181
length = len (self ._get_page_items ())
172
182
current_count = offset + length
173
183
174
- return PageInfo (params = {"offset" : current_count })
184
+ count = None
185
+ if self .paging is not None : # pyright: ignore[reportUnnecessaryComparison]
186
+ if self .paging .count is not None :
187
+ count = self .paging .count
188
+ if count is None :
189
+ return None
190
+
191
+ if current_count < count :
192
+ return PageInfo (params = {"offset" : current_count })
193
+
194
+ return None
175
195
176
196
177
197
class SyncPage (BaseSyncPage [_T ], BasePage [_T ], Generic [_T ]):
@@ -197,7 +217,17 @@ def next_page_info(self) -> Optional[PageInfo]:
197
217
length = len (self ._get_page_items ())
198
218
current_count = offset + length
199
219
200
- return PageInfo (params = {"offset" : current_count })
220
+ count = None
221
+ if self .paging is not None : # pyright: ignore[reportUnnecessaryComparison]
222
+ if self .paging .count is not None :
223
+ count = self .paging .count
224
+ if count is None :
225
+ return None
226
+
227
+ if current_count < count :
228
+ return PageInfo (params = {"offset" : current_count })
229
+
230
+ return None
201
231
202
232
203
233
class AsyncPage (BaseAsyncPage [_T ], BasePage [_T ], Generic [_T ]):
@@ -223,4 +253,14 @@ def next_page_info(self) -> Optional[PageInfo]:
223
253
length = len (self ._get_page_items ())
224
254
current_count = offset + length
225
255
226
- return PageInfo (params = {"offset" : current_count })
256
+ count = None
257
+ if self .paging is not None : # pyright: ignore[reportUnnecessaryComparison]
258
+ if self .paging .count is not None :
259
+ count = self .paging .count
260
+ if count is None :
261
+ return None
262
+
263
+ if current_count < count :
264
+ return PageInfo (params = {"offset" : current_count })
265
+
266
+ return None
0 commit comments