openapi-github 0.1.0

OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
Documentation
/*
 * GitHub's official OpenAPI spec + Octokit extension
 *
 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
 *
 * The version of the OpenAPI document: 16.6.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// AuthenticationToken : Authentication Token
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthenticationToken {
    /// The token used for authentication
    #[serde(rename = "token")]
    pub token: String,
    /// The time this token expires
    #[serde(rename = "expires_at")]
    pub expires_at: String,
    #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
    pub permissions: Option<serde_json::Value>,
    /// The repositories this token has access to
    #[serde(rename = "repositories", skip_serializing_if = "Option::is_none")]
    pub repositories: Option<Vec<models::Repository>>,
    #[serde(rename = "single_file", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub single_file: Option<Option<String>>,
    /// Describe whether all repositories have been selected or there's a selection involved
    #[serde(rename = "repository_selection", skip_serializing_if = "Option::is_none")]
    pub repository_selection: Option<RepositorySelection>,
}

impl AuthenticationToken {
    /// Authentication Token
    pub fn new(token: String, expires_at: String) -> AuthenticationToken {
        AuthenticationToken {
            token,
            expires_at,
            permissions: None,
            repositories: None,
            single_file: None,
            repository_selection: None,
        }
    }
}
/// Describe whether all repositories have been selected or there's a selection involved
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RepositorySelection {
    #[serde(rename = "all")]
    All,
    #[serde(rename = "selected")]
    Selected,
}

impl Default for RepositorySelection {
    fn default() -> RepositorySelection {
        Self::All
    }
}