Create song #33
@@ -1,6 +1,59 @@
|
||||
// TODO: Refactor this file when this app is functional
|
||||
|
||||
// TODO: Create song
|
||||
pub async fn create_song(base_url: &String, metadata_queue: &crate::api::get_metadata_queue::response::Metadata, user_id: &uuid::Uuid, song_type: &String) -> Result<reqwest::Response, reqwest::Error> {
|
||||
let payload = serde_json::json!(
|
||||
{
|
||||
"album": &metadata_queue.album,
|
||||
"album_artist": &metadata_queue.album_artist,
|
||||
"artist": &metadata_queue.artist,
|
||||
"disc": metadata_queue.disc,
|
||||
"disc_count": metadata_queue.disc_count,
|
||||
"duration": metadata_queue.duration,
|
||||
"genre": &metadata_queue.genre,
|
||||
"title": &metadata_queue.title,
|
||||
"track": metadata_queue.track,
|
||||
"track_count": metadata_queue.track_count,
|
||||
"year": metadata_queue.year,
|
||||
"audio_type": &song_type,
|
||||
"user_id": &user_id,
|
||||
"song_queue_id": &metadata_queue.song_queue_id,
|
||||
}
|
||||
);
|
||||
|
||||
let client = reqwest::Client::builder().build()?;
|
||||
|
||||
let url = format!("{base_url}/api/v2/song");
|
||||
|
||||
let request = client.post(url).json(&payload);
|
||||
let response = request.send().await?;
|
||||
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
pub mod response {
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* {
|
||||
"album": "Are You Experienced?",
|
||||
"album_artist": "The Jimi Hendrix Experience",
|
||||
"artist": "The Jimi Hendrix Experience",
|
||||
"disc": 1,
|
||||
"disc_count": 1,
|
||||
"duration": 213,
|
||||
"genre": "Psychadelic Rock",
|
||||
"title": "Hey Joe",
|
||||
"track": 1,
|
||||
"track_count": 17,
|
||||
"year": 1967,
|
||||
"audio_type": "flac",
|
||||
"user_id": "{{user_id}}",
|
||||
"song_queue_id": "{{queued_song_id}}"
|
||||
}
|
||||
*
|
||||
*/
|
||||
// TODO: Create coverart
|
||||
// TODO: Wipe data from queued song
|
||||
// TODO: Wipe data from queued coverart
|
||||
|
Reference in New Issue
Block a user