All checks were successful
Rust Build / Check (push) Successful in 33s
Rust Build / Check (pull_request) Successful in 35s
Rust Build / build (push) Successful in 41s
Release Tagging / release (push) Successful in 32s
Rust Build / Test Suite (push) Successful in 37s
Rust Build / Rustfmt (push) Successful in 26s
Rust Build / Clippy (push) Successful in 33s
Rust Build / Test Suite (pull_request) Successful in 35s
Rust Build / Rustfmt (pull_request) Successful in 27s
Rust Build / Clippy (pull_request) Successful in 31s
Rust Build / build (pull_request) Successful in 37s
Reviewed-on: #31 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
36 lines
912 B
Rust
36 lines
912 B
Rust
pub async fn update_queued_song(
|
|
base_url: &String,
|
|
song_path: &String,
|
|
song_queue_id: &uuid::Uuid,
|
|
) -> Result<reqwest::Response, reqwest::Error> {
|
|
let client = reqwest::Client::builder().build()?;
|
|
|
|
println!("Song path: {song_path:?}");
|
|
|
|
// TODO: Make the filename random
|
|
let form = reqwest::multipart::Form::new().part(
|
|
"file",
|
|
reqwest::multipart::Part::bytes(std::fs::read(song_path).unwrap())
|
|
.file_name("track01.flac"),
|
|
);
|
|
|
|
let url = format!("{base_url}/api/v2/song/queue/{song_queue_id}");
|
|
println!("Url: {url:?}");
|
|
|
|
let request = client.patch(url).multipart(form);
|
|
|
|
let response = request.send().await?;
|
|
|
|
Ok(response)
|
|
}
|
|
|
|
pub mod response {
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
pub struct Response {
|
|
pub message: String,
|
|
pub data: Vec<uuid::Uuid>,
|
|
}
|
|
}
|