openapi_github/models/
organization_programmatic_access_grant.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// OrganizationProgrammaticAccessGrant : Minimal representation of an organization programmatic access grant for enumerations
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrganizationProgrammaticAccessGrant {
17    /// Unique identifier of the fine-grained personal access token. The `pat_id` used to get details about an approved fine-grained personal access token.
18    #[serde(rename = "id")]
19    pub id: i32,
20    #[serde(rename = "owner")]
21    pub owner: Box<models::SimpleUser>,
22    /// Type of repository selection requested.
23    #[serde(rename = "repository_selection")]
24    pub repository_selection: RepositorySelection,
25    /// URL to the list of repositories the fine-grained personal access token can access. Only follow when `repository_selection` is `subset`.
26    #[serde(rename = "repositories_url")]
27    pub repositories_url: String,
28    #[serde(rename = "permissions")]
29    pub permissions: Box<models::OrganizationProgrammaticAccessGrantRequestPermissions>,
30    /// Date and time when the fine-grained personal access token was approved to access the organization.
31    #[serde(rename = "access_granted_at")]
32    pub access_granted_at: String,
33    /// Whether the associated fine-grained personal access token has expired.
34    #[serde(rename = "token_expired")]
35    pub token_expired: bool,
36    /// Date and time when the associated fine-grained personal access token expires.
37    #[serde(rename = "token_expires_at", deserialize_with = "Option::deserialize")]
38    pub token_expires_at: Option<String>,
39    /// Date and time when the associated fine-grained personal access token was last used for authentication.
40    #[serde(rename = "token_last_used_at", deserialize_with = "Option::deserialize")]
41    pub token_last_used_at: Option<String>,
42}
43
44impl OrganizationProgrammaticAccessGrant {
45    /// Minimal representation of an organization programmatic access grant for enumerations
46    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 {
47        OrganizationProgrammaticAccessGrant {
48            id,
49            owner: Box::new(owner),
50            repository_selection,
51            repositories_url,
52            permissions: Box::new(permissions),
53            access_granted_at,
54            token_expired,
55            token_expires_at,
56            token_last_used_at,
57        }
58    }
59}
60/// Type of repository selection requested.
61#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
62pub enum RepositorySelection {
63    #[serde(rename = "none")]
64    None,
65    #[serde(rename = "all")]
66    All,
67    #[serde(rename = "subset")]
68    Subset,
69}
70
71impl Default for RepositorySelection {
72    fn default() -> RepositorySelection {
73        Self::None
74    }
75}
76