1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 13:49:42 +02:00
Migrated from plain /vendor to go dep
This commit is contained in:
Harvey Kandola 2018-02-14 15:23:46 +00:00
parent 0262763c95
commit fd693f4ff4
957 changed files with 36866 additions and 177595 deletions

View file

@ -5,14 +5,17 @@
package github
import "fmt"
import (
"context"
"fmt"
)
// The Key type is defined in users_keys.go
// ListKeys lists the deploy keys for a repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/keys/#list
func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptions) ([]*Key, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/repos/keys/#list
func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Key, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@ -24,19 +27,19 @@ func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptio
return nil, nil, err
}
keys := new([]*Key)
resp, err := s.client.Do(req, keys)
var keys []*Key
resp, err := s.client.Do(ctx, req, &keys)
if err != nil {
return nil, resp, err
}
return *keys, resp, err
return keys, resp, nil
}
// GetKey fetches a single deploy key.
//
// GitHub API docs: http://developer.github.com/v3/repos/keys/#get
func (s *RepositoriesService) GetKey(owner string, repo string, id int) (*Key, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/repos/keys/#get
func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
req, err := s.client.NewRequest("GET", u, nil)
@ -45,18 +48,18 @@ func (s *RepositoriesService) GetKey(owner string, repo string, id int) (*Key, *
}
key := new(Key)
resp, err := s.client.Do(req, key)
resp, err := s.client.Do(ctx, req, key)
if err != nil {
return nil, resp, err
}
return key, resp, err
return key, resp, nil
}
// CreateKey adds a deploy key for a repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/keys/#create
func (s *RepositoriesService) CreateKey(owner string, repo string, key *Key) (*Key, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/repos/keys/#create
func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
req, err := s.client.NewRequest("POST", u, key)
@ -65,18 +68,18 @@ func (s *RepositoriesService) CreateKey(owner string, repo string, key *Key) (*K
}
k := new(Key)
resp, err := s.client.Do(req, k)
resp, err := s.client.Do(ctx, req, k)
if err != nil {
return nil, resp, err
}
return k, resp, err
return k, resp, nil
}
// EditKey edits a deploy key.
//
// GitHub API docs: http://developer.github.com/v3/repos/keys/#edit
func (s *RepositoriesService) EditKey(owner string, repo string, id int, key *Key) (*Key, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/repos/keys/#edit
func (s *RepositoriesService) EditKey(ctx context.Context, owner string, repo string, id int, key *Key) (*Key, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
req, err := s.client.NewRequest("PATCH", u, key)
@ -85,18 +88,18 @@ func (s *RepositoriesService) EditKey(owner string, repo string, id int, key *Ke
}
k := new(Key)
resp, err := s.client.Do(req, k)
resp, err := s.client.Do(ctx, req, k)
if err != nil {
return nil, resp, err
}
return k, resp, err
return k, resp, nil
}
// DeleteKey deletes a deploy key.
//
// GitHub API docs: http://developer.github.com/v3/repos/keys/#delete
func (s *RepositoriesService) DeleteKey(owner string, repo string, id int) (*Response, error) {
// GitHub API docs: https://developer.github.com/v3/repos/keys/#delete
func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
req, err := s.client.NewRequest("DELETE", u, nil)
@ -104,5 +107,5 @@ func (s *RepositoriesService) DeleteKey(owner string, repo string, id int) (*Res
return nil, err
}
return s.client.Do(req, nil)
return s.client.Do(ctx, req, nil)
}