use serde_json::Value;
use crate::client::{encode_path_segment, Client};
use crate::error::Error;
use crate::types::{CreateFolderParams, UpdateFolderParams};
#[derive(Debug, Clone, Copy)]
pub struct Folders<'a> {
pub(crate) client: &'a Client,
}
impl Folders<'_> {
pub async fn list(&self) -> Result<Value, Error> {
self.client.get("/folders", Vec::new()).await
}
pub async fn create(&self, params: CreateFolderParams) -> Result<Value, Error> {
self.client.post_json("/folders", ¶ms).await
}
pub async fn update(&self, id: &str, params: UpdateFolderParams) -> Result<Value, Error> {
self.client
.patch_json(&format!("/folders/{}", encode_path_segment(id)), ¶ms)
.await
}
pub async fn delete(&self, id: &str) -> Result<Value, Error> {
self.client
.delete(&format!("/folders/{}", encode_path_segment(id)))
.await
}
}