1use serde::{Deserialize, Serialize};
2
3use crate::model::user::User;
4
5#[derive(Default, Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
9pub enum ObjectFormatName {
10 #[default]
11 #[serde(rename = "sha1")]
12 SHA1,
13 #[serde(rename = "sha256")]
14 SHA256,
15}
16
17#[derive(Default, Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
21pub enum TrustModel {
22 #[serde(rename = "default")]
24 #[default]
25 Default,
26 #[serde(rename = "collaborator")]
28 Collaborator,
29 #[serde(rename = "committer")]
32 Committer,
33 #[serde(rename = "collaboratorcommitter")]
35 CollabroatorCommitter,
36}
37
38#[derive(Default, Debug, Clone, Serialize, Deserialize)]
42#[serde(default)]
43pub struct Repository {
44 pub allow_fast_forward_only_merge: bool,
45 pub allow_merge_commits: bool,
46 pub allow_rebase: bool,
47 pub allow_rebase_explicit: bool,
48 pub allow_rebase_update: bool,
49 pub allow_squash_merge: bool,
50 pub archived: bool,
51 pub archived_at: String,
52 pub avatar_url: String,
53 pub clone_url: String,
54 pub created_at: String,
55 pub default_allow_maintainer_edit: bool,
56 pub default_branch: String,
57 pub default_delete_branch_after_merge: bool,
58 pub default_merge_style: String,
59 pub description: String,
60 pub empty: bool,
61 pub external_tracker: ExternalTracker,
62 pub external_wiki: ExternalWiki,
63 pub fork: bool,
64 pub forks_count: i64,
65 pub full_name: String,
66 pub has_actions: bool,
67 pub has_issues: bool,
68 pub has_packages: bool,
69 pub has_projects: bool,
70 pub has_pull_requests: bool,
71 pub has_releases: bool,
72 pub has_wiki: bool,
73 pub html_url: String,
74 pub id: i64,
75 pub ignore_whitespace_conflicts: bool,
76 pub internal: bool,
77 pub language: String,
78 pub languages_url: String,
79 pub link: String,
80 pub mirror: bool,
81 pub mirror_interval: String,
82 pub mirror_updated: String,
83 pub name: String,
84 pub object_format_name: ObjectFormatName,
85 pub open_issues_count: i64,
86 pub open_pr_counter: i64,
87 pub original_url: String,
88 pub owner: User,
89 pub private: bool,
90 pub release_counter: i64,
91 pub size: i64,
92 pub ssh_url: String,
93 pub stars_count: i64,
94 pub template: bool,
95 pub updated_at: String,
96 pub url: String,
97 pub watchers_count: i64,
98 pub website: String,
99 pub wiki_branch: String,
100}
101
102#[derive(Default, Debug, Clone, Serialize, Deserialize)]
108#[serde(default)]
109pub struct CommitUser {
110 pub date: String,
112 pub email: String,
114 pub name: String,
116}
117
118#[derive(Default, Debug, Clone, Serialize, Deserialize)]
122#[serde(default)]
123pub struct RepoCommit {
124 pub author: CommitUser,
126 pub committer: CommitUser,
128 pub message: String,
130 pub url: String,
133}
134
135#[derive(Default, Debug, Clone, Serialize, Deserialize)]
140#[serde(default)]
141pub struct Commit {
142 pub author: Option<User>,
147 pub commit: RepoCommit,
148 pub committer: Option<User>,
153 pub html_url: String,
155 pub sha: String,
157 pub url: String,
159}
160
161#[derive(Default, Debug, Clone, Serialize, Deserialize)]
162pub struct PayloadUser {
163 pub email: String,
164 pub name: String,
166 pub username: String,
167}
168
169#[derive(Default, Debug, Clone, Serialize, Deserialize)]
170pub struct PayloadCommit {
171 pub author: PayloadUser,
172 pub committer: PayloadUser,
173 pub id: String,
175 pub message: String,
176 pub added: Option<Vec<String>>,
177 pub modified: Option<Vec<String>>,
178 pub removed: Option<Vec<String>>,
179 pub timestamp: String,
180 pub url: String,
181 }
183
184#[derive(Default, Debug, Clone, Serialize, Deserialize)]
185pub struct Branch {
186 pub commit: PayloadCommit,
187 pub effective_branch_protection_name: String,
188 pub enable_status_check: bool,
189 pub name: String,
190 pub protected: bool,
191 pub required_approvals: i64,
192 pub status_check_contexts: Vec<String>,
193 pub user_can_merge: bool,
194 pub user_can_push: bool,
195}
196
197#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
199#[serde(default)]
200pub struct ExternalTracker {
201 pub external_tracker_format: String,
203 pub external_tracker_regexp_pattern: String,
205 pub external_tracker_style: String,
207 pub external_tracker_url: String,
209}
210
211#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
213#[serde(default)]
214pub struct ExternalWiki {
215 pub external_wiki_url: String,
217}