openapi_github/models/
hook.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/// Hook : Webhooks for repositories.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Hook {
17    #[serde(rename = "type")]
18    pub r#type: String,
19    /// Unique identifier of the webhook.
20    #[serde(rename = "id")]
21    pub id: i32,
22    /// The name of a valid service, use 'web' for a webhook.
23    #[serde(rename = "name")]
24    pub name: String,
25    /// Determines whether the hook is actually triggered on pushes.
26    #[serde(rename = "active")]
27    pub active: bool,
28    /// Determines what events the hook is triggered for. Default: ['push'].
29    #[serde(rename = "events")]
30    pub events: Vec<String>,
31    #[serde(rename = "config")]
32    pub config: Box<models::WebhookConfig>,
33    #[serde(rename = "updated_at")]
34    pub updated_at: String,
35    #[serde(rename = "created_at")]
36    pub created_at: String,
37    #[serde(rename = "url")]
38    pub url: String,
39    #[serde(rename = "test_url")]
40    pub test_url: String,
41    #[serde(rename = "ping_url")]
42    pub ping_url: String,
43    #[serde(rename = "deliveries_url", skip_serializing_if = "Option::is_none")]
44    pub deliveries_url: Option<String>,
45    #[serde(rename = "last_response")]
46    pub last_response: Box<models::HookResponse>,
47}
48
49impl Hook {
50    /// Webhooks for repositories.
51    pub fn new(r#type: String, id: i32, name: String, active: bool, events: Vec<String>, config: models::WebhookConfig, updated_at: String, created_at: String, url: String, test_url: String, ping_url: String, last_response: models::HookResponse) -> Hook {
52        Hook {
53            r#type,
54            id,
55            name,
56            active,
57            events,
58            config: Box::new(config),
59            updated_at,
60            created_at,
61            url,
62            test_url,
63            ping_url,
64            deliveries_url: None,
65            last_response: Box::new(last_response),
66        }
67    }
68}
69