From 3b391067f9b79dc4cca83614e71b929adeed795f Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 15 Jul 2025 15:40:42 -0400 Subject: [PATCH] Code formatting --- src/main.rs | 32 ++++++++++++++++++++------------ src/the_rest.rs | 19 +++++++++++-------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/main.rs b/src/main.rs index cd890ca..226db68 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,9 +31,14 @@ async fn main() -> Result<(), Box> { (coverart_queue_id, coverart_queue_path), )) => { // TODO: Wipe data from song and coverart queues - match wipe_data_from_queues(&app_base_url, &song_queue_id, &coverart_queue_id).await { - Ok(_) => { - } + match wipe_data_from_queues( + &app_base_url, + &song_queue_id, + &coverart_queue_id, + ) + .await + { + Ok(_) => {} Err(err) => { eprintln!("Error: {err:?}"); } @@ -58,20 +63,23 @@ async fn main() -> Result<(), Box> { } } -async fn wipe_data_from_queues(app_base_url: &String, song_queue_id: &uuid::Uuid, coverart_queue_id: &uuid::Uuid) -> Result<(), std::io::Error> { +async fn wipe_data_from_queues( + app_base_url: &String, + song_queue_id: &uuid::Uuid, + coverart_queue_id: &uuid::Uuid, +) -> Result<(), std::io::Error> { match the_rest::wipe_data::song_queue::wipe_data(app_base_url, song_queue_id).await { - Ok(response) => match response.json::().await { + Ok(response) => match response + .json::() + .await + { Ok(_resp) => { println!("Wiped data from song queue"); Ok(()) } - Err(err) => { - Err(std::io::Error::other(err.to_string())) - } - } - Err(err) => { - Err(std::io::Error::other(err.to_string())) - } + Err(err) => Err(std::io::Error::other(err.to_string())), + }, + Err(err) => Err(std::io::Error::other(err.to_string())), } } diff --git a/src/the_rest.rs b/src/the_rest.rs index d3490fc..b5fa85f 100644 --- a/src/the_rest.rs +++ b/src/the_rest.rs @@ -76,15 +76,18 @@ pub mod create_coverart { pub mod wipe_data { pub mod song_queue { - pub async fn wipe_data(base_url: &String, song_queue_id: &uuid::Uuid) -> Result { - let client = reqwest::Client::builder().build()?; - let url = format!("{base_url}/api/v2/song/queue/data/wipe"); - let payload = serde_json::json!({ - "song_queue_id": song_queue_id - }); - let request = client.patch(url).json(&payload); + pub async fn wipe_data( + base_url: &String, + song_queue_id: &uuid::Uuid, + ) -> Result { + let client = reqwest::Client::builder().build()?; + let url = format!("{base_url}/api/v2/song/queue/data/wipe"); + let payload = serde_json::json!({ + "song_queue_id": song_queue_id + }); + let request = client.patch(url).json(&payload); - request.send().await + request.send().await } pub mod response {