openapi_github/models/
organization_programmatic_access_grant.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrganizationProgrammaticAccessGrant {
17 #[serde(rename = "id")]
19 pub id: i32,
20 #[serde(rename = "owner")]
21 pub owner: Box<models::SimpleUser>,
22 #[serde(rename = "repository_selection")]
24 pub repository_selection: RepositorySelection,
25 #[serde(rename = "repositories_url")]
27 pub repositories_url: String,
28 #[serde(rename = "permissions")]
29 pub permissions: Box<models::OrganizationProgrammaticAccessGrantRequestPermissions>,
30 #[serde(rename = "access_granted_at")]
32 pub access_granted_at: String,
33 #[serde(rename = "token_expired")]
35 pub token_expired: bool,
36 #[serde(rename = "token_expires_at", deserialize_with = "Option::deserialize")]
38 pub token_expires_at: Option<String>,
39 #[serde(rename = "token_last_used_at", deserialize_with = "Option::deserialize")]
41 pub token_last_used_at: Option<String>,
42}
43
44impl OrganizationProgrammaticAccessGrant {
45 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#[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