use_github_api/
schema.rs

1pub mod users {
2    pub mod list {
3        use core::panic;
4
5        #[derive(serde::Deserialize, serde::Serialize, Debug)]
6        #[allow(dead_code)]
7        pub struct User {
8            pub login: String,
9            pub id: usize,
10            #[cfg(feature = "node_ids")]
11            node_id: String,
12            // url: String,
13            // html_url: String,
14            // followers_url: String,
15            // following_url: String,
16            // gists_url: String,
17            // starred_url: String,
18            // subscriptions_url: String,
19            // organizations_url: String,
20            // repos_url: String,
21            // events_url: String,
22            // received_events_url: String,
23            pub r#type: String,
24            pub site_admin: bool,
25        }
26
27        #[derive(serde::Serialize, Debug)]
28        pub struct Params {
29            pub since: Option<usize>,
30            pub per_page: Option<usize>,
31        }
32
33        impl Params {
34            pub fn new(since: Option<usize>, per_page: Option<usize>) -> Self {
35                if let Some(per_page) = per_page {
36                    if per_page > 100 {
37                        panic!()
38                    }
39                }
40
41                Self { since, per_page }
42            }
43        }
44    }
45
46    pub mod single {
47        use std::usize;
48
49        use chrono::{DateTime, Utc};
50
51        #[derive(serde::Deserialize, Debug)]
52        pub struct User {
53            pub login: String,
54            pub id: usize,
55            // avatar_url: String,
56            pub gravatar_id: String,
57            // url: String,
58            // html_url: String,
59            // followers_url: String,
60            // following_url: String,
61            // gists_url: String,
62            // starred_url: String,
63            // subscriptions_url: String,
64            // organizations_url: String,
65            // repos_url: String,
66            // events_url: String,
67            // received_events_url: String,
68            pub r#type: String,
69            pub site_admin: bool,
70            pub name: String,
71            pub company: Option<String>,
72            pub blog: String,
73            pub location: String,
74            pub email: Option<String>,
75            pub hireable: Option<bool>,
76            pub bio: Option<String>,
77            pub twitter_username: Option<String>,
78            pub public_repos: usize,
79            pub public_gists: usize,
80            pub followers: usize,
81            pub following: usize,
82            pub created_at: DateTime<Utc>,
83            pub updated_at: DateTime<Utc>,
84            pub plan: Option<Plan>,
85        }
86
87        #[derive(Debug, serde::Deserialize)]
88        pub struct Plan {
89            name: String,
90            space: usize,
91            collaborators: usize,
92            private_repos: usize,
93        }
94    }
95
96    pub mod contextual_info {
97        #[derive(Debug, serde::Deserialize)]
98        pub struct User {
99            pub contexts: Vec<Context>,
100        }
101
102        #[derive(Debug, serde::Deserialize)]
103        pub struct Context {
104            pub message: String,
105            pub octicon: String,
106        }
107
108        #[derive(Debug, serde::Serialize)]
109        #[non_exhaustive]
110        pub struct Params {
111            subject_type: String,
112            subject_id: usize,
113        }
114
115        impl Params {
116            pub fn new(subject_type: String, subject_id: usize) -> Self {
117                Self {
118                    subject_id,
119                    subject_type,
120                }
121            }
122        }
123    }
124}
125
126#[derive(serde::Deserialize, Debug)]
127pub struct GitHubError {
128    pub message: String,
129    pub documentation_url: String,
130}