use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RepoTokenResponse {
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "created_by", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub created_by: Option<Option<String>>,
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub description: Option<Option<String>>,
#[serde(rename = "expires_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub expires_at: Option<Option<String>>,
#[serde(rename = "id")]
pub id: uuid::Uuid,
#[serde(rename = "is_expired")]
pub is_expired: bool,
#[serde(rename = "is_revoked")]
pub is_revoked: bool,
#[serde(rename = "last_used_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub last_used_at: Option<Option<String>>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "scopes")]
pub scopes: Vec<String>,
#[serde(rename = "token_prefix")]
pub token_prefix: String,
}
impl RepoTokenResponse {
pub fn new(created_at: String, id: uuid::Uuid, is_expired: bool, is_revoked: bool, name: String, scopes: Vec<String>, token_prefix: String) -> RepoTokenResponse {
RepoTokenResponse {
created_at,
created_by: None,
description: None,
expires_at: None,
id,
is_expired,
is_revoked,
last_used_at: None,
name,
scopes,
token_prefix,
}
}
}