mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-27 04:07:25 +01:00
Revert merging of server and client repository
This commit is contained in:
parent
2b9cff885b
commit
8c3c439409
147 changed files with 53 additions and 2113 deletions
18
src/backend/client/instruments.rs
Normal file
18
src/backend/client/instruments.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use super::Backend;
|
||||
use crate::database::Instrument;
|
||||
use anyhow::Result;
|
||||
|
||||
impl Backend {
|
||||
/// Get all available instruments from the server.
|
||||
pub async fn get_instruments(&self) -> Result<Vec<Instrument>> {
|
||||
let body = self.get("instruments").await?;
|
||||
let instruments: Vec<Instrument> = serde_json::from_str(&body)?;
|
||||
Ok(instruments)
|
||||
}
|
||||
|
||||
/// Post a new instrument to the server.
|
||||
pub async fn post_instrument(&self, data: &Instrument) -> Result<()> {
|
||||
self.post("instruments", serde_json::to_string(data)?).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue