objectstore_client/
delete.rs

1use crate::Session;
2
3/// The result from a successful [`delete()`](Session::delete) call.
4pub type DeleteResponse = ();
5
6impl Session {
7    /// Deletes the object with the given `key`.
8    pub fn delete(&self, key: &str) -> DeleteBuilder {
9        DeleteBuilder {
10            session: self.clone(),
11            key: key.to_owned(),
12        }
13    }
14}
15
16/// A [`delete`](Session::delete) request builder.
17#[derive(Debug)]
18pub struct DeleteBuilder {
19    session: Session,
20    key: String,
21}
22
23impl DeleteBuilder {
24    /// Sends the delete request.
25    pub async fn send(self) -> crate::Result<DeleteResponse> {
26        self.session
27            .request(reqwest::Method::DELETE, &self.key)
28            .send()
29            .await?;
30        Ok(())
31    }
32}