Constants and url changes
This commit is contained in:
+2
-14
@@ -3,6 +3,7 @@ use std::default::Default;
|
||||
use reqwest;
|
||||
|
||||
use crate::models;
|
||||
use crate::syncers;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Delete {
|
||||
@@ -24,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 = self.retrieve_url(&song);
|
||||
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
|
||||
@@ -55,17 +56,4 @@ impl Delete {
|
||||
|
||||
return Ok(sng);
|
||||
}
|
||||
|
||||
fn retrieve_url(&self, song: &icarus_models::song::Song) -> String {
|
||||
let api = &self.api;
|
||||
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 += &song.id.to_string();
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user