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

/// Installation : Installation
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Installation {
    /// The ID of the installation.
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "account", deserialize_with = "Option::deserialize")]
    pub account: Option<Box<models::InstallationAccount>>,
    /// Describe whether all repositories have been selected or there's a selection involved
    #[serde(rename = "repository_selection")]
    pub repository_selection: RepositorySelection,
    #[serde(rename = "access_tokens_url")]
    pub access_tokens_url: String,
    #[serde(rename = "repositories_url")]
    pub repositories_url: String,
    #[serde(rename = "html_url")]
    pub html_url: String,
    #[serde(rename = "app_id")]
    pub app_id: i32,
    /// The ID of the user or organization this token is being scoped to.
    #[serde(rename = "target_id")]
    pub target_id: i32,
    #[serde(rename = "target_type")]
    pub target_type: String,
    #[serde(rename = "permissions")]
    pub permissions: Box<models::AppPermissions>,
    #[serde(rename = "events")]
    pub events: Vec<String>,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    #[serde(rename = "single_file_name", deserialize_with = "Option::deserialize")]
    pub single_file_name: Option<String>,
    #[serde(rename = "has_multiple_single_files", skip_serializing_if = "Option::is_none")]
    pub has_multiple_single_files: Option<bool>,
    #[serde(rename = "single_file_paths", skip_serializing_if = "Option::is_none")]
    pub single_file_paths: Option<Vec<String>>,
    #[serde(rename = "app_slug")]
    pub app_slug: String,
    #[serde(rename = "suspended_by", deserialize_with = "Option::deserialize")]
    pub suspended_by: Option<Box<models::SimpleUser>>,
    #[serde(rename = "suspended_at", deserialize_with = "Option::deserialize")]
    pub suspended_at: Option<String>,
    #[serde(rename = "contact_email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub contact_email: Option<Option<String>>,
}

impl Installation {
    /// Installation
    pub fn new(id: i32, account: Option<models::InstallationAccount>, repository_selection: RepositorySelection, access_tokens_url: String, repositories_url: String, html_url: String, app_id: i32, target_id: i32, target_type: String, permissions: models::AppPermissions, events: Vec<String>, created_at: String, updated_at: String, single_file_name: Option<String>, app_slug: String, suspended_by: Option<models::SimpleUser>, suspended_at: Option<String>) -> Installation {
        Installation {
            id,
            account: account.map(Box::new),
            repository_selection,
            access_tokens_url,
            repositories_url,
            html_url,
            app_id,
            target_id,
            target_type,
            permissions: Box::new(permissions),
            events,
            created_at,
            updated_at,
            single_file_name,
            has_multiple_single_files: None,
            single_file_paths: None,
            app_slug,
            suspended_by: suspended_by.map(Box::new),
            suspended_at,
            contact_email: 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
    }
}