Update deps

This commit is contained in:
Jeff Mitchell
2017-02-24 14:36:54 -05:00
parent a4d535c9c1
commit ec7ec42e4c
146 changed files with 2195 additions and 4457 deletions

View File

@@ -6,6 +6,7 @@
package github
import (
"context"
"fmt"
"strings"
)
@@ -46,8 +47,8 @@ type updateRefRequest struct {
// GetRef fetches the Reference object for a given Git ref.
//
// GitHub API docs: http://developer.github.com/v3/git/refs/#get-a-reference
func (s *GitService) GetRef(owner string, repo string, ref string) (*Reference, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference
func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) {
ref = strings.TrimPrefix(ref, "refs/")
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
req, err := s.client.NewRequest("GET", u, nil)
@@ -56,7 +57,7 @@ func (s *GitService) GetRef(owner string, repo string, ref string) (*Reference,
}
r := new(Reference)
resp, err := s.client.Do(req, r)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
return nil, resp, err
}
@@ -74,8 +75,8 @@ type ReferenceListOptions struct {
// ListRefs lists all refs in a repository.
//
// GitHub API docs: http://developer.github.com/v3/git/refs/#get-all-references
func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/git/refs/#get-all-references
func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
var u string
if opt != nil && opt.Type != "" {
u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type)
@@ -93,7 +94,7 @@ func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]
}
var rs []*Reference
resp, err := s.client.Do(req, &rs)
resp, err := s.client.Do(ctx, req, &rs)
if err != nil {
return nil, resp, err
}
@@ -103,8 +104,8 @@ func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]
// CreateRef creates a new ref in a repository.
//
// GitHub API docs: http://developer.github.com/v3/git/refs/#create-a-reference
func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Reference, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/git/refs/#create-a-reference
func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo)
req, err := s.client.NewRequest("POST", u, &createRefRequest{
// back-compat with previous behavior that didn't require 'refs/' prefix
@@ -116,7 +117,7 @@ func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Refe
}
r := new(Reference)
resp, err := s.client.Do(req, r)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
return nil, resp, err
}
@@ -126,8 +127,8 @@ func (s *GitService) CreateRef(owner string, repo string, ref *Reference) (*Refe
// UpdateRef updates an existing ref in a repository.
//
// GitHub API docs: http://developer.github.com/v3/git/refs/#update-a-reference
func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/git/refs/#update-a-reference
func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
refPath := strings.TrimPrefix(*ref.Ref, "refs/")
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refPath)
req, err := s.client.NewRequest("PATCH", u, &updateRefRequest{
@@ -139,7 +140,7 @@ func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force
}
r := new(Reference)
resp, err := s.client.Do(req, r)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
return nil, resp, err
}
@@ -149,8 +150,8 @@ func (s *GitService) UpdateRef(owner string, repo string, ref *Reference, force
// DeleteRef deletes a ref from a repository.
//
// GitHub API docs: http://developer.github.com/v3/git/refs/#delete-a-reference
func (s *GitService) DeleteRef(owner string, repo string, ref string) (*Response, error) {
// GitHub API docs: https://developer.github.com/v3/git/refs/#delete-a-reference
func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) {
ref = strings.TrimPrefix(ref, "refs/")
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
req, err := s.client.NewRequest("DELETE", u, nil)
@@ -158,5 +159,5 @@ func (s *GitService) DeleteRef(owner string, repo string, ref string) (*Response
return nil, err
}
return s.client.Do(req, nil)
return s.client.Do(ctx, req, nil)
}