Full request schema.

This commit is contained in:
Tom Alexander 2024-07-14 17:04:08 -04:00
parent 14373c21dd
commit eb0c993e03
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 130 additions and 5 deletions

View File

@ -19,12 +19,137 @@ pub(crate) struct HookRequest {
ref_field: String,
before: String,
compare_url: String,
commits: Value,
commits: Vec<HookCommit>,
total_commits: u64,
head_commit: Value,
repository: Value,
pusher: Value,
sender: Value,
head_commit: HookCommit,
repository: HookRepository,
pusher: HookUser,
sender: HookUser,
}
#[allow(dead_code)]
#[derive(Deserialize)]
pub(crate) struct HookUser {
id: u64,
login: String,
login_name: String,
full_name: String,
email: String,
avatar_url: String,
language: String,
is_admin: bool,
last_login: String, // TODO: parse to datetime
created: String, // TODO: parse to datetime
restricted: bool,
active: bool,
prohibit_login: bool,
location: String,
website: String,
description: String,
visibility: String,
followers_count: u64,
following_count: u64,
starred_repos_count: u64,
username: String,
}
#[allow(dead_code)]
#[derive(Deserialize)]
pub(crate) struct HookRepository {
id: u64,
owner: HookUser,
name: String,
full_name: String,
description: String,
empty: bool,
private: bool,
fork: bool,
template: bool,
parent: Value, // Was null in test hook
mirror: bool,
size: u64,
language: String,
languages_url: String,
html_url: String,
url: String,
link: String,
ssh_url: String,
clone_url: String,
original_url: String,
website: String,
stars_count: u64,
forks_count: u64,
watchers_count: u64,
open_issues_count: u64,
open_pr_counter: u64,
release_counter: u64,
default_branch: String,
archived: bool,
created_at: String, // TODO: parse to datetime
updated_at: String, // TODO: parse to datetime
archived_at: String, // TODO: parse to datetime
permissions: HookRepositoryPermissions,
has_issues: bool,
internal_tracker: HookRepositoryInternalTracker,
has_wiki: bool,
has_pull_requests: bool,
has_projects: bool,
has_releases: bool,
has_packages: bool,
has_actions: bool,
ignore_whitespace_conflicts: bool,
allow_merge_commits: bool,
allow_rebase: bool,
allow_rebase_explicit: bool,
allow_squash_merge: bool,
allow_rebase_update: bool,
default_delete_branch_after_merge: bool,
default_merge_style: String,
default_allow_maintainer_edit: bool,
avatar_url: String,
internal: bool,
mirror_interval: String,
mirror_updated: String, // TODO: parse to datetime
repo_transfer: Value, // Was null in test hook
}
#[allow(dead_code)]
#[derive(Deserialize)]
pub(crate) struct HookRepositoryPermissions {
admin: bool,
push: bool,
pull: bool,
}
#[allow(dead_code)]
#[derive(Deserialize)]
pub(crate) struct HookRepositoryInternalTracker {
enable_time_tracker: bool,
allow_only_contributors_to_track_time: bool,
enable_issue_dependencies: bool,
}
#[allow(dead_code)]
#[derive(Deserialize)]
pub(crate) struct HookCommit {
id: String,
message: String,
url: String,
author: HookGitUser,
committer: HookGitUser,
verification: Value, // Was null in test hook
timestamp: String, // TODO: parse to datetime
added: Vec<String>,
removed: Vec<String>,
modified: Vec<String>,
}
#[allow(dead_code)]
#[derive(Deserialize)]
pub(crate) struct HookGitUser {
name: String,
email: String,
username: String,
}
#[derive(Serialize)]