openapi_github/models/
webhook_membership_added.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 WebhookMembershipAdded {
16    #[serde(rename = "action")]
17    pub action: Action,
18    #[serde(rename = "enterprise", skip_serializing_if = "Option::is_none")]
19    pub enterprise: Option<Box<models::EnterpriseWebhooks>>,
20    #[serde(rename = "installation", skip_serializing_if = "Option::is_none")]
21    pub installation: Option<Box<models::SimpleInstallation>>,
22    #[serde(rename = "member", deserialize_with = "Option::deserialize")]
23    pub member: Option<Box<models::WebhooksUser>>,
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    /// The scope of the membership. Currently, can only be `team`.
29    #[serde(rename = "scope")]
30    pub scope: Scope,
31    #[serde(rename = "sender", deserialize_with = "Option::deserialize")]
32    pub sender: Option<Box<models::User>>,
33    #[serde(rename = "team")]
34    pub team: Box<models::WebhooksTeam>,
35}
36
37impl WebhookMembershipAdded {
38    pub fn new(action: Action, member: Option<models::WebhooksUser>, organization: models::OrganizationSimpleWebhooks, scope: Scope, sender: Option<models::User>, team: models::WebhooksTeam) -> WebhookMembershipAdded {
39        WebhookMembershipAdded {
40            action,
41            enterprise: None,
42            installation: None,
43            member: member.map(Box::new),
44            organization: Box::new(organization),
45            repository: None,
46            scope,
47            sender: sender.map(Box::new),
48            team: Box::new(team),
49        }
50    }
51}
52/// 
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum Action {
55    #[serde(rename = "added")]
56    Added,
57}
58
59impl Default for Action {
60    fn default() -> Action {
61        Self::Added
62    }
63}
64/// The scope of the membership. Currently, can only be `team`.
65#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum Scope {
67    #[serde(rename = "team")]
68    Team,
69}
70
71impl Default for Scope {
72    fn default() -> Scope {
73        Self::Team
74    }
75}
76