github_rust/github/
types.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize)]
4pub struct GraphQLQuery<T> {
5    pub query: String,
6    pub variables: T,
7}
8
9#[derive(Deserialize)]
10pub struct GraphQLResponse<T> {
11    pub data: Option<T>,
12    pub errors: Option<Vec<GraphQLError>>,
13}
14
15#[derive(Deserialize)]
16pub struct GraphQLError {
17    pub message: String,
18    #[serde(rename = "type")]
19    #[allow(dead_code)]
20    pub error_type: Option<String>,
21}
22
23#[derive(Deserialize, Serialize, Clone, Default, Debug)]
24pub struct Language {
25    pub name: String,
26    pub color: Option<String>,
27}
28
29#[derive(Deserialize, Serialize, Clone, Default, Debug)]
30pub struct License {
31    pub name: String,
32    #[serde(rename = "spdxId")]
33    pub spdx_id: Option<String>,
34}
35
36#[derive(Deserialize, Serialize, Clone, Default, Debug)]
37pub struct TopicConnection {
38    pub edges: Vec<TopicEdge>,
39}
40
41#[derive(Deserialize, Serialize, Clone, Default, Debug)]
42pub struct TopicEdge {
43    pub node: TopicNode,
44}
45
46#[derive(Deserialize, Serialize, Clone, Default, Debug)]
47pub struct TopicNode {
48    pub topic: Topic,
49}
50
51#[derive(Deserialize, Serialize, Clone, Default, Debug)]
52pub struct Topic {
53    pub name: String,
54}
55
56#[derive(Deserialize, Serialize)]
57pub struct TotalCount {
58    #[serde(rename = "totalCount")]
59    pub total_count: u32,
60}
61
62#[derive(Deserialize, Serialize)]
63pub struct LanguageConnection {
64    pub edges: Vec<LanguageEdge>,
65}
66
67#[derive(Deserialize, Serialize)]
68pub struct LanguageEdge {
69    pub size: u64,
70    pub node: Language,
71}
72
73#[derive(Deserialize, Serialize)]
74pub struct Branch {
75    pub name: String,
76}
77
78/// GitHub user information
79#[derive(Deserialize, Serialize, Clone, Debug)]
80pub struct User {
81    pub login: String,
82    pub id: u64,
83    pub node_id: String,
84    pub avatar_url: String,
85    pub gravatar_id: String,
86    pub url: String,
87    pub html_url: String,
88    pub followers_url: String,
89    pub following_url: String,
90    pub gists_url: String,
91    pub starred_url: String,
92    pub subscriptions_url: String,
93    pub organizations_url: String,
94    pub repos_url: String,
95    pub events_url: String,
96    pub received_events_url: String,
97    #[serde(rename = "type")]
98    pub user_type: String,
99    pub site_admin: bool,
100}
101
102/// Stargazer with timestamp when the repository was starred
103#[derive(Deserialize, Serialize, Clone, Debug)]
104pub struct StargazerWithDate {
105    pub starred_at: String,
106    pub user: User,
107}