2024-09-01 14:33:08 +00:00
|
|
|
use chrono::{DateTime, Utc};
|
2024-04-19 18:49:31 +00:00
|
|
|
use serde::Deserialize;
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct CommitAuthor {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub name: String,
|
|
|
|
pub email: String,
|
|
|
|
pub username: String,
|
2024-04-19 18:49:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct User {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub id: u32,
|
|
|
|
pub login: String,
|
|
|
|
pub full_name: String,
|
|
|
|
pub email: String,
|
|
|
|
pub avatar_url: String,
|
|
|
|
pub username: String,
|
2024-04-19 18:49:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Commit {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub id: String,
|
|
|
|
pub message: String,
|
|
|
|
pub url: String,
|
|
|
|
pub author: CommitAuthor,
|
|
|
|
pub committer: CommitAuthor,
|
2024-09-01 14:33:08 +00:00
|
|
|
pub timestamp: DateTime<Utc>,
|
2024-04-19 18:49:31 +00:00
|
|
|
}
|
|
|
|
|
2024-04-23 15:21:27 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Perms {
|
2024-09-04 18:38:48 +00:00
|
|
|
admin: bool,
|
|
|
|
push: bool,
|
|
|
|
pull: bool,
|
2024-04-23 15:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct InternalTracker {
|
2024-09-04 18:38:48 +00:00
|
|
|
enable_time_tracker: bool,
|
|
|
|
allow_only_contributors_to_track_time: bool,
|
|
|
|
enable_issue_dependencies: bool,
|
2024-04-23 15:21:27 +00:00
|
|
|
}
|
|
|
|
|
2024-04-19 18:49:31 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Repository {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub id: u32,
|
|
|
|
pub owner: User,
|
|
|
|
pub name: String,
|
|
|
|
pub full_name: String,
|
|
|
|
pub description: String,
|
|
|
|
pub private: bool,
|
|
|
|
pub fork: bool,
|
|
|
|
pub html_url: String,
|
|
|
|
pub ssh_url: String,
|
|
|
|
pub clone_url: String,
|
|
|
|
pub website: String,
|
|
|
|
pub stars_count: u32,
|
|
|
|
pub forks_count: u32,
|
|
|
|
pub watchers_count: u32,
|
|
|
|
pub open_issues_count: u32,
|
|
|
|
pub default_branch: String,
|
2024-09-01 14:33:08 +00:00
|
|
|
pub created_at: DateTime<Utc>,
|
|
|
|
pub updated_at: DateTime<Utc>,
|
2024-04-19 18:49:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
2024-04-23 15:21:27 +00:00
|
|
|
pub struct RepositoryFull {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub id: u32,
|
|
|
|
pub owner: RepositoryOwner,
|
|
|
|
pub name: String,
|
|
|
|
pub full_name: String,
|
|
|
|
pub description: String,
|
|
|
|
pub empty: bool,
|
|
|
|
pub private: bool,
|
|
|
|
pub fork: bool,
|
|
|
|
pub template: bool,
|
|
|
|
pub parent: Option<Box<RepositoryFull>>,
|
|
|
|
pub mirror: bool,
|
|
|
|
pub size: u32,
|
|
|
|
pub language: String,
|
|
|
|
pub languages_url: String,
|
|
|
|
pub html_url: String,
|
|
|
|
pub url: String,
|
|
|
|
pub link: String,
|
|
|
|
pub ssh_url: String,
|
|
|
|
pub clone_url: String,
|
|
|
|
pub website: String,
|
|
|
|
pub stars_count: u32,
|
|
|
|
pub forks_count: u32,
|
|
|
|
pub watchers_count: u32,
|
|
|
|
pub open_issues_count: u32,
|
|
|
|
pub open_pr_counter: u32,
|
|
|
|
pub default_branch: String,
|
2024-09-01 14:33:08 +00:00
|
|
|
pub created_at: DateTime<Utc>,
|
|
|
|
pub updated_at: DateTime<Utc>,
|
|
|
|
pub archived_at: DateTime<Utc>,
|
2024-09-04 18:38:48 +00:00
|
|
|
pub permissions: Perms,
|
|
|
|
pub has_issues: bool,
|
|
|
|
pub internal_tracker: InternalTracker,
|
|
|
|
pub has_wiki: bool,
|
|
|
|
pub has_pull_requests: bool,
|
|
|
|
pub has_projects: bool,
|
|
|
|
pub has_releases: bool,
|
|
|
|
pub has_actions: bool,
|
|
|
|
pub ignore_whitespace_conflicts: bool,
|
|
|
|
pub allow_merge_commits: bool,
|
|
|
|
pub allow_rebase: bool,
|
|
|
|
pub allow_rebase_explicit: bool,
|
|
|
|
pub allow_squash_merge: bool,
|
|
|
|
pub allow_rebase_update: bool,
|
|
|
|
pub default_delete_branch_after_merge: bool,
|
|
|
|
pub default_merge_style: String,
|
|
|
|
pub default_allow_maintainer_edit: bool,
|
|
|
|
pub avatar_url: String,
|
|
|
|
pub internal: bool,
|
|
|
|
pub mirror_internal: String,
|
2024-09-01 14:33:08 +00:00
|
|
|
pub mirror_updated: DateTime<Utc>,
|
2024-09-04 18:38:48 +00:00
|
|
|
pub repo_transfer: Option<String>,
|
2024-04-23 15:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct RepositoryOwner {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub id: u32,
|
|
|
|
pub login: String,
|
|
|
|
pub login_name: String,
|
|
|
|
pub full_name: String,
|
|
|
|
pub email: String,
|
|
|
|
pub avatar_url: String,
|
|
|
|
pub language: String,
|
|
|
|
pub is_admin: bool,
|
2024-09-01 14:33:08 +00:00
|
|
|
pub last_login: DateTime<Utc>,
|
|
|
|
pub created: DateTime<Utc>,
|
2024-09-04 18:38:48 +00:00
|
|
|
pub restricted: bool,
|
|
|
|
pub active: bool,
|
|
|
|
pub prohibit_login: bool,
|
|
|
|
pub location: String,
|
|
|
|
pub website: String,
|
|
|
|
pub description: String,
|
|
|
|
pub visibility: String,
|
|
|
|
pub followers_count: u32,
|
|
|
|
pub following_count: u32,
|
|
|
|
pub starred_repos_count: u32,
|
|
|
|
pub username: String,
|
2024-04-23 15:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Push {
|
2024-09-04 18:38:48 +00:00
|
|
|
#[serde(rename(deserialize = "ref"))]
|
|
|
|
pub ref_: String,
|
|
|
|
pub before: String,
|
|
|
|
pub compare_url: String,
|
|
|
|
pub commits: Vec<Commit>,
|
|
|
|
pub repository: Repository,
|
|
|
|
pub pusher: User,
|
|
|
|
pub sender: User,
|
2024-04-19 18:49:31 +00:00
|
|
|
}
|
2024-04-23 15:21:27 +00:00
|
|
|
|
2024-07-02 19:34:13 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub enum RefType {
|
2024-09-04 18:38:48 +00:00
|
|
|
Branch,
|
2024-07-02 19:34:13 +00:00
|
|
|
}
|
|
|
|
|
2024-04-23 15:21:27 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct AddedBranch {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub sha: String,
|
|
|
|
pub ref_type: String,
|
|
|
|
pub repository: Repository,
|
|
|
|
pub sender: RepositoryOwner,
|
2024-04-23 15:21:27 +00:00
|
|
|
}
|
|
|
|
|
2024-07-02 19:34:13 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct RemovedBranch {
|
2024-09-04 18:38:48 +00:00
|
|
|
pub sha: String,
|
|
|
|
pub ref_type: String,
|
|
|
|
pub pusher_type: String,
|
|
|
|
pub repository: Repository,
|
|
|
|
pub sender: RepositoryOwner,
|
2024-07-02 19:34:13 +00:00
|
|
|
}
|
|
|
|
|
2024-04-23 15:21:27 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
#[serde(untagged)]
|
|
|
|
pub enum Hook {
|
2024-09-04 18:38:48 +00:00
|
|
|
Push(Push),
|
|
|
|
AddedBranch(AddedBranch),
|
|
|
|
RemovedBranch(RemovedBranch),
|
2024-04-23 15:21:27 +00:00
|
|
|
}
|