Split into multiple crates

This commit is contained in:
Elias Projahn 2021-02-04 21:47:22 +01:00
parent d7fb996183
commit 5d06ec9faf
88 changed files with 501 additions and 528 deletions

View file

@ -0,0 +1,17 @@
use crate::{Client, Result};
use musicus_database::Work;
impl Client {
/// Get all available works from the server.
pub async fn get_works(&self, composer_id: &str) -> Result<Vec<Work>> {
let body = self.get(&format!("persons/{}/works", composer_id)).await?;
let works: Vec<Work> = 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(())
}
}