aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/code.gitea.io/sdk/gitea/hook.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/code.gitea.io/sdk/gitea/hook.go')
-rw-r--r--vendor/code.gitea.io/sdk/gitea/hook.go29
1 files changed, 28 insertions, 1 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/hook.go b/vendor/code.gitea.io/sdk/gitea/hook.go
index 4e04275f86..c2f88f4a31 100644
--- a/vendor/code.gitea.io/sdk/gitea/hook.go
+++ b/vendor/code.gitea.io/sdk/gitea/hook.go
@@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
+// Copyright 2017 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
@@ -147,6 +148,7 @@ type PayloadCommit struct {
var (
_ Payloader = &CreatePayload{}
_ Payloader = &PushPayload{}
+ _ Payloader = &IssuePayload{}
_ Payloader = &PullRequestPayload{}
)
@@ -277,8 +279,33 @@ const (
HookIssueLabelCleared HookIssueAction = "label_cleared"
// HookIssueSynchronized synchronized
HookIssueSynchronized HookIssueAction = "synchronized"
+ // HookIssueMilestoned is an issue action for when a milestone is set on an issue.
+ HookIssueMilestoned HookIssueAction = "milestoned"
+ // HookIssueDemilestoned is an issue action for when a milestone is cleared on an issue.
+ HookIssueDemilestoned HookIssueAction = "demilestoned"
)
+// IssuePayload represents the payload information that is sent along with an issue event.
+type IssuePayload struct {
+ Secret string `json:"secret"`
+ Action HookIssueAction `json:"action"`
+ Index int64 `json:"number"`
+ Changes *ChangesPayload `json:"changes,omitempty"`
+ Issue *Issue `json:"issue"`
+ Repository *Repository `json:"repository"`
+ Sender *User `json:"sender"`
+}
+
+// SetSecret modifies the secret of the IssuePayload.
+func (p *IssuePayload) SetSecret(secret string) {
+ p.Secret = secret
+}
+
+// JSONPayload encodes the IssuePayload to JSON, with an indentation of two spaces.
+func (p *IssuePayload) JSONPayload() ([]byte, error) {
+ return json.MarshalIndent(p, "", " ")
+}
+
// ChangesFromPayload FIXME
type ChangesFromPayload struct {
From string `json:"from"`
@@ -308,7 +335,7 @@ type PullRequestPayload struct {
Sender *User `json:"sender"`
}
-// SetSecret FIXME
+// SetSecret modifies the secret of the PullRequestPayload.
func (p *PullRequestPayload) SetSecret(secret string) {
p.Secret = secret
}