aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/repos_hooks.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/repos_hooks.go')
-rw-r--r--vendor/github.com/google/go-github/github/repos_hooks.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/vendor/github.com/google/go-github/github/repos_hooks.go b/vendor/github.com/google/go-github/github/repos_hooks.go
index 818286b..67ce96a 100644
--- a/vendor/github.com/google/go-github/github/repos_hooks.go
+++ b/vendor/github.com/google/go-github/github/repos_hooks.go
@@ -6,6 +6,7 @@
package github
import (
+ "context"
"fmt"
"time"
)
@@ -86,7 +87,7 @@ func (h Hook) String() string {
// Name and Config are required fields.
//
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#create-a-hook
-func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook, *Response, error) {
+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,7 +95,7 @@ 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
}
@@ -105,7 +106,7 @@ func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook,
// ListHooks lists all Hooks for the specified repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#list
-func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) {
+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 {
@@ -118,7 +119,7 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([
}
var hooks []*Hook
- resp, err := s.client.Do(req, &hooks)
+ resp, err := s.client.Do(ctx, req, &hooks)
if err != nil {
return nil, resp, err
}
@@ -129,63 +130,63 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([
// GetHook returns a single specified Hook.
//
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#get-single-hook
-func (s *RepositoriesService) GetHook(owner, repo string, id int) (*Hook, *Response, error) {
+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: https://developer.github.com/v3/repos/hooks/#edit-a-hook
-func (s *RepositoriesService) EditHook(owner, repo string, id int, hook *Hook) (*Hook, *Response, error) {
+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: https://developer.github.com/v3/repos/hooks/#delete-a-hook
-func (s *RepositoriesService) DeleteHook(owner, repo string, id int) (*Response, error) {
+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: https://developer.github.com/v3/repos/hooks/#test-a-push-hook
-func (s *RepositoriesService) TestHook(owner, repo string, id int) (*Response, error) {
+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)
+ return s.client.Do(ctx, req, nil)
}