Skip to content

Commit 08824b5

Browse files
committed
repo_hook: add ReleasePayload
1 parent 8e43847 commit 08824b5

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

gogs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
func Version() string {
17-
return "0.12.9"
17+
return "0.12.10"
1818
}
1919

2020
// Client represents a Gogs API client.

release.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2017 The Gogs Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package gogs
6+
7+
import (
8+
"time"
9+
)
10+
11+
// Release represents a release API object.
12+
type Release struct {
13+
ID int64 `json:"id"`
14+
TagName string `json:"tag_name"`
15+
TargetCommitish string `json:"target_commitish"`
16+
Name string `json:"name"`
17+
Body string `json:"body"`
18+
Draft bool `json:"draft"`
19+
Prerelease bool `json:"prerelease"`
20+
Author *User `json:"author"`
21+
Created time.Time `json:"created_at"`
22+
}

repo_hook.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ type ChangesPayload struct {
256256
Body *ChangesFromPayload `json:"body,omitempty"`
257257
}
258258

259+
// IssuesPayload represents a payload information of issues event.
259260
type IssuesPayload struct {
260261
Action HookIssueAction `json:"action"`
261262
Index int64 `json:"number"`
@@ -277,6 +278,7 @@ const (
277278
HOOK_ISSUE_COMMENT_DELETED HookIssueCommentAction = "deleted"
278279
)
279280

281+
// IssueCommentPayload represents a payload information of issue comment event.
280282
type IssueCommentPayload struct {
281283
Action HookIssueCommentAction `json:"action"`
282284
Issue *Issue `json:"issue"`
@@ -310,3 +312,28 @@ type PullRequestPayload struct {
310312
func (p *PullRequestPayload) JSONPayload() ([]byte, error) {
311313
return json.MarshalIndent(p, "", " ")
312314
}
315+
316+
// __________ .__
317+
// \______ \ ____ | | ____ _____ ______ ____
318+
// | _// __ \| | _/ __ \\__ \ / ___// __ \
319+
// | | \ ___/| |_\ ___/ / __ \_\___ \\ ___/
320+
// |____|_ /\___ >____/\___ >____ /____ >\___ >
321+
// \/ \/ \/ \/ \/ \/
322+
323+
type HookReleaseAction string
324+
325+
const (
326+
HOOK_RELEASE_PUBLISHED HookReleaseAction = "published"
327+
)
328+
329+
// ReleasePayload represents a payload information of release event.
330+
type ReleasePayload struct {
331+
Action HookReleaseAction `json:"action"`
332+
Release *Release `json:"release"`
333+
Repository *Repository `json:"repository"`
334+
Sender *User `json:"sender"`
335+
}
336+
337+
func (p *ReleasePayload) JSONPayload() ([]byte, error) {
338+
return json.MarshalIndent(p, "", " ")
339+
}

0 commit comments

Comments
 (0)