Update dependencies (#53)
* Removing new lines * Updated reqwest, tokio, tokio-utils, and uuid * Including Cargo.lock in source control * Not sure how this got here * Updated icarus_models * Workflow change * Removing unused workflow * Github workflow fix * Warning fixes * Fixed what caused failed test * Code cleanup and formatting
This commit was merged in pull request #53.
This commit is contained in:
+7
-22
@@ -3,18 +3,11 @@ use std::default::Default;
|
||||
use crate::models;
|
||||
use crate::syncers;
|
||||
|
||||
#[derive(Default)]
|
||||
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),
|
||||
@@ -31,7 +24,7 @@ impl Download {
|
||||
let url = syncers::common::retrieve_url(&self.api, true, &song.id);
|
||||
let access_token = token.bearer_token();
|
||||
|
||||
println!("Url: {:?}", url);
|
||||
println!("Url: {url:?}");
|
||||
|
||||
let client = reqwest::Client::builder().build().unwrap();
|
||||
|
||||
@@ -45,24 +38,16 @@ impl Download {
|
||||
reqwest::StatusCode::OK => {
|
||||
let data = rep.text();
|
||||
match data.await {
|
||||
Ok(e) => {
|
||||
return Ok(e);
|
||||
}
|
||||
Err(er) => {
|
||||
return Err(MyError::Other(er.to_string()));
|
||||
}
|
||||
Ok(e) => Ok(e),
|
||||
Err(er) => Err(MyError::Other(er.to_string())),
|
||||
}
|
||||
}
|
||||
reqwest::StatusCode::UNAUTHORIZED => {
|
||||
return Err(MyError::Other(String::from("Need to grab a new token")));
|
||||
}
|
||||
other => {
|
||||
return Err(MyError::Other(other.to_string()));
|
||||
Err(MyError::Other(String::from("Need to grab a new token")))
|
||||
}
|
||||
other => Err(MyError::Other(other.to_string())),
|
||||
},
|
||||
Err(er) => {
|
||||
return Err(MyError::Request(er));
|
||||
}
|
||||
Err(er) => Err(MyError::Request(er)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user