From c304ae6d6561e100ceb1da944b10b1a82b588ab8 Mon Sep 17 00:00:00 2001 From: giangndm <45644921+giangndm@users.noreply.github.com> Date: Sat, 20 Jul 2024 13:50:25 +0700 Subject: [PATCH] Add with_delimiter for list method (#104) Co-authored-by: Paolo Barbolini --- src/actions/list_objects_v2.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/actions/list_objects_v2.rs b/src/actions/list_objects_v2.rs index 0ef5d4d..1f1d2ab 100644 --- a/src/actions/list_objects_v2.rs +++ b/src/actions/list_objects_v2.rs @@ -118,6 +118,19 @@ impl<'a> ListObjectsV2<'a> { self.query_mut().insert("prefix", prefix); } + /// A delimiter is a character that you use to group keys. + /// + /// See https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#API_ListObjectsV2_RequestSyntax for more infos. + /// # Example + /// ``` + /// # let bucket = rusty_s3::Bucket::new(url::Url::parse("http://rusty_s3/").unwrap(), rusty_s3::UrlStyle::Path, "doggo", "doggoland").unwrap(); + /// let mut list = bucket.list_objects_v2(None); + /// list.with_delimiter("/"); + /// ``` + pub fn with_delimiter(&mut self, delimiter: impl Into>) { + self.query_mut().insert("delimiter", delimiter); + } + /// StartAfter is where you want Amazon S3 to start listing from. /// Amazon S3 starts listing after this specified key. /// StartAfter can be any key in the bucket.