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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookStatus {
    #[serde(rename = "avatar_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub avatar_url: Option<Option<String>>,
    /// An array of branch objects containing the status' SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches.
    #[serde(rename = "branches")]
    pub branches: Vec<models::WebhookStatusBranchesInner>,
    #[serde(rename = "commit")]
    pub commit: Box<models::WebhookStatusCommit>,
    #[serde(rename = "context")]
    pub context: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// The optional human-readable description added to the status.
    #[serde(rename = "description", deserialize_with = "Option::deserialize")]
    pub description: Option<String>,
    #[serde(rename = "enterprise", skip_serializing_if = "Option::is_none")]
    pub enterprise: Option<Box<models::EnterpriseWebhooks>>,
    /// The unique identifier of the status.
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "installation", skip_serializing_if = "Option::is_none")]
    pub installation: Option<Box<models::SimpleInstallation>>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "organization", skip_serializing_if = "Option::is_none")]
    pub organization: Option<Box<models::OrganizationSimpleWebhooks>>,
    #[serde(rename = "repository")]
    pub repository: Box<models::RepositoryWebhooks>,
    #[serde(rename = "sender")]
    pub sender: Box<models::SimpleUserWebhooks>,
    /// The Commit SHA.
    #[serde(rename = "sha")]
    pub sha: String,
    /// The new state. Can be `pending`, `success`, `failure`, or `error`.
    #[serde(rename = "state")]
    pub state: State,
    /// The optional link added to the status.
    #[serde(rename = "target_url", deserialize_with = "Option::deserialize")]
    pub target_url: Option<String>,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl WebhookStatus {
    pub fn new(branches: Vec<models::WebhookStatusBranchesInner>, commit: models::WebhookStatusCommit, context: String, created_at: String, description: Option<String>, id: i32, name: String, repository: models::RepositoryWebhooks, sender: models::SimpleUserWebhooks, sha: String, state: State, target_url: Option<String>, updated_at: String) -> WebhookStatus {
        WebhookStatus {
            avatar_url: None,
            branches,
            commit: Box::new(commit),
            context,
            created_at,
            description,
            enterprise: None,
            id,
            installation: None,
            name,
            organization: None,
            repository: Box::new(repository),
            sender: Box::new(sender),
            sha,
            state,
            target_url,
            updated_at,
        }
    }
}
/// The new state. Can be `pending`, `success`, `failure`, or `error`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum State {
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "success")]
    Success,
    #[serde(rename = "failure")]
    Failure,
    #[serde(rename = "error")]
    Error,
}

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