update queued song (#28)
All checks were successful
Rust Build / build (push) Successful in 41s
Rust Build / Check (push) Successful in 33s
Rust Build / Check (pull_request) Successful in 35s
Rust Build / Test Suite (push) Successful in 36s
Rust Build / Rustfmt (push) Successful in 25s
Rust Build / Clippy (push) Successful in 33s
Rust Build / Test Suite (pull_request) Successful in 38s
Rust Build / Clippy (pull_request) Successful in 34s
Rust Build / build (pull_request) Successful in 45s
Release Tagging / release (push) Successful in 31s
Rust Build / Rustfmt (pull_request) Successful in 25s
All checks were successful
Rust Build / build (push) Successful in 41s
Rust Build / Check (push) Successful in 33s
Rust Build / Check (pull_request) Successful in 35s
Rust Build / Test Suite (push) Successful in 36s
Rust Build / Rustfmt (push) Successful in 25s
Rust Build / Clippy (push) Successful in 33s
Rust Build / Test Suite (pull_request) Successful in 38s
Rust Build / Clippy (pull_request) Successful in 34s
Rust Build / build (pull_request) Successful in 45s
Release Tagging / release (push) Successful in 31s
Rust Build / Rustfmt (pull_request) Successful in 25s
Reviewed-on: #28 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
35
src/update_queued_song.rs
Normal file
35
src/update_queued_song.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
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!("{}/api/v2/song/queue/{}", base_url, 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>,
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user