forgejo-hooks: cargo fmt

Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
pep 2024-09-04 20:38:48 +02:00
parent db88921290
commit 38b366204b
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

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