openapi_github/models/
webhooks_answer.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct WebhooksAnswer {
16 #[serde(rename = "author_association")]
18 pub author_association: AuthorAssociation,
19 #[serde(rename = "body")]
20 pub body: String,
21 #[serde(rename = "child_comment_count")]
22 pub child_comment_count: i32,
23 #[serde(rename = "created_at")]
24 pub created_at: String,
25 #[serde(rename = "discussion_id")]
26 pub discussion_id: i32,
27 #[serde(rename = "html_url")]
28 pub html_url: String,
29 #[serde(rename = "id")]
30 pub id: i32,
31 #[serde(rename = "node_id")]
32 pub node_id: String,
33 #[serde(rename = "parent_id", deserialize_with = "Option::deserialize")]
34 pub parent_id: Option<serde_json::Value>,
35 #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
36 pub reactions: Option<Box<models::Reactions>>,
37 #[serde(rename = "repository_url")]
38 pub repository_url: String,
39 #[serde(rename = "updated_at")]
40 pub updated_at: String,
41 #[serde(rename = "user", deserialize_with = "Option::deserialize")]
42 pub user: Option<Box<models::User>>,
43}
44
45impl WebhooksAnswer {
46 pub fn new(author_association: AuthorAssociation, body: String, child_comment_count: i32, created_at: String, discussion_id: i32, html_url: String, id: i32, node_id: String, parent_id: Option<serde_json::Value>, repository_url: String, updated_at: String, user: Option<models::User>) -> WebhooksAnswer {
47 WebhooksAnswer {
48 author_association,
49 body,
50 child_comment_count,
51 created_at,
52 discussion_id,
53 html_url,
54 id,
55 node_id,
56 parent_id,
57 reactions: None,
58 repository_url,
59 updated_at,
60 user: user.map(Box::new),
61 }
62 }
63}
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum AuthorAssociation {
67 #[serde(rename = "COLLABORATOR")]
68 Collaborator,
69 #[serde(rename = "CONTRIBUTOR")]
70 Contributor,
71 #[serde(rename = "FIRST_TIMER")]
72 FirstTimer,
73 #[serde(rename = "FIRST_TIME_CONTRIBUTOR")]
74 FirstTimeContributor,
75 #[serde(rename = "MANNEQUIN")]
76 Mannequin,
77 #[serde(rename = "MEMBER")]
78 Member,
79 #[serde(rename = "NONE")]
80 None,
81 #[serde(rename = "OWNER")]
82 Owner,
83}
84
85impl Default for AuthorAssociation {
86 fn default() -> AuthorAssociation {
87 Self::Collaborator
88 }
89}
90