use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Authorization {
#[serde(rename = "id")]
pub id: i32,
#[serde(rename = "url")]
pub url: String,
#[serde(rename = "scopes", deserialize_with = "Option::deserialize")]
pub scopes: Option<Vec<String>>,
#[serde(rename = "token")]
pub token: String,
#[serde(rename = "token_last_eight", deserialize_with = "Option::deserialize")]
pub token_last_eight: Option<String>,
#[serde(rename = "hashed_token", deserialize_with = "Option::deserialize")]
pub hashed_token: Option<String>,
#[serde(rename = "app")]
pub app: Box<models::AuthorizationApp>,
#[serde(rename = "note", deserialize_with = "Option::deserialize")]
pub note: Option<String>,
#[serde(rename = "note_url", deserialize_with = "Option::deserialize")]
pub note_url: Option<String>,
#[serde(rename = "updated_at")]
pub updated_at: String,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "fingerprint", deserialize_with = "Option::deserialize")]
pub fingerprint: Option<String>,
#[serde(rename = "user", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub user: Option<Option<Box<models::NullableSimpleUser>>>,
#[serde(rename = "installation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub installation: Option<Option<Box<models::NullableScopedInstallation>>>,
#[serde(rename = "expires_at", deserialize_with = "Option::deserialize")]
pub expires_at: Option<String>,
}
impl Authorization {
pub fn new(id: i32, url: String, scopes: Option<Vec<String>>, token: String, token_last_eight: Option<String>, hashed_token: Option<String>, app: models::AuthorizationApp, note: Option<String>, note_url: Option<String>, updated_at: String, created_at: String, fingerprint: Option<String>, expires_at: Option<String>) -> Authorization {
Authorization {
id,
url,
scopes,
token,
token_last_eight,
hashed_token,
app: Box::new(app),
note,
note_url,
updated_at,
created_at,
fingerprint,
user: None,
installation: None,
expires_at,
}
}
}