code.gitea.io/gitea@v1.22.3/modules/webhook/type.go (about) 1 // Copyright 2022 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package webhook 5 6 // HookEventType is the type of a hook event 7 type HookEventType string 8 9 // Types of hook events 10 const ( 11 HookEventCreate HookEventType = "create" 12 HookEventDelete HookEventType = "delete" 13 HookEventFork HookEventType = "fork" 14 HookEventPush HookEventType = "push" 15 HookEventIssues HookEventType = "issues" 16 HookEventIssueAssign HookEventType = "issue_assign" 17 HookEventIssueLabel HookEventType = "issue_label" 18 HookEventIssueMilestone HookEventType = "issue_milestone" 19 HookEventIssueComment HookEventType = "issue_comment" 20 HookEventPullRequest HookEventType = "pull_request" 21 HookEventPullRequestAssign HookEventType = "pull_request_assign" 22 HookEventPullRequestLabel HookEventType = "pull_request_label" 23 HookEventPullRequestMilestone HookEventType = "pull_request_milestone" 24 HookEventPullRequestComment HookEventType = "pull_request_comment" 25 HookEventPullRequestReviewApproved HookEventType = "pull_request_review_approved" 26 HookEventPullRequestReviewRejected HookEventType = "pull_request_review_rejected" 27 HookEventPullRequestReviewComment HookEventType = "pull_request_review_comment" 28 HookEventPullRequestSync HookEventType = "pull_request_sync" 29 HookEventPullRequestReviewRequest HookEventType = "pull_request_review_request" 30 HookEventWiki HookEventType = "wiki" 31 HookEventRepository HookEventType = "repository" 32 HookEventRelease HookEventType = "release" 33 HookEventPackage HookEventType = "package" 34 HookEventSchedule HookEventType = "schedule" 35 ) 36 37 // Event returns the HookEventType as an event string 38 func (h HookEventType) Event() string { 39 switch h { 40 case HookEventCreate: 41 return "create" 42 case HookEventDelete: 43 return "delete" 44 case HookEventFork: 45 return "fork" 46 case HookEventPush: 47 return "push" 48 case HookEventIssues, HookEventIssueAssign, HookEventIssueLabel, HookEventIssueMilestone: 49 return "issues" 50 case HookEventPullRequest, HookEventPullRequestAssign, HookEventPullRequestLabel, HookEventPullRequestMilestone, 51 HookEventPullRequestSync, HookEventPullRequestReviewRequest: 52 return "pull_request" 53 case HookEventIssueComment, HookEventPullRequestComment: 54 return "issue_comment" 55 case HookEventPullRequestReviewApproved: 56 return "pull_request_approved" 57 case HookEventPullRequestReviewRejected: 58 return "pull_request_rejected" 59 case HookEventPullRequestReviewComment: 60 return "pull_request_comment" 61 case HookEventWiki: 62 return "wiki" 63 case HookEventRepository: 64 return "repository" 65 case HookEventRelease: 66 return "release" 67 } 68 return "" 69 } 70 71 // HookType is the type of a webhook 72 type HookType = string 73 74 // Types of webhooks 75 const ( 76 GITEA HookType = "gitea" 77 GOGS HookType = "gogs" 78 SLACK HookType = "slack" 79 DISCORD HookType = "discord" 80 DINGTALK HookType = "dingtalk" 81 TELEGRAM HookType = "telegram" 82 MSTEAMS HookType = "msteams" 83 FEISHU HookType = "feishu" 84 MATRIX HookType = "matrix" 85 WECHATWORK HookType = "wechatwork" 86 PACKAGIST HookType = "packagist" 87 ) 88 89 // HookStatus is the status of a web hook 90 type HookStatus int 91 92 // Possible statuses of a web hook 93 const ( 94 HookStatusNone HookStatus = iota 95 HookStatusSucceed 96 HookStatusFail 97 )