Code formatting
All checks were successful
Rust Build / Check (pull_request) Successful in 34s
Rust Build / Test Suite (pull_request) Successful in 35s
Rust Build / Rustfmt (pull_request) Successful in 27s
Rust Build / Clippy (pull_request) Successful in 33s
Rust Build / build (pull_request) Successful in 41s
All checks were successful
Rust Build / Check (pull_request) Successful in 34s
Rust Build / Test Suite (pull_request) Successful in 35s
Rust Build / Rustfmt (pull_request) Successful in 27s
Rust Build / Clippy (pull_request) Successful in 33s
Rust Build / build (pull_request) Successful in 41s
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
pub async fn fetch_next_queue_item(
|
||||
base_url: &String,
|
||||
) -> Result<reqwest::Response, reqwest::Error> {
|
||||
pub async fn fetch_next_queue_item(base_url: &String) -> Result<reqwest::Response, reqwest::Error> {
|
||||
let client = reqwest::Client::new();
|
||||
let fetch_endpoint = String::from("api/v2/song/queue/next");
|
||||
let api_url = format!("{base_url}/{fetch_endpoint}");
|
||||
@@ -131,4 +129,3 @@ pub mod get_coverart_queue {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
34
src/main.rs
34
src/main.rs
@@ -95,8 +95,18 @@ async fn some_work(
|
||||
// TODO: Place this somewhere else
|
||||
let song_type = String::from("flac");
|
||||
// Err(std::io::Error::other(err.to_string()))
|
||||
match the_rest::create_song::create(app_base_url, &metadata, &user_id, &song_type).await {
|
||||
Ok(response) => match response.json::<the_rest::create_song::response::Response>().await {
|
||||
match the_rest::create_song::create(
|
||||
app_base_url,
|
||||
&metadata,
|
||||
&user_id,
|
||||
&song_type,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(response) => match response
|
||||
.json::<the_rest::create_song::response::Response>()
|
||||
.await
|
||||
{
|
||||
Ok(resp) => {
|
||||
println!("Response: {resp:?}");
|
||||
|
||||
@@ -111,13 +121,9 @@ async fn some_work(
|
||||
// println!("Response json: {:?}", response.text().await);
|
||||
Ok(())
|
||||
}
|
||||
Err(err) => {
|
||||
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())),
|
||||
},
|
||||
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||
}
|
||||
}
|
||||
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||
@@ -136,7 +142,15 @@ async fn some_work(
|
||||
async fn prep_song(
|
||||
api_url: &String,
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> Result<(String, String, api::get_metadata_queue::response::Metadata, uuid::Uuid), reqwest::Error> {
|
||||
) -> Result<
|
||||
(
|
||||
String,
|
||||
String,
|
||||
api::get_metadata_queue::response::Metadata,
|
||||
uuid::Uuid,
|
||||
),
|
||||
reqwest::Error,
|
||||
> {
|
||||
match api::fetch_song_queue_data::get_data(api_url, song_queue_id).await {
|
||||
Ok(response) => {
|
||||
// Process data here...
|
||||
|
@@ -2,7 +2,12 @@
|
||||
|
||||
// TODO: Create song
|
||||
pub mod create_song {
|
||||
pub async fn create(base_url: &String, metadata_queue: &crate::api::get_metadata_queue::response::Metadata, user_id: &uuid::Uuid, song_type: &String) -> Result<reqwest::Response, reqwest::Error> {
|
||||
pub async fn create(
|
||||
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,
|
||||
|
Reference in New Issue
Block a user