openapi_github/models/
webhook_repository_dispatch_sample.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 WebhookRepositoryDispatchSample {
16    /// The `event_type` that was specified in the `POST /repos/{owner}/{repo}/dispatches` request body.
17    #[serde(rename = "action")]
18    pub action: String,
19    #[serde(rename = "branch")]
20    pub branch: String,
21    /// The `client_payload` that was specified in the `POST /repos/{owner}/{repo}/dispatches` request body.
22    #[serde(rename = "client_payload", deserialize_with = "Option::deserialize")]
23    pub client_payload: Option<std::collections::HashMap<String, serde_json::Value>>,
24    #[serde(rename = "enterprise", skip_serializing_if = "Option::is_none")]
25    pub enterprise: Option<Box<models::EnterpriseWebhooks>>,
26    #[serde(rename = "installation")]
27    pub installation: Box<models::SimpleInstallation>,
28    #[serde(rename = "organization", skip_serializing_if = "Option::is_none")]
29    pub organization: Option<Box<models::OrganizationSimpleWebhooks>>,
30    #[serde(rename = "repository")]
31    pub repository: Box<models::RepositoryWebhooks>,
32    #[serde(rename = "sender")]
33    pub sender: Box<models::SimpleUserWebhooks>,
34}
35
36impl WebhookRepositoryDispatchSample {
37    pub fn new(action: String, branch: String, client_payload: Option<std::collections::HashMap<String, serde_json::Value>>, installation: models::SimpleInstallation, repository: models::RepositoryWebhooks, sender: models::SimpleUserWebhooks) -> WebhookRepositoryDispatchSample {
38        WebhookRepositoryDispatchSample {
39            action,
40            branch,
41            client_payload,
42            enterprise: None,
43            installation: Box::new(installation),
44            organization: None,
45            repository: Box::new(repository),
46            sender: Box::new(sender),
47        }
48    }
49}
50