use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OrganizationProgrammaticAccessGrant {
#[serde(rename = "id")]
pub id: i32,
#[serde(rename = "owner")]
pub owner: Box<models::SimpleUser>,
#[serde(rename = "repository_selection")]
pub repository_selection: RepositorySelection,
#[serde(rename = "repositories_url")]
pub repositories_url: String,
#[serde(rename = "permissions")]
pub permissions: Box<models::OrganizationProgrammaticAccessGrantRequestPermissions>,
#[serde(rename = "access_granted_at")]
pub access_granted_at: String,
#[serde(rename = "token_expired")]
pub token_expired: bool,
#[serde(rename = "token_expires_at", deserialize_with = "Option::deserialize")]
pub token_expires_at: Option<String>,
#[serde(rename = "token_last_used_at", deserialize_with = "Option::deserialize")]
pub token_last_used_at: Option<String>,
}
impl OrganizationProgrammaticAccessGrant {
pub fn new(id: i32, owner: models::SimpleUser, repository_selection: RepositorySelection, repositories_url: String, permissions: models::OrganizationProgrammaticAccessGrantRequestPermissions, access_granted_at: String, token_expired: bool, token_expires_at: Option<String>, token_last_used_at: Option<String>) -> OrganizationProgrammaticAccessGrant {
OrganizationProgrammaticAccessGrant {
id,
owner: Box::new(owner),
repository_selection,
repositories_url,
permissions: Box::new(permissions),
access_granted_at,
token_expired,
token_expires_at,
token_last_used_at,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RepositorySelection {
#[serde(rename = "none")]
None,
#[serde(rename = "all")]
All,
#[serde(rename = "subset")]
Subset,
}
impl Default for RepositorySelection {
fn default() -> RepositorySelection {
Self::None
}
}