Code formatting
Some checks failed
Rust Build / Check (pull_request) Failing after 35s
Rust Build / Test Suite (pull_request) Failing after 36s
Rust Build / Rustfmt (pull_request) Successful in 27s
Rust Build / Clippy (pull_request) Failing after 32s
Rust Build / build (pull_request) Failing after 36s
Some checks failed
Rust Build / Check (pull_request) Failing after 35s
Rust Build / Test Suite (pull_request) Failing after 36s
Rust Build / Rustfmt (pull_request) Successful in 27s
Rust Build / Clippy (pull_request) Failing after 32s
Rust Build / build (pull_request) Failing after 36s
This commit is contained in:
32
src/main.rs
32
src/main.rs
@@ -31,9 +31,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
(coverart_queue_id, coverart_queue_path),
|
(coverart_queue_id, coverart_queue_path),
|
||||||
)) => {
|
)) => {
|
||||||
// TODO: Wipe data from song and coverart queues
|
// TODO: Wipe data from song and coverart queues
|
||||||
match wipe_data_from_queues(&app_base_url, &song_queue_id, &coverart_queue_id).await {
|
match wipe_data_from_queues(
|
||||||
Ok(_) => {
|
&app_base_url,
|
||||||
}
|
&song_queue_id,
|
||||||
|
&coverart_queue_id,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(_) => {}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("Error: {err:?}");
|
eprintln!("Error: {err:?}");
|
||||||
}
|
}
|
||||||
@@ -58,20 +63,23 @@ async fn main() -> Result<(), Box<dyn std::error::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> {
|
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 {
|
match the_rest::wipe_data::song_queue::wipe_data(app_base_url, song_queue_id).await {
|
||||||
Ok(response) => match response.json::<the_rest::wipe_data::song_queue::response::Response>().await {
|
Ok(response) => match response
|
||||||
|
.json::<the_rest::wipe_data::song_queue::response::Response>()
|
||||||
|
.await
|
||||||
|
{
|
||||||
Ok(_resp) => {
|
Ok(_resp) => {
|
||||||
println!("Wiped data from song queue");
|
println!("Wiped data from song queue");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||||
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()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,10 @@ pub mod create_coverart {
|
|||||||
|
|
||||||
pub mod wipe_data {
|
pub mod wipe_data {
|
||||||
pub mod song_queue {
|
pub mod song_queue {
|
||||||
pub async fn wipe_data(base_url: &String, song_queue_id: &uuid::Uuid) -> Result<reqwest::Response, reqwest::Error> {
|
pub async fn wipe_data(
|
||||||
|
base_url: &String,
|
||||||
|
song_queue_id: &uuid::Uuid,
|
||||||
|
) -> Result<reqwest::Response, reqwest::Error> {
|
||||||
let client = reqwest::Client::builder().build()?;
|
let client = reqwest::Client::builder().build()?;
|
||||||
let url = format!("{base_url}/api/v2/song/queue/data/wipe");
|
let url = format!("{base_url}/api/v2/song/queue/data/wipe");
|
||||||
let payload = serde_json::json!({
|
let payload = serde_json::json!({
|
||||||
|
Reference in New Issue
Block a user