Merge v1.2.1-master
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
a590155b0b
commit
aeb17182b4
396 changed files with 27271 additions and 9969 deletions
45
vendor/github.com/google/go-github/github/activity_star.go
generated
vendored
45
vendor/github.com/google/go-github/github/activity_star.go
generated
vendored
|
@ -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 {
|
||||
|
@ -37,34 +40,34 @@ func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) (
|
|||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeStarringPreview)
|
||||
|
||||
stargazers := new([]*Stargazer)
|
||||
resp, err := s.client.Do(req, stargazers)
|
||||
var stargazers []*Stargazer
|
||||
resp, err := s.client.Do(ctx, req, &stargazers)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return *stargazers, resp, err
|
||||
return stargazers, resp, nil
|
||||
}
|
||||
|
||||
// ActivityListStarredOptions specifies the optional parameters to the
|
||||
// ActivityService.ListStarred method.
|
||||
type ActivityListStarredOptions struct {
|
||||
// How to sort the repository list. Possible values are: created, updated,
|
||||
// pushed, full_name. Default is "full_name".
|
||||
// How to sort the repository list. Possible values are: created, updated,
|
||||
// pushed, full_name. Default is "full_name".
|
||||
Sort string `url:"sort,omitempty"`
|
||||
|
||||
// Direction in which to sort repositories. Possible values are: asc, desc.
|
||||
// Direction in which to sort repositories. Possible values are: asc, desc.
|
||||
// Default is "asc" when sort is "full_name", otherwise default is "desc".
|
||||
Direction string `url:"direction,omitempty"`
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListStarred lists all the repos starred by a user. Passing the empty string
|
||||
// ListStarred lists all the repos starred by a user. Passing the empty string
|
||||
// will list the starred repositories for the authenticated user.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/activity/starring/#list-repositories-being-starred
|
||||
func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
|
||||
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)
|
||||
|
@ -84,25 +87,25 @@ func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptio
|
|||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeStarringPreview)
|
||||
|
||||
repos := new([]*StarredRepository)
|
||||
resp, err := s.client.Do(req, repos)
|
||||
var repos []*StarredRepository
|
||||
resp, err := s.client.Do(ctx, req, &repos)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return *repos, resp, err
|
||||
return repos, resp, nil
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue