openapi_github/models/
webhook_delete.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct WebhookDelete {
16    #[serde(rename = "enterprise", skip_serializing_if = "Option::is_none")]
17    pub enterprise: Option<Box<models::EnterpriseWebhooks>>,
18    #[serde(rename = "installation", skip_serializing_if = "Option::is_none")]
19    pub installation: Option<Box<models::SimpleInstallation>>,
20    #[serde(rename = "organization", skip_serializing_if = "Option::is_none")]
21    pub organization: Option<Box<models::OrganizationSimpleWebhooks>>,
22    /// The pusher type for the event. Can be either `user` or a deploy key.
23    #[serde(rename = "pusher_type")]
24    pub pusher_type: String,
25    /// The [`git ref`](https://docs.github.com/rest/git/refs#get-a-reference) resource.
26    #[serde(rename = "ref")]
27    pub r#ref: String,
28    /// The type of Git ref object deleted in the repository.
29    #[serde(rename = "ref_type")]
30    pub ref_type: RefType,
31    #[serde(rename = "repository")]
32    pub repository: Box<models::RepositoryWebhooks>,
33    #[serde(rename = "sender")]
34    pub sender: Box<models::SimpleUserWebhooks>,
35}
36
37impl WebhookDelete {
38    pub fn new(pusher_type: String, r#ref: String, ref_type: RefType, repository: models::RepositoryWebhooks, sender: models::SimpleUserWebhooks) -> WebhookDelete {
39        WebhookDelete {
40            enterprise: None,
41            installation: None,
42            organization: None,
43            pusher_type,
44            r#ref,
45            ref_type,
46            repository: Box::new(repository),
47            sender: Box::new(sender),
48        }
49    }
50}
51/// The type of Git ref object deleted in the repository.
52#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
53pub enum RefType {
54    #[serde(rename = "tag")]
55    Tag,
56    #[serde(rename = "branch")]
57    Branch,
58}
59
60impl Default for RefType {
61    fn default() -> RefType {
62        Self::Tag
63    }
64}
65