From 5979b049f96ff705edf6406f03b3b3e3d823efcd Mon Sep 17 00:00:00 2001 From: pep Date: Wed, 4 Sep 2024 20:24:30 +0200 Subject: [PATCH] forgejo-hooks: Add/modify Push attributes Compare with forgejo code and tests Signed-off-by: pep --- forgejo-hooks/src/lib.rs | 46 +++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/forgejo-hooks/src/lib.rs b/forgejo-hooks/src/lib.rs index 0016ff5..c7cba46 100644 --- a/forgejo-hooks/src/lib.rs +++ b/forgejo-hooks/src/lib.rs @@ -60,9 +60,22 @@ pub struct InternalTracker { enable_issue_dependencies: bool, } +#[derive(Deserialize, Debug, PartialEq)] +pub struct ExternalTracker { + pub external_tracker_url: String, + pub external_tracker_format: String, + pub external_tracker_style: String, + pub external_tracker_regexp_pattern: String, +} + +#[derive(Deserialize, Debug, PartialEq)] +pub struct ExternalWiki { + pub external_wiki_url: String, +} + #[derive(Deserialize, Debug, PartialEq)] pub struct Repository { - pub id: u32, + pub id: u64, pub owner: User, pub name: String, pub full_name: String, @@ -84,7 +97,7 @@ pub struct Repository { #[derive(Deserialize, Debug, PartialEq)] pub struct RepositoryFull { - pub id: u32, + pub id: u64, pub owner: RepositoryOwner, pub name: String, pub full_name: String, @@ -93,7 +106,7 @@ pub struct RepositoryFull { pub private: bool, pub fork: bool, pub template: bool, - pub parent: Option>, + pub parent: Option>, pub mirror: bool, pub size: u32, pub language: String, @@ -109,14 +122,20 @@ pub struct RepositoryFull { pub watchers_count: u32, pub open_issues_count: u32, pub open_pr_counter: u32, + pub release_counter: u32, pub default_branch: String, + pub archived: bool, pub created_at: DateTime, pub updated_at: DateTime, pub archived_at: DateTime, - pub permissions: Perms, + pub permissions: Option, pub has_issues: bool, - pub internal_tracker: InternalTracker, + pub internal_tracker: Option, + pub external_tracker: Option, pub has_wiki: bool, + pub external_wiki: Option, + pub wiki_branch: Option, + pub globally_editable_wiki: bool, pub has_pull_requests: bool, pub has_projects: bool, pub has_releases: bool, @@ -132,27 +151,32 @@ pub struct RepositoryFull { pub default_allow_maintainer_edit: bool, pub avatar_url: String, pub internal: bool, - pub mirror_internal: String, - pub mirror_updated: DateTime, + pub mirror_interval: String, + pub object_format_name: String, + pub mirror_updated: Option>, pub repo_transfer: Option, + pub topics: Option>, } #[derive(Deserialize, Debug, PartialEq)] pub struct RepositoryOwner { - pub id: u32, + pub id: u64, pub login: String, pub login_name: String, + pub source_id: u64, pub full_name: String, pub email: String, pub avatar_url: String, + pub html_url: String, pub language: String, pub is_admin: bool, - pub last_login: DateTime, - pub created: DateTime, + pub last_login: Option>, + pub created: Option>, pub restricted: bool, pub active: bool, pub prohibit_login: bool, pub location: String, + pub pronouns: String, pub website: String, pub description: String, pub visibility: String, @@ -167,8 +191,10 @@ pub struct Push { #[serde(rename(deserialize = "ref"))] pub ref_: String, pub before: String, + pub after: String, pub compare_url: String, pub commits: Vec, + pub total_commits: u32, pub repository: Repository, pub pusher: User, pub sender: User,