Skip to main content

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