aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2017-02-12 22:24:33 +0000
committerNiall Sheridan <nsheridan@gmail.com>2017-02-12 22:24:33 +0000
commitba4840c52becf73c2749c9ef0f2f09ed0b9d5c7f (patch)
tree61b839884d66c9dd8269e26117aa4e4c995ad119 /vendor/github.com/google
parent6e00d0000e54f21a4a393e67fd914bda4d394f4a (diff)
Update dependencies
Diffstat (limited to 'vendor/github.com/google')
-rw-r--r--vendor/github.com/google/go-github/github/activity_events.go50
-rw-r--r--vendor/github.com/google/go-github/github/activity_star.go12
-rw-r--r--vendor/github.com/google/go-github/github/activity_watching.go12
-rw-r--r--vendor/github.com/google/go-github/github/authorizations.go6
-rw-r--r--vendor/github.com/google/go-github/github/event_types.go229
-rw-r--r--vendor/github.com/google/go-github/github/gists.go31
-rw-r--r--vendor/github.com/google/go-github/github/gists_comments.go6
-rw-r--r--vendor/github.com/google/go-github/github/github.go20
-rw-r--r--vendor/github.com/google/go-github/github/gitignore.go6
-rw-r--r--vendor/github.com/google/go-github/github/integration.go4
-rw-r--r--vendor/github.com/google/go-github/github/issues.go18
-rw-r--r--vendor/github.com/google/go-github/github/issues_assignees.go6
-rw-r--r--vendor/github.com/google/go-github/github/issues_comments.go12
-rw-r--r--vendor/github.com/google/go-github/github/issues_labels.go40
-rw-r--r--vendor/github.com/google/go-github/github/issues_milestones.go12
-rw-r--r--vendor/github.com/google/go-github/github/licenses.go6
-rw-r--r--vendor/github.com/google/go-github/github/messages.go1
-rw-r--r--vendor/github.com/google/go-github/github/migrations_source_import.go12
-rw-r--r--vendor/github.com/google/go-github/github/misc.go6
-rw-r--r--vendor/github.com/google/go-github/github/orgs.go6
-rw-r--r--vendor/github.com/google/go-github/github/orgs_hooks.go6
-rw-r--r--vendor/github.com/google/go-github/github/orgs_members.go32
-rw-r--r--vendor/github.com/google/go-github/github/orgs_teams.go73
-rw-r--r--vendor/github.com/google/go-github/github/pulls.go51
-rw-r--r--vendor/github.com/google/go-github/github/pulls_comments.go12
-rw-r--r--vendor/github.com/google/go-github/github/pulls_reviews.go242
-rw-r--r--vendor/github.com/google/go-github/github/repos.go100
-rw-r--r--vendor/github.com/google/go-github/github/repos_collaborators.go35
-rw-r--r--vendor/github.com/google/go-github/github/repos_comments.go12
-rw-r--r--vendor/github.com/google/go-github/github/repos_commits.go6
-rw-r--r--vendor/github.com/google/go-github/github/repos_deployments.go38
-rw-r--r--vendor/github.com/google/go-github/github/repos_forks.go6
-rw-r--r--vendor/github.com/google/go-github/github/repos_hooks.go6
-rw-r--r--vendor/github.com/google/go-github/github/repos_keys.go6
-rw-r--r--vendor/github.com/google/go-github/github/repos_releases.go18
-rw-r--r--vendor/github.com/google/go-github/github/repos_statuses.go6
-rw-r--r--vendor/github.com/google/go-github/github/repos_traffic.go20
-rw-r--r--vendor/github.com/google/go-github/github/search.go41
-rw-r--r--vendor/github.com/google/go-github/github/users.go6
-rw-r--r--vendor/github.com/google/go-github/github/users_emails.go12
-rw-r--r--vendor/github.com/google/go-github/github/users_followers.go12
-rw-r--r--vendor/github.com/google/go-github/github/users_keys.go6
-rw-r--r--vendor/github.com/google/go-querystring/query/encode.go10
43 files changed, 862 insertions, 389 deletions
diff --git a/vendor/github.com/google/go-github/github/activity_events.go b/vendor/github.com/google/go-github/github/activity_events.go
index 557001e..5cdcabe 100644
--- a/vendor/github.com/google/go-github/github/activity_events.go
+++ b/vendor/github.com/google/go-github/github/activity_events.go
@@ -63,6 +63,8 @@ func (e *Event) Payload() (payload interface{}) {
payload = &MembershipEvent{}
case "MilestoneEvent":
payload = &MilestoneEvent{}
+ case "OrganizationEvent":
+ payload = &OrganizationEvent{}
case "PageBuildEvent":
payload = &PageBuildEvent{}
case "PingEvent":
@@ -108,13 +110,13 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, err
return nil, nil, err
}
- events := new([]*Event)
- resp, err := s.client.Do(req, events)
+ var events []*Event
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
// ListRepositoryEvents lists events for a repository.
@@ -132,13 +134,13 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti
return nil, nil, err
}
- events := new([]*Event)
- resp, err := s.client.Do(req, events)
+ var events []*Event
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
// ListIssueEventsForRepository lists issue events for a repository.
@@ -156,13 +158,13 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *
return nil, nil, err
}
- events := new([]*IssueEvent)
- resp, err := s.client.Do(req, events)
+ var events []*IssueEvent
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
// ListEventsForRepoNetwork lists public events for a network of repositories.
@@ -180,13 +182,13 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List
return nil, nil, err
}
- events := new([]*Event)
- resp, err := s.client.Do(req, events)
+ var events []*Event
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
// ListEventsForOrganization lists public events for an organization.
@@ -204,13 +206,13 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions
return nil, nil, err
}
- events := new([]*Event)
- resp, err := s.client.Do(req, events)
+ var events []*Event
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is
@@ -234,13 +236,13 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool
return nil, nil, err
}
- events := new([]*Event)
- resp, err := s.client.Do(req, events)
+ var events []*Event
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
// ListEventsReceivedByUser lists the events received by a user. If publicOnly is
@@ -264,13 +266,13 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool,
return nil, nil, err
}
- events := new([]*Event)
- resp, err := s.client.Do(req, events)
+ var events []*Event
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
// ListUserEventsForOrganization provides the user’s organization dashboard. You
@@ -289,11 +291,11 @@ func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *L
return nil, nil, err
}
- events := new([]*Event)
- resp, err := s.client.Do(req, events)
+ var events []*Event
+ resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
}
- return *events, resp, err
+ return events, resp, nil
}
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 5df6814..edf20e8 100644
--- a/vendor/github.com/google/go-github/github/activity_star.go
+++ b/vendor/github.com/google/go-github/github/activity_star.go
@@ -37,13 +37,13 @@ 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(req, &stargazers)
if err != nil {
return nil, resp, err
}
- return *stargazers, resp, err
+ return stargazers, resp, nil
}
// ActivityListStarredOptions specifies the optional parameters to the
@@ -84,13 +84,13 @@ 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(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.
diff --git a/vendor/github.com/google/go-github/github/activity_watching.go b/vendor/github.com/google/go-github/github/activity_watching.go
index 9a27541..ac77657 100644
--- a/vendor/github.com/google/go-github/github/activity_watching.go
+++ b/vendor/github.com/google/go-github/github/activity_watching.go
@@ -37,13 +37,13 @@ func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]
return nil, nil, err
}
- watchers := new([]*User)
- resp, err := s.client.Do(req, watchers)
+ var watchers []*User
+ resp, err := s.client.Do(req, &watchers)
if err != nil {
return nil, resp, err
}
- return *watchers, resp, err
+ return watchers, resp, nil
}
// ListWatched lists the repositories the specified user is watching. Passing
@@ -67,13 +67,13 @@ func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]*Reposit
return nil, nil, err
}
- watched := new([]*Repository)
- resp, err := s.client.Do(req, watched)
+ var watched []*Repository
+ resp, err := s.client.Do(req, &watched)
if err != nil {
return nil, resp, err
}
- return *watched, resp, err
+ return watched, resp, nil
}
// GetRepositorySubscription returns the subscription for the specified
diff --git a/vendor/github.com/google/go-github/github/authorizations.go b/vendor/github.com/google/go-github/github/authorizations.go
index d5a5e63..9f2a1ec 100644
--- a/vendor/github.com/google/go-github/github/authorizations.go
+++ b/vendor/github.com/google/go-github/github/authorizations.go
@@ -146,12 +146,12 @@ func (s *AuthorizationsService) List(opt *ListOptions) ([]*Authorization, *Respo
return nil, nil, err
}
- auths := new([]*Authorization)
- resp, err := s.client.Do(req, auths)
+ var auths []*Authorization
+ resp, err := s.client.Do(req, &auths)
if err != nil {
return nil, resp, err
}
- return *auths, resp, err
+ return auths, resp, nil
}
// Get a single authorization.
diff --git a/vendor/github.com/google/go-github/github/event_types.go b/vendor/github.com/google/go-github/github/event_types.go
index a1ffa69..6dd7fe3 100644
--- a/vendor/github.com/google/go-github/github/event_types.go
+++ b/vendor/github.com/google/go-github/github/event_types.go
@@ -15,9 +15,10 @@ type CommitCommentEvent struct {
Comment *RepositoryComment `json:"comment,omitempty"`
// The following fields are only populated by Webhook events.
- Action *string `json:"action,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Action *string `json:"action,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// CreateEvent represents a created repository, branch, or tag.
@@ -36,9 +37,10 @@ type CreateEvent struct {
Description *string `json:"description,omitempty"`
// The following fields are only populated by Webhook events.
- PusherType *string `json:"pusher_type,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ PusherType *string `json:"pusher_type,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// DeleteEvent represents a deleted branch or tag.
@@ -54,9 +56,10 @@ type DeleteEvent struct {
RefType *string `json:"ref_type,omitempty"`
// The following fields are only populated by Webhook events.
- PusherType *string `json:"pusher_type,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ PusherType *string `json:"pusher_type,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// DeploymentEvent represents a deployment.
@@ -70,7 +73,8 @@ type DeploymentEvent struct {
Repo *Repository `json:"repository,omitempty"`
// The following fields are only populated by Webhook events.
- Sender *User `json:"sender,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// DeploymentStatusEvent represents a deployment status.
@@ -85,7 +89,8 @@ type DeploymentStatusEvent struct {
Repo *Repository `json:"repository,omitempty"`
// The following fields are only populated by Webhook events.
- Sender *User `json:"sender,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// ForkEvent is triggered when a user forks a repository.
@@ -97,8 +102,9 @@ type ForkEvent struct {
Forkee *Repository `json:"forkee,omitempty"`
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// Page represents a single Wiki page.
@@ -119,8 +125,9 @@ type GollumEvent struct {
Pages []*Page `json:"pages,omitempty"`
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// IssueActivityEvent represents the payload delivered by Issue webhook.
@@ -131,8 +138,9 @@ type IssueActivityEvent struct {
Issue *Issue `json:"issue,omitempty"`
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// EditChange represents the changes when an issue, pull request, or comment has
@@ -154,8 +162,8 @@ type IntegrationInstallationEvent struct {
// The action that was performed. Possible values for an "integration_installation"
// event are: "created", "deleted".
Action *string `json:"action,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// IntegrationInstallationRepositoriesEvent is triggered when an integration repository
@@ -166,10 +174,10 @@ type IntegrationInstallationRepositoriesEvent struct {
// The action that was performed. Possible values for an "integration_installation_repositories"
// event are: "added", "removed".
Action *string `json:"action,omitempty"`
- Installation *Installation `json:"installation,omitempty"`
RepositoriesAdded []*Repository `json:"repositories_added,omitempty"`
RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"`
Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// IssueCommentEvent is triggered when an issue comment is created on an issue
@@ -185,9 +193,10 @@ type IssueCommentEvent struct {
Comment *IssueComment `json:"comment,omitempty"`
// The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// IssuesEvent is triggered when an issue is assigned, unassigned, labeled,
@@ -204,9 +213,10 @@ type IssuesEvent struct {
Label *Label `json:"label,omitempty"`
// The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// LabelEvent is triggered when a repository's label is created, edited, or deleted.
@@ -220,9 +230,10 @@ type LabelEvent struct {
Label *Label `json:"label,omitempty"`
// The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Org *Organization `json:"organization,omitempty"`
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Org *Organization `json:"organization,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// MemberEvent is triggered when a user is added as a collaborator to a repository.
@@ -235,8 +246,9 @@ type MemberEvent struct {
Member *User `json:"member,omitempty"`
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// MembershipEvent is triggered when a user is added or removed from a team.
@@ -255,8 +267,9 @@ type MembershipEvent struct {
Team *Team `json:"team,omitempty"`
// The following fields are only populated by Webhook events.
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Org *Organization `json:"organization,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
@@ -270,10 +283,33 @@ type MilestoneEvent struct {
Milestone *Milestone `json:"milestone,omitempty"`
// The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
- Org *Organization `json:"organization,omitempty"`
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Org *Organization `json:"organization,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
+}
+
+// OrganizationEvent is triggered when a user is added, removed, or invited to an organization.
+// Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
+// Webhook event name is "organization".
+//
+// Github docs: https://developer.github.com/v3/activity/events/types/#organizationevent
+type OrganizationEvent struct {
+ // Action is the action that was performed.
+ // Can be one of "member_added", "member_removed", or "member_invited".
+ Action *string `json:"action,omitempty"`
+
+ // Invitaion is the invitation for the user or email if the action is "member_invited".
+ Invitation *Invitation `json:"invitation,omitempty"`
+
+ // Membership is the membership between the user and the organization.
+ // Not present when the action is "member_invited".
+ Membership *Membership `json:"membership,omitempty"`
+
+ Organization *Organization `json:"organization,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// PageBuildEvent represents an attempted build of a GitHub Pages site, whether
@@ -290,9 +326,10 @@ type PageBuildEvent struct {
Build *PagesBuild `json:"build,omitempty"`
// The following fields are only populated by Webhook events.
- ID *int `json:"id,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ ID *int `json:"id,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// PingEvent is triggered when a Webhook is added to GitHub.
@@ -304,7 +341,8 @@ type PingEvent struct {
// The ID of the webhook that triggered the ping.
HookID *int `json:"hook_id,omitempty"`
// The webhook configuration.
- Hook *Hook `json:"hook,omitempty"`
+ Hook *Hook `json:"hook,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// PublicEvent is triggered when a private repository is open sourced.
@@ -314,8 +352,9 @@ type PingEvent struct {
// GitHub docs: https://developer.github.com/v3/activity/events/types/#publicevent
type PublicEvent struct {
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// PullRequestEvent is triggered when a pull request is assigned, unassigned,
@@ -334,9 +373,10 @@ type PullRequestEvent struct {
PullRequest *PullRequest `json:"pull_request,omitempty"`
// The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// PullRequestReviewEvent is triggered when a review is submitted on a pull
@@ -351,8 +391,9 @@ type PullRequestReviewEvent struct {
PullRequest *PullRequest `json:"pull_request,omitempty"`
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
@@ -372,34 +413,36 @@ type PullRequestReviewCommentEvent struct {
Comment *PullRequestComment `json:"comment,omitempty"`
// The following fields are only populated by Webhook events.
- Changes *EditChange `json:"changes,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// PushEvent represents a git push to a GitHub repository.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/types/#pushevent
type PushEvent struct {
- PushID *int `json:"push_id,omitempty"`
- Head *string `json:"head,omitempty"`
- Ref *string `json:"ref,omitempty"`
- Size *int `json:"size,omitempty"`
- Commits []PushEventCommit `json:"commits,omitempty"`
- Repo *PushEventRepository `json:"repository,omitempty"`
- Before *string `json:"before,omitempty"`
- DistinctSize *int `json:"distinct_size,omitempty"`
+ PushID *int `json:"push_id,omitempty"`
+ Head *string `json:"head,omitempty"`
+ Ref *string `json:"ref,omitempty"`
+ Size *int `json:"size,omitempty"`
+ Commits []PushEventCommit `json:"commits,omitempty"`
+ Before *string `json:"before,omitempty"`
+ DistinctSize *int `json:"distinct_size,omitempty"`
// The following fields are only populated by Webhook events.
- After *string `json:"after,omitempty"`
- Created *bool `json:"created,omitempty"`
- Deleted *bool `json:"deleted,omitempty"`
- Forced *bool `json:"forced,omitempty"`
- BaseRef *string `json:"base_ref,omitempty"`
- Compare *string `json:"compare,omitempty"`
- HeadCommit *PushEventCommit `json:"head_commit,omitempty"`
- Pusher *User `json:"pusher,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ After *string `json:"after,omitempty"`
+ Created *bool `json:"created,omitempty"`
+ Deleted *bool `json:"deleted,omitempty"`
+ Forced *bool `json:"forced,omitempty"`
+ BaseRef *string `json:"base_ref,omitempty"`
+ Compare *string `json:"compare,omitempty"`
+ Repo *PushEventRepository `json:"repository,omitempty"`
+ HeadCommit *PushEventCommit `json:"head_commit,omitempty"`
+ Pusher *User `json:"pusher,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
func (p PushEvent) String() string {
@@ -430,7 +473,7 @@ func (p PushEventCommit) String() string {
return Stringify(p)
}
-// PushEventRepository represents the repo object in a PushEvent payload
+// PushEventRepository represents the repo object in a PushEvent payload.
type PushEventRepository struct {
ID *int `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
@@ -456,13 +499,16 @@ type PushEventRepository struct {
DefaultBranch *string `json:"default_branch,omitempty"`
MasterBranch *string `json:"master_branch,omitempty"`
Organization *string `json:"organization,omitempty"`
-
- // The following fields are only populated by Webhook events.
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
+ URL *string `json:"url,omitempty"`
+ HTMLURL *string `json:"html_url,omitempty"`
+ StatusesURL *string `json:"statuses_url,omitempty"`
+ GitURL *string `json:"git_url,omitempty"`
+ SSHURL *string `json:"ssh_url,omitempty"`
+ CloneURL *string `json:"clone_url,omitempty"`
+ SVNURL *string `json:"svn_url,omitempty"`
}
-// PushEventRepoOwner is a basic reporesntation of user/org in a PushEvent payload
+// PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
type PushEventRepoOwner struct {
Name *string `json:"name,omitempty"`
Email *string `json:"email,omitempty"`
@@ -478,8 +524,9 @@ type ReleaseEvent struct {
Release *RepositoryRelease `json:"release,omitempty"`
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// RepositoryEvent is triggered when a repository is created.
@@ -496,8 +543,9 @@ type RepositoryEvent struct {
Repo *Repository `json:"repository,omitempty"`
// The following fields are only populated by Webhook events.
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Org *Organization `json:"organization,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// StatusEvent is triggered when the status of a Git commit changes.
@@ -516,14 +564,15 @@ type StatusEvent struct {
Branches []*Branch `json:"branches,omitempty"`
// The following fields are only populated by Webhook events.
- ID *int `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Context *string `json:"context,omitempty"`
- Commit *RepositoryCommit `json:"commit,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ ID *int `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Context *string `json:"context,omitempty"`
+ Commit *RepositoryCommit `json:"commit,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// TeamAddEvent is triggered when a repository is added to a team.
@@ -538,8 +587,9 @@ type TeamAddEvent struct {
Repo *Repository `json:"repository,omitempty"`
// The following fields are only populated by Webhook events.
- Org *Organization `json:"organization,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Org *Organization `json:"organization,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
// WatchEvent is related to starring a repository, not watching. See this API
@@ -554,6 +604,7 @@ type WatchEvent struct {
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Installation *Installation `json:"installation,omitempty"`
}
diff --git a/vendor/github.com/google/go-github/github/gists.go b/vendor/github.com/google/go-github/github/gists.go
index a3327f8..81f55b1 100644
--- a/vendor/github.com/google/go-github/github/gists.go
+++ b/vendor/github.com/google/go-github/github/gists.go
@@ -42,6 +42,7 @@ type GistFilename string
type GistFile struct {
Size *int `json:"size,omitempty"`
Filename *string `json:"filename,omitempty"`
+ Language *string `json:"language,omitempty"`
Type *string `json:"type,omitempty"`
RawURL *string `json:"raw_url,omitempty"`
Content *string `json:"content,omitempty"`
@@ -109,13 +110,13 @@ func (s *GistsService) List(user string, opt *GistListOptions) ([]*Gist, *Respon
return nil, nil, err
}
- gists := new([]*Gist)
- resp, err := s.client.Do(req, gists)
+ var gists []*Gist
+ resp, err := s.client.Do(req, &gists)
if err != nil {
return nil, resp, err
}
- return *gists, resp, err
+ return gists, resp, nil
}
// ListAll lists all public gists.
@@ -132,13 +133,13 @@ func (s *GistsService) ListAll(opt *GistListOptions) ([]*Gist, *Response, error)
return nil, nil, err
}
- gists := new([]*Gist)
- resp, err := s.client.Do(req, gists)
+ var gists []*Gist
+ resp, err := s.client.Do(req, &gists)
if err != nil {
return nil, resp, err
}
- return *gists, resp, err
+ return gists, resp, nil
}
// ListStarred lists starred gists of authenticated user.
@@ -155,13 +156,13 @@ func (s *GistsService) ListStarred(opt *GistListOptions) ([]*Gist, *Response, er
return nil, nil, err
}
- gists := new([]*Gist)
- resp, err := s.client.Do(req, gists)
+ var gists []*Gist
+ resp, err := s.client.Do(req, &gists)
if err != nil {
return nil, resp, err
}
- return *gists, resp, err
+ return gists, resp, nil
}
// Get a single gist.
@@ -246,13 +247,13 @@ func (s *GistsService) ListCommits(id string) ([]*GistCommit, *Response, error)
return nil, nil, err
}
- gistCommits := new([]*GistCommit)
- resp, err := s.client.Do(req, gistCommits)
+ var gistCommits []*GistCommit
+ resp, err := s.client.Do(req, &gistCommits)
if err != nil {
return nil, resp, err
}
- return *gistCommits, resp, err
+ return gistCommits, resp, nil
}
// Delete a gist.
@@ -334,11 +335,11 @@ func (s *GistsService) ListForks(id string) ([]*GistFork, *Response, error) {
return nil, nil, err
}
- gistForks := new([]*GistFork)
- resp, err := s.client.Do(req, gistForks)
+ var gistForks []*GistFork
+ resp, err := s.client.Do(req, &gistForks)
if err != nil {
return nil, resp, err
}
- return *gistForks, resp, err
+ return gistForks, resp, nil
}
diff --git a/vendor/github.com/google/go-github/github/gists_comments.go b/vendor/github.com/google/go-github/github/gists_comments.go
index 95a7fc7..71c1c01 100644
--- a/vendor/github.com/google/go-github/github/gists_comments.go
+++ b/vendor/github.com/google/go-github/github/gists_comments.go
@@ -38,13 +38,13 @@ func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]*GistCom
return nil, nil, err
}
- comments := new([]*GistComment)
- resp, err := s.client.Do(req, comments)
+ var comments []*GistComment
+ resp, err := s.client.Do(req, &comments)
if err != nil {
return nil, resp, err
}
- return *comments, resp, err
+ return comments, resp, nil
}
// GetComment retrieves a single comment from a gist.
diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go
index 3d7421f..a58dbfb 100644
--- a/vendor/github.com/google/go-github/github/github.go
+++ b/vendor/github.com/google/go-github/github/github.go
@@ -85,14 +85,20 @@ const (
// https://developer.github.com/changes/2016-07-06-github-pages-preiew-api/
mediaTypePagesPreview = "application/vnd.github.mister-fantastic-preview+json"
- // https://developer.github.com/v3/repos/traffic/
- mediaTypeTrafficPreview = "application/vnd.github.spiderman-preview+json"
-
// https://developer.github.com/changes/2016-09-14-projects-api/
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
// https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/
mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"
+
+ // https://developer.github.com/changes/2016-11-28-preview-org-membership/
+ mediaTypeOrgMembershipPreview = "application/vnd.github.korra-preview+json"
+
+ // https://developer.github.com/changes/2017-01-05-commit-search-api/
+ mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
+
+ // https://developer.github.com/changes/2016-12-14-reviews-api/
+ mediaTypePullRequestReviewsPreview = "application/vnd.github.black-cat-preview+json"
)
// A Client manages communication with the GitHub API.
@@ -406,6 +412,12 @@ func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) {
resp, err := c.client.Do(req)
if err != nil {
+ if e, ok := err.(*url.Error); ok {
+ if url, err := url.Parse(e.URL); err == nil {
+ e.URL = sanitizeURL(url).String()
+ return nil, e
+ }
+ }
return nil, err
}
@@ -550,7 +562,7 @@ func (r *AbuseRateLimitError) Error() string {
}
// sanitizeURL redacts the client_secret parameter from the URL which may be
-// exposed to the user, specifically in the ErrorResponse error message.
+// exposed to the user.
func sanitizeURL(uri *url.URL) *url.URL {
if uri == nil {
return nil
diff --git a/vendor/github.com/google/go-github/github/gitignore.go b/vendor/github.com/google/go-github/github/gitignore.go
index faaceb5..3f1f565 100644
--- a/vendor/github.com/google/go-github/github/gitignore.go
+++ b/vendor/github.com/google/go-github/github/gitignore.go
@@ -32,13 +32,13 @@ func (s GitignoresService) List() ([]string, *Response, error) {
return nil, nil, err
}
- availableTemplates := new([]string)
- resp, err := s.client.Do(req, availableTemplates)
+ var availableTemplates []string
+ resp, err := s.client.Do(req, &availableTemplates)
if err != nil {
return nil, resp, err
}
- return *availableTemplates, resp, err
+ return availableTemplates, resp, nil
}
// Get a Gitignore by name.
diff --git a/vendor/github.com/google/go-github/github/integration.go b/vendor/github.com/google/go-github/github/integration.go
index b8d77ca..033ee44 100644
--- a/vendor/github.com/google/go-github/github/integration.go
+++ b/vendor/github.com/google/go-github/github/integration.go
@@ -28,11 +28,11 @@ func (s *IntegrationsService) ListInstallations(opt *ListOptions) ([]*Installati
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeIntegrationPreview)
- i := new([]*Installation)
+ var i []*Installation
resp, err := s.client.Do(req, &i)
if err != nil {
return nil, resp, err
}
- return *i, resp, err
+ return i, resp, nil
}
diff --git a/vendor/github.com/google/go-github/github/issues.go b/vendor/github.com/google/go-github/github/issues.go
index d8e7d41..b14939e 100644
--- a/vendor/github.com/google/go-github/github/issues.go
+++ b/vendor/github.com/google/go-github/github/issues.go
@@ -141,13 +141,13 @@ func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]*Issue, *
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)
- issues := new([]*Issue)
- resp, err := s.client.Do(req, issues)
+ var issues []*Issue
+ resp, err := s.client.Do(req, &issues)
if err != nil {
return nil, resp, err
}
- return *issues, resp, err
+ return issues, resp, nil
}
// IssueListByRepoOptions specifies the optional parameters to the
@@ -208,13 +208,13 @@ func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRe
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)
- issues := new([]*Issue)
- resp, err := s.client.Do(req, issues)
+ var issues []*Issue
+ resp, err := s.client.Do(req, &issues)
if err != nil {
return nil, resp, err
}
- return *issues, resp, err
+ return issues, resp, nil
}
// Get a single issue.
@@ -236,7 +236,7 @@ func (s *IssuesService) Get(owner string, repo string, number int) (*Issue, *Res
return nil, resp, err
}
- return issue, resp, err
+ return issue, resp, nil
}
// Create a new issue on the specified repository.
@@ -255,7 +255,7 @@ func (s *IssuesService) Create(owner string, repo string, issue *IssueRequest) (
return nil, resp, err
}
- return i, resp, err
+ return i, resp, nil
}
// Edit an issue.
@@ -274,7 +274,7 @@ func (s *IssuesService) Edit(owner string, repo string, number int, issue *Issue
return nil, resp, err
}
- return i, resp, err
+ return i, resp, nil
}
// Lock an issue's conversation.
diff --git a/vendor/github.com/google/go-github/github/issues_assignees.go b/vendor/github.com/google/go-github/github/issues_assignees.go
index 2503be1..1f06102 100644
--- a/vendor/github.com/google/go-github/github/issues_assignees.go
+++ b/vendor/github.com/google/go-github/github/issues_assignees.go
@@ -22,13 +22,13 @@ func (s *IssuesService) ListAssignees(owner, repo string, opt *ListOptions) ([]*
if err != nil {
return nil, nil, err
}
- assignees := new([]*User)
- resp, err := s.client.Do(req, assignees)
+ var assignees []*User
+ resp, err := s.client.Do(req, &assignees)
if err != nil {
return nil, resp, err
}
- return *assignees, resp, err
+ return assignees, resp, nil
}
// IsAssignee checks if a user is an assignee for the specified repository.
diff --git a/vendor/github.com/google/go-github/github/issues_comments.go b/vendor/github.com/google/go-github/github/issues_comments.go
index b24c5ae..7d46913 100644
--- a/vendor/github.com/google/go-github/github/issues_comments.go
+++ b/vendor/github.com/google/go-github/github/issues_comments.go
@@ -66,13 +66,13 @@ func (s *IssuesService) ListComments(owner string, repo string, number int, opt
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)
- comments := new([]*IssueComment)
- resp, err := s.client.Do(req, comments)
+ var comments []*IssueComment
+ resp, err := s.client.Do(req, &comments)
if err != nil {
return nil, resp, err
}
- return *comments, resp, err
+ return comments, resp, nil
}
// GetComment fetches the specified issue comment.
@@ -95,7 +95,7 @@ func (s *IssuesService) GetComment(owner string, repo string, id int) (*IssueCom
return nil, resp, err
}
- return comment, resp, err
+ return comment, resp, nil
}
// CreateComment creates a new comment on the specified issue.
@@ -113,7 +113,7 @@ func (s *IssuesService) CreateComment(owner string, repo string, number int, com
return nil, resp, err
}
- return c, resp, err
+ return c, resp, nil
}
// EditComment updates an issue comment.
@@ -131,7 +131,7 @@ func (s *IssuesService) EditComment(owner string, repo string, id int, comment *
return nil, resp, err
}
- return c, resp, err
+ return c, resp, nil
}
// DeleteComment deletes an issue comment.
diff --git a/vendor/github.com/google/go-github/github/issues_labels.go b/vendor/github.com/google/go-github/github/issues_labels.go
index c654547..46b2d6e 100644
--- a/vendor/github.com/google/go-github/github/issues_labels.go
+++ b/vendor/github.com/google/go-github/github/issues_labels.go
@@ -33,13 +33,13 @@ func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions)
return nil, nil, err
}
- labels := new([]*Label)
- resp, err := s.client.Do(req, labels)
+ var labels []*Label
+ resp, err := s.client.Do(req, &labels)
if err != nil {
return nil, resp, err
}
- return *labels, resp, err
+ return labels, resp, nil
}
// GetLabel gets a single label.
@@ -58,7 +58,7 @@ func (s *IssuesService) GetLabel(owner string, repo string, name string) (*Label
return nil, resp, err
}
- return label, resp, err
+ return label, resp, nil
}
// CreateLabel creates a new label on the specified repository.
@@ -77,7 +77,7 @@ func (s *IssuesService) CreateLabel(owner string, repo string, label *Label) (*L
return nil, resp, err
}
- return l, resp, err
+ return l, resp, nil
}
// EditLabel edits a label.
@@ -96,7 +96,7 @@ func (s *IssuesService) EditLabel(owner string, repo string, name string, label
return nil, resp, err
}
- return l, resp, err
+ return l, resp, nil
}
// DeleteLabel deletes a label.
@@ -113,7 +113,7 @@ func (s *IssuesService) DeleteLabel(owner string, repo string, name string) (*Re
// ListLabelsByIssue lists all labels for an issue.
//
-// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
+// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue
func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
u, err := addOptions(u, opt)
@@ -126,18 +126,18 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int,
return nil, nil, err
}
- labels := new([]*Label)
- resp, err := s.client.Do(req, labels)
+ var labels []*Label
+ resp, err := s.client.Do(req, &labels)
if err != nil {
return nil, resp, err
}
- return *labels, resp, err
+ return labels, resp, nil
}
// AddLabelsToIssue adds labels to an issue.
//
-// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
+// GitHub API docs: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
req, err := s.client.NewRequest("POST", u, labels)
@@ -145,13 +145,13 @@ func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int,
return nil, nil, err
}
- l := new([]*Label)
- resp, err := s.client.Do(req, l)
+ var l []*Label
+ resp, err := s.client.Do(req, &l)
if err != nil {
return nil, resp, err
}
- return *l, resp, err
+ return l, resp, nil
}
// RemoveLabelForIssue removes a label for an issue.
@@ -176,13 +176,13 @@ func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number
return nil, nil, err
}
- l := new([]*Label)
- resp, err := s.client.Do(req, l)
+ var l []*Label
+ resp, err := s.client.Do(req, &l)
if err != nil {
return nil, resp, err
}
- return *l, resp, err
+ return l, resp, nil
}
// RemoveLabelsForIssue removes all labels for an issue.
@@ -212,11 +212,11 @@ func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number
return nil, nil, err
}
- labels := new([]*Label)
- resp, err := s.client.Do(req, labels)
+ var labels []*Label
+ resp, err := s.client.Do(req, &labels)
if err != nil {
return nil, resp, err
}
- return *labels, resp, err
+ return labels, resp, nil
}
diff --git a/vendor/github.com/google/go-github/github/issues_milestones.go b/vendor/github.com/google/go-github/github/issues_milestones.go
index b7621ac..0cc2d58 100644
--- a/vendor/github.com/google/go-github/github/issues_milestones.go
+++ b/vendor/github.com/google/go-github/github/issues_milestones.go
@@ -66,13 +66,13 @@ func (s *IssuesService) ListMilestones(owner string, repo string, opt *Milestone
return nil, nil, err
}
- milestones := new([]*Milestone)
- resp, err := s.client.Do(req, milestones)
+ var milestones []*Milestone
+ resp, err := s.client.Do(req, &milestones)
if err != nil {
return nil, resp, err
}
- return *milestones, resp, err
+ return milestones, resp, nil
}
// GetMilestone gets a single milestone.
@@ -91,7 +91,7 @@ func (s *IssuesService) GetMilestone(owner string, repo string, number int) (*Mi
return nil, resp, err
}
- return milestone, resp, err
+ return milestone, resp, nil
}
// CreateMilestone creates a new milestone on the specified repository.
@@ -110,7 +110,7 @@ func (s *IssuesService) CreateMilestone(owner string, repo string, milestone *Mi
return nil, resp, err
}
- return m, resp, err
+ return m, resp, nil
}
// EditMilestone edits a milestone.
@@ -129,7 +129,7 @@ func (s *IssuesService) EditMilestone(owner string, repo string, number int, mil
return nil, resp, err
}
- return m, resp, err
+ return m, resp, nil
}
// DeleteMilestone deletes a milestone.
diff --git a/vendor/github.com/google/go-github/github/licenses.go b/vendor/github.com/google/go-github/github/licenses.go
index 0b5e8b3..a1fec94 100644
--- a/vendor/github.com/google/go-github/github/licenses.go
+++ b/vendor/github.com/google/go-github/github/licenses.go
@@ -67,13 +67,13 @@ func (s *LicensesService) List() ([]*License, *Response, error) {
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeLicensesPreview)
- licenses := new([]*License)
- resp, err := s.client.Do(req, licenses)
+ var licenses []*License
+ resp, err := s.client.Do(req, &licenses)
if err != nil {
return nil, resp, err
}
- return *licenses, resp, err
+ return licenses, resp, nil
}
// Get extended metadata for one license.
diff --git a/vendor/github.com/google/go-github/github/messages.go b/vendor/github.com/google/go-github/github/messages.go
index 5e167ee..5f67ba5 100644
--- a/vendor/github.com/google/go-github/github/messages.go
+++ b/vendor/github.com/google/go-github/github/messages.go
@@ -53,6 +53,7 @@ var (
"member": "MemberEvent",
"membership": "MembershipEvent",
"milestone": "MilestoneEvent",
+ "organization": "OrganizationEvent",
"page_build": "PageBuildEvent",
"ping": "PingEvent",
"public": "PublicEvent",
diff --git a/vendor/github.com/google/go-github/github/migrations_source_import.go b/vendor/github.com/google/go-github/github/migrations_source_import.go
index 44505fa..451b13e 100644
--- a/vendor/github.com/google/go-github/github/migrations_source_import.go
+++ b/vendor/github.com/google/go-github/github/migrations_source_import.go
@@ -230,13 +230,13 @@ func (s *MigrationService) CommitAuthors(owner, repo string) ([]*SourceImportAut
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeImportPreview)
- authors := new([]*SourceImportAuthor)
- resp, err := s.client.Do(req, authors)
+ var authors []*SourceImportAuthor
+ resp, err := s.client.Do(req, &authors)
if err != nil {
return nil, resp, err
}
- return *authors, resp, err
+ return authors, resp, nil
}
// MapCommitAuthor updates an author's identity for the import. Your
@@ -300,13 +300,13 @@ func (s *MigrationService) LargeFiles(owner, repo string) ([]*LargeFile, *Respon
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeImportPreview)
- files := new([]*LargeFile)
- resp, err := s.client.Do(req, files)
+ var files []*LargeFile
+ resp, err := s.client.Do(req, &files)
if err != nil {
return nil, resp, err
}
- return *files, resp, err
+ return files, resp, nil
}
// CancelImport stops an import for a repository.
diff --git a/vendor/github.com/google/go-github/github/misc.go b/vendor/github.com/google/go-github/github/misc.go
index 8576a4c..89e1501 100644
--- a/vendor/github.com/google/go-github/github/misc.go
+++ b/vendor/github.com/google/go-github/github/misc.go
@@ -187,11 +187,11 @@ func (c *Client) ListServiceHooks() ([]*ServiceHook, *Response, error) {
return nil, nil, err
}
- hooks := new([]*ServiceHook)
- resp, err := c.Do(req, hooks)
+ var hooks []*ServiceHook
+ resp, err := c.Do(req, &hooks)
if err != nil {
return nil, resp, err
}
- return *hooks, resp, err
+ return hooks, resp, nil
}
diff --git a/vendor/github.com/google/go-github/github/orgs.go b/vendor/github.com/google/go-github/github/orgs.go
index d137e3e..696c2b7 100644
--- a/vendor/github.com/google/go-github/github/orgs.go
+++ b/vendor/github.com/google/go-github/github/orgs.go
@@ -125,13 +125,13 @@ func (s *OrganizationsService) List(user string, opt *ListOptions) ([]*Organizat
return nil, nil, err
}
- orgs := new([]*Organization)
- resp, err := s.client.Do(req, orgs)
+ var orgs []*Organization
+ resp, err := s.client.Do(req, &orgs)
if err != nil {
return nil, resp, err
}
- return *orgs, resp, err
+ return orgs, resp, nil
}
// Get fetches an organization by name.
diff --git a/vendor/github.com/google/go-github/github/orgs_hooks.go b/vendor/github.com/google/go-github/github/orgs_hooks.go
index 95b8322..4926311 100644
--- a/vendor/github.com/google/go-github/github/orgs_hooks.go
+++ b/vendor/github.com/google/go-github/github/orgs_hooks.go
@@ -22,13 +22,13 @@ func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]*Hook,
return nil, nil, err
}
- hooks := new([]*Hook)
- resp, err := s.client.Do(req, hooks)
+ var hooks []*Hook
+ resp, err := s.client.Do(req, &hooks)
if err != nil {
return nil, resp, err
}
- return *hooks, resp, err
+ return hooks, resp, nil
}
// GetHook returns a single specified Hook.
diff --git a/vendor/github.com/google/go-github/github/orgs_members.go b/vendor/github.com/google/go-github/github/orgs_members.go
index 80454ad..ea8a358 100644
--- a/vendor/github.com/google/go-github/github/orgs_members.go
+++ b/vendor/github.com/google/go-github/github/orgs_members.go
@@ -86,13 +86,13 @@ func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions)
return nil, nil, err
}
- members := new([]*User)
- resp, err := s.client.Do(req, members)
+ var members []*User
+ resp, err := s.client.Do(req, &members)
if err != nil {
return nil, resp, err
}
- return *members, resp, err
+ return members, resp, nil
}
// IsMember checks if a user is a member of an organization.
@@ -270,3 +270,29 @@ func (s *OrganizationsService) RemoveOrgMembership(user, org string) (*Response,
return s.client.Do(req, nil)
}
+
+// ListPendingOrgInvitations returns a list of pending invitations.
+//
+// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations
+func (s *OrganizationsService) ListPendingOrgInvitations(org int, opt *ListOptions) ([]*Invitation, *Response, error) {
+ u := fmt.Sprintf("orgs/%v/invitations", org)
+ u, err := addOptions(u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeOrgMembershipPreview)
+
+ var pendingInvitations []*Invitation
+ resp, err := s.client.Do(req, &pendingInvitations)
+ if err != nil {
+ return nil, resp, err
+ }
+ return pendingInvitations, resp, nil
+}
diff --git a/vendor/github.com/google/go-github/github/orgs_teams.go b/vendor/github.com/google/go-github/github/orgs_teams.go
index 8e8550c..ce8cbec 100644
--- a/vendor/github.com/google/go-github/github/orgs_teams.go
+++ b/vendor/github.com/google/go-github/github/orgs_teams.go
@@ -5,7 +5,10 @@
package github
-import "fmt"
+import (
+ "fmt"
+ "time"
+)
// Team represents a team within a GitHub organization. Teams are used to
// manage access to an organization's repositories.
@@ -41,6 +44,21 @@ func (t Team) String() string {
return Stringify(t)
}
+// Invitation represents a team member's invitation status.
+type Invitation struct {
+ ID *int `json:"id,omitempty"`
+ Login *string `json:"login,omitempty"`
+ Email *string `json:"email,omitempty"`
+ // Role can be one of the values - 'direct_member', 'admin', 'billing_manager', 'hiring_manager', or 'reinstate'.
+ Role *string `json:"role,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ Inviter *User `json:"inviter,omitempty"`
+}
+
+func (i Invitation) String() string {
+ return Stringify(i)
+}
+
// ListTeams lists all of the teams for an organization.
//
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-teams
@@ -56,13 +74,13 @@ func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]*Team,
return nil, nil, err
}
- teams := new([]*Team)
- resp, err := s.client.Do(req, teams)
+ var teams []*Team
+ resp, err := s.client.Do(req, &teams)
if err != nil {
return nil, resp, err
}
- return *teams, resp, err
+ return teams, resp, nil
}
// GetTeam fetches a team by ID.
@@ -161,13 +179,13 @@ func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTe
return nil, nil, err
}
- members := new([]*User)
- resp, err := s.client.Do(req, members)
+ var members []*User
+ resp, err := s.client.Do(req, &members)
if err != nil {
return nil, resp, err
}
- return *members, resp, err
+ return members, resp, nil
}
// IsTeamMember checks if a user is a member of the specified team.
@@ -200,13 +218,13 @@ func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]*Rep
return nil, nil, err
}
- repos := new([]*Repository)
- resp, err := s.client.Do(req, repos)
+ var repos []*Repository
+ resp, err := s.client.Do(req, &repos)
if err != nil {
return nil, resp, err
}
- return *repos, resp, err
+ return repos, resp, nil
}
// IsTeamRepo checks if a team manages the specified repository. If the
@@ -289,13 +307,13 @@ func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]*Team, *Respon
return nil, nil, err
}
- teams := new([]*Team)
- resp, err := s.client.Do(req, teams)
+ var teams []*Team
+ resp, err := s.client.Do(req, &teams)
if err != nil {
return nil, resp, err
}
- return *teams, resp, err
+ return teams, resp, nil
}
// GetTeamMembership returns the membership status for a user in a team.
@@ -377,3 +395,32 @@ func (s *OrganizationsService) RemoveTeamMembership(team int, user string) (*Res
return s.client.Do(req, nil)
}
+
+// ListPendingTeamInvitations get pending invitaion list in team.
+// Warning: The API may change without advance notice during the preview period.
+// Preview features are not supported for production use.
+//
+// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-pending-team-invitations
+func (s *OrganizationsService) ListPendingTeamInvitations(team int, opt *ListOptions) ([]*Invitation, *Response, error) {
+ u := fmt.Sprintf("teams/%v/invitations", team)
+ u, err := addOptions(u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeOrgMembershipPreview)
+
+ var pendingInvitations []*Invitation
+ resp, err := s.client.Do(req, &pendingInvitations)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return pendingInvitations, resp, nil
+}
diff --git a/vendor/github.com/google/go-github/github/pulls.go b/vendor/github.com/google/go-github/github/pulls.go
index 51c6ccb..d3a9ae8 100644
--- a/vendor/github.com/google/go-github/github/pulls.go
+++ b/vendor/github.com/google/go-github/github/pulls.go
@@ -107,13 +107,13 @@ func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestLi
return nil, nil, err
}
- pulls := new([]*PullRequest)
- resp, err := s.client.Do(req, pulls)
+ var pulls []*PullRequest
+ resp, err := s.client.Do(req, &pulls)
if err != nil {
return nil, resp, err
}
- return *pulls, resp, err
+ return pulls, resp, nil
}
// Get a single pull request.
@@ -132,7 +132,7 @@ func (s *PullRequestsService) Get(owner string, repo string, number int) (*PullR
return nil, resp, err
}
- return pull, resp, err
+ return pull, resp, nil
}
// GetRaw gets raw (diff or patch) format of a pull request.
@@ -158,7 +158,7 @@ func (s *PullRequestsService) GetRaw(owner string, repo string, number int, opt
return "", resp, err
}
- return ret.String(), resp, err
+ return ret.String(), resp, nil
}
// NewPullRequest represents a new pull request to be created.
@@ -186,15 +186,36 @@ func (s *PullRequestsService) Create(owner string, repo string, pull *NewPullReq
return nil, resp, err
}
- return p, resp, err
+ return p, resp, nil
+}
+
+type pullRequestUpdate struct {
+ Title *string `json:"title,omitempty"`
+ Body *string `json:"body,omitempty"`
+ State *string `json:"state,omitempty"`
+ Base *string `json:"base,omitempty"`
}
// Edit a pull request.
//
+// The following fields are editable: Title, Body, State, and Base.Ref.
+// Base.Ref updates the base branch of the pull request.
+//
// GitHub API docs: https://developer.github.com/v3/pulls/#update-a-pull-request
func (s *PullRequestsService) Edit(owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
- req, err := s.client.NewRequest("PATCH", u, pull)
+
+ update := new(pullRequestUpdate)
+ if pull != nil {
+ update.Title = pull.Title
+ update.Body = pull.Body
+ update.State = pull.State
+ if pull.Base != nil {
+ update.Base = pull.Base.Ref
+ }
+ }
+
+ req, err := s.client.NewRequest("PATCH", u, update)
if err != nil {
return nil, nil, err
}
@@ -205,7 +226,7 @@ func (s *PullRequestsService) Edit(owner string, repo string, number int, pull *
return nil, resp, err
}
- return p, resp, err
+ return p, resp, nil
}
// ListCommits lists the commits in a pull request.
@@ -223,13 +244,13 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int,
return nil, nil, err
}
- commits := new([]*RepositoryCommit)
- resp, err := s.client.Do(req, commits)
+ var commits []*RepositoryCommit
+ resp, err := s.client.Do(req, &commits)
if err != nil {
return nil, resp, err
}
- return *commits, resp, err
+ return commits, resp, nil
}
// ListFiles lists the files in a pull request.
@@ -247,13 +268,13 @@ func (s *PullRequestsService) ListFiles(owner string, repo string, number int, o
return nil, nil, err
}
- commitFiles := new([]*CommitFile)
- resp, err := s.client.Do(req, commitFiles)
+ var commitFiles []*CommitFile
+ resp, err := s.client.Do(req, &commitFiles)
if err != nil {
return nil, resp, err
}
- return *commitFiles, resp, err
+ return commitFiles, resp, nil
}
// IsMerged checks if a pull request has been merged.
@@ -321,5 +342,5 @@ func (s *PullRequestsService) Merge(owner string, repo string, number int, commi
return nil, resp, err
}
- return mergeResult, resp, err
+ return mergeResult, resp, nil
}
diff --git a/vendor/github.com/google/go-github/github/pulls_comments.go b/vendor/github.com/google/go-github/github/pulls_comments.go
index c7af85a..51518f0 100644
--- a/vendor/github.com/google/go-github/github/pulls_comments.go
+++ b/vendor/github.com/google/go-github/github/pulls_comments.go
@@ -74,13 +74,13 @@ func (s *PullRequestsService) ListComments(owner string, repo string, number int
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)
- comments := new([]*PullRequestComment)
- resp, err := s.client.Do(req, comments)
+ var comments []*PullRequestComment
+ resp, err := s.client.Do(req, &comments)
if err != nil {
return nil, resp, err
}
- return *comments, resp, err
+ return comments, resp, nil
}
// GetComment fetches the specified pull request comment.
@@ -102,7 +102,7 @@ func (s *PullRequestsService) GetComment(owner string, repo string, number int)
return nil, resp, err
}
- return comment, resp, err
+ return comment, resp, nil
}
// CreateComment creates a new comment on the specified pull request.
@@ -121,7 +121,7 @@ func (s *PullRequestsService) CreateComment(owner string, repo string, number in
return nil, resp, err
}
- return c, resp, err
+ return c, resp, nil
}
// EditComment updates a pull request comment.
@@ -140,7 +140,7 @@ func (s *PullRequestsService) EditComment(owner string, repo string, number int,
return nil, resp, err
}
- return c, resp, err
+ return c, resp, nil
}
// DeleteComment deletes a pull request comment.
diff --git a/vendor/github.com/google/go-github/github/pulls_reviews.go b/vendor/github.com/google/go-github/github/pulls_reviews.go
index ae3cdd4..be57af8 100644
--- a/vendor/github.com/google/go-github/github/pulls_reviews.go
+++ b/vendor/github.com/google/go-github/github/pulls_reviews.go
@@ -5,15 +5,243 @@
package github
-import "time"
+import (
+ "fmt"
+ "time"
+)
// PullRequestReview represents a review of a pull request.
type PullRequestReview struct {
- ID *int `json:"id,omitempty"`
- User *User `json:"user,omitempty"`
- Body *string `json:"body,omitempty"`
- SubmittedAt *time.Time `json:"submitted_at,omitempty"`
+ ID *int `json:"id,omitempty"`
+ User *User `json:"user,omitempty"`
+ Body *string `json:"body,omitempty"`
+ SubmittedAt *time.Time `json:"submitted_at,omitempty"`
+ CommitID *string `json:"commit_id,omitempty"`
+ HTMLURL *string `json:"html_url,omitempty"`
+ PullRequestURL *string `json:"pull_request_url,omitempty"`
+ State *string `json:"state,omitempty"`
+}
+
+func (p PullRequestReview) String() string {
+ return Stringify(p)
+}
+
+// DraftReviewComment represents a comment part of the review.
+type DraftReviewComment struct {
+ Path *string `json:"path,omitempty"`
+ Position *int `json:"position,omitempty"`
+ Body *string `json:"body,omitempty"`
+}
+
+func (c DraftReviewComment) String() string {
+ return Stringify(c)
+}
+
+// PullRequestReviewRequest represents a request to create a review.
+type PullRequestReviewRequest struct {
+ Body *string `json:"body,omitempty"`
+ Event *string `json:"event,omitempty"`
+ Comments []*DraftReviewComment `json:"comments,omitempty"`
+}
+
+func (r PullRequestReviewRequest) String() string {
+ return Stringify(r)
+}
+
+// PullRequestReviewDismissalRequest represents a request to dismiss a review.
+type PullRequestReviewDismissalRequest struct {
+ Message *string `json:"message,omitempty"`
+}
+
+func (r PullRequestReviewDismissalRequest) String() string {
+ return Stringify(r)
+}
+
+// ListReviews lists all reviews on the specified pull request.
+//
+// TODO: Follow up with GitHub support about an issue with this method's
+// returned error format and remove this comment once it's fixed.
+// Read more about it here - https://github.com/google/go-github/issues/540
+//
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request
+func (s *PullRequestsService) ListReviews(owner, repo string, number int) ([]*PullRequestReview, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number)
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
+
+ var reviews []*PullRequestReview
+ resp, err := s.client.Do(req, &reviews)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return reviews, resp, nil
+}
+
+// GetReview fetches the specified pull request review.
+//
+// TODO: Follow up with GitHub support about an issue with this method's
+// returned error format and remove this comment once it's fixed.
+// Read more about it here - https://github.com/google/go-github/issues/540
+//
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-single-review
+func (s *PullRequestsService) GetReview(owner, repo string, number, reviewID int) (*PullRequestReview, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
+
+ review := new(PullRequestReview)
+ resp, err := s.client.Do(req, review)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return review, resp, nil
+}
+
+// DeletePendingReview deletes the specified pull request pending review.
+//
+// TODO: Follow up with GitHub support about an issue with this method's
+// returned error format and remove this comment once it's fixed.
+// Read more about it here - https://github.com/google/go-github/issues/540
+//
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review
+func (s *PullRequestsService) DeletePendingReview(owner, repo string, number, reviewID int) (*PullRequestReview, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
+
+ req, err := s.client.NewRequest("DELETE", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
+
+ review := new(PullRequestReview)
+ resp, err := s.client.Do(req, review)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return review, resp, nil
+}
+
+// ListReviewComments lists all the comments for the specified review.
+//
+// TODO: Follow up with GitHub support about an issue with this method's
+// returned error format and remove this comment once it's fixed.
+// Read more about it here - https://github.com/google/go-github/issues/540
+//
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-single-reviews-comments
+func (s *PullRequestsService) ListReviewComments(owner, repo string, number, reviewID int) ([]*PullRequestComment, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID)
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
+
+ var comments []*PullRequestComment
+ resp, err := s.client.Do(req, &comments)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return comments, resp, nil
+}
+
+// CreateReview creates a new review on the specified pull request.
+//
+// TODO: Follow up with GitHub support about an issue with this method's
+// returned error format and remove this comment once it's fixed.
+// Read more about it here - https://github.com/google/go-github/issues/540
+//
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review
+func (s *PullRequestsService) CreateReview(owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number)
+
+ req, err := s.client.NewRequest("POST", u, review)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
+
+ r := new(PullRequestReview)
+ resp, err := s.client.Do(req, r)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return r, resp, nil
+}
+
+// SubmitReview submits a specified review on the specified pull request.
+//
+// TODO: Follow up with GitHub support about an issue with this method's
+// returned error format and remove this comment once it's fixed.
+// Read more about it here - https://github.com/google/go-github/issues/540
+//
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review
+func (s *PullRequestsService) SubmitReview(owner, repo string, number, reviewID int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID)
+
+ req, err := s.client.NewRequest("POST", u, review)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
+
+ r := new(PullRequestReview)
+ resp, err := s.client.Do(req, r)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return r, resp, nil
+}
+
+// DismissReview dismisses a specified review on the specified pull request.
+//
+// TODO: Follow up with GitHub support about an issue with this method's
+// returned error format and remove this comment once it's fixed.
+// Read more about it here - https://github.com/google/go-github/issues/540
+//
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review
+func (s *PullRequestsService) DismissReview(owner, repo string, number, reviewID int, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID)
+
+ req, err := s.client.NewRequest("PUT", u, review)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
+
+ r := new(PullRequestReview)
+ resp, err := s.client.Do(req, r)
+ if err != nil {
+ return nil, resp, err
+ }
- // State can be "approved", "rejected", or "commented".
- State *string `json:"state,omitempty"`
+ return r, resp, nil
}
diff --git a/vendor/github.com/google/go-github/github/repos.go b/vendor/github.com/google/go-github/github/repos.go
index 040cd31..019a731 100644
--- a/vendor/github.com/google/go-github/github/repos.go
+++ b/vendor/github.com/google/go-github/github/repos.go
@@ -175,13 +175,13 @@ func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]*
// TODO: remove custom Accept header when license support fully launches
req.Header.Set("Accept", mediaTypeLicensesPreview)
- repos := new([]*Repository)
- resp, err := s.client.Do(req, repos)
+ var repos []*Repository
+ resp, err := s.client.Do(req, &repos)
if err != nil {
return nil, resp, err
}
- return *repos, resp, err
+ return repos, resp, nil
}
// RepositoryListByOrgOptions specifies the optional parameters to the
@@ -212,13 +212,13 @@ func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOpti
// TODO: remove custom Accept header when license support fully launches
req.Header.Set("Accept", mediaTypeLicensesPreview)
- repos := new([]*Repository)
- resp, err := s.client.Do(req, repos)
+ var repos []*Repository
+ resp, err := s.client.Do(req, &repos)
if err != nil {
return nil, resp, err
}
- return *repos, resp, err
+ return repos, resp, nil
}
// RepositoryListAllOptions specifies the optional parameters to the
@@ -244,13 +244,13 @@ func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]*Reposit
return nil, nil, err
}
- repos := new([]*Repository)
- resp, err := s.client.Do(req, repos)
+ var repos []*Repository
+ resp, err := s.client.Do(req, &repos)
if err != nil {
return nil, resp, err
}
- return *repos, resp, err
+ return repos, resp, nil
}
// Create a new repository. If an organization is specified, the new
@@ -277,7 +277,7 @@ func (s *RepositoriesService) Create(org string, repo *Repository) (*Repository,
return nil, resp, err
}
- return r, resp, err
+ return r, resp, nil
}
// Get fetches a repository.
@@ -301,7 +301,7 @@ func (s *RepositoriesService) Get(owner, repo string) (*Repository, *Response, e
return nil, resp, err
}
- return repository, resp, err
+ return repository, resp, nil
}
// GetByID fetches a repository.
@@ -324,7 +324,7 @@ func (s *RepositoriesService) GetByID(id int) (*Repository, *Response, error) {
return nil, resp, err
}
- return repository, resp, err
+ return repository, resp, nil
}
// Edit updates a repository.
@@ -346,7 +346,7 @@ func (s *RepositoriesService) Edit(owner, repo string, repository *Repository) (
return nil, resp, err
}
- return r, resp, err
+ return r, resp, nil
}
// Delete a repository.
@@ -408,13 +408,13 @@ func (s *RepositoriesService) ListContributors(owner string, repository string,
return nil, nil, err
}
- contributor := new([]*Contributor)
- resp, err := s.client.Do(req, contributor)
+ var contributor []*Contributor
+ resp, err := s.client.Do(req, &contributor)
if err != nil {
return nil, nil, err
}
- return *contributor, resp, err
+ return contributor, resp, nil
}
// ListLanguages lists languages for the specified repository. The returned map
@@ -440,7 +440,7 @@ func (s *RepositoriesService) ListLanguages(owner string, repo string) (map[stri
return nil, resp, err
}
- return languages, resp, err
+ return languages, resp, nil
}
// ListTeams lists the teams for the specified repository.
@@ -458,13 +458,13 @@ func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOpti
return nil, nil, err
}
- teams := new([]*Team)
- resp, err := s.client.Do(req, teams)
+ var teams []*Team
+ resp, err := s.client.Do(req, &teams)
if err != nil {
return nil, resp, err
}
- return *teams, resp, err
+ return teams, resp, nil
}
// RepositoryTag represents a repository tag.
@@ -490,13 +490,13 @@ func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptio
return nil, nil, err
}
- tags := new([]*RepositoryTag)
- resp, err := s.client.Do(req, tags)
+ var tags []*RepositoryTag
+ resp, err := s.client.Do(req, &tags)
if err != nil {
return nil, resp, err
}
- return *tags, resp, err
+ return tags, resp, nil
}
// Branch represents a repository branch
@@ -508,34 +508,42 @@ type Branch struct {
// Protection represents a repository branch's protection.
type Protection struct {
- RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
- Restrictions *BranchRestrictions `json:"restrictions"`
+ RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
+ RequiredPullRequestReviews *RequiredPullRequestReviews `json:"required_pull_request_reviews"`
+ Restrictions *BranchRestrictions `json:"restrictions"`
}
// ProtectionRequest represents a request to create/edit a branch's protection.
type ProtectionRequest struct {
- RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
- Restrictions *BranchRestrictionsRequest `json:"restrictions"`
+ RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
+ RequiredPullRequestReviews *RequiredPullRequestReviews `json:"required_pull_request_reviews"`
+ Restrictions *BranchRestrictionsRequest `json:"restrictions"`
}
// RequiredStatusChecks represents the protection status of a individual branch.
type RequiredStatusChecks struct {
- // Enforce required status checks for repository administrators.
- IncludeAdmins *bool `json:"include_admins,omitempty"`
- // Require branches to be up to date before merging.
- Strict *bool `json:"strict,omitempty"`
+ // Enforce required status checks for repository administrators. (Required.)
+ IncludeAdmins bool `json:"include_admins"`
+ // Require branches to be up to date before merging. (Required.)
+ Strict bool `json:"strict"`
// The list of status checks to require in order to merge into this
- // branch.
- Contexts *[]string `json:"contexts,omitempty"`
+ // branch. (Required; use []string{} instead of nil for empty list.)
+ Contexts []string `json:"contexts"`
+}
+
+// RequiredPullRequestReviews represents the protection configuration for pull requests.
+type RequiredPullRequestReviews struct {
+ // Enforce pull request reviews for repository administrators. (Required.)
+ IncludeAdmins bool `json:"include_admins"`
}
// BranchRestrictions represents the restriction that only certain users or
// teams may push to a branch.
type BranchRestrictions struct {
// The list of user logins with push access.
- Users []*User `json:"users,omitempty"`
+ Users []*User `json:"users"`
// The list of team slugs with push access.
- Teams []*Team `json:"teams,omitempty"`
+ Teams []*Team `json:"teams"`
}
// BranchRestrictionsRequest represents the request to create/edit the
@@ -543,10 +551,10 @@ type BranchRestrictions struct {
// separate from BranchRestrictions above because the request structure is
// different from the response structure.
type BranchRestrictionsRequest struct {
- // The list of user logins with push access.
- Users *[]string `json:"users,omitempty"`
- // The list of team slugs with push access.
- Teams *[]string `json:"teams,omitempty"`
+ // The list of user logins with push access. (Required; use []string{} instead of nil for empty list.)
+ Users []string `json:"users"`
+ // The list of team slugs with push access. (Required; use []string{} instead of nil for empty list.)
+ Teams []string `json:"teams"`
}
// ListBranches lists branches for the specified repository.
@@ -567,13 +575,13 @@ func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListO
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
- branches := new([]*Branch)
- resp, err := s.client.Do(req, branches)
+ var branches []*Branch
+ resp, err := s.client.Do(req, &branches)
if err != nil {
return nil, resp, err
}
- return *branches, resp, err
+ return branches, resp, nil
}
// GetBranch gets the specified branch for a repository.
@@ -595,7 +603,7 @@ func (s *RepositoriesService) GetBranch(owner, repo, branch string) (*Branch, *R
return nil, resp, err
}
- return b, resp, err
+ return b, resp, nil
}
// GetBranchProtection gets the protection of a given branch.
@@ -617,7 +625,7 @@ func (s *RepositoriesService) GetBranchProtection(owner, repo, branch string) (*
return nil, resp, err
}
- return p, resp, err
+ return p, resp, nil
}
// UpdateBranchProtection updates the protection of a given branch.
@@ -639,7 +647,7 @@ func (s *RepositoriesService) UpdateBranchProtection(owner, repo, branch string,
return nil, resp, err
}
- return p, resp, err
+ return p, resp, nil
}
// RemoveBranchProtection removes the protection of a given branch.
@@ -674,5 +682,5 @@ func (s *RepositoriesService) License(owner, repo string) (*RepositoryLicense, *
return nil, resp, err
}
- return r, resp, err
+ return r, resp, nil
}
diff --git a/vendor/github.com/google/go-github/github/repos_collaborators.go b/vendor/github.com/google/go-github/github/repos_collaborators.go
index 68a9f46..a19a14a 100644
--- a/vendor/github.com/google/go-github/github/repos_collaborators.go
+++ b/vendor/github.com/google/go-github/github/repos_collaborators.go
@@ -22,13 +22,13 @@ func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOpt
return nil, nil, err
}
- users := new([]*User)
- resp, err := s.client.Do(req, users)
+ var users []*User
+ resp, err := s.client.Do(req, &users)
if err != nil {
return nil, resp, err
}
- return *users, resp, err
+ return users, resp, nil
}
// IsCollaborator checks whether the specified Github user has collaborator
@@ -49,6 +49,35 @@ func (s *RepositoriesService) IsCollaborator(owner, repo, user string) (bool, *R
return isCollab, resp, err
}
+// RepositoryPermissionLevel represents the permission level an organization
+// member has for a given repository.
+type RepositoryPermissionLevel struct {
+ // Possible values: "admin", "write", "read", "none"
+ Permission *string `json:"permission,omitempty"`
+
+ User *User `json:"user,omitempty"`
+}
+
+// GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository.
+// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
+func (s *RepositoriesService) GetPermissionLevel(owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user)
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeOrgMembershipPreview)
+
+ rpl := new(RepositoryPermissionLevel)
+ resp, err := s.client.Do(req, rpl)
+ if err != nil {
+ return nil, resp, err
+ }
+ return rpl, resp, nil
+}
+
// RepositoryAddCollaboratorOptions specifies the optional parameters to the
// RepositoriesService.AddCollaborator method.
type RepositoryAddCollaboratorOptions struct {
diff --git a/vendor/github.com/google/go-github/github/repos_comments.go b/vendor/github.com/google/go-github/github/repos_comments.go
index 34a8d02..7abedc8 100644
--- a/vendor/github.com/google/go-github/github/repos_comments.go
+++ b/vendor/github.com/google/go-github/github/repos_comments.go
@@ -50,13 +50,13 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions)
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)
- comments := new([]*RepositoryComment)
- resp, err := s.client.Do(req, comments)
+ var comments []*RepositoryComment
+ resp, err := s.client.Do(req, &comments)
if err != nil {
return nil, resp, err
}
- return *comments, resp, err
+ return comments, resp, nil
}
// ListCommitComments lists all the comments for a given commit SHA.
@@ -77,13 +77,13 @@ func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *L
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)
- comments := new([]*RepositoryComment)
- resp, err := s.client.Do(req, comments)
+ var comments []*RepositoryComment
+ resp, err := s.client.Do(req, &comments)
if err != nil {
return nil, resp, err
}
- return *comments, resp, err
+ return comments, resp, nil
}
// CreateComment creates a comment for the given commit.
diff --git a/vendor/github.com/google/go-github/github/repos_commits.go b/vendor/github.com/google/go-github/github/repos_commits.go
index 22e8fca..bc0fbf9 100644
--- a/vendor/github.com/google/go-github/github/repos_commits.go
+++ b/vendor/github.com/google/go-github/github/repos_commits.go
@@ -120,13 +120,13 @@ func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOp
return nil, nil, err
}
- commits := new([]*RepositoryCommit)
- resp, err := s.client.Do(req, commits)
+ var commits []*RepositoryCommit
+ resp, err := s.client.Do(req, &commits)
if err != nil {
return nil, resp, err
}
- return *commits, resp, err
+ return commits, resp, nil
}
// GetCommit fetches the specified commit, including all details about it.
diff --git a/vendor/github.com/google/go-github/github/repos_deployments.go b/vendor/github.com/google/go-github/github/repos_deployments.go
index 4b40fbe..32a9a25 100644
--- a/vendor/github.com/google/go-github/github/repos_deployments.go
+++ b/vendor/github.com/google/go-github/github/repos_deployments.go
@@ -73,19 +73,18 @@ func (s *RepositoriesService) ListDeployments(owner, repo string, opt *Deploymen
return nil, nil, err
}
- deployments := new([]*Deployment)
- resp, err := s.client.Do(req, deployments)
+ var deployments []*Deployment
+ resp, err := s.client.Do(req, &deployments)
if err != nil {
return nil, resp, err
}
- return *deployments, resp, err
+ return deployments, resp, nil
}
// GetDeployment returns a single deployment of a repository.
//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/
-// Note: GetDeployment uses the undocumented GitHub API endpoint /repos/:owner/:repo/deployments/:id.
+// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment
func (s *RepositoriesService) GetDeployment(owner, repo string, deploymentID int) (*Deployment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
@@ -167,13 +166,36 @@ func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deploym
return nil, nil, err
}
- statuses := new([]*DeploymentStatus)
- resp, err := s.client.Do(req, statuses)
+ var statuses []*DeploymentStatus
+ resp, err := s.client.Do(req, &statuses)
if err != nil {
return nil, resp, err
}
- return *statuses, resp, err
+ return statuses, resp, nil
+}
+
+// GetDeploymentStatus returns a single deployment status of a repository.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment-status
+func (s *RepositoriesService) GetDeploymentStatus(owner, repo string, deploymentID, deploymentStatusID int) (*DeploymentStatus, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID)
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when deployment support fully launches
+ req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
+
+ d := new(DeploymentStatus)
+ resp, err := s.client.Do(req, d)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return d, resp, err
}
// CreateDeploymentStatus creates a new status for a deployment.
diff --git a/vendor/github.com/google/go-github/github/repos_forks.go b/vendor/github.com/google/go-github/github/repos_forks.go
index c88f3d3..986559d 100644
--- a/vendor/github.com/google/go-github/github/repos_forks.go
+++ b/vendor/github.com/google/go-github/github/repos_forks.go
@@ -32,13 +32,13 @@ func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListF
return nil, nil, err
}
- repos := new([]*Repository)
- resp, err := s.client.Do(req, repos)
+ var repos []*Repository
+ resp, err := s.client.Do(req, &repos)
if err != nil {
return nil, resp, err
}
- return *repos, resp, err
+ return repos, resp, nil
}
// RepositoryCreateForkOptions specifies the optional parameters to the
diff --git a/vendor/github.com/google/go-github/github/repos_hooks.go b/vendor/github.com/google/go-github/github/repos_hooks.go
index fe725b4..25f50b2 100644
--- a/vendor/github.com/google/go-github/github/repos_hooks.go
+++ b/vendor/github.com/google/go-github/github/repos_hooks.go
@@ -117,13 +117,13 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([
return nil, nil, err
}
- hooks := new([]*Hook)
- resp, err := s.client.Do(req, hooks)
+ var hooks []*Hook
+ resp, err := s.client.Do(req, &hooks)
if err != nil {
return nil, resp, err
}
- return *hooks, resp, err
+ return hooks, resp, nil
}
// GetHook returns a single specified Hook.
diff --git a/vendor/github.com/google/go-github/github/repos_keys.go b/vendor/github.com/google/go-github/github/repos_keys.go
index 0bb404a..f8f4f48 100644
--- a/vendor/github.com/google/go-github/github/repos_keys.go
+++ b/vendor/github.com/google/go-github/github/repos_keys.go
@@ -24,13 +24,13 @@ 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(req, &keys)
if err != nil {
return nil, resp, err
}
- return *keys, resp, err
+ return keys, resp, nil
}
// GetKey fetches a single deploy key.
diff --git a/vendor/github.com/google/go-github/github/repos_releases.go b/vendor/github.com/google/go-github/github/repos_releases.go
index 331a4b7..72d95eb 100644
--- a/vendor/github.com/google/go-github/github/repos_releases.go
+++ b/vendor/github.com/google/go-github/github/repos_releases.go
@@ -76,12 +76,12 @@ func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions)
return nil, nil, err
}
- releases := new([]*RepositoryRelease)
- resp, err := s.client.Do(req, releases)
+ var releases []*RepositoryRelease
+ resp, err := s.client.Do(req, &releases)
if err != nil {
return nil, resp, err
}
- return *releases, resp, err
+ return releases, resp, nil
}
// GetRelease fetches a single release.
@@ -188,12 +188,12 @@ func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt
return nil, nil, err
}
- assets := new([]*ReleaseAsset)
- resp, err := s.client.Do(req, assets)
+ var assets []*ReleaseAsset
+ resp, err := s.client.Do(req, &assets)
if err != nil {
- return nil, resp, nil
+ return nil, resp, err
}
- return *assets, resp, err
+ return assets, resp, nil
}
// GetReleaseAsset fetches a single release asset.
@@ -210,7 +210,7 @@ func (s *RepositoriesService) GetReleaseAsset(owner, repo string, id int) (*Rele
asset := new(ReleaseAsset)
resp, err := s.client.Do(req, asset)
if err != nil {
- return nil, resp, nil
+ return nil, resp, err
}
return asset, resp, err
}
@@ -248,7 +248,7 @@ func (s *RepositoriesService) DownloadReleaseAsset(owner, repo string, id int) (
if !strings.Contains(err.Error(), "disable redirect") {
return nil, "", err
}
- return nil, loc, nil
+ return nil, loc, nil // Intentionally return no error with valid redirect URL.
}
if err := CheckResponse(resp); err != nil {
diff --git a/vendor/github.com/google/go-github/github/repos_statuses.go b/vendor/github.com/google/go-github/github/repos_statuses.go
index 6478ee2..1056eee 100644
--- a/vendor/github.com/google/go-github/github/repos_statuses.go
+++ b/vendor/github.com/google/go-github/github/repos_statuses.go
@@ -54,13 +54,13 @@ func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOpt
return nil, nil, err
}
- statuses := new([]*RepoStatus)
- resp, err := s.client.Do(req, statuses)
+ var statuses []*RepoStatus
+ resp, err := s.client.Do(req, &statuses)
if err != nil {
return nil, resp, err
}
- return *statuses, resp, err
+ return statuses, resp, nil
}
// CreateStatus creates a new status for a repository at the specified
diff --git a/vendor/github.com/google/go-github/github/repos_traffic.go b/vendor/github.com/google/go-github/github/repos_traffic.go
index 9688b58..0713c73 100644
--- a/vendor/github.com/google/go-github/github/repos_traffic.go
+++ b/vendor/github.com/google/go-github/github/repos_traffic.go
@@ -60,16 +60,13 @@ func (s *RepositoriesService) ListTrafficReferrers(owner, repo string) ([]*Traff
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTrafficPreview)
-
- trafficReferrers := new([]*TrafficReferrer)
+ var trafficReferrers []*TrafficReferrer
resp, err := s.client.Do(req, &trafficReferrers)
if err != nil {
return nil, resp, err
}
- return *trafficReferrers, resp, err
+ return trafficReferrers, resp, nil
}
// ListTrafficPaths list the top 10 popular content over the last 14 days.
@@ -83,16 +80,13 @@ func (s *RepositoriesService) ListTrafficPaths(owner, repo string) ([]*TrafficPa
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTrafficPreview)
-
- var paths = new([]*TrafficPath)
+ var paths []*TrafficPath
resp, err := s.client.Do(req, &paths)
if err != nil {
return nil, resp, err
}
- return *paths, resp, err
+ return paths, resp, nil
}
// ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week.
@@ -110,9 +104,6 @@ func (s *RepositoriesService) ListTrafficViews(owner, repo string, opt *TrafficB
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTrafficPreview)
-
trafficViews := new(TrafficViews)
resp, err := s.client.Do(req, &trafficViews)
if err != nil {
@@ -137,9 +128,6 @@ func (s *RepositoriesService) ListTrafficClones(owner, repo string, opt *Traffic
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTrafficPreview)
-
trafficClones := new(TrafficClones)
resp, err := s.client.Do(req, &trafficClones)
if err != nil {
diff --git a/vendor/github.com/google/go-github/github/search.go b/vendor/github.com/google/go-github/github/search.go
index 579a57d..8fd9430 100644
--- a/vendor/github.com/google/go-github/github/search.go
+++ b/vendor/github.com/google/go-github/github/search.go
@@ -21,6 +21,7 @@ type SearchService service
type SearchOptions struct {
// How to sort the search results. Possible values are:
// - for repositories: stars, fork, updated
+ // - for commits: author-date, committer-date
// - for code: indexed
// - for issues: comments, created, updated
// - for users: followers, repositories, joined
@@ -54,6 +55,37 @@ func (s *SearchService) Repositories(query string, opt *SearchOptions) (*Reposit
return result, resp, err
}
+// CommitsSearchResult represents the result of a commits search.
+type CommitsSearchResult struct {
+ Total *int `json:"total_count,omitempty"`
+ IncompleteResults *bool `json:"incomplete_results,omitempty"`
+ Commits []*CommitResult `json:"items,omitempty"`
+}
+
+// CommitResult represents a commit object as returned in commit search endpoint response.
+type CommitResult struct {
+ Hash *string `json:"hash,omitempty"`
+ Message *string `json:"message,omitempty"`
+ AuthorID *int `json:"author_id,omitempty"`
+ AuthorName *string `json:"author_name,omitempty"`
+ AuthorEmail *string `json:"author_email,omitempty"`
+ AuthorDate *Timestamp `json:"author_date,omitempty"`
+ CommitterID *int `json:"committer_id,omitempty"`
+ CommitterName *string `json:"committer_name,omitempty"`
+ CommitterEmail *string `json:"committer_email,omitempty"`
+ CommitterDate *Timestamp `json:"committer_date,omitempty"`
+ Repository *Repository `json:"repository,omitempty"`
+}
+
+// Commits searches commits via various criteria.
+//
+// GitHub API Docs: https://developer.github.com/v3/search/#search-commits
+func (s *SearchService) Commits(query string, opt *SearchOptions) (*CommitsSearchResult, *Response, error) {
+ result := new(CommitsSearchResult)
+ resp, err := s.search("commits", query, opt, result)
+ return result, resp, err
+}
+
// IssuesSearchResult represents the result of an issues search.
type IssuesSearchResult struct {
Total *int `json:"total_count,omitempty"`
@@ -136,7 +168,7 @@ func (s *SearchService) Code(query string, opt *SearchOptions) (*CodeSearchResul
}
// Helper function that executes search queries against different
-// GitHub search types (repositories, code, issues, users)
+// GitHub search types (repositories, commits, code, issues, users)
func (s *SearchService) search(searchType string, query string, opt *SearchOptions, result interface{}) (*Response, error) {
params, err := qs.Values(opt)
if err != nil {
@@ -150,7 +182,12 @@ func (s *SearchService) search(searchType string, query string, opt *SearchOptio
return nil, err
}
- if opt != nil && opt.TextMatch {
+ switch {
+ case searchType == "commits":
+ // Accept header for search commits preview endpoint
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeCommitSearchPreview)
+ case opt != nil && opt.TextMatch:
// Accept header defaults to "application/vnd.github.v3+json"
// We change it here to fetch back text-match metadata
req.Header.Set("Accept", "application/vnd.github.v3.text-match+json")
diff --git a/vendor/github.com/google/go-github/github/users.go b/vendor/github.com/google/go-github/github/users.go
index 8f63746..cd305a9 100644
--- a/vendor/github.com/google/go-github/github/users.go
+++ b/vendor/github.com/google/go-github/github/users.go
@@ -156,13 +156,13 @@ func (s *UsersService) ListAll(opt *UserListOptions) ([]*User, *Response, error)
return nil, nil, err
}
- users := new([]*User)
- resp, err := s.client.Do(req, users)
+ var users []*User
+ resp, err := s.client.Do(req, &users)
if err != nil {
return nil, resp, err
}
- return *users, resp, err
+ return users, resp, nil
}
// ListInvitations lists all currently-open repository invitations for the
diff --git a/vendor/github.com/google/go-github/github/users_emails.go b/vendor/github.com/google/go-github/github/users_emails.go
index e4a5898..4785946 100644
--- a/vendor/github.com/google/go-github/github/users_emails.go
+++ b/vendor/github.com/google/go-github/github/users_emails.go
@@ -27,13 +27,13 @@ func (s *UsersService) ListEmails(opt *ListOptions) ([]*UserEmail, *Response, er
return nil, nil, err
}
- emails := new([]*UserEmail)
- resp, err := s.client.Do(req, emails)
+ var emails []*UserEmail
+ resp, err := s.client.Do(req, &emails)
if err != nil {
return nil, resp, err
}
- return *emails, resp, err
+ return emails, resp, nil
}
// AddEmails adds email addresses of the authenticated user.
@@ -46,13 +46,13 @@ func (s *UsersService) AddEmails(emails []string) ([]*UserEmail, *Response, erro
return nil, nil, err
}
- e := new([]*UserEmail)
- resp, err := s.client.Do(req, e)
+ var e []*UserEmail
+ resp, err := s.client.Do(req, &e)
if err != nil {
return nil, resp, err
}
- return *e, resp, err
+ return e, resp, nil
}
// DeleteEmails deletes email addresses from authenticated user.
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 38a1662..123b1c1 100644
--- a/vendor/github.com/google/go-github/github/users_followers.go
+++ b/vendor/github.com/google/go-github/github/users_followers.go
@@ -28,13 +28,13 @@ func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *R
return nil, nil, err
}
- users := new([]*User)
- resp, err := s.client.Do(req, users)
+ var users []*User
+ resp, err := s.client.Do(req, &users)
if err != nil {
return nil, resp, err
}
- return *users, resp, err
+ return users, resp, nil
}
// ListFollowing lists the people that a user is following. Passing the empty
@@ -58,13 +58,13 @@ func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *R
return nil, nil, err
}
- users := new([]*User)
- resp, err := s.client.Do(req, users)
+ var users []*User
+ resp, err := s.client.Do(req, &users)
if err != nil {
return nil, resp, err
}
- return *users, resp, err
+ return users, resp, nil
}
// IsFollowing checks if "user" is following "target". Passing the empty
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 e4c255f..59b1dc2 100644
--- a/vendor/github.com/google/go-github/github/users_keys.go
+++ b/vendor/github.com/google/go-github/github/users_keys.go
@@ -41,13 +41,13 @@ func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Respons
return nil, nil, err
}
- keys := new([]*Key)
- resp, err := s.client.Do(req, keys)
+ var keys []*Key
+ resp, err := s.client.Do(req, &keys)
if err != nil {
return nil, resp, err
}
- return *keys, resp, err
+ return keys, resp, nil
}
// GetKey fetches a single public key.
diff --git a/vendor/github.com/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go
index 19437b3..37080b1 100644
--- a/vendor/github.com/google/go-querystring/query/encode.go
+++ b/vendor/github.com/google/go-querystring/query/encode.go
@@ -217,11 +217,6 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
continue
}
- if sv.Type() == timeType {
- values.Add(name, valueString(sv, opts))
- continue
- }
-
for sv.Kind() == reflect.Ptr {
if sv.IsNil() {
break
@@ -229,6 +224,11 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
sv = sv.Elem()
}
+ if sv.Type() == timeType {
+ values.Add(name, valueString(sv, opts))
+ continue
+ }
+
if sv.Kind() == reflect.Struct {
reflectValue(values, sv, name)
continue