Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit e363d3f

Browse files
committed
Remove unused payload types
1 parent 5799eb6 commit e363d3f

File tree

2 files changed

+18
-43
lines changed

2 files changed

+18
-43
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.11.0"
17+
return "0.12.0"
1818
}
1919

2020
// Client represents a Gogs API client.

repo_hook.go

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -74,45 +74,20 @@ type Payloader interface {
7474
JSONPayload() ([]byte, error)
7575
}
7676

77-
type PayloadAuthor struct {
78-
Name string `json:"name"`
79-
Email string `json:"email"`
80-
UserName string `json:"username"`
81-
}
82-
83-
type PayloadCommitter struct {
77+
type PayloadUser struct {
8478
Name string `json:"name"`
8579
Email string `json:"email"`
8680
UserName string `json:"username"`
8781
}
8882

89-
type PayloadUser struct {
90-
UserName string `json:"login"`
91-
ID int64 `json:"id"`
92-
AvatarUrl string `json:"avatar_url"`
93-
}
94-
83+
// FIXME: consider use same format as API when commits API are added.
9584
type PayloadCommit struct {
96-
ID string `json:"id"`
97-
Message string `json:"message"`
98-
URL string `json:"url"`
99-
Author *PayloadAuthor `json:"author"`
100-
Committer *PayloadCommitter `json:"committer"`
101-
Timestamp time.Time `json:"timestamp"`
102-
}
103-
104-
type PayloadRepo struct {
105-
ID int64 `json:"id"`
106-
Name string `json:"name"`
107-
URL string `json:"url"`
108-
SSHURL string `json:"ssh_url"`
109-
CloneURL string `json:"clone_url"`
110-
Description string `json:"description"`
111-
Website string `json:"website"`
112-
Watchers int `json:"watchers"`
113-
Owner *PayloadAuthor `json:"owner"`
114-
Private bool `json:"private"`
115-
DefaultBranch string `json:"default_branch"`
85+
ID string `json:"id"`
86+
Message string `json:"message"`
87+
URL string `json:"url"`
88+
Author *PayloadUser `json:"author"`
89+
Committer *PayloadUser `json:"committer"`
90+
Timestamp time.Time `json:"timestamp"`
11691
}
11792

11893
var (
@@ -129,11 +104,11 @@ var (
129104
// \/ \/ \/ \/
130105

131106
type CreatePayload struct {
132-
Secret string `json:"secret"`
133-
Ref string `json:"ref"`
134-
RefType string `json:"ref_type"`
135-
Repo *PayloadRepo `json:"repository"`
136-
Sender *PayloadUser `json:"sender"`
107+
Secret string `json:"secret"`
108+
Ref string `json:"ref"`
109+
RefType string `json:"ref_type"`
110+
Repo *Repository `json:"repository"`
111+
Sender *User `json:"sender"`
137112
}
138113

139114
func (p *CreatePayload) SetSecret(secret string) {
@@ -177,11 +152,11 @@ type PushPayload struct {
177152
Ref string `json:"ref"`
178153
Before string `json:"before"`
179154
After string `json:"after"`
180-
CompareUrl string `json:"compare_url"`
155+
CompareURL string `json:"compare_url"`
181156
Commits []*PayloadCommit `json:"commits"`
182-
Repo *PayloadRepo `json:"repository"`
183-
Pusher *PayloadAuthor `json:"pusher"`
184-
Sender *PayloadUser `json:"sender"`
157+
Repo *Repository `json:"repository"`
158+
Pusher *User `json:"pusher"`
159+
Sender *User `json:"sender"`
185160
}
186161

187162
func (p *PushPayload) SetSecret(secret string) {

0 commit comments

Comments
 (0)