Merge v1.2.1-master
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
a590155b0b
commit
aeb17182b4
396 changed files with 27271 additions and 9969 deletions
58
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
58
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
|
@ -6,14 +6,15 @@
|
|||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// WebHookPayload represents the data that is received from GitHub when a push
|
||||
// event hook is triggered. The format of these payloads pre-date most of the
|
||||
// event hook is triggered. The format of these payloads pre-date most of the
|
||||
// GitHub v3 API, so there are lots of minor incompatibilities with the types
|
||||
// defined in the rest of the API. Therefore, several types are duplicated
|
||||
// defined in the rest of the API. Therefore, several types are duplicated
|
||||
// here to account for these differences.
|
||||
//
|
||||
// GitHub API docs: https://help.github.com/articles/post-receive-hooks
|
||||
|
@ -55,7 +56,7 @@ func (w WebHookCommit) String() string {
|
|||
}
|
||||
|
||||
// WebHookAuthor represents the author or committer of a commit, as specified
|
||||
// in a WebHookCommit. The commit author may not correspond to a GitHub User.
|
||||
// in a WebHookCommit. The commit author may not correspond to a GitHub User.
|
||||
type WebHookAuthor struct {
|
||||
Email *string `json:"email,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
@ -85,8 +86,8 @@ func (h Hook) String() string {
|
|||
// CreateHook creates a Hook for the specified repository.
|
||||
// Name and Config are required fields.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#create-a-hook
|
||||
func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#create-a-hook
|
||||
func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
||||
req, err := s.client.NewRequest("POST", u, hook)
|
||||
if err != nil {
|
||||
|
@ -94,18 +95,18 @@ func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook,
|
|||
}
|
||||
|
||||
h := new(Hook)
|
||||
resp, err := s.client.Do(req, h)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return h, resp, err
|
||||
return h, resp, nil
|
||||
}
|
||||
|
||||
// ListHooks lists all Hooks for the specified repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#list
|
||||
func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#list
|
||||
func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -117,80 +118,75 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
hooks := new([]*Hook)
|
||||
resp, err := s.client.Do(req, hooks)
|
||||
var hooks []*Hook
|
||||
resp, err := s.client.Do(ctx, req, &hooks)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return *hooks, resp, err
|
||||
return hooks, resp, nil
|
||||
}
|
||||
|
||||
// GetHook returns a single specified Hook.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#get-single-hook
|
||||
func (s *RepositoriesService) GetHook(owner, repo string, id int) (*Hook, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#get-single-hook
|
||||
func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int) (*Hook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
hook := new(Hook)
|
||||
resp, err := s.client.Do(req, hook)
|
||||
resp, err := s.client.Do(ctx, req, hook)
|
||||
return hook, resp, err
|
||||
}
|
||||
|
||||
// EditHook updates a specified Hook.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#edit-a-hook
|
||||
func (s *RepositoriesService) EditHook(owner, repo string, id int, hook *Hook) (*Hook, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#edit-a-hook
|
||||
func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int, hook *Hook) (*Hook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
||||
req, err := s.client.NewRequest("PATCH", u, hook)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
h := new(Hook)
|
||||
resp, err := s.client.Do(req, h)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
return h, resp, err
|
||||
}
|
||||
|
||||
// DeleteHook deletes a specified Hook.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#delete-a-hook
|
||||
func (s *RepositoriesService) DeleteHook(owner, repo string, id int) (*Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#delete-a-hook
|
||||
func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(req, nil)
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// PingHook triggers a 'ping' event to be sent to the Hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#ping-a-hook
|
||||
func (s *RepositoriesService) PingHook(owner, repo string, id int) (*Response, error) {
|
||||
func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id)
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(req, nil)
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// TestHook triggers a test Hook by github.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#test-a-push-hook
|
||||
func (s *RepositoriesService) TestHook(owner, repo string, id int) (*Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#test-a-push-hook
|
||||
func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id)
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(req, nil)
|
||||
}
|
||||
|
||||
// ListServiceHooks is deprecated. Use Client.ListServiceHooks instead.
|
||||
func (s *RepositoriesService) ListServiceHooks() ([]*ServiceHook, *Response, error) {
|
||||
return s.client.ListServiceHooks()
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue