openapi_github/models/
webhook_create.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct WebhookCreate {
16 #[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 #[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 #[serde(rename = "pusher_type")]
30 pub pusher_type: String,
31 #[serde(rename = "ref")]
33 pub r#ref: String,
34 #[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#[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