Files
icarus_dm/src/syncers/common.rs
T
KD 809f27cf01 Upload song (#58)
* Queue song (#57)

* Added code to queue song

* Making functions async

* Able to queue song

* Cleanup

* Link user to queued song (#59)

* Renaming queue_song function

* Queued song linked to user

* Cleanup and code formatting

* Queue metadata (#60)

* Added code to queue metadata

* Code formatting

* Queue coverart (#61)

* Added queued coverart code

* Code formatting and cleanup

* Link queued coverart to queued song (#62)

* Added code to link queued coverart to queued song

* Code formatting

* Update queued song status (#63)

* Added function call to update queued song status

* Added skeleton method

* Added more code to the method

* Got it working

* Code formatting

* Multi upload (#64)

* Added comments

* Added TODO

* Got it working

* Updated documentation

* Version bump

* Code formatting and cleanup
2025-08-29 21:59:54 -04:00

31 lines
803 B
Rust

use crate::models;
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 {
retrieve_url_reg(api)
}
}
fn retrieve_url_reg(api: &models::api::Api) -> String {
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 url = format!("{}/api/{}/{}/{}", api.url, api.version, api.endpoint, id);
url
}
pub async fn auth_header(
token: &icarus_models::token::AccessToken,
) -> (http::HeaderName, http::HeaderValue) {
let auth = reqwest::header::AUTHORIZATION;
let auth_value = http::HeaderValue::from_str(&token.bearer_token()).unwrap();
(auth, auth_value)
}