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

/// RepositoryAdvisory : A repository security advisory.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RepositoryAdvisory {
    /// The GitHub Security Advisory ID.
    #[serde(rename = "ghsa_id")]
    pub ghsa_id: String,
    /// The Common Vulnerabilities and Exposures (CVE) ID.
    #[serde(rename = "cve_id", deserialize_with = "Option::deserialize")]
    pub cve_id: Option<String>,
    /// The API URL for the advisory.
    #[serde(rename = "url")]
    pub url: String,
    /// The URL for the advisory.
    #[serde(rename = "html_url")]
    pub html_url: String,
    /// A short summary of the advisory.
    #[serde(rename = "summary")]
    pub summary: String,
    /// A detailed description of what the advisory entails.
    #[serde(rename = "description", deserialize_with = "Option::deserialize")]
    pub description: Option<String>,
    /// The severity of the advisory.
    #[serde(rename = "severity", deserialize_with = "Option::deserialize")]
    pub severity: Option<Severity>,
    /// The author of the advisory.
    #[serde(rename = "author", deserialize_with = "Option::deserialize")]
    pub author: Option<Box<models::SimpleUser>>,
    /// The publisher of the advisory.
    #[serde(rename = "publisher", deserialize_with = "Option::deserialize")]
    pub publisher: Option<Box<models::SimpleUser>>,
    #[serde(rename = "identifiers")]
    pub identifiers: Vec<models::GlobalAdvisoryIdentifiersInner>,
    /// The state of the advisory.
    #[serde(rename = "state")]
    pub state: State,
    /// The date and time of when the advisory was created, in ISO 8601 format.
    #[serde(rename = "created_at", deserialize_with = "Option::deserialize")]
    pub created_at: Option<String>,
    /// The date and time of when the advisory was last updated, in ISO 8601 format.
    #[serde(rename = "updated_at", deserialize_with = "Option::deserialize")]
    pub updated_at: Option<String>,
    /// The date and time of when the advisory was published, in ISO 8601 format.
    #[serde(rename = "published_at", deserialize_with = "Option::deserialize")]
    pub published_at: Option<String>,
    /// The date and time of when the advisory was closed, in ISO 8601 format.
    #[serde(rename = "closed_at", deserialize_with = "Option::deserialize")]
    pub closed_at: Option<String>,
    /// The date and time of when the advisory was withdrawn, in ISO 8601 format.
    #[serde(rename = "withdrawn_at", deserialize_with = "Option::deserialize")]
    pub withdrawn_at: Option<String>,
    #[serde(rename = "submission", deserialize_with = "Option::deserialize")]
    pub submission: Option<Box<models::RepositoryAdvisorySubmission>>,
    #[serde(rename = "vulnerabilities", deserialize_with = "Option::deserialize")]
    pub vulnerabilities: Option<Vec<models::RepositoryAdvisoryVulnerability>>,
    #[serde(rename = "cvss", deserialize_with = "Option::deserialize")]
    pub cvss: Option<Box<models::GlobalAdvisoryCvss>>,
    #[serde(rename = "cwes", deserialize_with = "Option::deserialize")]
    pub cwes: Option<Vec<models::GlobalAdvisoryCwesInner>>,
    /// A list of only the CWE IDs.
    #[serde(rename = "cwe_ids", deserialize_with = "Option::deserialize")]
    pub cwe_ids: Option<Vec<String>>,
    #[serde(rename = "credits", deserialize_with = "Option::deserialize")]
    pub credits: Option<Vec<models::RepositoryAdvisoryCreditsInner>>,
    #[serde(rename = "credits_detailed", deserialize_with = "Option::deserialize")]
    pub credits_detailed: Option<Vec<models::RepositoryAdvisoryCredit>>,
    /// A list of users that collaborate on the advisory.
    #[serde(rename = "collaborating_users", deserialize_with = "Option::deserialize")]
    pub collaborating_users: Option<Vec<models::SimpleUser>>,
    /// A list of teams that collaborate on the advisory.
    #[serde(rename = "collaborating_teams", deserialize_with = "Option::deserialize")]
    pub collaborating_teams: Option<Vec<models::Team>>,
    /// A temporary private fork of the advisory's repository for collaborating on a fix.
    #[serde(rename = "private_fork", deserialize_with = "Option::deserialize")]
    pub private_fork: Option<Box<models::SimpleRepository>>,
}

impl RepositoryAdvisory {
    /// A repository security advisory.
    pub fn new(ghsa_id: String, cve_id: Option<String>, url: String, html_url: String, summary: String, description: Option<String>, severity: Option<Severity>, author: Option<models::SimpleUser>, publisher: Option<models::SimpleUser>, identifiers: Vec<models::GlobalAdvisoryIdentifiersInner>, state: State, created_at: Option<String>, updated_at: Option<String>, published_at: Option<String>, closed_at: Option<String>, withdrawn_at: Option<String>, submission: Option<models::RepositoryAdvisorySubmission>, vulnerabilities: Option<Vec<models::RepositoryAdvisoryVulnerability>>, cvss: Option<models::GlobalAdvisoryCvss>, cwes: Option<Vec<models::GlobalAdvisoryCwesInner>>, cwe_ids: Option<Vec<String>>, credits: Option<Vec<models::RepositoryAdvisoryCreditsInner>>, credits_detailed: Option<Vec<models::RepositoryAdvisoryCredit>>, collaborating_users: Option<Vec<models::SimpleUser>>, collaborating_teams: Option<Vec<models::Team>>, private_fork: Option<models::SimpleRepository>) -> RepositoryAdvisory {
        RepositoryAdvisory {
            ghsa_id,
            cve_id,
            url,
            html_url,
            summary,
            description,
            severity,
            author: author.map(Box::new),
            publisher: publisher.map(Box::new),
            identifiers,
            state,
            created_at,
            updated_at,
            published_at,
            closed_at,
            withdrawn_at,
            submission: submission.map(Box::new),
            vulnerabilities,
            cvss: cvss.map(Box::new),
            cwes,
            cwe_ids,
            credits,
            credits_detailed,
            collaborating_users,
            collaborating_teams,
            private_fork: private_fork.map(Box::new),
        }
    }
}
/// The severity of the advisory.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Severity {
    #[serde(rename = "critical")]
    Critical,
    #[serde(rename = "high")]
    High,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "low")]
    Low,
}

impl Default for Severity {
    fn default() -> Severity {
        Self::Critical
    }
}
/// The state of the advisory.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum State {
    #[serde(rename = "published")]
    Published,
    #[serde(rename = "closed")]
    Closed,
    #[serde(rename = "withdrawn")]
    Withdrawn,
    #[serde(rename = "draft")]
    Draft,
    #[serde(rename = "triage")]
    Triage,
}

impl Default for State {
    fn default() -> State {
        Self::Published
    }
}