github.com/go-playground/webhooks/v6@v6.3.0/gitea/payload.go (about) 1 package gitea 2 3 import "time" 4 5 // PayloadUser represents the author or committer of a commit 6 type PayloadUser struct { 7 Name string `json:"name"` 8 Email string `json:"email"` 9 UserName string `json:"username"` 10 } 11 12 // PayloadCommitVerification represents the GPG verification of a commit 13 type PayloadCommitVerification struct { 14 Verified bool `json:"verified"` 15 Reason string `json:"reason"` 16 Signature string `json:"signature"` 17 Signer *PayloadUser `json:"signer"` 18 Payload string `json:"payload"` 19 } 20 21 // PayloadCommit represents a commit 22 type PayloadCommit struct { 23 // sha1 hash of the commit 24 ID string `json:"id"` 25 Message string `json:"message"` 26 URL string `json:"url"` 27 Author *PayloadUser `json:"author"` 28 Committer *PayloadUser `json:"committer"` 29 Verification *PayloadCommitVerification `json:"verification"` 30 // swagger:strfmt date-time 31 Timestamp time.Time `json:"timestamp"` 32 Added []string `json:"added"` 33 Removed []string `json:"removed"` 34 Modified []string `json:"modified"` 35 } 36 37 // Repository represents a repository 38 type Repository struct { 39 ID int64 `json:"id"` 40 Owner *User `json:"owner"` 41 Name string `json:"name"` 42 FullName string `json:"full_name"` 43 Description string `json:"description"` 44 Empty bool `json:"empty"` 45 Private bool `json:"private"` 46 Fork bool `json:"fork"` 47 Template bool `json:"template"` 48 Parent *Repository `json:"parent"` 49 Mirror bool `json:"mirror"` 50 Size int `json:"size"` 51 HTMLURL string `json:"html_url"` 52 SSHURL string `json:"ssh_url"` 53 CloneURL string `json:"clone_url"` 54 OriginalURL string `json:"original_url"` 55 Website string `json:"website"` 56 Stars int `json:"stars_count"` 57 Forks int `json:"forks_count"` 58 Watchers int `json:"watchers_count"` 59 OpenIssues int `json:"open_issues_count"` 60 OpenPulls int `json:"open_pr_counter"` 61 Releases int `json:"release_counter"` 62 DefaultBranch string `json:"default_branch"` 63 Archived bool `json:"archived"` 64 Created time.Time `json:"created_at"` 65 Updated time.Time `json:"updated_at"` 66 Permissions *Permission `json:"permissions,omitempty"` 67 HasIssues bool `json:"has_issues"` 68 InternalTracker *InternalTracker `json:"internal_tracker,omitempty"` 69 ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"` 70 HasWiki bool `json:"has_wiki"` 71 ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"` 72 HasPullRequests bool `json:"has_pull_requests"` 73 HasProjects bool `json:"has_projects"` 74 IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"` 75 AllowMerge bool `json:"allow_merge_commits"` 76 AllowRebase bool `json:"allow_rebase"` 77 AllowRebaseMerge bool `json:"allow_rebase_explicit"` 78 AllowSquash bool `json:"allow_squash_merge"` 79 DefaultMergeStyle string `json:"default_merge_style"` 80 AvatarURL string `json:"avatar_url"` 81 Internal bool `json:"internal"` 82 MirrorInterval string `json:"mirror_interval"` 83 } 84 85 // User represents a user 86 type User struct { 87 ID int64 `json:"id"` 88 UserName string `json:"login"` 89 FullName string `json:"full_name"` 90 Email string `json:"email"` 91 AvatarURL string `json:"avatar_url"` 92 Language string `json:"language"` 93 IsAdmin bool `json:"is_admin"` 94 LastLogin time.Time `json:"last_login,omitempty"` 95 Created time.Time `json:"created,omitempty"` 96 Restricted bool `json:"restricted"` 97 IsActive bool `json:"active"` 98 ProhibitLogin bool `json:"prohibit_login"` 99 Location string `json:"location"` 100 Website string `json:"website"` 101 Description string `json:"description"` 102 Visibility string `json:"visibility"` 103 Followers int `json:"followers_count"` 104 Following int `json:"following_count"` 105 StarredRepos int `json:"starred_repos_count"` 106 } 107 108 // Permission represents a set of permissions 109 type Permission struct { 110 Admin bool `json:"admin"` 111 Push bool `json:"push"` 112 Pull bool `json:"pull"` 113 } 114 115 // InternalTracker represents settings for internal tracker 116 type InternalTracker struct { 117 EnableTimeTracker bool `json:"enable_time_tracker"` 118 AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time"` 119 EnableIssueDependencies bool `json:"enable_issue_dependencies"` 120 } 121 122 // ExternalTracker represents settings for external tracker 123 type ExternalTracker struct { 124 ExternalTrackerURL string `json:"external_tracker_url"` 125 ExternalTrackerFormat string `json:"external_tracker_format"` 126 ExternalTrackerStyle string `json:"external_tracker_style"` 127 } 128 129 // ExternalWiki represents setting for external wiki 130 type ExternalWiki struct { 131 ExternalWikiURL string `json:"external_wiki_url"` 132 } 133 134 // PusherType define the type to push 135 type PusherType string 136 137 // HookIssueCommentAction defines hook issue comment action 138 type HookIssueCommentAction string 139 140 // Issue represents an issue in a repository 141 type Issue struct { 142 ID int64 `json:"id"` 143 URL string `json:"url"` 144 HTMLURL string `json:"html_url"` 145 Index int64 `json:"number"` 146 Poster *User `json:"user"` 147 OriginalAuthor string `json:"original_author"` 148 OriginalAuthorID int64 `json:"original_author_id"` 149 Title string `json:"title"` 150 Body string `json:"body"` 151 Ref string `json:"ref"` 152 Labels []*Label `json:"labels"` 153 Milestone *Milestone `json:"milestone"` 154 Assignee *User `json:"assignee"` 155 Assignees []*User `json:"assignees"` 156 State StateType `json:"state"` 157 IsLocked bool `json:"is_locked"` 158 Comments int `json:"comments"` 159 Created time.Time `json:"created_at"` 160 Updated time.Time `json:"updated_at"` 161 Closed *time.Time `json:"closed_at"` 162 Deadline *time.Time `json:"due_date"` 163 PullRequest *PullRequestMeta `json:"pull_request"` 164 Repo *RepositoryMeta `json:"repository"` 165 } 166 167 // Label a label to an issue or a pr 168 type Label struct { 169 ID int64 `json:"id"` 170 Name string `json:"name"` 171 Color string `json:"color"` 172 Description string `json:"description"` 173 URL string `json:"url"` 174 } 175 176 // Milestone milestone is a collection of issues on one repository 177 type Milestone struct { 178 ID int64 `json:"id"` 179 Title string `json:"title"` 180 Description string `json:"description"` 181 State StateType `json:"state"` 182 OpenIssues int `json:"open_issues"` 183 ClosedIssues int `json:"closed_issues"` 184 Created time.Time `json:"created_at"` 185 Updated *time.Time `json:"updated_at"` 186 Closed *time.Time `json:"closed_at"` 187 Deadline *time.Time `json:"due_on"` 188 } 189 190 // StateType issue state type 191 type StateType string 192 193 // PullRequestMeta PR info if an issue is a PR 194 type PullRequestMeta struct { 195 HasMerged bool `json:"merged"` 196 Merged *time.Time `json:"merged_at"` 197 } 198 199 // RepositoryMeta basic repository information 200 type RepositoryMeta struct { 201 ID int64 `json:"id"` 202 Name string `json:"name"` 203 Owner string `json:"owner"` 204 FullName string `json:"full_name"` 205 } 206 207 // CreatePayload represents a payload create reposoitory 208 type CreatePayload struct { 209 Sha string `json:"sha"` 210 Ref string `json:"ref"` 211 RefType string `json:"ref_type"` 212 Repo *Repository `json:"repository"` 213 Sender *User `json:"sender"` 214 } 215 216 // DeletePayload represents delete payload 217 type DeletePayload struct { 218 Ref string `json:"ref"` 219 RefType string `json:"ref_type"` 220 PusherType PusherType `json:"pusher_type"` 221 Repo *Repository `json:"repository"` 222 Sender *User `json:"sender"` 223 } 224 225 // ForkPayload represents fork payload 226 type ForkPayload struct { 227 Forkee *Repository `json:"forkee"` 228 Repo *Repository `json:"repository"` 229 Sender *User `json:"sender"` 230 } 231 232 // IssueCommentPayload represents a payload information of issue comment event. 233 type IssueCommentPayload struct { 234 Action HookIssueCommentAction `json:"action"` 235 Issue *Issue `json:"issue"` 236 Comment *Comment `json:"comment"` 237 Changes *ChangesPayload `json:"changes,omitempty"` 238 Repository *Repository `json:"repository"` 239 Sender *User `json:"sender"` 240 IsPull bool `json:"is_pull"` 241 } 242 243 // ChangesPayload represents the payload information of issue change 244 type ChangesPayload struct { 245 Title *ChangesFromPayload `json:"title,omitempty"` 246 Body *ChangesFromPayload `json:"body,omitempty"` 247 Ref *ChangesFromPayload `json:"ref,omitempty"` 248 } 249 250 // ChangesFromPayload FIXME 251 type ChangesFromPayload struct { 252 From string `json:"from"` 253 } 254 255 // Comment represents a comment on a commit or issue 256 type Comment struct { 257 ID int64 `json:"id"` 258 HTMLURL string `json:"html_url"` 259 PRURL string `json:"pull_request_url"` 260 IssueURL string `json:"issue_url"` 261 Poster *User `json:"user"` 262 OriginalAuthor string `json:"original_author"` 263 OriginalAuthorID int64 `json:"original_author_id"` 264 Body string `json:"body"` 265 Created time.Time `json:"created_at"` 266 Updated time.Time `json:"updated_at"` 267 } 268 269 // PushPayload represents a payload information of push event. 270 type PushPayload struct { 271 Ref string `json:"ref"` 272 Before string `json:"before"` 273 After string `json:"after"` 274 CompareURL string `json:"compare_url"` 275 Commits []*PayloadCommit `json:"commits"` 276 HeadCommit *PayloadCommit `json:"head_commit"` 277 Repo *Repository `json:"repository"` 278 Pusher *User `json:"pusher"` 279 Sender *User `json:"sender"` 280 } 281 282 // PullRequestPayload represents a payload information of pull request event. 283 type PullRequestPayload struct { 284 Action HookIssueAction `json:"action"` 285 Index int64 `json:"number"` 286 Changes *ChangesPayload `json:"changes,omitempty"` 287 PullRequest *PullRequest `json:"pull_request"` 288 Repository *Repository `json:"repository"` 289 Sender *User `json:"sender"` 290 Review *ReviewPayload `json:"review"` 291 } 292 293 // HookIssueAction FIXME 294 type HookIssueAction string 295 296 // PullRequest represents a pull request 297 type PullRequest struct { 298 ID int64 `json:"id"` 299 URL string `json:"url"` 300 Index int64 `json:"number"` 301 Poster *User `json:"user"` 302 Title string `json:"title"` 303 Body string `json:"body"` 304 Labels []*Label `json:"labels"` 305 Milestone *Milestone `json:"milestone"` 306 Assignee *User `json:"assignee"` 307 Assignees []*User `json:"assignees"` 308 State StateType `json:"state"` 309 IsLocked bool `json:"is_locked"` 310 Comments int `json:"comments"` 311 HTMLURL string `json:"html_url"` 312 DiffURL string `json:"diff_url"` 313 PatchURL string `json:"patch_url"` 314 Mergeable bool `json:"mergeable"` 315 HasMerged bool `json:"merged"` 316 Merged *time.Time `json:"merged_at"` 317 MergedCommitID *string `json:"merge_commit_sha"` 318 MergedBy *User `json:"merged_by"` 319 Base *PRBranchInfo `json:"base"` 320 Head *PRBranchInfo `json:"head"` 321 MergeBase string `json:"merge_base"` 322 Deadline *time.Time `json:"due_date"` 323 Created *time.Time `json:"created_at"` 324 Updated *time.Time `json:"updated_at"` 325 Closed *time.Time `json:"closed_at"` 326 } 327 328 // PRBranchInfo information about a branch 329 type PRBranchInfo struct { 330 Name string `json:"label"` 331 Ref string `json:"ref"` 332 Sha string `json:"sha"` 333 RepoID int64 `json:"repo_id"` 334 Repository *Repository `json:"repo"` 335 } 336 337 // ReviewPayload FIXME 338 type ReviewPayload struct { 339 Type string `json:"type"` 340 Content string `json:"content"` 341 } 342 343 // RepositoryPayload payload for repository webhooks 344 type RepositoryPayload struct { 345 Action HookRepoAction `json:"action"` 346 Repository *Repository `json:"repository"` 347 Organization *User `json:"organization"` 348 Sender *User `json:"sender"` 349 } 350 351 // HookRepoAction an action that happens to a repo 352 type HookRepoAction string 353 354 // ReleasePayload represents a payload information of release event. 355 type ReleasePayload struct { 356 Action HookReleaseAction `json:"action"` 357 Release *Release `json:"release"` 358 Repository *Repository `json:"repository"` 359 Sender *User `json:"sender"` 360 } 361 362 // Release represents a repository release 363 type Release struct { 364 ID int64 `json:"id"` 365 TagName string `json:"tag_name"` 366 Target string `json:"target_commitish"` 367 Title string `json:"name"` 368 Note string `json:"body"` 369 URL string `json:"url"` 370 HTMLURL string `json:"html_url"` 371 TarURL string `json:"tarball_url"` 372 ZipURL string `json:"zipball_url"` 373 IsDraft bool `json:"draft"` 374 IsPrerelease bool `json:"prerelease"` 375 CreatedAt time.Time `json:"created_at"` 376 PublishedAt time.Time `json:"published_at"` 377 Publisher *User `json:"author"` 378 Attachments []*Attachment `json:"assets"` 379 } 380 381 // HookReleaseAction defines hook release action type 382 type HookReleaseAction string 383 384 // Attachment a generic attachment 385 type Attachment struct { 386 ID int64 `json:"id"` 387 Name string `json:"name"` 388 Size int64 `json:"size"` 389 DownloadCount int64 `json:"download_count"` 390 Created time.Time `json:"created_at"` 391 UUID string `json:"uuid"` 392 DownloadURL string `json:"browser_download_url"` 393 } 394 395 // IssuePayload represents the payload information that is sent along with an issue event. 396 type IssuePayload struct { 397 Action HookIssueAction `json:"action"` 398 Index int64 `json:"number"` 399 Changes *ChangesPayload `json:"changes,omitempty"` 400 Issue *Issue `json:"issue"` 401 Repository *Repository `json:"repository"` 402 Sender *User `json:"sender"` 403 }