openapi_github/models/
issue.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/// Issue : The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Issue {
17    #[serde(rename = "active_lock_reason", deserialize_with = "Option::deserialize")]
18    pub active_lock_reason: Option<ActiveLockReason>,
19    #[serde(rename = "assignee", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
20    pub assignee: Option<Option<Box<models::User>>>,
21    #[serde(rename = "assignees")]
22    pub assignees: Vec<models::User>,
23    /// How the author is associated with the repository.
24    #[serde(rename = "author_association")]
25    pub author_association: AuthorAssociation,
26    /// Contents of the issue
27    #[serde(rename = "body", deserialize_with = "Option::deserialize")]
28    pub body: Option<String>,
29    #[serde(rename = "closed_at", deserialize_with = "Option::deserialize")]
30    pub closed_at: Option<String>,
31    #[serde(rename = "comments")]
32    pub comments: i32,
33    #[serde(rename = "comments_url")]
34    pub comments_url: String,
35    #[serde(rename = "created_at")]
36    pub created_at: String,
37    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
38    pub draft: Option<bool>,
39    #[serde(rename = "events_url")]
40    pub events_url: String,
41    #[serde(rename = "html_url")]
42    pub html_url: String,
43    #[serde(rename = "id")]
44    pub id: i64,
45    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
46    pub labels: Option<Vec<models::Label>>,
47    #[serde(rename = "labels_url")]
48    pub labels_url: String,
49    #[serde(rename = "locked", skip_serializing_if = "Option::is_none")]
50    pub locked: Option<bool>,
51    #[serde(rename = "milestone", deserialize_with = "Option::deserialize")]
52    pub milestone: Option<Box<models::Milestone1>>,
53    #[serde(rename = "node_id")]
54    pub node_id: String,
55    #[serde(rename = "number")]
56    pub number: i32,
57    #[serde(rename = "performed_via_github_app", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
58    pub performed_via_github_app: Option<Option<Box<models::App10>>>,
59    #[serde(rename = "pull_request", skip_serializing_if = "Option::is_none")]
60    pub pull_request: Option<Box<models::WebhooksIssuePullRequest>>,
61    #[serde(rename = "reactions")]
62    pub reactions: Box<models::Reactions>,
63    #[serde(rename = "repository_url")]
64    pub repository_url: String,
65    /// State of the issue; either 'open' or 'closed'
66    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
67    pub state: Option<State>,
68    #[serde(rename = "state_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
69    pub state_reason: Option<Option<String>>,
70    #[serde(rename = "timeline_url", skip_serializing_if = "Option::is_none")]
71    pub timeline_url: Option<String>,
72    /// Title of the issue
73    #[serde(rename = "title")]
74    pub title: String,
75    #[serde(rename = "updated_at")]
76    pub updated_at: String,
77    /// URL for the issue
78    #[serde(rename = "url")]
79    pub url: String,
80    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
81    pub user: Option<Box<models::User>>,
82}
83
84impl Issue {
85    /// The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself.
86    pub fn new(active_lock_reason: Option<ActiveLockReason>, assignees: Vec<models::User>, author_association: AuthorAssociation, body: Option<String>, closed_at: Option<String>, comments: i32, comments_url: String, created_at: String, events_url: String, html_url: String, id: i64, labels_url: String, milestone: Option<models::Milestone1>, node_id: String, number: i32, reactions: models::Reactions, repository_url: String, title: String, updated_at: String, url: String, user: Option<models::User>) -> Issue {
87        Issue {
88            active_lock_reason,
89            assignee: None,
90            assignees,
91            author_association,
92            body,
93            closed_at,
94            comments,
95            comments_url,
96            created_at,
97            draft: None,
98            events_url,
99            html_url,
100            id,
101            labels: None,
102            labels_url,
103            locked: None,
104            milestone: milestone.map(Box::new),
105            node_id,
106            number,
107            performed_via_github_app: None,
108            pull_request: None,
109            reactions: Box::new(reactions),
110            repository_url,
111            state: None,
112            state_reason: None,
113            timeline_url: None,
114            title,
115            updated_at,
116            url,
117            user: user.map(Box::new),
118        }
119    }
120}
121/// 
122#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
123pub enum ActiveLockReason {
124    #[serde(rename = "resolved")]
125    Resolved,
126    #[serde(rename = "off-topic")]
127    OffTopic,
128    #[serde(rename = "too heated")]
129    TooHeated,
130    #[serde(rename = "spam")]
131    Spam,
132}
133
134impl Default for ActiveLockReason {
135    fn default() -> ActiveLockReason {
136        Self::Resolved
137    }
138}
139/// How the author is associated with the repository.
140#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
141pub enum AuthorAssociation {
142    #[serde(rename = "COLLABORATOR")]
143    Collaborator,
144    #[serde(rename = "CONTRIBUTOR")]
145    Contributor,
146    #[serde(rename = "FIRST_TIMER")]
147    FirstTimer,
148    #[serde(rename = "FIRST_TIME_CONTRIBUTOR")]
149    FirstTimeContributor,
150    #[serde(rename = "MANNEQUIN")]
151    Mannequin,
152    #[serde(rename = "MEMBER")]
153    Member,
154    #[serde(rename = "NONE")]
155    None,
156    #[serde(rename = "OWNER")]
157    Owner,
158}
159
160impl Default for AuthorAssociation {
161    fn default() -> AuthorAssociation {
162        Self::Collaborator
163    }
164}
165/// State of the issue; either 'open' or 'closed'
166#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
167pub enum State {
168    #[serde(rename = "open")]
169    Open,
170    #[serde(rename = "closed")]
171    Closed,
172}
173
174impl Default for State {
175    fn default() -> State {
176        Self::Open
177    }
178}
179