mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-27 20:27:25 +01:00
Split into multiple crates
This commit is contained in:
parent
d7fb996183
commit
5d06ec9faf
88 changed files with 501 additions and 528 deletions
|
|
@ -1,16 +0,0 @@
|
|||
use crate::backend::{Backend, Result, Work};
|
||||
|
||||
impl Backend {
|
||||
/// 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(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue