Saving changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::models;
|
||||
|
||||
pub fn retrieve_url(api: &models::api::API, with_id: bool, id: i32) -> String {
|
||||
pub fn retrieve_url(api: &models::api::API, with_id: bool, id: &uuid::Uuid) -> String {
|
||||
if with_id {
|
||||
retrieve_url_with_id(&api, id)
|
||||
} else {
|
||||
@@ -19,7 +19,7 @@ fn retrieve_url_reg(api: &models::api::API) -> String {
|
||||
return url;
|
||||
}
|
||||
|
||||
fn retrieve_url_with_id(api: &models::api::API, id: i32) -> String {
|
||||
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);
|
||||
|
||||
@@ -25,7 +25,7 @@ impl Delete {
|
||||
song: &icarus_models::song::Song,
|
||||
) -> Result<icarus_models::song::Song, std::io::Error> {
|
||||
self.api.endpoint = "song/data/delete".to_owned();
|
||||
let url = syncers::common::retrieve_url(&self.api, true, song.id);
|
||||
let url = syncers::common::retrieve_url(&self.api, true, &song.id);
|
||||
let client = reqwest::Client::builder().build().unwrap();
|
||||
let access_token = token.bearer_token();
|
||||
let response = client
|
||||
|
||||
@@ -28,7 +28,7 @@ impl Download {
|
||||
song: &icarus_models::song::Song,
|
||||
) -> Result<String, MyError> {
|
||||
self.api.endpoint = String::from("song/data/download");
|
||||
let url = syncers::common::retrieve_url(&self.api, true, song.id);
|
||||
let url = syncers::common::retrieve_url(&self.api, true, &song.id);
|
||||
let access_token = token.bearer_token();
|
||||
|
||||
let client = reqwest::Client::builder().build().unwrap();
|
||||
|
||||
@@ -22,7 +22,7 @@ impl RetrieveRecords {
|
||||
token: &icarus_models::token::AccessToken,
|
||||
) -> Result<Vec<icarus_models::song::Song>, Error> {
|
||||
self.api.endpoint = String::from("song");
|
||||
let url = syncers::common::retrieve_url(&self.api, false, 0);
|
||||
let url = syncers::common::retrieve_url(&self.api, false, &uuid::Uuid::nil());
|
||||
let access_token = token.bearer_token();
|
||||
|
||||
let client = reqwest::Client::builder().build().unwrap();
|
||||
|
||||
@@ -26,7 +26,7 @@ impl Upload {
|
||||
cover: &icarus_models::coverart::CoverArt,
|
||||
) -> Result<reqwest::Response, reqwest::Error> {
|
||||
self.api.endpoint = String::from("song/data/upload/with/data");
|
||||
let url = syncers::common::retrieve_url(&self.api, false, 0);
|
||||
let url = syncers::common::retrieve_url(&self.api, false, &uuid::Uuid::new_v4());
|
||||
let access_token = token.bearer_token();
|
||||
|
||||
if url.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user