aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/users_keys.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/users_keys.go')
-rw-r--r--vendor/github.com/google/go-github/github/users_keys.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/vendor/github.com/google/go-github/github/users_keys.go b/vendor/github.com/google/go-github/github/users_keys.go
index ebc333f..97ed4b8 100644
--- a/vendor/github.com/google/go-github/github/users_keys.go
+++ b/vendor/github.com/google/go-github/github/users_keys.go
@@ -5,7 +5,10 @@
package github
-import "fmt"
+import (
+ "context"
+ "fmt"
+)
// Key represents a public SSH key used to authenticate a user or deploy script.
type Key struct {
@@ -24,7 +27,7 @@ func (k Key) String() string {
// string will fetch keys for the authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
-func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Response, error) {
+func (s *UsersService) ListKeys(ctx context.Context, user string, opt *ListOptions) ([]*Key, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/keys", user)
@@ -42,7 +45,7 @@ func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Respons
}
var keys []*Key
- resp, err := s.client.Do(req, &keys)
+ resp, err := s.client.Do(ctx, req, &keys)
if err != nil {
return nil, resp, err
}
@@ -53,7 +56,7 @@ func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Respons
// GetKey fetches a single public key.
//
// GitHub API docs: https://developer.github.com/v3/users/keys/#get-a-single-public-key
-func (s *UsersService) GetKey(id int) (*Key, *Response, error) {
+func (s *UsersService) GetKey(ctx context.Context, id int) (*Key, *Response, error) {
u := fmt.Sprintf("user/keys/%v", id)
req, err := s.client.NewRequest("GET", u, nil)
@@ -62,7 +65,7 @@ func (s *UsersService) GetKey(id int) (*Key, *Response, error) {
}
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
}
@@ -73,7 +76,7 @@ func (s *UsersService) GetKey(id int) (*Key, *Response, error) {
// CreateKey adds a public key for the authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/users/keys/#create-a-public-key
-func (s *UsersService) CreateKey(key *Key) (*Key, *Response, error) {
+func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) {
u := "user/keys"
req, err := s.client.NewRequest("POST", u, key)
@@ -82,7 +85,7 @@ func (s *UsersService) CreateKey(key *Key) (*Key, *Response, error) {
}
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
}
@@ -93,7 +96,7 @@ func (s *UsersService) CreateKey(key *Key) (*Key, *Response, error) {
// DeleteKey deletes a public key.
//
// GitHub API docs: https://developer.github.com/v3/users/keys/#delete-a-public-key
-func (s *UsersService) DeleteKey(id int) (*Response, error) {
+func (s *UsersService) DeleteKey(ctx context.Context, id int) (*Response, error) {
u := fmt.Sprintf("user/keys/%v", id)
req, err := s.client.NewRequest("DELETE", u, nil)
@@ -101,5 +104,5 @@ func (s *UsersService) DeleteKey(id int) (*Response, error) {
return nil, err
}
- return s.client.Do(req, nil)
+ return s.client.Do(ctx, req, nil)
}