Added new struct and methods

This commit is contained in:
kdeng00
2024-04-14 20:00:27 -04:00
parent 1cd66ce1de
commit c7141533be
+32
View File
@@ -0,0 +1,32 @@
use std::default::Default;
use crate::models;
pub struct TokenManager {
pub user: models::user::User,
pub api: models::api::API,
}
impl TokenManager {
pub fn request_token(&self) -> models::token::Token {
let usr_json = self.user.to_json();
println!("Sending request for a token");
let endpoint = self.construct_endpoint();
let mut url: String = String::from(&self.api.url);
url += &endpoint;
println!("URL: {}", url);
return models::token::Token::default();
}
fn construct_endpoint(&self) -> String {
let mut endpoint: String = String::from("api/");
endpoint += &self.api.version;
endpoint += "/login";
return endpoint;
}
}