openapi_github/models/
discussion.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/// Discussion : A Discussion in a repository.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Discussion {
17    #[serde(rename = "active_lock_reason", deserialize_with = "Option::deserialize")]
18    pub active_lock_reason: Option<String>,
19    #[serde(rename = "answer_chosen_at", deserialize_with = "Option::deserialize")]
20    pub answer_chosen_at: Option<String>,
21    #[serde(rename = "answer_chosen_by", deserialize_with = "Option::deserialize")]
22    pub answer_chosen_by: Option<Box<models::User>>,
23    #[serde(rename = "answer_html_url", deserialize_with = "Option::deserialize")]
24    pub answer_html_url: Option<String>,
25    /// How the author is associated with the repository.
26    #[serde(rename = "author_association")]
27    pub author_association: AuthorAssociation,
28    #[serde(rename = "body")]
29    pub body: String,
30    #[serde(rename = "category")]
31    pub category: Box<models::DiscussionCategory>,
32    #[serde(rename = "comments")]
33    pub comments: i32,
34    #[serde(rename = "created_at")]
35    pub created_at: String,
36    #[serde(rename = "html_url")]
37    pub html_url: String,
38    #[serde(rename = "id")]
39    pub id: i32,
40    #[serde(rename = "locked")]
41    pub locked: bool,
42    #[serde(rename = "node_id")]
43    pub node_id: String,
44    #[serde(rename = "number")]
45    pub number: i32,
46    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
47    pub reactions: Option<Box<models::Reactions>>,
48    #[serde(rename = "repository_url")]
49    pub repository_url: String,
50    /// The current state of the discussion. `converting` means that the discussion is being converted from an issue. `transferring` means that the discussion is being transferred from another repository.
51    #[serde(rename = "state")]
52    pub state: State,
53    /// The reason for the current state
54    #[serde(rename = "state_reason", deserialize_with = "Option::deserialize")]
55    pub state_reason: Option<StateReason>,
56    #[serde(rename = "timeline_url", skip_serializing_if = "Option::is_none")]
57    pub timeline_url: Option<String>,
58    #[serde(rename = "title")]
59    pub title: String,
60    #[serde(rename = "updated_at")]
61    pub updated_at: String,
62    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
63    pub user: Option<Box<models::User>>,
64}
65
66impl Discussion {
67    /// A Discussion in a repository.
68    pub fn new(active_lock_reason: Option<String>, answer_chosen_at: Option<String>, answer_chosen_by: Option<models::User>, answer_html_url: Option<String>, author_association: AuthorAssociation, body: String, category: models::DiscussionCategory, comments: i32, created_at: String, html_url: String, id: i32, locked: bool, node_id: String, number: i32, repository_url: String, state: State, state_reason: Option<StateReason>, title: String, updated_at: String, user: Option<models::User>) -> Discussion {
69        Discussion {
70            active_lock_reason,
71            answer_chosen_at,
72            answer_chosen_by: answer_chosen_by.map(Box::new),
73            answer_html_url,
74            author_association,
75            body,
76            category: Box::new(category),
77            comments,
78            created_at,
79            html_url,
80            id,
81            locked,
82            node_id,
83            number,
84            reactions: None,
85            repository_url,
86            state,
87            state_reason,
88            timeline_url: None,
89            title,
90            updated_at,
91            user: user.map(Box::new),
92        }
93    }
94}
95/// How the author is associated with the repository.
96#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
97pub enum AuthorAssociation {
98    #[serde(rename = "COLLABORATOR")]
99    Collaborator,
100    #[serde(rename = "CONTRIBUTOR")]
101    Contributor,
102    #[serde(rename = "FIRST_TIMER")]
103    FirstTimer,
104    #[serde(rename = "FIRST_TIME_CONTRIBUTOR")]
105    FirstTimeContributor,
106    #[serde(rename = "MANNEQUIN")]
107    Mannequin,
108    #[serde(rename = "MEMBER")]
109    Member,
110    #[serde(rename = "NONE")]
111    None,
112    #[serde(rename = "OWNER")]
113    Owner,
114}
115
116impl Default for AuthorAssociation {
117    fn default() -> AuthorAssociation {
118        Self::Collaborator
119    }
120}
121/// The current state of the discussion. `converting` means that the discussion is being converted from an issue. `transferring` means that the discussion is being transferred from another repository.
122#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
123pub enum State {
124    #[serde(rename = "open")]
125    Open,
126    #[serde(rename = "closed")]
127    Closed,
128    #[serde(rename = "locked")]
129    Locked,
130    #[serde(rename = "converting")]
131    Converting,
132    #[serde(rename = "transferring")]
133    Transferring,
134}
135
136impl Default for State {
137    fn default() -> State {
138        Self::Open
139    }
140}
141/// The reason for the current state
142#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
143pub enum StateReason {
144    #[serde(rename = "resolved")]
145    Resolved,
146    #[serde(rename = "outdated")]
147    Outdated,
148    #[serde(rename = "duplicate")]
149    Duplicate,
150    #[serde(rename = "reopened")]
151    Reopened,
152}
153
154impl Default for StateReason {
155    fn default() -> StateReason {
156        Self::Resolved
157    }
158}
159