use crate::api::ClientData;
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct AccessToken {
access_token: String,
token_type: String,
}
impl AccessToken {
pub fn new(access_token: String, token_type: String) -> Self {
Self {
access_token,
token_type,
}
}
pub fn get_access_token(&self) -> &str {
&self.access_token
}
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct ContractsRequestParams {
pub next_url: Option<String>,
pub hash_algorithm: String,
}
impl ContractsRequestParams {
pub fn new(next_url: Option<String>, hash_algorithm: String) -> Self {
Self {
next_url,
hash_algorithm,
}
}
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Contract {
pub contract_id: String,
pub api_id: String,
pub version_id: String,
pub sla_tier_id: Option<String>,
pub client_id: String,
pub client_secret: String,
pub client_secret_salt: String,
pub client_name: String,
pub removed: bool,
}
impl Contract {
pub fn cast_to_client_information(self) -> ClientData {
ClientData {
client_id: self.client_id,
client_name: self.client_name,
sla_id: self.sla_tier_id,
}
}
}