openapi_github/models/
webhook_status.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct WebhookStatus {
16 #[serde(rename = "avatar_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17 pub avatar_url: Option<Option<String>>,
18 #[serde(rename = "branches")]
20 pub branches: Vec<models::WebhookStatusBranchesInner>,
21 #[serde(rename = "commit")]
22 pub commit: Box<models::WebhookStatusCommit>,
23 #[serde(rename = "context")]
24 pub context: String,
25 #[serde(rename = "created_at")]
26 pub created_at: String,
27 #[serde(rename = "description", deserialize_with = "Option::deserialize")]
29 pub description: Option<String>,
30 #[serde(rename = "enterprise", skip_serializing_if = "Option::is_none")]
31 pub enterprise: Option<Box<models::EnterpriseWebhooks>>,
32 #[serde(rename = "id")]
34 pub id: i32,
35 #[serde(rename = "installation", skip_serializing_if = "Option::is_none")]
36 pub installation: Option<Box<models::SimpleInstallation>>,
37 #[serde(rename = "name")]
38 pub name: String,
39 #[serde(rename = "organization", skip_serializing_if = "Option::is_none")]
40 pub organization: Option<Box<models::OrganizationSimpleWebhooks>>,
41 #[serde(rename = "repository")]
42 pub repository: Box<models::RepositoryWebhooks>,
43 #[serde(rename = "sender")]
44 pub sender: Box<models::SimpleUserWebhooks>,
45 #[serde(rename = "sha")]
47 pub sha: String,
48 #[serde(rename = "state")]
50 pub state: State,
51 #[serde(rename = "target_url", deserialize_with = "Option::deserialize")]
53 pub target_url: Option<String>,
54 #[serde(rename = "updated_at")]
55 pub updated_at: String,
56}
57
58impl WebhookStatus {
59 pub fn new(branches: Vec<models::WebhookStatusBranchesInner>, commit: models::WebhookStatusCommit, context: String, created_at: String, description: Option<String>, id: i32, name: String, repository: models::RepositoryWebhooks, sender: models::SimpleUserWebhooks, sha: String, state: State, target_url: Option<String>, updated_at: String) -> WebhookStatus {
60 WebhookStatus {
61 avatar_url: None,
62 branches,
63 commit: Box::new(commit),
64 context,
65 created_at,
66 description,
67 enterprise: None,
68 id,
69 installation: None,
70 name,
71 organization: None,
72 repository: Box::new(repository),
73 sender: Box::new(sender),
74 sha,
75 state,
76 target_url,
77 updated_at,
78 }
79 }
80}
81#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
83pub enum State {
84 #[serde(rename = "pending")]
85 Pending,
86 #[serde(rename = "success")]
87 Success,
88 #[serde(rename = "failure")]
89 Failure,
90 #[serde(rename = "error")]
91 Error,
92}
93
94impl Default for State {
95 fn default() -> State {
96 Self::Pending
97 }
98}
99