Updated api_parser and song model

This commit is contained in:
kdeng00
2024-04-08 13:27:45 -04:00
parent 66fb53185e
commit a071fc93ba
2 changed files with 60 additions and 17 deletions
+20 -6
View File
@@ -7,14 +7,28 @@ pub struct APIParser {
}
impl APIParser {
// pub fn init() -> APIParser {
// }
pub fn retrieve_api(&self) -> models::api::API {
return models::api::API::default();
return self.api;
}
// TODO: Implement
fn parse_api(&self) {
pub fn parse_api(&self) {
let flags = self.ica_act.flags;
println!("Parsing api");
for (i, elem) in flags {
let arg = elem.flag;
let value = elem.value;
if arg == "-h" {
if value.chars().nth((value.len() - 1)) == '/' {
self.api.url = value;
} else {
self.api.url = value + "/";
}
break;
}
}
self.api.version = "v1";
}
}