openapi_github/models/
webhooks_sponsorship.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 WebhooksSponsorship {
16    #[serde(rename = "created_at")]
17    pub created_at: String,
18    #[serde(rename = "maintainer", skip_serializing_if = "Option::is_none")]
19    pub maintainer: Option<Box<models::WebhooksSponsorshipMaintainer>>,
20    #[serde(rename = "node_id")]
21    pub node_id: String,
22    #[serde(rename = "privacy_level")]
23    pub privacy_level: String,
24    #[serde(rename = "sponsor", deserialize_with = "Option::deserialize")]
25    pub sponsor: Option<Box<models::User>>,
26    #[serde(rename = "sponsorable", deserialize_with = "Option::deserialize")]
27    pub sponsorable: Option<Box<models::User>>,
28    #[serde(rename = "tier")]
29    pub tier: Box<models::SponsorshipTier>,
30}
31
32impl WebhooksSponsorship {
33    pub fn new(created_at: String, node_id: String, privacy_level: String, sponsor: Option<models::User>, sponsorable: Option<models::User>, tier: models::SponsorshipTier) -> WebhooksSponsorship {
34        WebhooksSponsorship {
35            created_at,
36            maintainer: None,
37            node_id,
38            privacy_level,
39            sponsor: sponsor.map(Box::new),
40            sponsorable: sponsorable.map(Box::new),
41            tier: Box::new(tier),
42        }
43    }
44}
45