Remove unused payload types
This commit is contained in:
parent
5799eb65e0
commit
e363d3ff8f
2 changed files with 20 additions and 45 deletions
2
gogs.go
2
gogs.go
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Version() string {
|
func Version() string {
|
||||||
return "0.11.0"
|
return "0.12.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client represents a Gogs API client.
|
// Client represents a Gogs API client.
|
||||||
|
|
49
repo_hook.go
49
repo_hook.go
|
@ -74,47 +74,22 @@ type Payloader interface {
|
||||||
JSONPayload() ([]byte, error)
|
JSONPayload() ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PayloadAuthor struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Email string `json:"email"`
|
|
||||||
UserName string `json:"username"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PayloadCommitter struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Email string `json:"email"`
|
|
||||||
UserName string `json:"username"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PayloadUser struct {
|
type PayloadUser struct {
|
||||||
UserName string `json:"login"`
|
Name string `json:"name"`
|
||||||
ID int64 `json:"id"`
|
Email string `json:"email"`
|
||||||
AvatarUrl string `json:"avatar_url"`
|
UserName string `json:"username"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: consider use same format as API when commits API are added.
|
||||||
type PayloadCommit struct {
|
type PayloadCommit struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Author *PayloadAuthor `json:"author"`
|
Author *PayloadUser `json:"author"`
|
||||||
Committer *PayloadCommitter `json:"committer"`
|
Committer *PayloadUser `json:"committer"`
|
||||||
Timestamp time.Time `json:"timestamp"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PayloadRepo struct {
|
|
||||||
ID int64 `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
SSHURL string `json:"ssh_url"`
|
|
||||||
CloneURL string `json:"clone_url"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Website string `json:"website"`
|
|
||||||
Watchers int `json:"watchers"`
|
|
||||||
Owner *PayloadAuthor `json:"owner"`
|
|
||||||
Private bool `json:"private"`
|
|
||||||
DefaultBranch string `json:"default_branch"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ Payloader = &CreatePayload{}
|
_ Payloader = &CreatePayload{}
|
||||||
_ Payloader = &PushPayload{}
|
_ Payloader = &PushPayload{}
|
||||||
|
@ -132,8 +107,8 @@ type CreatePayload struct {
|
||||||
Secret string `json:"secret"`
|
Secret string `json:"secret"`
|
||||||
Ref string `json:"ref"`
|
Ref string `json:"ref"`
|
||||||
RefType string `json:"ref_type"`
|
RefType string `json:"ref_type"`
|
||||||
Repo *PayloadRepo `json:"repository"`
|
Repo *Repository `json:"repository"`
|
||||||
Sender *PayloadUser `json:"sender"`
|
Sender *User `json:"sender"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *CreatePayload) SetSecret(secret string) {
|
func (p *CreatePayload) SetSecret(secret string) {
|
||||||
|
@ -177,11 +152,11 @@ type PushPayload struct {
|
||||||
Ref string `json:"ref"`
|
Ref string `json:"ref"`
|
||||||
Before string `json:"before"`
|
Before string `json:"before"`
|
||||||
After string `json:"after"`
|
After string `json:"after"`
|
||||||
CompareUrl string `json:"compare_url"`
|
CompareURL string `json:"compare_url"`
|
||||||
Commits []*PayloadCommit `json:"commits"`
|
Commits []*PayloadCommit `json:"commits"`
|
||||||
Repo *PayloadRepo `json:"repository"`
|
Repo *Repository `json:"repository"`
|
||||||
Pusher *PayloadAuthor `json:"pusher"`
|
Pusher *User `json:"pusher"`
|
||||||
Sender *PayloadUser `json:"sender"`
|
Sender *User `json:"sender"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PushPayload) SetSecret(secret string) {
|
func (p *PushPayload) SetSecret(secret string) {
|
||||||
|
|
Loading…
Reference in a new issue