openapi_github/models/
webhook.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Webhook : The webhook that is being pinged
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Webhook {
17    /// Determines whether the hook is actually triggered for the events it subscribes to.
18    #[serde(rename = "active")]
19    pub active: bool,
20    /// 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.
21    #[serde(rename = "app_id", skip_serializing_if = "Option::is_none")]
22    pub app_id: Option<i32>,
23    #[serde(rename = "config")]
24    pub config: Box<models::WebhookConfig>,
25    #[serde(rename = "created_at")]
26    pub created_at: String,
27    #[serde(rename = "deliveries_url", skip_serializing_if = "Option::is_none")]
28    pub deliveries_url: Option<String>,
29    /// Determines what events the hook is triggered for. Default: ['push'].
30    #[serde(rename = "events")]
31    pub events: Vec<String>,
32    /// Unique identifier of the webhook.
33    #[serde(rename = "id")]
34    pub id: i32,
35    #[serde(rename = "last_response", skip_serializing_if = "Option::is_none")]
36    pub last_response: Option<Box<models::HookResponse>>,
37    /// The type of webhook. The only valid value is 'web'.
38    #[serde(rename = "name")]
39    pub name: Name,
40    #[serde(rename = "ping_url", skip_serializing_if = "Option::is_none")]
41    pub ping_url: Option<String>,
42    #[serde(rename = "test_url", skip_serializing_if = "Option::is_none")]
43    pub test_url: Option<String>,
44    #[serde(rename = "type")]
45    pub r#type: String,
46    #[serde(rename = "updated_at")]
47    pub updated_at: String,
48    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
49    pub url: Option<String>,
50}
51
52impl Webhook {
53    /// The webhook that is being pinged
54    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 {
55        Webhook {
56            active,
57            app_id: None,
58            config: Box::new(config),
59            created_at,
60            deliveries_url: None,
61            events,
62            id,
63            last_response: None,
64            name,
65            ping_url: None,
66            test_url: None,
67            r#type,
68            updated_at,
69            url: None,
70        }
71    }
72}
73/// The type of webhook. The only valid value is 'web'.
74#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
75pub enum Name {
76    #[serde(rename = "web")]
77    Web,
78}
79
80impl Default for Name {
81    fn default() -> Name {
82        Self::Web
83    }
84}
85