Code formatting

This commit is contained in:
kdeng00
2025-08-28 15:55:54 -04:00
parent 3d3f7ffd90
commit 26013ddba5
2 changed files with 22 additions and 15 deletions
+3 -4
View File
@@ -442,10 +442,9 @@ impl CommitManager {
}
}
let queued_metadata_id = match up.queue_metadata(token, album, song, &queued_song_id).await {
Ok(id) => {
id
}
let queued_metadata_id = match up.queue_metadata(token, album, song, &queued_song_id).await
{
Ok(id) => id,
Err(err) => {
return Err(std::io::Error::other(err.to_string()));
}
+19 -11
View File
@@ -24,7 +24,7 @@ mod response {
#[derive(Debug, serde::Deserialize)]
pub struct Response {
pub message: String,
pub data: Vec<uuid::Uuid>
pub data: Vec<uuid::Uuid>,
}
}
}
@@ -152,7 +152,13 @@ impl Upload {
}
}
pub async fn queue_metadata(&self, token: &icarus_models::token::AccessToken, album: &icarus_models::album::collection::Album, song: &icarus_models::song::Song, queued_song_id: &uuid::Uuid) -> Result<uuid::Uuid, reqwest::Error> {
pub async fn queue_metadata(
&self,
token: &icarus_models::token::AccessToken,
album: &icarus_models::album::collection::Album,
song: &icarus_models::song::Song,
queued_song_id: &uuid::Uuid,
) -> Result<uuid::Uuid, reqwest::Error> {
let endpoint = String::from("api/v2/song/metadata/queue");
let url = format!("{}/{endpoint}", self.api.url);
@@ -174,23 +180,25 @@ impl Upload {
"year": album.year,
"duration": song.duration,
});
let client = reqwest::Client::builder().build().unwrap();
match client.post(url).headers(headers).json(&payload).send().await {
match client
.post(url)
.headers(headers)
.json(&payload)
.send()
.await
{
Ok(response) => match response.json::<response::queue_metadata::Response>().await {
Ok(resp) => {
println!("Message: {:?}", resp.message);
Ok(resp.data[0])
}
Err(err) => {
Err(err)
}
}
Err(err) => {
Err(err)
}
Err(err) => Err(err),
},
Err(err) => Err(err),
}
}