1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct Repository {
5 pub id: u64,
6 pub name: String,
7 pub full_name: String,
8 pub description: Option<String>,
9 pub private: bool,
10 pub fork: bool,
11 pub html_url: String,
12 pub clone_url: String,
13 pub ssh_url: String,
14 pub default_branch: String,
15 pub stargazers_count: u64,
16 pub forks_count: u64,
17 pub open_issues_count: u64,
18}
19
20#[derive(Debug, Clone, Serialize, Deserialize)]
21pub struct Branch {
22 pub name: String,
23 pub commit: CommitRef,
24 pub protected: bool,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct CommitRef {
29 pub sha: String,
30 pub url: String,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct Commit {
35 pub sha: String,
36 pub message: String,
37 pub author: Option<GitUser>,
38 pub committer: Option<GitUser>,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct GitUser {
43 pub name: String,
44 pub email: String,
45 pub date: Option<String>,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
49pub struct User {
50 pub id: u64,
51 pub login: String,
52 pub name: Option<String>,
53 pub email: Option<String>,
54 pub avatar_url: String,
55 pub html_url: String,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
59pub struct FileContent {
60 pub name: String,
61 pub path: String,
62 pub sha: String,
63 pub size: u64,
64 pub content: Option<String>,
65 pub encoding: Option<String>,
66 pub download_url: Option<String>,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize)]
70pub struct TreeEntry {
71 pub path: String,
72 pub mode: String,
73 pub sha: String,
74 #[serde(rename = "type")]
75 pub entry_type: String,
76 pub size: Option<u64>,
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
80pub struct Tree {
81 pub sha: String,
82 pub tree: Vec<TreeEntry>,
83 pub truncated: bool,
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
87pub struct Reference {
88 #[serde(rename = "ref")]
89 pub ref_name: String,
90 pub node_id: String,
91 pub url: String,
92 pub object: RefObject,
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
96pub struct RefObject {
97 pub sha: String,
98 #[serde(rename = "type")]
99 pub object_type: String,
100 pub url: String,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
104pub struct CreateTreeEntry {
105 pub path: String,
106 pub mode: String,
107 pub content: Option<String>,
108 pub sha: Option<String>,
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
112pub struct Release {
113 pub id: u64,
114 pub tag_name: String,
115 pub name: Option<String>,
116 pub body: Option<String>,
117 pub draft: bool,
118 pub prerelease: bool,
119 pub html_url: String,
120 pub tarball_url: Option<String>,
121 pub zipball_url: Option<String>,
122 #[serde(default)]
123 pub assets: Vec<ReleaseAsset>,
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
127pub struct ReleaseAsset {
128 pub id: u64,
129 pub name: String,
130 pub content_type: String,
131 pub size: u64,
132 pub download_count: u64,
133 pub browser_download_url: String,
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
137pub struct Blob {
138 pub sha: String,
139 pub url: String,
140}