aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/users_followers.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/users_followers.go')
-rw-r--r--vendor/github.com/google/go-github/github/users_followers.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/vendor/github.com/google/go-github/github/users_followers.go b/vendor/github.com/google/go-github/github/users_followers.go
index 9e81b60..c222409 100644
--- a/vendor/github.com/google/go-github/github/users_followers.go
+++ b/vendor/github.com/google/go-github/github/users_followers.go
@@ -5,13 +5,16 @@
package github
-import "fmt"
+import (
+ "context"
+ "fmt"
+)
// ListFollowers lists the followers for a user. Passing the empty string will
// fetch followers for the authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/users/followers/#list-followers-of-a-user
-func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *Response, error) {
+func (s *UsersService) ListFollowers(ctx context.Context, user string, opt *ListOptions) ([]*User, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/followers", user)
@@ -29,7 +32,7 @@ func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *R
}
var users []*User
- resp, err := s.client.Do(req, &users)
+ resp, err := s.client.Do(ctx, req, &users)
if err != nil {
return nil, resp, err
}
@@ -41,7 +44,7 @@ func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *R
// string will list people the authenticated user is following.
//
// GitHub API docs: https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user
-func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *Response, error) {
+func (s *UsersService) ListFollowing(ctx context.Context, user string, opt *ListOptions) ([]*User, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/following", user)
@@ -59,7 +62,7 @@ func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *R
}
var users []*User
- resp, err := s.client.Do(req, &users)
+ resp, err := s.client.Do(ctx, req, &users)
if err != nil {
return nil, resp, err
}
@@ -71,7 +74,7 @@ func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *R
// string for "user" will check if the authenticated user is following "target".
//
// GitHub API docs: https://developer.github.com/v3/users/followers/#check-if-you-are-following-a-user
-func (s *UsersService) IsFollowing(user, target string) (bool, *Response, error) {
+func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bool, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/following/%v", user, target)
@@ -84,7 +87,7 @@ func (s *UsersService) IsFollowing(user, target string) (bool, *Response, error)
return false, nil, err
}
- resp, err := s.client.Do(req, nil)
+ resp, err := s.client.Do(ctx, req, nil)
following, err := parseBoolResponse(err)
return following, resp, err
}
@@ -92,25 +95,25 @@ func (s *UsersService) IsFollowing(user, target string) (bool, *Response, error)
// Follow will cause the authenticated user to follow the specified user.
//
// GitHub API docs: https://developer.github.com/v3/users/followers/#follow-a-user
-func (s *UsersService) Follow(user string) (*Response, error) {
+func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error) {
u := fmt.Sprintf("user/following/%v", user)
req, err := s.client.NewRequest("PUT", u, nil)
if err != nil {
return nil, err
}
- return s.client.Do(req, nil)
+ return s.client.Do(ctx, req, nil)
}
// Unfollow will cause the authenticated user to unfollow the specified user.
//
// GitHub API docs: https://developer.github.com/v3/users/followers/#unfollow-a-user
-func (s *UsersService) Unfollow(user string) (*Response, error) {
+func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error) {
u := fmt.Sprintf("user/following/%v", user)
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)
}