n4n5/commands/gh/
types.rs

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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
use serde::{Deserialize, Serialize};

/// Github Response
#[derive(Deserialize, Default, Debug)]
pub struct GhResponse {
    /// Data
    pub data: GhData,
}

/// Data
#[derive(Deserialize, Default, Debug)]
pub struct GhData {
    /// User
    pub user: GhUser,
}

/// User
#[derive(Deserialize, Default, Debug)]
pub struct GhUser {
    /// Login
    #[serde(rename = "pullRequests")]
    pub pull_requests: GhPullRequests,
}

/// Pull requests
#[derive(Deserialize, Default, Debug)]
pub struct GhPullRequests {
    /// Edges
    pub edges: Vec<GhPullRequest>,

    /// Page info
    #[serde(rename = "pageInfo")]
    pub page_info: GhPageInfo,
}

/// Page info
#[derive(Deserialize, Default, Debug)]
pub struct GhPageInfo {
    /// End cursor
    #[serde(rename = "endCursor")]
    pub end_cursor: String,

    /// Start cursor
    #[serde(rename = "hasNextPage")]
    pub has_next_page: bool,
}

/// Pull request
#[derive(Deserialize, Serialize, Default, Debug)]
pub struct GhPullRequest {
    /// Node
    node: GhPullRequestNode,
}

/// Pull request node
#[derive(Deserialize, Serialize, Default, Debug)]
pub struct GhPullRequestNode {
    /// Id
    id: String,

    /// Number
    number: i32,

    /// Title
    title: String,

    /// Url
    url: String,

    /// State
    state: String,

    /// Created at
    #[serde(rename = "createdAt")]
    created_at: String,

    /// Base repository
    #[serde(rename = "baseRepository")]
    base_repository: GhBaseRepository,
}

/// Base repository
#[derive(Deserialize, Serialize, Default, Debug)]
pub struct GhBaseRepository {
    /// Url
    url: String,

    /// Name
    name: String,

    /// Description
    description: Option<String>,

    /// Owner
    owner: GhOwner,

    /// Languages
    languages: GhLanguages,
}

/// Owner
#[derive(Deserialize, Serialize, Default, Debug)]
pub struct GhOwner {
    /// Login
    login: String,
}

/// Languages
#[derive(Deserialize, Serialize, Default, Debug)]
pub struct GhLanguages {
    /// Nodes
    nodes: Vec<GhLanguage>,
}

/// Language
#[derive(Deserialize, Serialize, Default, Debug)]
pub struct GhLanguage {
    /// Name of the language
    name: String,

    /// Color of the language
    color: Option<String>,
}

/// Github Project Response (gist or repository)
#[derive(Deserialize, Serialize, Default, Debug)]
pub struct GhProject {
    /// Project url
    pub url: String,

    /// Project name
    pub name: String,

    /// Project description
    pub description: Option<String>,

    /// stargazerCount
    #[serde(rename = "stargazerCount")]
    pub stargazer_count: i32,

    /// homepageUrl
    #[serde(rename = "homepageUrl")]
    pub homepage_url: Option<String>,

    /// primaryLanguage
    #[serde(rename = "primaryLanguage")]
    pub primary_language: Option<GhLanguage>,
}