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