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

/// Webhook : The webhook that is being pinged
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Webhook {
    /// Determines whether the hook is actually triggered for the events it subscribes to.
    #[serde(rename = "active")]
    pub active: bool,
    /// Only included for GitHub Apps. When you register a new GitHub App, GitHub sends a ping event to the webhook URL you specified during registration. The GitHub App ID sent in this field is required for authenticating an app.
    #[serde(rename = "app_id", skip_serializing_if = "Option::is_none")]
    pub app_id: Option<i32>,
    #[serde(rename = "config")]
    pub config: Box<models::WebhookConfig>,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "deliveries_url", skip_serializing_if = "Option::is_none")]
    pub deliveries_url: Option<String>,
    /// Determines what events the hook is triggered for. Default: ['push'].
    #[serde(rename = "events")]
    pub events: Vec<String>,
    /// Unique identifier of the webhook.
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "last_response", skip_serializing_if = "Option::is_none")]
    pub last_response: Option<Box<models::HookResponse>>,
    /// The type of webhook. The only valid value is 'web'.
    #[serde(rename = "name")]
    pub name: Name,
    #[serde(rename = "ping_url", skip_serializing_if = "Option::is_none")]
    pub ping_url: Option<String>,
    #[serde(rename = "test_url", skip_serializing_if = "Option::is_none")]
    pub test_url: Option<String>,
    #[serde(rename = "type")]
    pub r#type: String,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
}

impl Webhook {
    /// The webhook that is being pinged
    pub fn new(active: bool, config: models::WebhookConfig, created_at: String, events: Vec<String>, id: i32, name: Name, r#type: String, updated_at: String) -> Webhook {
        Webhook {
            active,
            app_id: None,
            config: Box::new(config),
            created_at,
            deliveries_url: None,
            events,
            id,
            last_response: None,
            name,
            ping_url: None,
            test_url: None,
            r#type,
            updated_at,
            url: None,
        }
    }
}
/// The type of webhook. The only valid value is 'web'.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Name {
    #[serde(rename = "web")]
    Web,
}

impl Default for Name {
    fn default() -> Name {
        Self::Web
    }
}