openapi_github/models/
authentication_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/// AuthenticationToken : Authentication Token
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct AuthenticationToken {
17    /// The token used for authentication
18    #[serde(rename = "token")]
19    pub token: String,
20    /// The time this token expires
21    #[serde(rename = "expires_at")]
22    pub expires_at: String,
23    #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
24    pub permissions: Option<serde_json::Value>,
25    /// The repositories this token has access to
26    #[serde(rename = "repositories", skip_serializing_if = "Option::is_none")]
27    pub repositories: Option<Vec<models::Repository>>,
28    #[serde(rename = "single_file", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub single_file: Option<Option<String>>,
30    /// Describe whether all repositories have been selected or there's a selection involved
31    #[serde(rename = "repository_selection", skip_serializing_if = "Option::is_none")]
32    pub repository_selection: Option<RepositorySelection>,
33}
34
35impl AuthenticationToken {
36    /// Authentication Token
37    pub fn new(token: String, expires_at: String) -> AuthenticationToken {
38        AuthenticationToken {
39            token,
40            expires_at,
41            permissions: None,
42            repositories: None,
43            single_file: None,
44            repository_selection: None,
45        }
46    }
47}
48/// Describe whether all repositories have been selected or there's a selection involved
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
50pub enum RepositorySelection {
51    #[serde(rename = "all")]
52    All,
53    #[serde(rename = "selected")]
54    Selected,
55}
56
57impl Default for RepositorySelection {
58    fn default() -> RepositorySelection {
59        Self::All
60    }
61}
62