Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ba630f5

Browse files
committed
repo_hook: add DeletePayload
1 parent f12fbac commit ba630f5

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
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.6"
17+
return "0.12.7"
1818
}
1919

2020
// Client represents a Gogs API client.

‎repo_hook.go

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type PayloadCommit struct {
9191

9292
var (
9393
_ Payloader = &CreatePayload{}
94+
_ Payloader = &DeletePayload{}
9495
_ Payloader = &PushPayload{}
9596
_ Payloader = &PullRequestPayload{}
9697
)
@@ -103,10 +104,11 @@ var (
103104
// \/ \/ \/ \/
104105

105106
type CreatePayload struct {
106-
Ref string `json:"ref"`
107-
RefType string `json:"ref_type"`
108-
Repo *Repository `json:"repository"`
109-
Sender *User `json:"sender"`
107+
Ref string `json:"ref"`
108+
RefType string `json:"ref_type"`
109+
DefaultBranch string `json:"default_branch"`
110+
Repo *Repository `json:"repository"`
111+
Sender *User `json:"sender"`
110112
}
111113

112114
func (p *CreatePayload) JSONPayload() ([]byte, error) {
@@ -133,6 +135,31 @@ func ParseCreateHook(raw []byte) (*CreatePayload, error) {
133135
return hook, nil
134136
}
135137

138+
// ________ .__ __
139+
// \______ \ ____ | | _____/ |_ ____
140+
// | | \_/ __ \| | _/ __ \ __\/ __ \
141+
// | ` \ ___/| |_\ ___/| | \ ___/
142+
// /_______ /\___ >____/\___ >__| \___ >
143+
// \/ \/ \/ \/
144+
145+
type PusherType string
146+
147+
const (
148+
PUSHER_TYPE_USER PusherType = "user"
149+
)
150+
151+
type DeletePayload struct {
152+
Ref string `json:"ref"`
153+
RefType string `json:"ref_type"`
154+
PusherType PusherType `json:"pusher_type"`
155+
Repo *Repository `json:"repository"`
156+
Sender *User `json:"sender"`
157+
}
158+
159+
func (p *DeletePayload) JSONPayload() ([]byte, error) {
160+
return json.MarshalIndent(p, "", " ")
161+
}
162+
136163
// __________ .__
137164
// \______ \__ __ _____| |__
138165
// | ___/ | \/ ___/ | \

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /