229 lines
9.1 KiB
Go
229 lines
9.1 KiB
Go
|
// Package git_hook...
|
||
|
//
|
||
|
// Description : git_hook...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 2021-11-11 6:23 下午
|
||
|
package git_hook
|
||
|
|
||
|
// HookData hook通知数据
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:23 下午 2021/11/11
|
||
|
type HookData struct {
|
||
|
Repository Repository `json:"repository"`
|
||
|
Sender Sender `json:"sender"`
|
||
|
Ref string `json:"ref"`
|
||
|
Before string `json:"before"`
|
||
|
After string `json:"after"`
|
||
|
HeadCommit HeadCommit `json:"head_commit"`
|
||
|
CompareUrl string `json:"compare_url"`
|
||
|
Commits []Commit `json:"commits"`
|
||
|
Pusher Pusher `json:"pusher"`
|
||
|
}
|
||
|
|
||
|
// Repository 仓库信息
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:24 下午 2021/11/11
|
||
|
type Repository struct {
|
||
|
Mirror bool `json:"mirror"`
|
||
|
OriginalUrl string `json:"original_url"`
|
||
|
StarsCount int64 `json:"stars_count"`
|
||
|
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"`
|
||
|
FullName string `json:"full_name"`
|
||
|
Fork bool `json:"fork"`
|
||
|
CreatedAt string `json:"created_at"`
|
||
|
Internal bool `json:"internal"`
|
||
|
AllowRebaseExplicit bool `json:"allow_rebase_explicit"`
|
||
|
MirrorInterval string `json:"mirror_interval"`
|
||
|
CloneUrl string `json:"clone_url"`
|
||
|
WatchersCount int64 `json:"watchers_count"`
|
||
|
OpenIssuesCount int64 `json:"open_issues_count"`
|
||
|
ReleaseCounter int64 `json:"release_counter"`
|
||
|
InternalTracker RepositoryInternalTracker `json:"internal_tracker"`
|
||
|
Name string `json:"name"`
|
||
|
Empty bool `json:"empty"`
|
||
|
SshUrl string `json:"ssh_url"`
|
||
|
ForksCount int64 `json:"forks_count"`
|
||
|
Permissions RepositoryPermission `json:"permissions"`
|
||
|
Private bool `json:"private"`
|
||
|
Size int64 `json:"size"`
|
||
|
HasWiki bool `json:"has_wiki"`
|
||
|
HasProjects bool `json:"has_projects"`
|
||
|
AllowMergeCommits bool `json:"allow_merge_commits"`
|
||
|
AvatarUrl string `json:"avatar_url"`
|
||
|
Id int64 `json:"id"`
|
||
|
Description string `json:"description"`
|
||
|
Website string `json:"website"`
|
||
|
UpdatedAt string `json:"updated_at"`
|
||
|
HasPullRequests bool `json:"has_pull_requests"`
|
||
|
Parent map[string]interface{} `json:"parent"`
|
||
|
OpenPrCounter int64 `json:"open_pr_counter"`
|
||
|
HasIssues bool `json:"has_issues"`
|
||
|
AllowRebase bool `json:"allow_rebase"`
|
||
|
AllowSquashMerge bool `json:"allow_squash_merge"`
|
||
|
Owner RepositoryOwner `json:"owner"`
|
||
|
Template bool `json:"template"`
|
||
|
HtmlUrl string `json:"html_url"`
|
||
|
DefaultBranch string `json:"default_branch"`
|
||
|
Archived bool `json:"archived"`
|
||
|
DefaultMergeStyle string `json:"default_merge_style"`
|
||
|
}
|
||
|
|
||
|
// RepositoryInternalTracker 内部跟踪器
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:28 下午 2021/11/11
|
||
|
type RepositoryInternalTracker struct {
|
||
|
EnableTimeTracker bool `json:"enable_time_tracker"`
|
||
|
AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time"`
|
||
|
EnableIssueDependencies bool `json:"enable_issue_dependencies"`
|
||
|
}
|
||
|
|
||
|
// RepositoryPermission 仓库权限
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:29 下午 2021/11/11
|
||
|
type RepositoryPermission struct {
|
||
|
Pull bool `json:"pull"`
|
||
|
Admin bool `json:"admin"`
|
||
|
Push bool `json:"push"`
|
||
|
}
|
||
|
|
||
|
// RepositoryOwner 仓库Owner
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:30 下午 2021/11/11
|
||
|
type RepositoryOwner struct {
|
||
|
IsAdmin bool `json:"is_admin"`
|
||
|
Website string `json:"website"`
|
||
|
Email string `json:"email"`
|
||
|
AvatarUrl string `json:"avatar_url"`
|
||
|
ProhibitLogin bool `json:"prohibit_login"`
|
||
|
Description string `json:"description"`
|
||
|
FollowingCount int64 `json:"following_count"`
|
||
|
StarredReposCount int64 `json:"starred_repos_count"`
|
||
|
Username string `json:"username"`
|
||
|
Login string `json:"login"`
|
||
|
Created string `json:"created"`
|
||
|
Visibility string `json:"visibility"`
|
||
|
FullName string `json:"full_name"`
|
||
|
LastLogin string `json:"last_login"`
|
||
|
Restricted bool `json:"restricted"`
|
||
|
Active bool `json:"active"`
|
||
|
Location string `json:"location"`
|
||
|
FollowersCount int64 `json:"followers_count"`
|
||
|
ID int64 `json:"id"`
|
||
|
Language string `json:"language"`
|
||
|
}
|
||
|
|
||
|
// Sender ...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:25 下午 2021/11/11
|
||
|
type Sender struct {
|
||
|
Created string `json:"created"`
|
||
|
Website string `json:"website"`
|
||
|
FollowingCount int64 `json:"following_count"`
|
||
|
StarredReposCount int64 `json:"starred_repos_count"`
|
||
|
FullName string `json:"full_name"`
|
||
|
Language string `json:"language"`
|
||
|
LastLogin string `json:"last_login"`
|
||
|
Visibility string `json:"visibility"`
|
||
|
FollowersCount int64 `json:"followers_count"`
|
||
|
Username string `json:"username"`
|
||
|
IsAdmin bool `json:"is_admin"`
|
||
|
Active bool `json:"active"`
|
||
|
Location string `json:"location"`
|
||
|
Restricted bool `json:"restricted"`
|
||
|
Description string `json:"description"`
|
||
|
AvatarUrl string `json:"avatar_url"`
|
||
|
ProhibitLogin bool `json:"prohibit_login"`
|
||
|
Id int64 `json:"id"`
|
||
|
Login string `json:"login"`
|
||
|
Email string `json:"email"`
|
||
|
}
|
||
|
|
||
|
// HeadCommit ...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:25 下午 2021/11/11
|
||
|
type HeadCommit struct {
|
||
|
Message string `json:"message"`
|
||
|
Url string `json:"url"`
|
||
|
Author CommitAuthor `json:"author"`
|
||
|
Verification map[string]interface{} `json:"verification"`
|
||
|
Timestamp string `json:"timestamp"`
|
||
|
ID string `json:"id"`
|
||
|
Committer CommitAuthor `json:"committer"`
|
||
|
Added []string `json:"added"` // 增加的文件列表
|
||
|
Removed []string `json:"removed"` // 移除文件列表
|
||
|
Modified []string `json:"modified"` // 修改的文件列表
|
||
|
}
|
||
|
|
||
|
// CommitAuthor 提交人的信息
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:31 下午 2021/11/11
|
||
|
type CommitAuthor struct {
|
||
|
Name string `json:"name"`
|
||
|
Email string `json:"email"`
|
||
|
Username string `json:"username"`
|
||
|
}
|
||
|
|
||
|
// Commit ...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:26 下午 2021/11/11
|
||
|
type Commit struct {
|
||
|
Url string `json:"url"`
|
||
|
Author CommitAuthor `json:"author"`
|
||
|
Committer CommitAuthor `json:"committer"`
|
||
|
Verification map[string]interface{} `json:"verification"`
|
||
|
Removed []string `json:"removed"`
|
||
|
Id string `json:"id"`
|
||
|
Message string `json:"message"`
|
||
|
Modified []string `json:"modified"`
|
||
|
Timestamp string `json:"timestamp"`
|
||
|
Added []string `json:"added"`
|
||
|
}
|
||
|
|
||
|
// Pusher ...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 6:27 下午 2021/11/11
|
||
|
type Pusher struct {
|
||
|
Language string `json:"language"`
|
||
|
Website string `json:"website"`
|
||
|
Id int64 `json:"id"`
|
||
|
Email string `json:"email"`
|
||
|
Active bool `json:"active"`
|
||
|
Description string `json:"description"`
|
||
|
Visibility string `json:"visibility"`
|
||
|
Login string `json:"login"`
|
||
|
Restricted bool `json:"restricted"`
|
||
|
Location string `json:"location"`
|
||
|
StarredReposCount int64 `json:"starred_repos_count"`
|
||
|
Username string `json:"username"`
|
||
|
IsAdmin bool `json:"is_admin"`
|
||
|
ProhibitLogin bool `json:"prohibit_login"`
|
||
|
LastLogin string `json:"last_login"`
|
||
|
Created string `json:"created"`
|
||
|
FollowersCount int64 `json:"followers_count"`
|
||
|
FollowingCount int64 `json:"following_count"`
|
||
|
FullName string `json:"full_name"`
|
||
|
AvatarUrl string `json:"avatar_url"`
|
||
|
}
|