openapi_github/models/
installation_token.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/// InstallationToken : Authentication token for a GitHub App installed on a user or org.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct InstallationToken {
17    #[serde(rename = "token")]
18    pub token: String,
19    #[serde(rename = "expires_at")]
20    pub expires_at: String,
21    #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
22    pub permissions: Option<Box<models::AppPermissions>>,
23    #[serde(rename = "repository_selection", skip_serializing_if = "Option::is_none")]
24    pub repository_selection: Option<RepositorySelection>,
25    #[serde(rename = "repositories", skip_serializing_if = "Option::is_none")]
26    pub repositories: Option<Vec<models::Repository>>,
27    #[serde(rename = "single_file", skip_serializing_if = "Option::is_none")]
28    pub single_file: Option<String>,
29    #[serde(rename = "has_multiple_single_files", skip_serializing_if = "Option::is_none")]
30    pub has_multiple_single_files: Option<bool>,
31    #[serde(rename = "single_file_paths", skip_serializing_if = "Option::is_none")]
32    pub single_file_paths: Option<Vec<String>>,
33}
34
35impl InstallationToken {
36    /// Authentication token for a GitHub App installed on a user or org.
37    pub fn new(token: String, expires_at: String) -> InstallationToken {
38        InstallationToken {
39            token,
40            expires_at,
41            permissions: None,
42            repository_selection: None,
43            repositories: None,
44            single_file: None,
45            has_multiple_single_files: None,
46            single_file_paths: None,
47        }
48    }
49}
50/// 
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum RepositorySelection {
53    #[serde(rename = "all")]
54    All,
55    #[serde(rename = "selected")]
56    Selected,
57}
58
59impl Default for RepositorySelection {
60    fn default() -> RepositorySelection {
61        Self::All
62    }
63}
64