From 3d3568d5a5af79d42ed1b9542faf1769a7ac01c4 Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 11 Aug 2026 10:20:29 -0400 Subject: [PATCH] Added code for deleting object from storage --- src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d308129..40cf13c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,6 +47,7 @@ pub enum Error { } impl Labyrinth { + /// Upload object to the bucket pub async fn upload( &self, file_key: &str, @@ -77,6 +78,7 @@ impl Labyrinth { } } + /// Download object from the bucket pub async fn download(&self, file_key: &str) -> Result, Error> { let client = init_client(&self.config).await; @@ -103,4 +105,18 @@ impl Labyrinth { Err(err) => Err(Error::Info(err.to_string())), } } + + /// Delete an object from the bucket + pub async fn delete(&self, file_key: &str) -> Result { + let client = init_client(&self.config).await; + + match client.delete_object().bucket(self.config.bucket.clone()).key(file_key).send().await { + Ok(response) => { + Ok(response) + } + Err(err) => { + Err(Error::Info(err.to_string())) + } + } + } }