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

/// NullableIssue : Issues are a great way to keep track of tasks, enhancements, and bugs for your projects.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NullableIssue {
    #[serde(rename = "id")]
    pub id: i64,
    #[serde(rename = "node_id")]
    pub node_id: String,
    /// URL for the issue
    #[serde(rename = "url")]
    pub url: String,
    #[serde(rename = "repository_url")]
    pub repository_url: String,
    #[serde(rename = "labels_url")]
    pub labels_url: String,
    #[serde(rename = "comments_url")]
    pub comments_url: String,
    #[serde(rename = "events_url")]
    pub events_url: String,
    #[serde(rename = "html_url")]
    pub html_url: String,
    /// Number uniquely identifying the issue within its repository
    #[serde(rename = "number")]
    pub number: i32,
    /// State of the issue; either 'open' or 'closed'
    #[serde(rename = "state")]
    pub state: String,
    /// The reason for the current state
    #[serde(rename = "state_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub state_reason: Option<Option<StateReason>>,
    /// Title of the issue
    #[serde(rename = "title")]
    pub title: String,
    /// Contents of the issue
    #[serde(rename = "body", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub body: Option<Option<String>>,
    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
    pub user: Option<Box<models::NullableSimpleUser>>,
    /// Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository
    #[serde(rename = "labels")]
    pub labels: Vec<models::IssueLabelsInner>,
    #[serde(rename = "assignee", deserialize_with = "Option::deserialize")]
    pub assignee: Option<Box<models::NullableSimpleUser>>,
    #[serde(rename = "assignees", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub assignees: Option<Option<Vec<models::SimpleUser>>>,
    #[serde(rename = "milestone", deserialize_with = "Option::deserialize")]
    pub milestone: Option<Box<models::NullableMilestone>>,
    #[serde(rename = "locked")]
    pub locked: bool,
    #[serde(rename = "active_lock_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub active_lock_reason: Option<Option<String>>,
    #[serde(rename = "comments")]
    pub comments: i32,
    #[serde(rename = "pull_request", skip_serializing_if = "Option::is_none")]
    pub pull_request: Option<Box<models::IssuePullRequest>>,
    #[serde(rename = "closed_at", deserialize_with = "Option::deserialize")]
    pub closed_at: Option<String>,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
    pub draft: Option<bool>,
    #[serde(rename = "closed_by", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub closed_by: Option<Option<Box<models::NullableSimpleUser>>>,
    #[serde(rename = "body_html", skip_serializing_if = "Option::is_none")]
    pub body_html: Option<String>,
    #[serde(rename = "body_text", skip_serializing_if = "Option::is_none")]
    pub body_text: Option<String>,
    #[serde(rename = "timeline_url", skip_serializing_if = "Option::is_none")]
    pub timeline_url: Option<String>,
    #[serde(rename = "repository", skip_serializing_if = "Option::is_none")]
    pub repository: Option<Box<models::Repository>>,
    #[serde(rename = "performed_via_github_app", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub performed_via_github_app: Option<Option<Box<models::NullableIntegration>>>,
    #[serde(rename = "author_association")]
    pub author_association: models::AuthorAssociation,
    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
    pub reactions: Option<Box<models::ReactionRollup>>,
}

impl NullableIssue {
    /// Issues are a great way to keep track of tasks, enhancements, and bugs for your projects.
    pub fn new(id: i64, node_id: String, url: String, repository_url: String, labels_url: String, comments_url: String, events_url: String, html_url: String, number: i32, state: String, title: String, user: Option<models::NullableSimpleUser>, labels: Vec<models::IssueLabelsInner>, assignee: Option<models::NullableSimpleUser>, milestone: Option<models::NullableMilestone>, locked: bool, comments: i32, closed_at: Option<String>, created_at: String, updated_at: String, author_association: models::AuthorAssociation) -> NullableIssue {
        NullableIssue {
            id,
            node_id,
            url,
            repository_url,
            labels_url,
            comments_url,
            events_url,
            html_url,
            number,
            state,
            state_reason: None,
            title,
            body: None,
            user: user.map(Box::new),
            labels,
            assignee: assignee.map(Box::new),
            assignees: None,
            milestone: milestone.map(Box::new),
            locked,
            active_lock_reason: None,
            comments,
            pull_request: None,
            closed_at,
            created_at,
            updated_at,
            draft: None,
            closed_by: None,
            body_html: None,
            body_text: None,
            timeline_url: None,
            repository: None,
            performed_via_github_app: None,
            author_association,
            reactions: None,
        }
    }
}
/// The reason for the current state
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StateReason {
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "reopened")]
    Reopened,
    #[serde(rename = "not_planned")]
    NotPlanned,
}

impl Default for StateReason {
    fn default() -> StateReason {
        Self::Completed
    }
}