diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2017-04-10 21:18:42 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-04-10 21:38:33 +0100 |
commit | 30802e07b2d84fbc213b490d3402707dffe60096 (patch) | |
tree | 934aecb8f3582325dfd1aa6652193adac87d00db /vendor/github.com/google/go-github/github/activity_star.go | |
parent | da7638dc112c4c106e8929601b642d2ca4596cba (diff) |
update dependencies
Diffstat (limited to 'vendor/github.com/google/go-github/github/activity_star.go')
-rw-r--r-- | vendor/github.com/google/go-github/github/activity_star.go | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/vendor/github.com/google/go-github/github/activity_star.go b/vendor/github.com/google/go-github/github/activity_star.go index db9a309..d5b0671 100644 --- a/vendor/github.com/google/go-github/github/activity_star.go +++ b/vendor/github.com/google/go-github/github/activity_star.go @@ -5,7 +5,10 @@ package github -import "fmt" +import ( + "context" + "fmt" +) // StarredRepository is returned by ListStarred. type StarredRepository struct { @@ -21,8 +24,8 @@ type Stargazer struct { // ListStargazers lists people who have starred the specified repo. // -// GitHub API Docs: https://developer.github.com/v3/activity/starring/#list-stargazers -func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-stargazers +func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error) { u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo) u, err := addOptions(u, opt) if err != nil { @@ -38,7 +41,7 @@ func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) ( req.Header.Set("Accept", mediaTypeStarringPreview) var stargazers []*Stargazer - resp, err := s.client.Do(req, &stargazers) + resp, err := s.client.Do(ctx, req, &stargazers) if err != nil { return nil, resp, err } @@ -64,7 +67,7 @@ type ActivityListStarredOptions struct { // will list the starred repositories for the authenticated user. // // GitHub API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred -func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) { +func (s *ActivityService) ListStarred(ctx context.Context, user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) { var u string if user != "" { u = fmt.Sprintf("users/%v/starred", user) @@ -85,7 +88,7 @@ func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptio req.Header.Set("Accept", mediaTypeStarringPreview) var repos []*StarredRepository - resp, err := s.client.Do(req, &repos) + resp, err := s.client.Do(ctx, req, &repos) if err != nil { return nil, resp, err } @@ -96,13 +99,13 @@ func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptio // IsStarred checks if a repository is starred by authenticated user. // // GitHub API docs: https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository -func (s *ActivityService) IsStarred(owner, repo string) (bool, *Response, error) { +func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(req, nil) + resp, err := s.client.Do(ctx, req, nil) starred, err := parseBoolResponse(err) return starred, resp, err } @@ -110,23 +113,23 @@ func (s *ActivityService) IsStarred(owner, repo string) (bool, *Response, error) // Star a repository as the authenticated user. // // GitHub API docs: https://developer.github.com/v3/activity/starring/#star-a-repository -func (s *ActivityService) Star(owner, repo string) (*Response, error) { +func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) 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) } // Unstar a repository as the authenticated user. // // GitHub API docs: https://developer.github.com/v3/activity/starring/#unstar-a-repository -func (s *ActivityService) Unstar(owner, repo string) (*Response, error) { +func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) 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) } |