@@ -263,7 +263,7 @@ class _BasePageIterator(Iterator[Sequence[I]]):
263263 def __init__ (self ,
264264 client : CloudantV1 ,
265265 operation : Callable [..., DetailedResponse ],
266- page_opts : list [str ],
266+ page_opts : Sequence [str ],
267267 opts : dict ):
268268 self ._client : CloudantV1 = client
269269 self ._has_next : bool = True
@@ -318,7 +318,7 @@ def _get_next_page_options(self, result: R) -> dict:
318318class _KeyPageIterator (_BasePageIterator , Generic [K ]):
319319
320320 def __init__ (self , client : CloudantV1 , operation : Callable [..., DetailedResponse ], opts : dict ):
321- super ().__init__ (client , operation , [ ' start_key' , 'start_key_doc_id' ] , opts )
321+ super ().__init__ (client , operation , ( 'skip' , ' start_key' , 'start_key_doc_id' ,) , opts )
322322 self ._boundary_failure : Optional [str ] = None
323323
324324 def _next_request (self ) -> list [I ]:
@@ -353,8 +353,8 @@ def check_boundary(self, penultimate_item: I, last_item: I) -> Optional[str]:
353353
354354class _BookmarkPageIterator (_BasePageIterator ):
355355
356- def __init__ (self , client : CloudantV1 , operation : Callable [..., DetailedResponse ], opts : dict ):
357- super ().__init__ (client , operation , [ 'bookmark' ] , opts )
356+ def __init__ (self , client : CloudantV1 , operation : Callable [..., DetailedResponse ], opts : dict , extra_page_opts : Sequence [ str ] = () ):
357+ super ().__init__ (client , operation , ( 'bookmark' ,) + extra_page_opts , opts )
358358
359359 def _get_next_page_options (self , result : R ) -> dict :
360360 return {'bookmark' : result .bookmark }
@@ -391,6 +391,12 @@ def __init__(self, client: CloudantV1, opts: dict):
391391
392392class _FindBasePageIterator (_BookmarkPageIterator ):
393393
394+ def __init__ (self , client : CloudantV1 , operation : Callable [..., DetailedResponse ], opts : dict ):
395+ # Find requests allow skip, but it should only be used on the first request.
396+ # Since we don't want it on subsequent page requests we need to exclude it from
397+ # fixed opts used for the partial function.
398+ super ().__init__ (client , operation , opts , extra_page_opts = ('skip' ,))
399+
394400 def _items (self , result : FindResult ):
395401 return result .docs
396402
0 commit comments