forgejo-hooks: Add/modify Push attributes

Compare with forgejo code and tests

Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
pep 2024-09-04 20:24:30 +02:00
parent 25eeacde7c
commit 5979b049f9

View file

@ -60,9 +60,22 @@ pub struct InternalTracker {
enable_issue_dependencies: bool, 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)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Repository { pub struct Repository {
pub id: u32, pub id: u64,
pub owner: User, pub owner: User,
pub name: String, pub name: String,
pub full_name: String, pub full_name: String,
@ -84,7 +97,7 @@ pub struct Repository {
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct RepositoryFull { pub struct RepositoryFull {
pub id: u32, pub id: u64,
pub owner: RepositoryOwner, pub owner: RepositoryOwner,
pub name: String, pub name: String,
pub full_name: String, pub full_name: String,
@ -93,7 +106,7 @@ pub struct RepositoryFull {
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<Repository>>,
pub mirror: bool, pub mirror: bool,
pub size: u32, pub size: u32,
pub language: String, pub language: String,
@ -109,14 +122,20 @@ pub struct RepositoryFull {
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 release_counter: u32,
pub default_branch: String, pub default_branch: String,
pub archived: bool,
pub created_at: DateTime<Utc>, pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>, pub updated_at: DateTime<Utc>,
pub archived_at: DateTime<Utc>, pub archived_at: DateTime<Utc>,
pub permissions: Perms, pub permissions: Option<Permissions>,
pub has_issues: bool, pub has_issues: bool,
pub internal_tracker: InternalTracker, pub internal_tracker: Option<InternalTracker>,
pub external_tracker: Option<ExternalTracker>,
pub has_wiki: bool, pub has_wiki: bool,
pub external_wiki: Option<ExternalWiki>,
pub wiki_branch: Option<String>,
pub globally_editable_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,
@ -132,27 +151,32 @@ pub struct RepositoryFull {
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_interval: String,
pub mirror_updated: DateTime<Utc>, pub object_format_name: String,
pub mirror_updated: Option<DateTime<Utc>>,
pub repo_transfer: Option<String>, pub repo_transfer: Option<String>,
pub topics: Option<Vec<String>>,
} }
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct RepositoryOwner { pub struct RepositoryOwner {
pub id: u32, pub id: u64,
pub login: String, pub login: String,
pub login_name: String, pub login_name: String,
pub source_id: u64,
pub full_name: String, pub full_name: String,
pub email: String, pub email: String,
pub avatar_url: String, pub avatar_url: String,
pub html_url: String,
pub language: String, pub language: String,
pub is_admin: bool, pub is_admin: bool,
pub last_login: DateTime<Utc>, pub last_login: Option<DateTime<Utc>>,
pub created: DateTime<Utc>, pub created: Option<DateTime<Utc>>,
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 pronouns: String,
pub website: String, pub website: String,
pub description: String, pub description: String,
pub visibility: String, pub visibility: String,
@ -167,8 +191,10 @@ pub struct Push {
#[serde(rename(deserialize = "ref"))] #[serde(rename(deserialize = "ref"))]
pub ref_: String, pub ref_: String,
pub before: String, pub before: String,
pub after: String,
pub compare_url: String, pub compare_url: String,
pub commits: Vec<Commit>, pub commits: Vec<Commit>,
pub total_commits: u32,
pub repository: Repository, pub repository: Repository,
pub pusher: User, pub pusher: User,
pub sender: User, pub sender: User,