mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-27 04:07:25 +01:00
Move crates to toplevel directory
This commit is contained in:
parent
d16961efa8
commit
0ffe68e04f
127 changed files with 15 additions and 13 deletions
17
client/src/persons.rs
Normal file
17
client/src/persons.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use crate::{Client, Result};
|
||||
use musicus_database::Person;
|
||||
|
||||
impl Client {
|
||||
/// Get all available persons from the server.
|
||||
pub async fn get_persons(&self) -> Result<Vec<Person>> {
|
||||
let body = self.get("persons").await?;
|
||||
let persons: Vec<Person> = serde_json::from_str(&body)?;
|
||||
Ok(persons)
|
||||
}
|
||||
|
||||
/// Post a new person to the server.
|
||||
pub async fn post_person(&self, data: &Person) -> Result<()> {
|
||||
self.post("persons", serde_json::to_string(data)?).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue