|
|
@ -70,7 +70,6 @@ func (c *Client) DeleteRepoHook(user, repo string, id int64) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type Payloader interface { |
|
|
|
type Payloader interface { |
|
|
|
SetSecret(string) |
|
|
|
|
|
|
|
JSONPayload() ([]byte, error) |
|
|
|
JSONPayload() ([]byte, error) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -104,17 +103,12 @@ var ( |
|
|
|
// \/ \/ \/ \/
|
|
|
|
// \/ \/ \/ \/
|
|
|
|
|
|
|
|
|
|
|
|
type CreatePayload struct { |
|
|
|
type CreatePayload struct { |
|
|
|
Secret string `json:"secret"` |
|
|
|
|
|
|
|
Ref string `json:"ref"` |
|
|
|
Ref string `json:"ref"` |
|
|
|
RefType string `json:"ref_type"` |
|
|
|
RefType string `json:"ref_type"` |
|
|
|
Repo *Repository `json:"repository"` |
|
|
|
Repo *Repository `json:"repository"` |
|
|
|
Sender *User `json:"sender"` |
|
|
|
Sender *User `json:"sender"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (p *CreatePayload) SetSecret(secret string) { |
|
|
|
|
|
|
|
p.Secret = secret |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (p *CreatePayload) JSONPayload() ([]byte, error) { |
|
|
|
func (p *CreatePayload) JSONPayload() ([]byte, error) { |
|
|
|
return json.MarshalIndent(p, "", " ") |
|
|
|
return json.MarshalIndent(p, "", " ") |
|
|
|
} |
|
|
|
} |
|
|
@ -148,7 +142,6 @@ func ParseCreateHook(raw []byte) (*CreatePayload, error) { |
|
|
|
|
|
|
|
|
|
|
|
// PushPayload represents a payload information of push event.
|
|
|
|
// PushPayload represents a payload information of push event.
|
|
|
|
type PushPayload struct { |
|
|
|
type PushPayload struct { |
|
|
|
Secret string `json:"secret"` |
|
|
|
|
|
|
|
Ref string `json:"ref"` |
|
|
|
Ref string `json:"ref"` |
|
|
|
Before string `json:"before"` |
|
|
|
Before string `json:"before"` |
|
|
|
After string `json:"after"` |
|
|
|
After string `json:"after"` |
|
|
@ -159,10 +152,6 @@ type PushPayload struct { |
|
|
|
Sender *User `json:"sender"` |
|
|
|
Sender *User `json:"sender"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (p *PushPayload) SetSecret(secret string) { |
|
|
|
|
|
|
|
p.Secret = secret |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (p *PushPayload) JSONPayload() ([]byte, error) { |
|
|
|
func (p *PushPayload) JSONPayload() ([]byte, error) { |
|
|
|
return json.MarshalIndent(p, "", " ") |
|
|
|
return json.MarshalIndent(p, "", " ") |
|
|
|
} |
|
|
|
} |
|
|
@ -227,7 +216,6 @@ type ChangesPayload struct { |
|
|
|
|
|
|
|
|
|
|
|
// PullRequestPayload represents a payload information of pull request event.
|
|
|
|
// PullRequestPayload represents a payload information of pull request event.
|
|
|
|
type PullRequestPayload struct { |
|
|
|
type PullRequestPayload struct { |
|
|
|
Secret string `json:"secret"` |
|
|
|
|
|
|
|
Action HookIssueAction `json:"action"` |
|
|
|
Action HookIssueAction `json:"action"` |
|
|
|
Index int64 `json:"number"` |
|
|
|
Index int64 `json:"number"` |
|
|
|
Changes *ChangesPayload `json:"changes,omitempty"` |
|
|
|
Changes *ChangesPayload `json:"changes,omitempty"` |
|
|
@ -236,10 +224,6 @@ type PullRequestPayload struct { |
|
|
|
Sender *User `json:"sender"` |
|
|
|
Sender *User `json:"sender"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (p *PullRequestPayload) SetSecret(secret string) { |
|
|
|
|
|
|
|
p.Secret = secret |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (p *PullRequestPayload) JSONPayload() ([]byte, error) { |
|
|
|
func (p *PullRequestPayload) JSONPayload() ([]byte, error) { |
|
|
|
return json.MarshalIndent(p, "", " ") |
|
|
|
return json.MarshalIndent(p, "", " ") |
|
|
|
} |
|
|
|
} |
|
|
|