Updated icarus_models (#44)

* Updated icarus_models

* Constants and url changes

* Refactoring

* Removed functions

* Fixing tests
This commit was merged in pull request #44.
This commit is contained in:
KD
2025-03-30 16:00:06 -04:00
committed by GitHub
parent 24e066d8d9
commit 219b95bb2f
9 changed files with 93 additions and 125 deletions
+32
View File
@@ -0,0 +1,32 @@
use crate::models;
pub fn retrieve_url(api: &models::api::API, with_id: bool, id: i32) -> 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 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("/");
return url;
}
fn retrieve_url_with_id(api: &models::api::API, id: i32) -> 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();
return url;
}