use serde::Serialize;
use super::models::{ClosetItem, ClosetQuery, PaginatedList};
use super::{Authed, NameBody};
use crate::error::Result;
#[derive(Serialize)]
struct TidBody {
tid: u64,
}
impl<'a> Authed<'a> {
pub async fn closet(&self, query: &ClosetQuery) -> Result<PaginatedList<ClosetItem>> {
self.get_envelope_query("/closet", query).await
}
pub async fn add_to_closet(&self, tid: u64) -> Result<()> {
self.post_unit("/closet", &TidBody { tid }).await
}
pub async fn rename_closet_item(&self, tid: u64, name: &str) -> Result<()> {
self.put_unit(&format!("/closet/{tid}"), &NameBody { name })
.await
}
pub async fn remove_from_closet(&self, tid: u64) -> Result<()> {
self.delete_unit(&format!("/closet/{tid}")).await
}
}