openapi_github/models/
webhook_org_block_blocked.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct WebhookOrgBlockBlocked {
16 #[serde(rename = "action")]
17 pub action: Action,
18 #[serde(rename = "blocked_user", deserialize_with = "Option::deserialize")]
19 pub blocked_user: Option<Box<models::WebhooksUser>>,
20 #[serde(rename = "enterprise", skip_serializing_if = "Option::is_none")]
21 pub enterprise: Option<Box<models::EnterpriseWebhooks>>,
22 #[serde(rename = "installation", skip_serializing_if = "Option::is_none")]
23 pub installation: Option<Box<models::SimpleInstallation>>,
24 #[serde(rename = "organization")]
25 pub organization: Box<models::OrganizationSimpleWebhooks>,
26 #[serde(rename = "repository", skip_serializing_if = "Option::is_none")]
27 pub repository: Option<Box<models::RepositoryWebhooks>>,
28 #[serde(rename = "sender")]
29 pub sender: Box<models::SimpleUserWebhooks>,
30}
31
32impl WebhookOrgBlockBlocked {
33 pub fn new(action: Action, blocked_user: Option<models::WebhooksUser>, organization: models::OrganizationSimpleWebhooks, sender: models::SimpleUserWebhooks) -> WebhookOrgBlockBlocked {
34 WebhookOrgBlockBlocked {
35 action,
36 blocked_user: blocked_user.map(Box::new),
37 enterprise: None,
38 installation: None,
39 organization: Box::new(organization),
40 repository: None,
41 sender: Box::new(sender),
42 }
43 }
44}
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
47pub enum Action {
48 #[serde(rename = "blocked")]
49 Blocked,
50}
51
52impl Default for Action {
53 fn default() -> Action {
54 Self::Blocked
55 }
56}
57