openapi_github/models/
organization_programmatic_access_grant_request.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/// OrganizationProgrammaticAccessGrantRequest : Minimal representation of an organization programmatic access grant request for enumerations
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrganizationProgrammaticAccessGrantRequest {
17    /// Unique identifier of the request for access via fine-grained personal access token. The `pat_request_id` used to review PAT requests.
18    #[serde(rename = "id")]
19    pub id: i32,
20    /// Reason for requesting access.
21    #[serde(rename = "reason", deserialize_with = "Option::deserialize")]
22    pub reason: Option<String>,
23    #[serde(rename = "owner")]
24    pub owner: Box<models::SimpleUser>,
25    /// Type of repository selection requested.
26    #[serde(rename = "repository_selection")]
27    pub repository_selection: RepositorySelection,
28    /// URL to the list of repositories requested to be accessed via fine-grained personal access token. Should only be followed when `repository_selection` is `subset`.
29    #[serde(rename = "repositories_url")]
30    pub repositories_url: String,
31    #[serde(rename = "permissions")]
32    pub permissions: Box<models::OrganizationProgrammaticAccessGrantRequestPermissions>,
33    /// Date and time when the request for access was created.
34    #[serde(rename = "created_at")]
35    pub created_at: String,
36    /// Whether the associated fine-grained personal access token has expired.
37    #[serde(rename = "token_expired")]
38    pub token_expired: bool,
39    /// Date and time when the associated fine-grained personal access token expires.
40    #[serde(rename = "token_expires_at", deserialize_with = "Option::deserialize")]
41    pub token_expires_at: Option<String>,
42    /// Date and time when the associated fine-grained personal access token was last used for authentication.
43    #[serde(rename = "token_last_used_at", deserialize_with = "Option::deserialize")]
44    pub token_last_used_at: Option<String>,
45}
46
47impl OrganizationProgrammaticAccessGrantRequest {
48    /// Minimal representation of an organization programmatic access grant request for enumerations
49    pub fn new(id: i32, reason: Option<String>, owner: models::SimpleUser, repository_selection: RepositorySelection, repositories_url: String, permissions: models::OrganizationProgrammaticAccessGrantRequestPermissions, created_at: String, token_expired: bool, token_expires_at: Option<String>, token_last_used_at: Option<String>) -> OrganizationProgrammaticAccessGrantRequest {
50        OrganizationProgrammaticAccessGrantRequest {
51            id,
52            reason,
53            owner: Box::new(owner),
54            repository_selection,
55            repositories_url,
56            permissions: Box::new(permissions),
57            created_at,
58            token_expired,
59            token_expires_at,
60            token_last_used_at,
61        }
62    }
63}
64/// Type of repository selection requested.
65#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum RepositorySelection {
67    #[serde(rename = "none")]
68    None,
69    #[serde(rename = "all")]
70    All,
71    #[serde(rename = "subset")]
72    Subset,
73}
74
75impl Default for RepositorySelection {
76    fn default() -> RepositorySelection {
77        Self::None
78    }
79}
80