Update dependencies #53

Merged
kdeng00 merged 11 commits from update_dependencies into icarus_v2_support 2025-07-02 12:26:38 -04:00
6 changed files with 17 additions and 104 deletions
Showing only changes of commit 53ca7702cf - Show all commits
-18
View File
@@ -9,30 +9,12 @@ pub fn retrieve_url(api: &models::api::API, with_id: bool, id: &uuid::Uuid) -> S
}
fn retrieve_url_reg(api: &models::api::API) -> String {
/*
let mut url: String = String::from(&api.url);
url += &String::from("/");
url += &String::from("api/");
url += &String::from(&api.version);
url += &String::from("/");
url += &String::from(&api.endpoint);
url += &String::from("/");
*/
let url = format!("{}/api/{}/{}/", api.url, api.version, api.endpoint);
url
}
fn retrieve_url_with_id(api: &models::api::API, id: &uuid::Uuid) -> String {
/*
let mut url: String = String::from(&api.url);
url += &String::from("api/");
url += &String::from(&api.version);
url += &String::from("/");
url += &String::from(&api.endpoint);
url += &String::from("/");
url += &id.to_string();
*/
let url = format!("{}/api/{}/{}/{}", api.url, api.version, api.endpoint, id);
url
+2 -16
View File
@@ -10,16 +10,6 @@ pub struct Delete {
pub api: models::api::API,
}
/*
impl Default for Delete {
fn default() -> Self {
Delete {
api: models::api::API::default(),
}
}
}
*/
impl Delete {
pub async fn delete_song(
&mut self,
@@ -43,14 +33,10 @@ impl Delete {
match response.json::<icarus_models::song::Song>().await {
Ok(sng) => Ok(sng),
Err(er) => Err(std::io::Error::other(
er.to_string(),
)),
Err(er) => Err(std::io::Error::other(er.to_string())),
}
}
other => Err(std::io::Error::other(
other.to_string(),
)),
other => Err(std::io::Error::other(other.to_string())),
}
}
}
+4 -22
View File
@@ -8,16 +8,6 @@ pub struct Download {
pub api: models::api::API,
}
/*
impl Default for Download {
fn default() -> Self {
Download {
api: models::api::API::default(),
}
}
}
*/
#[derive(Debug)]
pub enum MyError {
Request(reqwest::Error),
@@ -48,24 +38,16 @@ impl Download {
reqwest::StatusCode::OK => {
let data = rep.text();
match data.await {
Ok(e) => {
Ok(e)
}
Err(er) => {
Err(MyError::Other(er.to_string()))
}
Ok(e) => Ok(e),
Err(er) => Err(MyError::Other(er.to_string())),
}
}
reqwest::StatusCode::UNAUTHORIZED => {
Err(MyError::Other(String::from("Need to grab a new token")))
}
other => {
Err(MyError::Other(other.to_string()))
}
other => Err(MyError::Other(other.to_string())),
},
Err(er) => {
Err(MyError::Request(er))
}
Err(er) => Err(MyError::Request(er)),
}
}
}
+3 -23
View File
@@ -9,16 +9,6 @@ pub struct RetrieveRecords {
pub api: models::api::API,
}
/*
impl Default for RetrieveRecords {
fn default() -> Self {
RetrieveRecords {
api: models::api::API::default(),
}
}
}
*/
impl RetrieveRecords {
pub async fn get_all_songs(
&mut self,
@@ -41,23 +31,13 @@ impl RetrieveRecords {
// on success, parse our JSON to an APIResponse
match response.json::<Vec<icarus_models::song::Song>>().await {
Ok(parsed) => Ok(parsed),
Err(err) => {
Err(std::io::Error::other(
err.to_string(),
))
}
Err(err) => Err(std::io::Error::other(err.to_string())),
}
}
reqwest::StatusCode::UNAUTHORIZED => {
Err(std::io::Error::other(
"Need to grab a new token",
))
}
other => {
Err(std::io::Error::other(
other.to_string(),
))
Err(std::io::Error::other("Need to grab a new token"))
}
other => Err(std::io::Error::other(other.to_string())),
}
}
}
+7 -22
View File
@@ -11,16 +11,6 @@ pub struct Upload {
pub api: models::api::API,
}
/*
impl Default for Upload {
fn default() -> Self {
Upload {
api: models::api::API::default(),
}
}
}
*/
impl Upload {
pub async fn upload_song_with_metadata(
&mut self,
@@ -56,12 +46,8 @@ impl Upload {
.send()
.await
{
Ok(r) => {
Ok(r)
}
Err(err) => {
Err(err)
}
Ok(r) => Ok(r),
Err(err) => Err(err),
}
}
@@ -74,11 +60,6 @@ impl Upload {
let coverpath = cover.path.clone();
println!("Cover path: {coverpath:?}");
let song_detail = song.to_metadata_json(true).unwrap_or_default();
/*{
Ok(s) => s,
Err(_) => String::new(),
};
*/
println!("\n{song_detail}\n");
@@ -102,7 +83,11 @@ impl Upload {
}
pub fn set_api(&mut self, host: &str) {
let api = models::api::API { url: host.to_owned(), version: String::from("v1"), endpoint: String::new() };
let api = models::api::API {
url: host.to_owned(),
version: String::from("v1"),
endpoint: String::new(),
};
self.api = api;
}
}
+1 -3
View File
@@ -1,8 +1,6 @@
pub fn o_to_string(val: &std::ffi::OsString) -> Result<std::string::String, std::io::Error> {
match val.clone().into_string() {
Ok(value) => Ok(value),
Err(_) => Err(std::io::Error::other(
String::from("Error"),
)),
Err(_) => Err(std::io::Error::other(String::from("Error"))),
}
}