1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use crate::model::{commits::association::Association, prelude::*, user::SimpleUser};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Discussion {
    pub lock_reason: Option<LockReason>,
    pub repository_url: String,
    pub answer_html_url: Option<String>,
    pub answer_chosen_at: Option<String>,
    pub answer_chosen_by: Option<SimpleUser>,
    pub html_url: String,
    pub id: usize,
    pub node_id: String,
    pub number: usize,
    pub title: String,
    pub user: SimpleUser,
    pub state: String,
    pub locked: bool,
    pub comments: usize,
    pub created_at: String,
    pub updated_at: String,
    pub author_association: Association,
    pub active_lock_reason: Option<Value>,
    pub body: String,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, EnumString, EnumVariantNames)]
#[serde(rename_all = "snake_case")]
pub enum LockReason {
    OffTopic,
    Resolved,
    Spam,
    TooHeated,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DiscussionComment {
    pub id: usize,
    pub node_id: String,
    pub html_url: String,
    pub parent_id: Option<Value>,
    pub child_comment_count: usize,
    pub repository_url: String,
    pub discussion_id: usize,
    pub author_association: Association,
    pub user: SimpleUser,
    pub created_at: String,
    pub updated_at: Option<String>,
    pub body: String,
}