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};

/// Authorization : The authorization for an OAuth app, GitHub App, or a Personal Access Token.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Authorization {
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "url")]
    pub url: String,
    /// A list of scopes that this authorization is in.
    #[serde(rename = "scopes", deserialize_with = "Option::deserialize")]
    pub scopes: Option<Vec<String>>,
    #[serde(rename = "token")]
    pub token: String,
    #[serde(rename = "token_last_eight", deserialize_with = "Option::deserialize")]
    pub token_last_eight: Option<String>,
    #[serde(rename = "hashed_token", deserialize_with = "Option::deserialize")]
    pub hashed_token: Option<String>,
    #[serde(rename = "app")]
    pub app: Box<models::AuthorizationApp>,
    #[serde(rename = "note", deserialize_with = "Option::deserialize")]
    pub note: Option<String>,
    #[serde(rename = "note_url", deserialize_with = "Option::deserialize")]
    pub note_url: Option<String>,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "fingerprint", deserialize_with = "Option::deserialize")]
    pub fingerprint: Option<String>,
    #[serde(rename = "user", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub user: Option<Option<Box<models::NullableSimpleUser>>>,
    #[serde(rename = "installation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub installation: Option<Option<Box<models::NullableScopedInstallation>>>,
    #[serde(rename = "expires_at", deserialize_with = "Option::deserialize")]
    pub expires_at: Option<String>,
}

impl Authorization {
    /// The authorization for an OAuth app, GitHub App, or a Personal Access Token.
    pub fn new(id: i32, url: String, scopes: Option<Vec<String>>, token: String, token_last_eight: Option<String>, hashed_token: Option<String>, app: models::AuthorizationApp, note: Option<String>, note_url: Option<String>, updated_at: String, created_at: String, fingerprint: Option<String>, expires_at: Option<String>) -> Authorization {
        Authorization {
            id,
            url,
            scopes,
            token,
            token_last_eight,
            hashed_token,
            app: Box::new(app),
            note,
            note_url,
            updated_at,
            created_at,
            fingerprint,
            user: None,
            installation: None,
            expires_at,
        }
    }
}