Move crates to toplevel directory

This commit is contained in:
Elias Projahn 2021-02-07 12:53:25 +01:00
parent d16961efa8
commit 0ffe68e04f
127 changed files with 15 additions and 13 deletions

17
client/src/persons.rs Normal file
View 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(())
}
}