mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-27 04:07:25 +01:00
client: Add extensive logging
This commit is contained in:
parent
2b95dbeadd
commit
ec47969aa9
9 changed files with 32 additions and 2 deletions
|
|
@ -1,9 +1,11 @@
|
|||
use crate::{Client, Result};
|
||||
use log::info;
|
||||
use musicus_database::Ensemble;
|
||||
|
||||
impl Client {
|
||||
/// Get all available ensembles from the server.
|
||||
pub async fn get_ensembles(&self) -> Result<Vec<Ensemble>> {
|
||||
info!("Get ensembles");
|
||||
let body = self.get("ensembles").await?;
|
||||
let ensembles: Vec<Ensemble> = serde_json::from_str(&body)?;
|
||||
Ok(ensembles)
|
||||
|
|
@ -11,6 +13,7 @@ impl Client {
|
|||
|
||||
/// Post a new ensemble to the server.
|
||||
pub async fn post_ensemble(&self, data: &Ensemble) -> Result<()> {
|
||||
info!("Post ensemble {:?}", data);
|
||||
self.post("ensembles", serde_json::to_string(data)?).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue