use super::Backend; use crate::database::Work; use anyhow::Result; impl Backend { /// Get all available works from the server. pub async fn get_works(&self, composer_id: &str) -> Result> { let body = self.get(&format!("persons/{}/works", composer_id)).await?; let works: Vec = serde_json::from_str(&body)?; Ok(works) } /// Post a new work to the server. pub async fn post_work(&self, data: &Work) -> Result<()> { self.post("works", serde_json::to_string(data)?).await?; Ok(()) } }