@@ -27,12 +27,13 @@ use crate::client::s3::{
2727use crate :: client:: { GetOptionsExt , HttpClient , HttpError , HttpResponse } ;
2828use crate :: gcp:: credential:: CredentialExt ;
2929use crate :: gcp:: { GcpCredential , GcpCredentialProvider , GcpSigningCredentialProvider , STORE } ;
30+ use crate :: list:: { PaginatedListOptions , PaginatedListResult } ;
3031use crate :: multipart:: PartId ;
31- use crate :: path:: { Path , DELIMITER } ;
32+ use crate :: path:: Path ;
3233use crate :: util:: hex_encode;
3334use crate :: {
34- Attribute , Attributes , ClientOptions , GetOptions , ListResult , MultipartId , PutMode ,
35- PutMultipartOpts , PutOptions , PutPayload , PutResult , Result , RetryConfig ,
35+ Attribute , Attributes , ClientOptions , GetOptions , MultipartId , PutMode , PutMultipartOpts ,
36+ PutOptions , PutPayload , PutResult , Result , RetryConfig ,
3637} ;
3738use async_trait:: async_trait;
3839use base64:: prelude:: BASE64_STANDARD ;
@@ -652,38 +653,43 @@ impl ListClient for Arc<GoogleCloudStorageClient> {
652653 async fn list_request (
653654 & self ,
654655 prefix : Option < & str > ,
655- delimiter : bool ,
656- page_token : Option < & str > ,
657- offset : Option < & str > ,
658- ) -> Result < ( ListResult , Option < String > ) > {
656+ opts : PaginatedListOptions ,
657+ ) -> Result < PaginatedListResult > {
659658 let credential = self . get_credential ( ) . await ?;
660659 let url = format ! ( "{}/{}" , self . config. base_url, self . bucket_name_encoded) ;
661660
662661 let mut query = Vec :: with_capacity ( 5 ) ;
663662 query. push ( ( "list-type" , "2" ) ) ;
664- if delimiter {
665- query. push ( ( "delimiter" , DELIMITER ) )
663+ if let Some ( delimiter ) = & opts . delimiter {
664+ query. push ( ( "delimiter" , delimiter . as_ref ( ) ) )
666665 }
667666
668- if let Some ( prefix) = & prefix {
667+ if let Some ( prefix) = prefix {
669668 query. push ( ( "prefix" , prefix) )
670669 }
671670
672- if let Some ( page_token) = page_token {
671+ if let Some ( page_token) = & opts . page_token {
673672 query. push ( ( "continuation-token" , page_token) )
674673 }
675674
676675 if let Some ( max_results) = & self . max_list_results {
677676 query. push ( ( "max-keys" , max_results) )
678677 }
679678
680- if let Some ( offset) = offset {
681- query. push ( ( "start-after" , offset) )
679+ if let Some ( offset) = & opts. offset {
680+ query. push ( ( "start-after" , offset. as_ref ( ) ) )
681+ }
682+
683+ let max_keys_str;
684+ if let Some ( max_keys) = & opts. max_keys {
685+ max_keys_str = max_keys. to_string ( ) ;
686+ query. push ( ( "max-keys" , max_keys_str. as_ref ( ) ) )
682687 }
683688
684689 let response = self
685690 . client
686691 . request ( Method :: GET , url)
692+ . extensions ( opts. extensions )
687693 . query ( & query)
688694 . with_bearer_auth ( credential. as_deref ( ) )
689695 . send_retry ( & self . config . retry_config )
@@ -698,6 +704,9 @@ impl ListClient for Arc<GoogleCloudStorageClient> {
698704 . map_err ( |source| Error :: InvalidListResponse { source } ) ?;
699705
700706 let token = response. next_continuation_token . take ( ) ;
701- Ok ( ( response. try_into ( ) ?, token) )
707+ Ok ( PaginatedListResult {
708+ result : response. try_into ( ) ?,
709+ page_token : token,
710+ } )
702711 }
703712}
0 commit comments