aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-07-17 17:16:14 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-07-17 18:24:20 +0100
commitc9849d667ab55c23d343332a11afb3eb8ede3f2d (patch)
tree86684d5481d8b12be84ea1a3a8f32afaac007efa /vendor/github.com/google
parent49f40a952943f26494d6407dc608b50b2ec0df7f (diff)
Update vendor libs
Diffstat (limited to 'vendor/github.com/google')
-rw-r--r--vendor/github.com/google/go-github/github/activity.go4
-rw-r--r--vendor/github.com/google/go-github/github/activity_events.go32
-rw-r--r--vendor/github.com/google/go-github/github/activity_notifications.go10
-rw-r--r--vendor/github.com/google/go-github/github/activity_star.go8
-rw-r--r--vendor/github.com/google/go-github/github/activity_watching.go8
-rw-r--r--vendor/github.com/google/go-github/github/authorizations.go126
-rw-r--r--vendor/github.com/google/go-github/github/doc.go42
-rw-r--r--vendor/github.com/google/go-github/github/event_types.go17
-rw-r--r--vendor/github.com/google/go-github/github/gists.go80
-rw-r--r--vendor/github.com/google/go-github/github/gists_comments.go4
-rw-r--r--vendor/github.com/google/go-github/github/git.go4
-rw-r--r--vendor/github.com/google/go-github/github/git_commits.go28
-rw-r--r--vendor/github.com/google/go-github/github/git_refs.go4
-rw-r--r--vendor/github.com/google/go-github/github/git_tags.go16
-rw-r--r--vendor/github.com/google/go-github/github/github.go80
-rw-r--r--vendor/github.com/google/go-github/github/gitignore.go4
-rw-r--r--vendor/github.com/google/go-github/github/issues.go25
-rw-r--r--vendor/github.com/google/go-github/github/issues_assignees.go42
-rw-r--r--vendor/github.com/google/go-github/github/issues_comments.go4
-rw-r--r--vendor/github.com/google/go-github/github/issues_events.go8
-rw-r--r--vendor/github.com/google/go-github/github/issues_labels.go20
-rw-r--r--vendor/github.com/google/go-github/github/issues_milestones.go6
-rw-r--r--vendor/github.com/google/go-github/github/issues_timeline.go148
-rw-r--r--vendor/github.com/google/go-github/github/licenses.go8
-rw-r--r--vendor/github.com/google/go-github/github/messages.go119
-rw-r--r--vendor/github.com/google/go-github/github/migrations.go4
-rw-r--r--vendor/github.com/google/go-github/github/migrations_source_import.go8
-rw-r--r--vendor/github.com/google/go-github/github/misc.go4
-rw-r--r--vendor/github.com/google/go-github/github/orgs.go14
-rw-r--r--vendor/github.com/google/go-github/github/orgs_hooks.go4
-rw-r--r--vendor/github.com/google/go-github/github/orgs_members.go12
-rw-r--r--vendor/github.com/google/go-github/github/orgs_teams.go40
-rw-r--r--vendor/github.com/google/go-github/github/pulls.go35
-rw-r--r--vendor/github.com/google/go-github/github/pulls_comments.go4
-rw-r--r--vendor/github.com/google/go-github/github/reactions.go10
-rw-r--r--vendor/github.com/google/go-github/github/repos.go61
-rw-r--r--vendor/github.com/google/go-github/github/repos_collaborators.go15
-rw-r--r--vendor/github.com/google/go-github/github/repos_comments.go8
-rw-r--r--vendor/github.com/google/go-github/github/repos_commits.go9
-rw-r--r--vendor/github.com/google/go-github/github/repos_deployments.go8
-rw-r--r--vendor/github.com/google/go-github/github/repos_forks.go4
-rw-r--r--vendor/github.com/google/go-github/github/repos_hooks.go6
-rw-r--r--vendor/github.com/google/go-github/github/repos_invitations.go91
-rw-r--r--vendor/github.com/google/go-github/github/repos_keys.go4
-rw-r--r--vendor/github.com/google/go-github/github/repos_pages.go4
-rw-r--r--vendor/github.com/google/go-github/github/repos_releases.go8
-rw-r--r--vendor/github.com/google/go-github/github/repos_stats.go20
-rw-r--r--vendor/github.com/google/go-github/github/repos_statuses.go4
-rw-r--r--vendor/github.com/google/go-github/github/search.go4
-rw-r--r--vendor/github.com/google/go-github/github/users.go68
-rw-r--r--vendor/github.com/google/go-github/github/users_emails.go8
-rw-r--r--vendor/github.com/google/go-github/github/users_followers.go8
-rw-r--r--vendor/github.com/google/go-github/github/users_gpg_keys.go127
-rw-r--r--vendor/github.com/google/go-github/github/users_keys.go13
54 files changed, 1126 insertions, 326 deletions
diff --git a/vendor/github.com/google/go-github/github/activity.go b/vendor/github.com/google/go-github/github/activity.go
index 88ad8d2..d719ebb 100644
--- a/vendor/github.com/google/go-github/github/activity.go
+++ b/vendor/github.com/google/go-github/github/activity.go
@@ -9,9 +9,7 @@ package github
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/activity/
-type ActivityService struct {
- client *Client
-}
+type ActivityService service
// FeedLink represents a link to a related resource.
type FeedLink struct {
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 be7e4b2..a0e5f08 100644
--- a/vendor/github.com/google/go-github/github/activity_events.go
+++ b/vendor/github.com/google/go-github/github/activity_events.go
@@ -85,7 +85,7 @@ func (e *Event) Payload() (payload interface{}) {
// ListEvents drinks from the firehose of all public events across GitHub.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events
-func (s *ActivityService) ListEvents(opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, error) {
u, err := addOptions("events", opt)
if err != nil {
return nil, nil, err
@@ -96,7 +96,7 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]Event, *Response, erro
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
@@ -108,7 +108,7 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]Event, *Response, erro
// ListRepositoryEvents lists events for a repository.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-repository-events
-func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/events", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -120,7 +120,7 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
@@ -132,7 +132,7 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti
// ListIssueEventsForRepository lists issue events for a repository.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
-func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -144,7 +144,7 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
@@ -156,7 +156,7 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *
// ListEventsForRepoNetwork lists public events for a network of repositories.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
-func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
u := fmt.Sprintf("networks/%v/%v/events", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -168,7 +168,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
@@ -180,7 +180,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List
// ListEventsForOrganization lists public events for an organization.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
-func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions) ([]*Event, *Response, error) {
u := fmt.Sprintf("orgs/%v/events", org)
u, err := addOptions(u, opt)
if err != nil {
@@ -192,7 +192,7 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
@@ -205,7 +205,7 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions
// true, only public events will be returned.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
-func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool, opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
var u string
if publicOnly {
u = fmt.Sprintf("users/%v/events/public", user)
@@ -222,7 +222,7 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
@@ -235,7 +235,7 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool
// true, only public events will be returned.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
-func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
var u string
if publicOnly {
u = fmt.Sprintf("users/%v/received_events/public", user)
@@ -252,7 +252,7 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool,
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
@@ -265,7 +265,7 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool,
// must be authenticated as the user to view this.
//
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-for-an-organization
-func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *ListOptions) ([]Event, *Response, error) {
+func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *ListOptions) ([]*Event, *Response, error) {
u := fmt.Sprintf("users/%v/events/orgs/%v", user, org)
u, err := addOptions(u, opt)
if err != nil {
@@ -277,7 +277,7 @@ func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *L
return nil, nil, err
}
- events := new([]Event)
+ events := new([]*Event)
resp, err := s.client.Do(req, events)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/activity_notifications.go b/vendor/github.com/google/go-github/github/activity_notifications.go
index 290b954..8890388 100644
--- a/vendor/github.com/google/go-github/github/activity_notifications.go
+++ b/vendor/github.com/google/go-github/github/activity_notifications.go
@@ -42,12 +42,14 @@ type NotificationListOptions struct {
Participating bool `url:"participating,omitempty"`
Since time.Time `url:"since,omitempty"`
Before time.Time `url:"before,omitempty"`
+
+ ListOptions
}
// ListNotifications lists all notifications for the authenticated user.
//
// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications
-func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]Notification, *Response, error) {
+func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]*Notification, *Response, error) {
u := fmt.Sprintf("notifications")
u, err := addOptions(u, opt)
if err != nil {
@@ -59,7 +61,7 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]Not
return nil, nil, err
}
- var notifications []Notification
+ var notifications []*Notification
resp, err := s.client.Do(req, &notifications)
if err != nil {
return nil, resp, err
@@ -72,7 +74,7 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]Not
// for the authenticated user.
//
// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
-func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *NotificationListOptions) ([]Notification, *Response, error) {
+func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -84,7 +86,7 @@ func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *N
return nil, nil, err
}
- var notifications []Notification
+ var notifications []*Notification
resp, err := s.client.Do(req, &notifications)
if err != nil {
return nil, resp, err
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 080d654..5df6814 100644
--- a/vendor/github.com/google/go-github/github/activity_star.go
+++ b/vendor/github.com/google/go-github/github/activity_star.go
@@ -22,7 +22,7 @@ type Stargazer struct {
// ListStargazers lists people who have starred the specified repo.
//
// GitHub API Docs: https://developer.github.com/v3/activity/starring/#list-stargazers
-func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) ([]Stargazer, *Response, error) {
+func (s *ActivityService) ListStargazers(owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -37,7 +37,7 @@ 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)
+ stargazers := new([]*Stargazer)
resp, err := s.client.Do(req, stargazers)
if err != nil {
return nil, resp, err
@@ -64,7 +64,7 @@ type ActivityListStarredOptions struct {
// will list the starred repositories for the authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/activity/starring/#list-repositories-being-starred
-func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptions) ([]StarredRepository, *Response, error) {
+func (s *ActivityService) ListStarred(user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/starred", user)
@@ -84,7 +84,7 @@ 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)
+ repos := new([]*StarredRepository)
resp, err := s.client.Do(req, repos)
if err != nil {
return nil, resp, err
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 c002b3b..6bf91dd 100644
--- a/vendor/github.com/google/go-github/github/activity_watching.go
+++ b/vendor/github.com/google/go-github/github/activity_watching.go
@@ -25,7 +25,7 @@ type Subscription struct {
// ListWatchers lists watchers of a particular repo.
//
// GitHub API Docs: http://developer.github.com/v3/activity/watching/#list-watchers
-func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]User, *Response, error) {
+func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -37,7 +37,7 @@ func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]
return nil, nil, err
}
- watchers := new([]User)
+ watchers := new([]*User)
resp, err := s.client.Do(req, watchers)
if err != nil {
return nil, resp, err
@@ -50,7 +50,7 @@ func (s *ActivityService) ListWatchers(owner, repo string, opt *ListOptions) ([]
// the empty string will fetch watched repos for the authenticated user.
//
// GitHub API Docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
-func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]Repository, *Response, error) {
+func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]*Repository, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/subscriptions", user)
@@ -67,7 +67,7 @@ func (s *ActivityService) ListWatched(user string, opt *ListOptions) ([]Reposito
return nil, nil, err
}
- watched := new([]Repository)
+ watched := new([]*Repository)
resp, err := s.client.Do(req, watched)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/authorizations.go b/vendor/github.com/google/go-github/github/authorizations.go
index cfe6349..58fcc4e 100644
--- a/vendor/github.com/google/go-github/github/authorizations.go
+++ b/vendor/github.com/google/go-github/github/authorizations.go
@@ -35,6 +35,9 @@ const (
ScopeReadPublicKey Scope = "read:public_key"
ScopeWritePublicKey Scope = "write:public_key"
ScopeAdminPublicKey Scope = "admin:public_key"
+ ScopeReadGPGKey Scope = "read:gpg_key"
+ ScopeWriteGPGKey Scope = "write:gpg_key"
+ ScopeAdminGPGKey Scope = "admin:gpg_key"
)
// AuthorizationsService handles communication with the authorization related
@@ -44,9 +47,7 @@ const (
// an OAuth token.
//
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/
-type AuthorizationsService struct {
- client *Client
-}
+type AuthorizationsService service
// Authorization represents an individual GitHub authorization.
type Authorization struct {
@@ -82,6 +83,20 @@ func (a AuthorizationApp) String() string {
return Stringify(a)
}
+// Grant represents an OAuth application that has been granted access to an account.
+type Grant struct {
+ ID *int `json:"id,omitempty"`
+ URL *string `json:"url,omitempty"`
+ App *AuthorizationApp `json:"app,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+ Scopes []string `json:"scopes,omitempty"`
+}
+
+func (g Grant) String() string {
+ return Stringify(g)
+}
+
// AuthorizationRequest represents a request to create an authorization.
type AuthorizationRequest struct {
Scopes []Scope `json:"scopes,omitempty"`
@@ -119,7 +134,7 @@ func (a AuthorizationUpdateRequest) String() string {
// List the authorizations for the authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations
-func (s *AuthorizationsService) List(opt *ListOptions) ([]Authorization, *Response, error) {
+func (s *AuthorizationsService) List(opt *ListOptions) ([]*Authorization, *Response, error) {
u := "authorizations"
u, err := addOptions(u, opt)
if err != nil {
@@ -131,7 +146,7 @@ func (s *AuthorizationsService) List(opt *ListOptions) ([]Authorization, *Respon
return nil, nil, err
}
- auths := new([]Authorization)
+ auths := new([]*Authorization)
resp, err := s.client.Do(req, auths)
if err != nil {
return nil, resp, err
@@ -318,3 +333,104 @@ func (s *AuthorizationsService) Revoke(clientID string, token string) (*Response
return s.client.Do(req, nil)
}
+
+// ListGrants lists the set of OAuth applications that have been granted
+// access to a user's account. This will return one entry for each application
+// that has been granted access to the account, regardless of the number of
+// tokens an application has generated for the user.
+//
+// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-grants
+func (s *AuthorizationsService) ListGrants() ([]*Grant, *Response, error) {
+ req, err := s.client.NewRequest("GET", "applications/grants", nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeOAuthGrantAuthorizationsPreview)
+
+ grants := []*Grant{}
+ resp, err := s.client.Do(req, &grants)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return grants, resp, err
+}
+
+// GetGrant gets a single OAuth application grant.
+//
+// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-grant
+func (s *AuthorizationsService) GetGrant(id int) (*Grant, *Response, error) {
+ u := fmt.Sprintf("applications/grants/%d", id)
+ 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", mediaTypeOAuthGrantAuthorizationsPreview)
+
+ grant := new(Grant)
+ resp, err := s.client.Do(req, grant)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return grant, resp, err
+}
+
+// DeleteGrant deletes an OAuth application grant. Deleting an application's
+// grant will also delete all OAuth tokens associated with the application for
+// the user.
+//
+// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-a-grant
+func (s *AuthorizationsService) DeleteGrant(id int) (*Response, error) {
+ u := fmt.Sprintf("applications/grants/%d", id)
+ req, err := s.client.NewRequest("DELETE", u, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeOAuthGrantAuthorizationsPreview)
+
+ return s.client.Do(req, nil)
+}
+
+// Create an impersonation OAuth token.
+//
+// This requires admin permissions. With the returned Authorization.Token
+// you can e.g. create or delete a user's public SSH key. NOTE: creating a
+// new token automatically revokes an existing one.
+//
+// GitHub API docs: https://developer.github.com/enterprise/2.5/v3/users/administration/#create-an-impersonation-oauth-token
+func (s *AuthorizationsService) CreateImpersonation(username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) {
+ u := fmt.Sprintf("admin/users/%v/authorizations", username)
+ req, err := s.client.NewRequest("POST", u, authReq)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ a := new(Authorization)
+ resp, err := s.client.Do(req, a)
+ if err != nil {
+ return nil, resp, err
+ }
+ return a, resp, err
+}
+
+// Delete an impersonation OAuth token.
+//
+// NOTE: there can be only one at a time.
+//
+// GitHub API docs: https://developer.github.com/enterprise/2.5/v3/users/administration/#delete-an-impersonation-oauth-token
+func (s *AuthorizationsService) DeleteImpersonation(username string) (*Response, error) {
+ u := fmt.Sprintf("admin/users/%v/authorizations", username)
+ req, err := s.client.NewRequest("DELETE", u, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ return s.client.Do(req, nil)
+}
diff --git a/vendor/github.com/google/go-github/github/doc.go b/vendor/github.com/google/go-github/github/doc.go
index 0d32d49..ba7b089 100644
--- a/vendor/github.com/google/go-github/github/doc.go
+++ b/vendor/github.com/google/go-github/github/doc.go
@@ -6,6 +6,10 @@
/*
Package github provides a client for using the GitHub API.
+Usage:
+
+ import "github.com/google/go-github/github"
+
Construct a new GitHub client, then use the various services on the client to
access different parts of the GitHub API. For example:
@@ -14,7 +18,9 @@ access different parts of the GitHub API. For example:
// list all organizations for user "willnorris"
orgs, _, err := client.Organizations.List("willnorris", nil)
-Set optional parameters for an API method by passing an Options object.
+Some API methods have optional parameters that can be passed. For example:
+
+ client := github.NewClient(nil)
// list recently updated repositories for org "github"
opt := &github.RepositoryListByOrgOptions{Sort: "updated"}
@@ -51,18 +57,23 @@ Note that when using an authenticated Client, all calls made by the client will
include the specified OAuth token. Therefore, authenticated clients should
almost never be shared between different users.
+See the oauth2 docs for complete instructions on using that library.
+
+For API methods that require HTTP Basic Authentication, use the
+BasicAuthTransport.
+
Rate Limiting
-GitHub imposes a rate limit on all API clients. Unauthenticated clients are
+GitHub imposes a rate limit on all API clients. Unauthenticated clients are
limited to 60 requests per hour, while authenticated clients can make up to
-5,000 requests per hour. To receive the higher rate limit when making calls
+5,000 requests per hour. To receive the higher rate limit when making calls
that are not issued on behalf of a user, use the
UnauthenticatedRateLimitedTransport.
The Rate method on a client returns the rate limit information based on the most
-recent API call. This is updated on every call, but may be out of date if it's
+recent API call. This is updated on every call, but may be out of date if it's
been some time since the last API call and other clients have made subsequent
-requests since then. You can always call RateLimits() directly to get the most
+requests since then. You can always call RateLimits() directly to get the most
up-to-date rate limit data for the client.
To detect an API rate limit error, you can check if its type is *github.RateLimitError:
@@ -79,11 +90,9 @@ Conditional Requests
The GitHub API has good support for conditional requests which will help
prevent you from burning through your rate limit, as well as help speed up your
-application. go-github does not handle conditional requests directly, but is
-instead designed to work with a caching http.Transport. We recommend using
-https://github.com/gregjones/httpcache, which can be used in conjunction with
-https://github.com/sourcegraph/apiproxy to provide additional flexibility and
-control of caching rules.
+application. go-github does not handle conditional requests directly, but is
+instead designed to work with a caching http.Transport. We recommend using
+https://github.com/gregjones/httpcache for that.
Learn more about GitHub conditional requests at
https://developer.github.com/v3/#conditional-requests.
@@ -93,7 +102,7 @@ Creating and Updating Resources
All structs for GitHub resources use pointer values for all non-repeated fields.
This allows distinguishing between unset fields and those set to a zero-value.
Helper functions have been provided to easily create these pointers for string,
-bool, and int values. For example:
+bool, and int values. For example:
// create a new private repository named "foo"
repo := &github.Repository{
@@ -106,17 +115,20 @@ Users who have worked with protocol buffers should find this pattern familiar.
Pagination
-All requests for resource collections (repos, pull requests, issues, etc)
+All requests for resource collections (repos, pull requests, issues, etc.)
support pagination. Pagination options are described in the
-ListOptions struct and passed to the list methods directly or as an
+github.ListOptions struct and passed to the list methods directly or as an
embedded type of a more specific list options struct (for example
-PullRequestListOptions). Pages information is available via Response struct.
+github.PullRequestListOptions). Pages information is available via the
+github.Response struct.
+
+ client := github.NewClient(nil)
opt := &github.RepositoryListByOrgOptions{
ListOptions: github.ListOptions{PerPage: 10},
}
// get all pages of results
- var allRepos []github.Repository
+ var allRepos []*github.Repository
for {
repos, resp, err := client.Repositories.ListByOrg("github", opt)
if err != nil {
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 6f7202e..f3e163d 100644
--- a/vendor/github.com/google/go-github/github/event_types.go
+++ b/vendor/github.com/google/go-github/github/event_types.go
@@ -316,12 +316,19 @@ func (p PushEvent) String() string {
// PushEventCommit represents a git commit in a GitHub PushEvent.
type PushEventCommit struct {
- SHA *string `json:"sha,omitempty"`
- Message *string `json:"message,omitempty"`
- Author *CommitAuthor `json:"author,omitempty"`
+ Message *string `json:"message,omitempty"`
+ Author *CommitAuthor `json:"author,omitempty"`
+ URL *string `json:"url,omitempty"`
+ Distinct *bool `json:"distinct,omitempty"`
+
+ // The following fields are only populated by Events API.
+ SHA *string `json:"sha,omitempty"`
+
+ // The following fields are only populated by Webhook events.
+ ID *string `json:"id,omitempty"`
+ TreeID *string `json:"tree_id,omitempty"`
+ Timestamp *Timestamp `json:"timestamp,omitempty"`
Committer *CommitAuthor `json:"committer,omitempty"`
- URL *string `json:"url,omitempty"`
- Distinct *bool `json:"distinct,omitempty"`
Added []string `json:"added,omitempty"`
Removed []string `json:"removed,omitempty"`
Modified []string `json:"modified,omitempty"`
diff --git a/vendor/github.com/google/go-github/github/gists.go b/vendor/github.com/google/go-github/github/gists.go
index a662d35..697fcb5 100644
--- a/vendor/github.com/google/go-github/github/gists.go
+++ b/vendor/github.com/google/go-github/github/gists.go
@@ -14,9 +14,7 @@ import (
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/gists/
-type GistsService struct {
- client *Client
-}
+type GistsService service
// Gist represents a GitHub's gist.
type Gist struct {
@@ -52,6 +50,32 @@ func (g GistFile) String() string {
return Stringify(g)
}
+// GistCommit represents a commit on a gist.
+type GistCommit struct {
+ URL *string `json:"url,omitempty"`
+ Version *string `json:"version,omitempty"`
+ User *User `json:"user,omitempty"`
+ ChangeStatus *CommitStats `json:"change_status,omitempty"`
+ CommitedAt *Timestamp `json:"commited_at,omitempty"`
+}
+
+func (gc GistCommit) String() string {
+ return Stringify(gc)
+}
+
+// GistFork represents a fork of a gist.
+type GistFork struct {
+ URL *string `json:"url,omitempty"`
+ User *User `json:"user,omitempty"`
+ ID *string `json:"id,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+}
+
+func (gf GistFork) String() string {
+ return Stringify(gf)
+}
+
// GistListOptions specifies the optional parameters to the
// GistsService.List, GistsService.ListAll, and GistsService.ListStarred methods.
type GistListOptions struct {
@@ -67,7 +91,7 @@ type GistListOptions struct {
// user.
//
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
-func (s *GistsService) List(user string, opt *GistListOptions) ([]Gist, *Response, error) {
+func (s *GistsService) List(user string, opt *GistListOptions) ([]*Gist, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/gists", user)
@@ -84,7 +108,7 @@ func (s *GistsService) List(user string, opt *GistListOptions) ([]Gist, *Respons
return nil, nil, err
}
- gists := new([]Gist)
+ gists := new([]*Gist)
resp, err := s.client.Do(req, gists)
if err != nil {
return nil, resp, err
@@ -96,7 +120,7 @@ func (s *GistsService) List(user string, opt *GistListOptions) ([]Gist, *Respons
// ListAll lists all public gists.
//
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
-func (s *GistsService) ListAll(opt *GistListOptions) ([]Gist, *Response, error) {
+func (s *GistsService) ListAll(opt *GistListOptions) ([]*Gist, *Response, error) {
u, err := addOptions("gists/public", opt)
if err != nil {
return nil, nil, err
@@ -107,7 +131,7 @@ func (s *GistsService) ListAll(opt *GistListOptions) ([]Gist, *Response, error)
return nil, nil, err
}
- gists := new([]Gist)
+ gists := new([]*Gist)
resp, err := s.client.Do(req, gists)
if err != nil {
return nil, resp, err
@@ -119,7 +143,7 @@ func (s *GistsService) ListAll(opt *GistListOptions) ([]Gist, *Response, error)
// ListStarred lists starred gists of authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/gists/#list-gists
-func (s *GistsService) ListStarred(opt *GistListOptions) ([]Gist, *Response, error) {
+func (s *GistsService) ListStarred(opt *GistListOptions) ([]*Gist, *Response, error) {
u, err := addOptions("gists/starred", opt)
if err != nil {
return nil, nil, err
@@ -130,7 +154,7 @@ func (s *GistsService) ListStarred(opt *GistListOptions) ([]Gist, *Response, err
return nil, nil, err
}
- gists := new([]Gist)
+ gists := new([]*Gist)
resp, err := s.client.Do(req, gists)
if err != nil {
return nil, resp, err
@@ -211,6 +235,25 @@ func (s *GistsService) Edit(id string, gist *Gist) (*Gist, *Response, error) {
return g, resp, err
}
+// ListCommits lists commits of a gist.
+//
+// Github API docs: https://developer.github.com/v3/gists/#list-gist-commits
+func (s *GistsService) ListCommits(id string) ([]*GistCommit, *Response, error) {
+ u := fmt.Sprintf("gists/%v/commits", id)
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ gistCommits := new([]*GistCommit)
+ resp, err := s.client.Do(req, gistCommits)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return *gistCommits, resp, err
+}
+
// Delete a gist.
//
// GitHub API docs: http://developer.github.com/v3/gists/#delete-a-gist
@@ -279,3 +322,22 @@ func (s *GistsService) Fork(id string) (*Gist, *Response, error) {
return g, resp, err
}
+
+// ListForks lists forks of a gist.
+//
+// Github API docs: https://developer.github.com/v3/gists/#list-gist-forks
+func (s *GistsService) ListForks(id string) ([]*GistFork, *Response, error) {
+ u := fmt.Sprintf("gists/%v/forks", id)
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ gistForks := new([]*GistFork)
+ resp, err := s.client.Do(req, gistForks)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return *gistForks, resp, err
+}
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 c5c21bd..95a7fc7 100644
--- a/vendor/github.com/google/go-github/github/gists_comments.go
+++ b/vendor/github.com/google/go-github/github/gists_comments.go
@@ -26,7 +26,7 @@ func (g GistComment) String() string {
// ListComments lists all comments for a gist.
//
// GitHub API docs: http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
-func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]GistComment, *Response, error) {
+func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]*GistComment, *Response, error) {
u := fmt.Sprintf("gists/%v/comments", gistID)
u, err := addOptions(u, opt)
if err != nil {
@@ -38,7 +38,7 @@ func (s *GistsService) ListComments(gistID string, opt *ListOptions) ([]GistComm
return nil, nil, err
}
- comments := new([]GistComment)
+ comments := new([]*GistComment)
resp, err := s.client.Do(req, comments)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/git.go b/vendor/github.com/google/go-github/github/git.go
index a80e55b..c934751 100644
--- a/vendor/github.com/google/go-github/github/git.go
+++ b/vendor/github.com/google/go-github/github/git.go
@@ -9,6 +9,4 @@ package github
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/git/
-type GitService struct {
- client *Client
-}
+type GitService service
diff --git a/vendor/github.com/google/go-github/github/git_commits.go b/vendor/github.com/google/go-github/github/git_commits.go
index 41e7ff9..0bcad41 100644
--- a/vendor/github.com/google/go-github/github/git_commits.go
+++ b/vendor/github.com/google/go-github/github/git_commits.go
@@ -10,16 +10,25 @@ import (
"time"
)
+// SignatureVerification represents GPG signature verification.
+type SignatureVerification struct {
+ Verified *bool `json:"verified,omitempty"`
+ Reason *string `json:"reason,omitempty"`
+ Signature *string `json:"signature,omitempty"`
+ Payload *string `json:"payload,omitempty"`
+}
+
// Commit represents a GitHub commit.
type Commit struct {
- SHA *string `json:"sha,omitempty"`
- Author *CommitAuthor `json:"author,omitempty"`
- Committer *CommitAuthor `json:"committer,omitempty"`
- Message *string `json:"message,omitempty"`
- Tree *Tree `json:"tree,omitempty"`
- Parents []Commit `json:"parents,omitempty"`
- Stats *CommitStats `json:"stats,omitempty"`
- URL *string `json:"url,omitempty"`
+ SHA *string `json:"sha,omitempty"`
+ Author *CommitAuthor `json:"author,omitempty"`
+ Committer *CommitAuthor `json:"committer,omitempty"`
+ Message *string `json:"message,omitempty"`
+ Tree *Tree `json:"tree,omitempty"`
+ Parents []Commit `json:"parents,omitempty"`
+ Stats *CommitStats `json:"stats,omitempty"`
+ URL *string `json:"url,omitempty"`
+ Verification *SignatureVerification `json:"verification,omitempty"`
// CommentCount is the number of GitHub comments on the commit. This
// is only populated for requests that fetch GitHub data like
@@ -56,6 +65,9 @@ func (s *GitService) GetCommit(owner string, repo string, sha string) (*Commit,
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGitSigningPreview)
+
c := new(Commit)
resp, err := s.client.Do(req, c)
if err != nil {
diff --git a/vendor/github.com/google/go-github/github/git_refs.go b/vendor/github.com/google/go-github/github/git_refs.go
index 3d2f6c8..16cbd6b 100644
--- a/vendor/github.com/google/go-github/github/git_refs.go
+++ b/vendor/github.com/google/go-github/github/git_refs.go
@@ -75,7 +75,7 @@ type ReferenceListOptions struct {
// ListRefs lists all refs in a repository.
//
// GitHub API docs: http://developer.github.com/v3/git/refs/#get-all-references
-func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]Reference, *Response, error) {
+func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
var u string
if opt != nil && opt.Type != "" {
u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type)
@@ -92,7 +92,7 @@ func (s *GitService) ListRefs(owner, repo string, opt *ReferenceListOptions) ([]
return nil, nil, err
}
- var rs []Reference
+ var rs []*Reference
resp, err := s.client.Do(req, &rs)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/git_tags.go b/vendor/github.com/google/go-github/github/git_tags.go
index 7b53f5c..01b9cb2 100644
--- a/vendor/github.com/google/go-github/github/git_tags.go
+++ b/vendor/github.com/google/go-github/github/git_tags.go
@@ -11,12 +11,13 @@ import (
// Tag represents a tag object.
type Tag struct {
- Tag *string `json:"tag,omitempty"`
- SHA *string `json:"sha,omitempty"`
- URL *string `json:"url,omitempty"`
- Message *string `json:"message,omitempty"`
- Tagger *CommitAuthor `json:"tagger,omitempty"`
- Object *GitObject `json:"object,omitempty"`
+ Tag *string `json:"tag,omitempty"`
+ SHA *string `json:"sha,omitempty"`
+ URL *string `json:"url,omitempty"`
+ Message *string `json:"message,omitempty"`
+ Tagger *CommitAuthor `json:"tagger,omitempty"`
+ Object *GitObject `json:"object,omitempty"`
+ Verification *SignatureVerification `json:"verification,omitempty"`
}
// createTagRequest represents the body of a CreateTag request. This is mostly
@@ -40,6 +41,9 @@ func (s *GitService) GetTag(owner string, repo string, sha string) (*Tag, *Respo
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGitSigningPreview)
+
tag := new(Tag)
resp, err := s.client.Do(req, tag)
return tag, resp, err
diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go
index 01e573d..4faf09c 100644
--- a/vendor/github.com/google/go-github/github/github.go
+++ b/vendor/github.com/google/go-github/github/github.go
@@ -29,7 +29,7 @@ const (
)
const (
- libraryVersion = "0.1"
+ libraryVersion = "2"
defaultBaseURL = "https://api.github.com/"
uploadBaseURL = "https://uploads.github.com/"
userAgent = "go-github/" + libraryVersion
@@ -39,9 +39,10 @@ const (
headerRateReset = "X-RateLimit-Reset"
headerOTP = "X-GitHub-OTP"
- mediaTypeV3 = "application/vnd.github.v3+json"
- defaultMediaType = "application/octet-stream"
- mediaTypeV3SHA = "application/vnd.github.v3.sha"
+ mediaTypeV3 = "application/vnd.github.v3+json"
+ defaultMediaType = "application/octet-stream"
+ mediaTypeV3SHA = "application/vnd.github.v3.sha"
+ mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json"
// Media Type values to access preview APIs
@@ -51,16 +52,9 @@ const (
// https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
- // https://developer.github.com/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/
- mediaTypeOrgPermissionPreview = "application/vnd.github.ironman-preview+json"
- mediaTypeOrgPermissionRepoPreview = "application/vnd.github.ironman-preview.repository+json"
-
// https://developer.github.com/changes/2015-11-11-protected-branches-api/
mediaTypeProtectedBranchesPreview = "application/vnd.github.loki-preview+json"
- // https://developer.github.com/changes/2016-02-11-issue-locking-api/
- mediaTypeIssueLockingPreview = "application/vnd.github.the-key-preview+json"
-
// https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
@@ -72,14 +66,27 @@ const (
// https://developer.github.com/changes/2016-05-12-reactions-api-preview/
mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
+
+ // https://developer.github.com/changes/2016-04-01-squash-api-preview/
+ mediaTypeSquashPreview = "application/vnd.github.polaris-preview+json"
+
+ // https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
+ mediaTypeGitSigningPreview = "application/vnd.github.cryptographer-preview+json"
+
+ // https://developer.github.com/changes/2016-05-23-timeline-preview-api/
+ mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
+
+ // https://developer.github.com/changes/2016-06-14-repository-invitations/
+ mediaTypeRepositoryInvitationsPreview = "application/vnd.github.swamp-thing-preview+json"
+
+ // https://developer.github.com/changes/2016-04-21-oauth-authorizations-grants-api-preview/
+ mediaTypeOAuthGrantAuthorizationsPreview = "application/vnd.github.damage-preview+json"
)
// A Client manages communication with the GitHub API.
type Client struct {
- // HTTP client used to communicate with the API.
- client *http.Client
- // clientMu protects the client during calls that modify the CheckRedirect func.
- clientMu sync.Mutex
+ clientMu sync.Mutex // clientMu protects the client during calls that modify the CheckRedirect func.
+ client *http.Client // HTTP client used to communicate with the API.
// Base URL for API requests. Defaults to the public GitHub API, but can be
// set to a domain endpoint to use with GitHub Enterprise. BaseURL should
@@ -96,6 +103,8 @@ type Client struct {
rateLimits [categories]Rate // Rate limits for the client as determined by the most recent API calls.
mostRecent rateLimitCategory
+ common service // Reuse a single struct instead of allocating one for each service on the heap.
+
// Services used for talking to different parts of the GitHub API.
Activity *ActivityService
Authorizations *AuthorizationsService
@@ -113,6 +122,10 @@ type Client struct {
Reactions *ReactionsService
}
+type service struct {
+ client *Client
+}
+
// ListOptions specifies the optional parameters to various List methods that
// support pagination.
type ListOptions struct {
@@ -162,20 +175,21 @@ func NewClient(httpClient *http.Client) *Client {
uploadURL, _ := url.Parse(uploadBaseURL)
c := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, UploadURL: uploadURL}
- c.Activity = &ActivityService{client: c}
- c.Authorizations = &AuthorizationsService{client: c}
- c.Gists = &GistsService{client: c}
- c.Git = &GitService{client: c}
- c.Gitignores = &GitignoresService{client: c}
- c.Issues = &IssuesService{client: c}
- c.Organizations = &OrganizationsService{client: c}
- c.PullRequests = &PullRequestsService{client: c}
- c.Repositories = &RepositoriesService{client: c}
- c.Search = &SearchService{client: c}
- c.Users = &UsersService{client: c}
- c.Licenses = &LicensesService{client: c}
- c.Migrations = &MigrationService{client: c}
- c.Reactions = &ReactionsService{client: c}
+ c.common.client = c
+ c.Activity = (*ActivityService)(&c.common)
+ c.Authorizations = (*AuthorizationsService)(&c.common)
+ c.Gists = (*GistsService)(&c.common)
+ c.Git = (*GitService)(&c.common)
+ c.Gitignores = (*GitignoresService)(&c.common)
+ c.Issues = (*IssuesService)(&c.common)
+ c.Licenses = (*LicensesService)(&c.common)
+ c.Migrations = (*MigrationService)(&c.common)
+ c.Organizations = (*OrganizationsService)(&c.common)
+ c.PullRequests = (*PullRequestsService)(&c.common)
+ c.Reactions = (*ReactionsService)(&c.common)
+ c.Repositories = (*RepositoriesService)(&c.common)
+ c.Search = (*SearchService)(&c.common)
+ c.Users = (*UsersService)(&c.common)
return c
}
@@ -435,6 +449,10 @@ type ErrorResponse struct {
Reason string `json:"reason,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
} `json:"block,omitempty"`
+ // Most errors will also include a documentation_url field pointing
+ // to some content that might help you resolve the error, see
+ // https://developer.github.com/v3/#client-errors
+ DocumentationURL string `json:"documentation_url,omitempty"`
}
func (r *ErrorResponse) Error() string {
@@ -490,6 +508,9 @@ These are the possible validation error codes:
the formatting of a field is invalid
already_exists:
another resource has the same valid as this field
+ custom:
+ some resources return this (e.g. github.User.CreateKey()), additional
+ information is set in the Message field of the Error
GitHub API docs: http://developer.github.com/v3/#client-errors
*/
@@ -497,6 +518,7 @@ type Error struct {
Resource string `json:"resource"` // resource on which the error occurred
Field string `json:"field"` // field on which the error occurred
Code string `json:"code"` // validation error code
+ Message string `json:"message"` // Message describing the error. Errors with Code == "custom" will always have this set.
}
func (e *Error) Error() string {
diff --git a/vendor/github.com/google/go-github/github/gitignore.go b/vendor/github.com/google/go-github/github/gitignore.go
index 31d5902..faaceb5 100644
--- a/vendor/github.com/google/go-github/github/gitignore.go
+++ b/vendor/github.com/google/go-github/github/gitignore.go
@@ -11,9 +11,7 @@ import "fmt"
// GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/gitignore/
-type GitignoresService struct {
- client *Client
-}
+type GitignoresService service
// Gitignore represents a .gitignore file as returned by the GitHub API.
type Gitignore struct {
diff --git a/vendor/github.com/google/go-github/github/issues.go b/vendor/github.com/google/go-github/github/issues.go
index d380dd3..02c82cd 100644
--- a/vendor/github.com/google/go-github/github/issues.go
+++ b/vendor/github.com/google/go-github/github/issues.go
@@ -14,12 +14,11 @@ import (
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/issues/
-type IssuesService struct {
- client *Client
-}
+type IssuesService service
// Issue represents a GitHub issue on a repository.
type Issue struct {
+ ID *int `json:"id,omitempty"`
Number *int `json:"number,omitempty"`
State *string `json:"state,omitempty"`
Title *string `json:"title,omitempty"`
@@ -37,6 +36,7 @@ type Issue struct {
PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Reactions *Reactions `json:"reactions,omitempty"`
+ Assignees []*User `json:"assignees,omitempty"`
// TextMatches is only populated from search results that request text matches
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
@@ -57,6 +57,7 @@ type IssueRequest struct {
Assignee *string `json:"assignee,omitempty"`
State *string `json:"state,omitempty"`
Milestone *int `json:"milestone,omitempty"`
+ Assignees *[]string `json:"assignees,omitempty"`
}
// IssueListOptions specifies the optional parameters to the IssuesService.List
@@ -102,7 +103,7 @@ type PullRequestLinks struct {
// repositories.
//
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues
-func (s *IssuesService) List(all bool, opt *IssueListOptions) ([]Issue, *Response, error) {
+func (s *IssuesService) List(all bool, opt *IssueListOptions) ([]*Issue, *Response, error) {
var u string
if all {
u = "issues"
@@ -116,12 +117,12 @@ func (s *IssuesService) List(all bool, opt *IssueListOptions) ([]Issue, *Respons
// authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues
-func (s *IssuesService) ListByOrg(org string, opt *IssueListOptions) ([]Issue, *Response, error) {
+func (s *IssuesService) ListByOrg(org string, opt *IssueListOptions) ([]*Issue, *Response, error) {
u := fmt.Sprintf("orgs/%v/issues", org)
return s.listIssues(u, opt)
}
-func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]Issue, *Response, error) {
+func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]*Issue, *Response, error) {
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
@@ -135,7 +136,7 @@ func (s *IssuesService) listIssues(u string, opt *IssueListOptions) ([]Issue, *R
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)
- issues := new([]Issue)
+ issues := new([]*Issue)
resp, err := s.client.Do(req, issues)
if err != nil {
return nil, resp, err
@@ -187,7 +188,7 @@ type IssueListByRepoOptions struct {
// ListByRepo lists the issues for the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/issues/#list-issues-for-a-repository
-func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRepoOptions) ([]Issue, *Response, error) {
+func (s *IssuesService) ListByRepo(owner string, repo string, opt *IssueListByRepoOptions) ([]*Issue, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -202,7 +203,7 @@ 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)
+ issues := new([]*Issue)
resp, err := s.client.Do(req, issues)
if err != nil {
return nil, resp, err
@@ -281,9 +282,6 @@ func (s *IssuesService) Lock(owner string, repo string, number int) (*Response,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIssueLockingPreview)
-
return s.client.Do(req, nil)
}
@@ -297,8 +295,5 @@ func (s *IssuesService) Unlock(owner string, repo string, number int) (*Response
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeIssueLockingPreview)
-
return s.client.Do(req, nil)
}
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 6338c22..2503be1 100644
--- a/vendor/github.com/google/go-github/github/issues_assignees.go
+++ b/vendor/github.com/google/go-github/github/issues_assignees.go
@@ -11,7 +11,7 @@ import "fmt"
// which issues may be assigned.
//
// GitHub API docs: http://developer.github.com/v3/issues/assignees/#list-assignees
-func (s *IssuesService) ListAssignees(owner string, repo string, opt *ListOptions) ([]User, *Response, error) {
+func (s *IssuesService) ListAssignees(owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -22,7 +22,7 @@ func (s *IssuesService) ListAssignees(owner string, repo string, opt *ListOption
if err != nil {
return nil, nil, err
}
- assignees := new([]User)
+ assignees := new([]*User)
resp, err := s.client.Do(req, assignees)
if err != nil {
return nil, resp, err
@@ -34,7 +34,7 @@ func (s *IssuesService) ListAssignees(owner string, repo string, opt *ListOption
// IsAssignee checks if a user is an assignee for the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/issues/assignees/#check-assignee
-func (s *IssuesService) IsAssignee(owner string, repo string, user string) (bool, *Response, error) {
+func (s *IssuesService) IsAssignee(owner, repo, user string) (bool, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@@ -44,3 +44,39 @@ func (s *IssuesService) IsAssignee(owner string, repo string, user string) (bool
assignee, err := parseBoolResponse(err)
return assignee, resp, err
}
+
+// AddAssignees adds the provided GitHub users as assignees to the issue.
+//
+// GitHub API docs: https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
+func (s *IssuesService) AddAssignees(owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
+ users := &struct {
+ Assignees []string `json:"assignees,omitempty"`
+ }{Assignees: assignees}
+ u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
+ req, err := s.client.NewRequest("POST", u, users)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ issue := &Issue{}
+ resp, err := s.client.Do(req, issue)
+ return issue, resp, err
+}
+
+// RemoveAssignees removes the provided GitHub users as assignees from the issue.
+//
+// GitHub API docs: https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
+func (s *IssuesService) RemoveAssignees(owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
+ users := &struct {
+ Assignees []string `json:"assignees,omitempty"`
+ }{Assignees: assignees}
+ u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number)
+ req, err := s.client.NewRequest("DELETE", u, users)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ issue := &Issue{}
+ resp, err := s.client.Do(req, issue)
+ return issue, resp, err
+}
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 6dbc31e..b24c5ae 100644
--- a/vendor/github.com/google/go-github/github/issues_comments.go
+++ b/vendor/github.com/google/go-github/github/issues_comments.go
@@ -46,7 +46,7 @@ type IssueListCommentsOptions struct {
// number of 0 will return all comments on all issues for the repository.
//
// GitHub API docs: http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
-func (s *IssuesService) ListComments(owner string, repo string, number int, opt *IssueListCommentsOptions) ([]IssueComment, *Response, error) {
+func (s *IssuesService) ListComments(owner string, repo string, number int, opt *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
var u string
if number == 0 {
u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo)
@@ -66,7 +66,7 @@ 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)
+ comments := new([]*IssueComment)
resp, err := s.client.Do(req, comments)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/issues_events.go b/vendor/github.com/google/go-github/github/issues_events.go
index 9062d4d..71cf61a 100644
--- a/vendor/github.com/google/go-github/github/issues_events.go
+++ b/vendor/github.com/google/go-github/github/issues_events.go
@@ -73,7 +73,7 @@ type IssueEvent struct {
// ListIssueEvents lists events for the specified issue.
//
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-an-issue
-func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *ListOptions) ([]IssueEvent, *Response, error) {
+func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *ListOptions) ([]*IssueEvent, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number)
u, err := addOptions(u, opt)
if err != nil {
@@ -85,7 +85,7 @@ func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *Lis
return nil, nil, err
}
- var events []IssueEvent
+ var events []*IssueEvent
resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
@@ -97,7 +97,7 @@ func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *Lis
// ListRepositoryEvents lists events for the specified repository.
//
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-a-repository
-func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]IssueEvent, *Response, error) {
+func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -109,7 +109,7 @@ func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOption
return nil, nil, err
}
- var events []IssueEvent
+ var events []*IssueEvent
resp, err := s.client.Do(req, &events)
if err != nil {
return nil, resp, err
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 88f9f3f..c654547 100644
--- a/vendor/github.com/google/go-github/github/issues_labels.go
+++ b/vendor/github.com/google/go-github/github/issues_labels.go
@@ -21,7 +21,7 @@ func (l Label) String() string {
// ListLabels lists all labels for a repository.
//
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
-func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) ([]Label, *Response, error) {
+func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions) ([]*Label, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -33,7 +33,7 @@ func (s *IssuesService) ListLabels(owner string, repo string, opt *ListOptions)
return nil, nil, err
}
- labels := new([]Label)
+ labels := new([]*Label)
resp, err := s.client.Do(req, labels)
if err != nil {
return nil, resp, err
@@ -114,7 +114,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
-func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int, opt *ListOptions) ([]Label, *Response, error) {
+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)
if err != nil {
@@ -126,7 +126,7 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int,
return nil, nil, err
}
- labels := new([]Label)
+ labels := new([]*Label)
resp, err := s.client.Do(req, labels)
if err != nil {
return nil, resp, err
@@ -138,14 +138,14 @@ func (s *IssuesService) ListLabelsByIssue(owner string, repo string, number int,
// AddLabelsToIssue adds labels to an issue.
//
// GitHub API docs: http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
-func (s *IssuesService) AddLabelsToIssue(owner string, repo string, number int, labels []string) ([]Label, *Response, error) {
+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)
if err != nil {
return nil, nil, err
}
- l := new([]Label)
+ l := new([]*Label)
resp, err := s.client.Do(req, l)
if err != nil {
return nil, resp, err
@@ -169,14 +169,14 @@ func (s *IssuesService) RemoveLabelForIssue(owner string, repo string, number in
// ReplaceLabelsForIssue replaces all labels for an issue.
//
// GitHub API docs: http://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
-func (s *IssuesService) ReplaceLabelsForIssue(owner string, repo string, number int, labels []string) ([]Label, *Response, error) {
+func (s *IssuesService) ReplaceLabelsForIssue(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("PUT", u, labels)
if err != nil {
return nil, nil, err
}
- l := new([]Label)
+ l := new([]*Label)
resp, err := s.client.Do(req, l)
if err != nil {
return nil, resp, err
@@ -200,7 +200,7 @@ func (s *IssuesService) RemoveLabelsForIssue(owner string, repo string, number i
// ListLabelsForMilestone lists labels for every issue in a milestone.
//
// GitHub API docs: http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
-func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number int, opt *ListOptions) ([]Label, *Response, error) {
+func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number)
u, err := addOptions(u, opt)
if err != nil {
@@ -212,7 +212,7 @@ func (s *IssuesService) ListLabelsForMilestone(owner string, repo string, number
return nil, nil, err
}
- labels := new([]Label)
+ labels := new([]*Label)
resp, err := s.client.Do(req, labels)
if err != nil {
return nil, resp, err
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 cc07cd7..b7621ac 100644
--- a/vendor/github.com/google/go-github/github/issues_milestones.go
+++ b/vendor/github.com/google/go-github/github/issues_milestones.go
@@ -47,12 +47,14 @@ type MilestoneListOptions struct {
// Direction in which to sort milestones. Possible values are: asc, desc.
// Default is "asc".
Direction string `url:"direction,omitempty"`
+
+ ListOptions
}
// ListMilestones lists all milestones for a repository.
//
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
-func (s *IssuesService) ListMilestones(owner string, repo string, opt *MilestoneListOptions) ([]Milestone, *Response, error) {
+func (s *IssuesService) ListMilestones(owner string, repo string, opt *MilestoneListOptions) ([]*Milestone, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -64,7 +66,7 @@ func (s *IssuesService) ListMilestones(owner string, repo string, opt *Milestone
return nil, nil, err
}
- milestones := new([]Milestone)
+ milestones := new([]*Milestone)
resp, err := s.client.Do(req, milestones)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/issues_timeline.go b/vendor/github.com/google/go-github/github/issues_timeline.go
new file mode 100644
index 0000000..d20eef8
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/issues_timeline.go
@@ -0,0 +1,148 @@
+// Copyright 2016 The go-github AUTHORS. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package github
+
+import (
+ "fmt"
+ "time"
+)
+
+// Timeline represents an event that occurred around an Issue or Pull Request.
+//
+// It is similar to an IssueEvent but may contain more information.
+// GitHub API docs: https://developer.github.com/v3/issues/timeline/
+type Timeline struct {
+ ID *int `json:"id,omitempty"`
+ URL *string `json:"url,omitempty"`
+ CommitURL *string `json:"commit_url,omitempty"`
+
+ // The User object that generated the event.
+ Actor *User `json:"actor,omitempty"`
+
+ // Event identifies the actual type of Event that occurred. Possible values
+ // are:
+ //
+ // assigned
+ // The issue was assigned to the assignee.
+ //
+ // closed
+ // The issue was closed by the actor. When the commit_id is present, it
+ // identifies the commit that closed the issue using "closes / fixes #NN"
+ // syntax.
+ //
+ // commented
+ // A comment was added to the issue.
+ //
+ // committed
+ // A commit was added to the pull request's 'HEAD' branch. Only provided
+ // for pull requests.
+ //
+ // cross-referenced
+ // The issue was referenced from another issue. The 'source' attribute
+ // contains the 'id', 'actor', and 'url' of the reference's source.
+ //
+ // demilestoned
+ // The issue was removed from a milestone.
+ //
+ // head_ref_deleted
+ // The pull request's branch was deleted.
+ //
+ // head_ref_restored
+ // The pull request's branch was restored.
+ //
+ // labeled
+ // A label was added to the issue.
+ //
+ // locked
+ // The issue was locked by the actor.
+ //
+ // mentioned
+ // The actor was @mentioned in an issue body.
+ //
+ // merged
+ // The issue was merged by the actor. The 'commit_id' attribute is the
+ // SHA1 of the HEAD commit that was merged.
+ //
+ // milestoned
+ // The issue was added to a milestone.
+ //
+ // referenced
+ // The issue was referenced from a commit message. The 'commit_id'
+ // attribute is the commit SHA1 of where that happened.
+ //
+ // renamed
+ // The issue title was changed.
+ //
+ // reopened
+ // The issue was reopened by the actor.
+ //
+ // subscribed
+ // The actor subscribed to receive notifications for an issue.
+ //
+ // unassigned
+ // The assignee was unassigned from the issue.
+ //
+ // unlabeled
+ // A label was removed from the issue.
+ //
+ // unlocked
+ // The issue was unlocked by the actor.
+ //
+ // unsubscribed
+ // The actor unsubscribed to stop receiving notifications for an issue.
+ //
+ Event *string `json:"event,omitempty"`
+
+ // The string SHA of a commit that referenced this Issue or Pull Request.
+ CommitID *string `json:"commit_id,omitempty"`
+ // The timestamp indicating when the event occurred.
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ // The Label object including `name` and `color` attributes. Only provided for
+ // 'labeled' and 'unlabeled' events.
+ Label *Label `json:"label,omitempty"`
+ // The User object which was assigned to (or unassigned from) this Issue or
+ // Pull Request. Only provided for 'assigned' and 'unassigned' events.
+ Assignee *User `json:"assignee,omitempty"`
+ // The Milestone object including a 'title' attribute.
+ // Only provided for 'milestoned' and 'demilestoned' events.
+ Milestone *Milestone `json:"milestone,omitempty"`
+ // The 'id', 'actor', and 'url' for the source of a reference from another issue.
+ // Only provided for 'cross-referenced' events.
+ Source *Source `json:"source,omitempty"`
+ // An object containing rename details including 'from' and 'to' attributes.
+ // Only provided for 'renamed' events.
+ Rename *Rename `json:"rename,omitempty"`
+}
+
+// Source represents a reference's source.
+type Source struct {
+ ID *int `json:"id,omitempty"`
+ URL *string `json:"url,omitempty"`
+ Actor *User `json:"actor,omitempty"`
+}
+
+// ListIssueTimeline lists events for the specified issue.
+//
+// GitHub API docs: https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
+func (s *IssuesService) ListIssueTimeline(owner, repo string, number int, opt *ListOptions) ([]*Timeline, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number)
+ 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", mediaTypeTimelinePreview)
+
+ var events []*Timeline
+ resp, err := s.client.Do(req, &events)
+ return events, resp, err
+}
diff --git a/vendor/github.com/google/go-github/github/licenses.go b/vendor/github.com/google/go-github/github/licenses.go
index fb2fb5a..35cd234 100644
--- a/vendor/github.com/google/go-github/github/licenses.go
+++ b/vendor/github.com/google/go-github/github/licenses.go
@@ -11,9 +11,7 @@ import "fmt"
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/pulls/
-type LicensesService struct {
- client *Client
-}
+type LicensesService service
// License represents an open source license.
type License struct {
@@ -39,7 +37,7 @@ func (l License) String() string {
// List popular open source licenses.
//
// GitHub API docs: https://developer.github.com/v3/licenses/#list-all-licenses
-func (s *LicensesService) List() ([]License, *Response, error) {
+func (s *LicensesService) List() ([]*License, *Response, error) {
req, err := s.client.NewRequest("GET", "licenses", nil)
if err != nil {
return nil, nil, err
@@ -48,7 +46,7 @@ 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)
+ licenses := new([]*License)
resp, err := s.client.Do(req, licenses)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/messages.go b/vendor/github.com/google/go-github/github/messages.go
new file mode 100644
index 0000000..9f0aba9
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/messages.go
@@ -0,0 +1,119 @@
+// Copyright 2016 The go-github AUTHORS. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file provides functions for validating payloads from GitHub Webhooks.
+// GitHub docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github
+
+package github
+
+import (
+ "crypto/hmac"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/sha512"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "hash"
+ "io/ioutil"
+ "net/http"
+ "strings"
+)
+
+const (
+ // sha1Prefix is the prefix used by GitHub before the HMAC hexdigest.
+ sha1Prefix = "sha1"
+ // sha256Prefix and sha512Prefix are provided for future compatibility.
+ sha256Prefix = "sha256"
+ sha512Prefix = "sha512"
+ // signatureHeader is the GitHub header key used to pass the HMAC hexdigest.
+ signatureHeader = "X-Hub-Signature"
+)
+
+// genMAC generates the HMAC signature for a message provided the secret key
+// and hashFunc.
+func genMAC(message, key []byte, hashFunc func() hash.Hash) []byte {
+ mac := hmac.New(hashFunc, key)
+ mac.Write(message)
+ return mac.Sum(nil)
+}
+
+// checkMAC reports whether messageMAC is a valid HMAC tag for message.
+func checkMAC(message, messageMAC, key []byte, hashFunc func() hash.Hash) bool {
+ expectedMAC := genMAC(message, key, hashFunc)
+ return hmac.Equal(messageMAC, expectedMAC)
+}
+
+// messageMAC returns the hex-decoded HMAC tag from the signature and its
+// corresponding hash function.
+func messageMAC(signature string) ([]byte, func() hash.Hash, error) {
+ if signature == "" {
+ return nil, nil, errors.New("missing signature")
+ }
+ sigParts := strings.SplitN(signature, "=", 2)
+ if len(sigParts) != 2 {
+ return nil, nil, fmt.Errorf("error parsing signature %q", signature)
+ }
+
+ var hashFunc func() hash.Hash
+ switch sigParts[0] {
+ case sha1Prefix:
+ hashFunc = sha1.New
+ case sha256Prefix:
+ hashFunc = sha256.New
+ case sha512Prefix:
+ hashFunc = sha512.New
+ default:
+ return nil, nil, fmt.Errorf("unknown hash type prefix: %q", sigParts[0])
+ }
+
+ buf, err := hex.DecodeString(sigParts[1])
+ if err != nil {
+ return nil, nil, fmt.Errorf("error decoding signature %q: %v", signature, err)
+ }
+ return buf, hashFunc, nil
+}
+
+// ValidatePayload validates an incoming GitHub Webhook event request
+// and returns the (JSON) payload.
+// secretKey is the GitHub Webhook secret message.
+//
+// Example usage:
+//
+// func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+// payload, err := github.ValidatePayload(r, s.webhookSecretKey)
+// if err != nil { ... }
+// // Process payload...
+// }
+//
+func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err error) {
+ payload, err = ioutil.ReadAll(r.Body)
+ if err != nil {
+ return nil, err
+ }
+
+ sig := r.Header.Get(signatureHeader)
+ if err := validateSignature(sig, payload, secretKey); err != nil {
+ return nil, err
+ }
+ return payload, nil
+}
+
+// validateSignature validates the signature for the given payload.
+// signature is the GitHub hash signature delivered in the X-Hub-Signature header.
+// payload is the JSON payload sent by GitHub Webhooks.
+// secretKey is the GitHub Webhook secret message.
+//
+// GitHub docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github
+func validateSignature(signature string, payload, secretKey []byte) error {
+ messageMAC, hashFunc, err := messageMAC(signature)
+ if err != nil {
+ return err
+ }
+ if !checkMAC(payload, messageMAC, secretKey, hashFunc) {
+ return errors.New("payload signature check failed")
+ }
+ return nil
+}
diff --git a/vendor/github.com/google/go-github/github/migrations.go b/vendor/github.com/google/go-github/github/migrations.go
index 8a7bc5f..a7890b0 100644
--- a/vendor/github.com/google/go-github/github/migrations.go
+++ b/vendor/github.com/google/go-github/github/migrations.go
@@ -16,9 +16,7 @@ import (
// in the GitHub API.
//
// GitHub API docs: https://developer.github.com/v3/migration/
-type MigrationService struct {
- client *Client
-}
+type MigrationService service
// Migration represents a GitHub migration (archival).
type Migration struct {
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 4861698..6ed4acf 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
@@ -220,7 +220,7 @@ func (s *MigrationService) UpdateImport(owner, repo string, in *Import) (*Import
// information.
//
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors
-func (s *MigrationService) CommitAuthors(owner, repo string) ([]SourceImportAuthor, *Response, error) {
+func (s *MigrationService) CommitAuthors(owner, repo string) ([]*SourceImportAuthor, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@@ -230,7 +230,7 @@ func (s *MigrationService) CommitAuthors(owner, repo string) ([]SourceImportAuth
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeImportPreview)
- authors := new([]SourceImportAuthor)
+ authors := new([]*SourceImportAuthor)
resp, err := s.client.Do(req, authors)
if err != nil {
return nil, resp, err
@@ -290,7 +290,7 @@ func (s *MigrationService) SetLFSPreference(owner, repo string, in *Import) (*Im
// LargeFiles lists files larger than 100MB found during the import.
//
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files
-func (s *MigrationService) LargeFiles(owner, repo string) ([]LargeFile, *Response, error) {
+func (s *MigrationService) LargeFiles(owner, repo string) ([]*LargeFile, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@@ -300,7 +300,7 @@ func (s *MigrationService) LargeFiles(owner, repo string) ([]LargeFile, *Respons
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeImportPreview)
- files := new([]LargeFile)
+ files := new([]*LargeFile)
resp, err := s.client.Do(req, files)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/misc.go b/vendor/github.com/google/go-github/github/misc.go
index 66e7f52..8576a4c 100644
--- a/vendor/github.com/google/go-github/github/misc.go
+++ b/vendor/github.com/google/go-github/github/misc.go
@@ -180,14 +180,14 @@ func (s *ServiceHook) String() string {
// ListServiceHooks lists all of the available service hooks.
//
// GitHub API docs: https://developer.github.com/webhooks/#services
-func (c *Client) ListServiceHooks() ([]ServiceHook, *Response, error) {
+func (c *Client) ListServiceHooks() ([]*ServiceHook, *Response, error) {
u := "hooks"
req, err := c.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
- hooks := new([]ServiceHook)
+ hooks := new([]*ServiceHook)
resp, err := c.Do(req, hooks)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/orgs.go b/vendor/github.com/google/go-github/github/orgs.go
index 6018a3a..e71055c 100644
--- a/vendor/github.com/google/go-github/github/orgs.go
+++ b/vendor/github.com/google/go-github/github/orgs.go
@@ -14,9 +14,7 @@ import (
// in the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/orgs/
-type OrganizationsService struct {
- client *Client
-}
+type OrganizationsService service
// Organization represents a GitHub organization account.
type Organization struct {
@@ -73,6 +71,8 @@ func (p Plan) String() string {
type OrganizationsListOptions struct {
// Since filters Organizations by ID.
Since int `url:"since,omitempty"`
+
+ ListOptions
}
// ListAll lists all organizations, in the order that they were created on GitHub.
@@ -82,7 +82,7 @@ type OrganizationsListOptions struct {
// as the opts.Since parameter for the next call.
//
// GitHub API docs: https://developer.github.com/v3/orgs/#list-all-organizations
-func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]Organization, *Response, error) {
+func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]*Organization, *Response, error) {
u, err := addOptions("organizations", opt)
if err != nil {
return nil, nil, err
@@ -93,7 +93,7 @@ func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]Organiz
return nil, nil, err
}
- orgs := []Organization{}
+ orgs := []*Organization{}
resp, err := s.client.Do(req, &orgs)
if err != nil {
return nil, resp, err
@@ -105,7 +105,7 @@ func (s *OrganizationsService) ListAll(opt *OrganizationsListOptions) ([]Organiz
// organizations for the authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/orgs/#list-user-organizations
-func (s *OrganizationsService) List(user string, opt *ListOptions) ([]Organization, *Response, error) {
+func (s *OrganizationsService) List(user string, opt *ListOptions) ([]*Organization, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/orgs", user)
@@ -122,7 +122,7 @@ func (s *OrganizationsService) List(user string, opt *ListOptions) ([]Organizati
return nil, nil, err
}
- orgs := new([]Organization)
+ orgs := new([]*Organization)
resp, err := s.client.Do(req, orgs)
if err != nil {
return nil, resp, err
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 3e7ad40..95b8322 100644
--- a/vendor/github.com/google/go-github/github/orgs_hooks.go
+++ b/vendor/github.com/google/go-github/github/orgs_hooks.go
@@ -10,7 +10,7 @@ import "fmt"
// ListHooks lists all Hooks for the specified organization.
//
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#list-hooks
-func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]Hook, *Response, error) {
+func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]*Hook, *Response, error) {
u := fmt.Sprintf("orgs/%v/hooks", org)
u, err := addOptions(u, opt)
if err != nil {
@@ -22,7 +22,7 @@ func (s *OrganizationsService) ListHooks(org string, opt *ListOptions) ([]Hook,
return nil, nil, err
}
- hooks := new([]Hook)
+ hooks := new([]*Hook)
resp, err := s.client.Do(req, hooks)
if err != nil {
return nil, resp, err
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 01a9ba9..80454ad 100644
--- a/vendor/github.com/google/go-github/github/orgs_members.go
+++ b/vendor/github.com/google/go-github/github/orgs_members.go
@@ -69,7 +69,7 @@ type ListMembersOptions struct {
// public members, otherwise it will only return public members.
//
// GitHub API docs: http://developer.github.com/v3/orgs/members/#members-list
-func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions) ([]User, *Response, error) {
+func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions) ([]*User, *Response, error) {
var u string
if opt != nil && opt.PublicOnly {
u = fmt.Sprintf("orgs/%v/public_members", org)
@@ -86,11 +86,7 @@ func (s *OrganizationsService) ListMembers(org string, opt *ListMembersOptions)
return nil, nil, err
}
- if opt != nil && opt.Role != "" {
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
- }
-
- members := new([]User)
+ members := new([]*User)
resp, err := s.client.Do(req, members)
if err != nil {
return nil, resp, err
@@ -182,7 +178,7 @@ type ListOrgMembershipsOptions struct {
// ListOrgMemberships lists the organization memberships for the authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-your-organization-memberships
-func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions) ([]Membership, *Response, error) {
+func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions) ([]*Membership, *Response, error) {
u := "user/memberships/orgs"
u, err := addOptions(u, opt)
if err != nil {
@@ -194,7 +190,7 @@ func (s *OrganizationsService) ListOrgMemberships(opt *ListOrgMembershipsOptions
return nil, nil, err
}
- var memberships []Membership
+ var memberships []*Membership
resp, err := s.client.Do(req, &memberships)
if err != nil {
return nil, resp, err
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 ddcaa24..8e8550c 100644
--- a/vendor/github.com/google/go-github/github/orgs_teams.go
+++ b/vendor/github.com/google/go-github/github/orgs_teams.go
@@ -44,7 +44,7 @@ func (t Team) String() string {
// ListTeams lists all of the teams for an organization.
//
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-teams
-func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]Team, *Response, error) {
+func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]*Team, *Response, error) {
u := fmt.Sprintf("orgs/%v/teams", org)
u, err := addOptions(u, opt)
if err != nil {
@@ -56,7 +56,7 @@ func (s *OrganizationsService) ListTeams(org string, opt *ListOptions) ([]Team,
return nil, nil, err
}
- teams := new([]Team)
+ teams := new([]*Team)
resp, err := s.client.Do(req, teams)
if err != nil {
return nil, resp, err
@@ -94,10 +94,6 @@ func (s *OrganizationsService) CreateTeam(org string, team *Team) (*Team, *Respo
return nil, nil, err
}
- if team.Privacy != nil {
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
- }
-
t := new(Team)
resp, err := s.client.Do(req, t)
if err != nil {
@@ -117,10 +113,6 @@ func (s *OrganizationsService) EditTeam(id int, team *Team) (*Team, *Response, e
return nil, nil, err
}
- if team.Privacy != nil {
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
- }
-
t := new(Team)
resp, err := s.client.Do(req, t)
if err != nil {
@@ -157,7 +149,7 @@ type OrganizationListTeamMembersOptions struct {
// team.
//
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-team-members
-func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTeamMembersOptions) ([]User, *Response, error) {
+func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) {
u := fmt.Sprintf("teams/%v/members", team)
u, err := addOptions(u, opt)
if err != nil {
@@ -169,11 +161,7 @@ func (s *OrganizationsService) ListTeamMembers(team int, opt *OrganizationListTe
return nil, nil, err
}
- if opt != nil && opt.Role != "" {
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
- }
-
- members := new([]User)
+ members := new([]*User)
resp, err := s.client.Do(req, members)
if err != nil {
return nil, resp, err
@@ -200,7 +188,7 @@ func (s *OrganizationsService) IsTeamMember(team int, user string) (bool, *Respo
// ListTeamRepos lists the repositories that the specified team has access to.
//
// GitHub API docs: http://developer.github.com/v3/orgs/teams/#list-team-repos
-func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]Repository, *Response, error) {
+func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]*Repository, *Response, error) {
u := fmt.Sprintf("teams/%v/repos", team)
u, err := addOptions(u, opt)
if err != nil {
@@ -212,7 +200,7 @@ func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]Repo
return nil, nil, err
}
- repos := new([]Repository)
+ repos := new([]*Repository)
resp, err := s.client.Do(req, repos)
if err != nil {
return nil, resp, err
@@ -225,7 +213,7 @@ func (s *OrganizationsService) ListTeamRepos(team int, opt *ListOptions) ([]Repo
// repository is managed by team, a Repository is returned which includes the
// permissions team has for that repo.
//
-// GitHub API docs: http://developer.github.com/v3/orgs/teams/#get-team-repo
+// GitHub API docs: https://developer.github.com/v3/orgs/teams/#check-if-a-team-manages-a-repository
func (s *OrganizationsService) IsTeamRepo(team int, owner string, repo string) (*Repository, *Response, error) {
u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
@@ -233,7 +221,7 @@ func (s *OrganizationsService) IsTeamRepo(team int, owner string, repo string) (
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeOrgPermissionRepoPreview)
+ req.Header.Set("Accept", mediaTypeOrgPermissionRepo)
repository := new(Repository)
resp, err := s.client.Do(req, repository)
@@ -269,10 +257,6 @@ func (s *OrganizationsService) AddTeamRepo(team int, owner string, repo string,
return nil, err
}
- if opt != nil {
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
- }
-
return s.client.Do(req, nil)
}
@@ -293,7 +277,7 @@ func (s *OrganizationsService) RemoveTeamRepo(team int, owner string, repo strin
// ListUserTeams lists a user's teams
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-user-teams
-func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]Team, *Response, error) {
+func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]*Team, *Response, error) {
u := "user/teams"
u, err := addOptions(u, opt)
if err != nil {
@@ -305,7 +289,7 @@ func (s *OrganizationsService) ListUserTeams(opt *ListOptions) ([]Team, *Respons
return nil, nil, err
}
- teams := new([]Team)
+ teams := new([]*Team)
resp, err := s.client.Do(req, teams)
if err != nil {
return nil, resp, err
@@ -372,10 +356,6 @@ func (s *OrganizationsService) AddTeamMembership(team int, user string, opt *Org
return nil, nil, err
}
- if opt != nil {
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
- }
-
t := new(Membership)
resp, err := s.client.Do(req, t)
if err != nil {
diff --git a/vendor/github.com/google/go-github/github/pulls.go b/vendor/github.com/google/go-github/github/pulls.go
index 8f31ab5..0900766 100644
--- a/vendor/github.com/google/go-github/github/pulls.go
+++ b/vendor/github.com/google/go-github/github/pulls.go
@@ -14,12 +14,11 @@ import (
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/pulls/
-type PullRequestsService struct {
- client *Client
-}
+type PullRequestsService service
// PullRequest represents a GitHub pull request on a repository.
type PullRequest struct {
+ ID *int `json:"id,omitempty"`
Number *int `json:"number,omitempty"`
State *string `json:"state,omitempty"`
Title *string `json:"title,omitempty"`
@@ -91,7 +90,7 @@ type PullRequestListOptions struct {
// List the pull requests for the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/pulls/#list-pull-requests
-func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestListOptions) ([]PullRequest, *Response, error) {
+func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestListOptions) ([]*PullRequest, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -103,7 +102,7 @@ func (s *PullRequestsService) List(owner string, repo string, opt *PullRequestLi
return nil, nil, err
}
- pulls := new([]PullRequest)
+ pulls := new([]*PullRequest)
resp, err := s.client.Do(req, pulls)
if err != nil {
return nil, resp, err
@@ -181,7 +180,7 @@ func (s *PullRequestsService) Edit(owner string, repo string, number int, pull *
// ListCommits lists the commits in a pull request.
//
// GitHub API docs: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
-func (s *PullRequestsService) ListCommits(owner string, repo string, number int, opt *ListOptions) ([]RepositoryCommit, *Response, error) {
+func (s *PullRequestsService) ListCommits(owner string, repo string, number int, opt *ListOptions) ([]*RepositoryCommit, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number)
u, err := addOptions(u, opt)
if err != nil {
@@ -193,7 +192,7 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int,
return nil, nil, err
}
- commits := new([]RepositoryCommit)
+ commits := new([]*RepositoryCommit)
resp, err := s.client.Do(req, commits)
if err != nil {
return nil, resp, err
@@ -205,7 +204,7 @@ func (s *PullRequestsService) ListCommits(owner string, repo string, number int,
// ListFiles lists the files in a pull request.
//
// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests-files
-func (s *PullRequestsService) ListFiles(owner string, repo string, number int, opt *ListOptions) ([]CommitFile, *Response, error) {
+func (s *PullRequestsService) ListFiles(owner string, repo string, number int, opt *ListOptions) ([]*CommitFile, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number)
u, err := addOptions(u, opt)
if err != nil {
@@ -217,7 +216,7 @@ func (s *PullRequestsService) ListFiles(owner string, repo string, number int, o
return nil, nil, err
}
- commitFiles := new([]CommitFile)
+ commitFiles := new([]*CommitFile)
resp, err := s.client.Do(req, commitFiles)
if err != nil {
return nil, resp, err
@@ -248,20 +247,30 @@ type PullRequestMergeResult struct {
Message *string `json:"message,omitempty"`
}
+// PullRequestOptions lets you define how a pull request will be merged.
+type PullRequestOptions struct {
+ Squash bool
+}
+
type pullRequestMergeRequest struct {
CommitMessage *string `json:"commit_message"`
+ Squash *bool `json:"squash,omitempty"`
}
// Merge a pull request (Merge Buttonâ„¢).
//
// GitHub API docs: https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade
-func (s *PullRequestsService) Merge(owner string, repo string, number int, commitMessage string) (*PullRequestMergeResult, *Response, error) {
+func (s *PullRequestsService) Merge(owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
- req, err := s.client.NewRequest("PUT", u, &pullRequestMergeRequest{
- CommitMessage: &commitMessage,
- })
+ pullRequestBody := &pullRequestMergeRequest{CommitMessage: &commitMessage}
+ if options != nil {
+ pullRequestBody.Squash = &options.Squash
+ }
+ req, err := s.client.NewRequest("PUT", u, pullRequestBody)
+ // TODO: This header will be unnecessary when the API is no longer in preview.
+ req.Header.Set("Accept", mediaTypeSquashPreview)
if err != nil {
return nil, nil, err
}
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 247f179..c7af85a 100644
--- a/vendor/github.com/google/go-github/github/pulls_comments.go
+++ b/vendor/github.com/google/go-github/github/pulls_comments.go
@@ -54,7 +54,7 @@ type PullRequestListCommentsOptions struct {
// the repository.
//
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
-func (s *PullRequestsService) ListComments(owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]PullRequestComment, *Response, error) {
+func (s *PullRequestsService) ListComments(owner string, repo string, number int, opt *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) {
var u string
if number == 0 {
u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo)
@@ -74,7 +74,7 @@ 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)
+ comments := new([]*PullRequestComment)
resp, err := s.client.Do(req, comments)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/reactions.go b/vendor/github.com/google/go-github/github/reactions.go
index 283938a..03b131b 100644
--- a/vendor/github.com/google/go-github/github/reactions.go
+++ b/vendor/github.com/google/go-github/github/reactions.go
@@ -11,15 +11,13 @@ import "fmt"
// GitHub API.
//
// GitHub API docs: https://developer.github.com/v3/reactions/
-type ReactionsService struct {
- client *Client
-}
+type ReactionsService service
// Reaction represents a GitHub reaction.
type Reaction struct {
// ID is the Reaction ID.
- ID *int `json:"id,omitempty"`
- UserID *int `json:"user_id,omitempty"`
+ ID *int `json:"id,omitempty"`
+ User *User `json:"user,omitempty"`
// Content is the type of reaction.
// Possible values are:
// "+1", "-1", "laugh", "confused", "heart", "hooray".
@@ -258,7 +256,7 @@ func (s ReactionsService) CreatePullRequestCommentReaction(owner, repo string, i
//
// GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive
func (s *ReactionsService) DeleteReaction(id int) (*Response, error) {
- u := fmt.Sprintf("/reactions/%v", id)
+ u := fmt.Sprintf("reactions/%v", id)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
diff --git a/vendor/github.com/google/go-github/github/repos.go b/vendor/github.com/google/go-github/github/repos.go
index 4909b16..fb402ee 100644
--- a/vendor/github.com/google/go-github/github/repos.go
+++ b/vendor/github.com/google/go-github/github/repos.go
@@ -11,9 +11,7 @@ import "fmt"
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/repos/
-type RepositoriesService struct {
- client *Client
-}
+type RepositoriesService service
// Repository represents a GitHub repository.
type Repository struct {
@@ -110,16 +108,33 @@ func (r Repository) String() string {
// RepositoryListOptions specifies the optional parameters to the
// RepositoriesService.List method.
type RepositoryListOptions struct {
- // Type of repositories to list. Possible values are: all, owner, public,
- // private, member. Default is "all".
+ // Visibility of repositories to list. Can be one of all, public, or private.
+ // Default: all
+ Visibility string `url:"visibility,omitempty"`
+
+ // List repos of given affiliation[s].
+ // Comma-separated list of values. Can include:
+ // * owner: Repositories that are owned by the authenticated user.
+ // * collaborator: Repositories that the user has been added to as a
+ // collaborator.
+ // * organization_member: Repositories that the user has access to through
+ // being a member of an organization. This includes every repository on
+ // every team that the user is on.
+ // Default: owner,collaborator,organization_member
+ Affiliation string `url:"affiliation,omitempty"`
+
+ // Type of repositories to list.
+ // Can be one of all, owner, public, private, member. Default: all
+ // Will cause a 422 error if used in the same request as visibility or
+ // affiliation.
Type string `url:"type,omitempty"`
- // How to sort the repository list. Possible values are: created, updated,
- // pushed, full_name. Default is "full_name".
+ // How to sort the repository list. Can be one of created, updated, pushed,
+ // full_name. Default: full_name
Sort string `url:"sort,omitempty"`
- // Direction in which to sort repositories. Possible values are: asc, desc.
- // Default is "asc" when sort is "full_name", otherwise default is "desc".
+ // Direction in which to sort repositories. Can be one of asc or desc.
+ // Default: when using full_name: asc; otherwise desc
Direction string `url:"direction,omitempty"`
ListOptions
@@ -129,7 +144,7 @@ type RepositoryListOptions struct {
// repositories for the authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/repos/#list-user-repositories
-func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]Repository, *Response, error) {
+func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]*Repository, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/repos", user)
@@ -149,7 +164,7 @@ func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]R
// TODO: remove custom Accept header when license support fully launches
req.Header.Set("Accept", mediaTypeLicensesPreview)
- repos := new([]Repository)
+ repos := new([]*Repository)
resp, err := s.client.Do(req, repos)
if err != nil {
return nil, resp, err
@@ -171,7 +186,7 @@ type RepositoryListByOrgOptions struct {
// ListByOrg lists the repositories for an organization.
//
// GitHub API docs: http://developer.github.com/v3/repos/#list-organization-repositories
-func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOptions) ([]Repository, *Response, error) {
+func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOptions) ([]*Repository, *Response, error) {
u := fmt.Sprintf("orgs/%v/repos", org)
u, err := addOptions(u, opt)
if err != nil {
@@ -186,7 +201,7 @@ 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)
+ repos := new([]*Repository)
resp, err := s.client.Do(req, repos)
if err != nil {
return nil, resp, err
@@ -207,7 +222,7 @@ type RepositoryListAllOptions struct {
// ListAll lists all GitHub repositories in the order that they were created.
//
// GitHub API docs: http://developer.github.com/v3/repos/#list-all-public-repositories
-func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]Repository, *Response, error) {
+func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]*Repository, *Response, error) {
u, err := addOptions("repositories", opt)
if err != nil {
return nil, nil, err
@@ -218,7 +233,7 @@ func (s *RepositoriesService) ListAll(opt *RepositoryListAllOptions) ([]Reposito
return nil, nil, err
}
- repos := new([]Repository)
+ repos := new([]*Repository)
resp, err := s.client.Do(req, repos)
if err != nil {
return nil, resp, err
@@ -366,7 +381,7 @@ type ListContributorsOptions struct {
// ListContributors lists contributors for a repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/#list-contributors
-func (s *RepositoriesService) ListContributors(owner string, repository string, opt *ListContributorsOptions) ([]Contributor, *Response, error) {
+func (s *RepositoriesService) ListContributors(owner string, repository string, opt *ListContributorsOptions) ([]*Contributor, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository)
u, err := addOptions(u, opt)
if err != nil {
@@ -378,7 +393,7 @@ func (s *RepositoriesService) ListContributors(owner string, repository string,
return nil, nil, err
}
- contributor := new([]Contributor)
+ contributor := new([]*Contributor)
resp, err := s.client.Do(req, contributor)
if err != nil {
return nil, nil, err
@@ -416,7 +431,7 @@ func (s *RepositoriesService) ListLanguages(owner string, repo string) (map[stri
// ListTeams lists the teams for the specified repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/#list-teams
-func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOptions) ([]Team, *Response, error) {
+func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOptions) ([]*Team, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/teams", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -428,7 +443,7 @@ func (s *RepositoriesService) ListTeams(owner string, repo string, opt *ListOpti
return nil, nil, err
}
- teams := new([]Team)
+ teams := new([]*Team)
resp, err := s.client.Do(req, teams)
if err != nil {
return nil, resp, err
@@ -448,7 +463,7 @@ type RepositoryTag struct {
// ListTags lists tags for the specified repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/#list-tags
-func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptions) ([]RepositoryTag, *Response, error) {
+func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptions) ([]*RepositoryTag, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/tags", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -460,7 +475,7 @@ func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptio
return nil, nil, err
}
- tags := new([]RepositoryTag)
+ tags := new([]*RepositoryTag)
resp, err := s.client.Do(req, tags)
if err != nil {
return nil, resp, err
@@ -497,7 +512,7 @@ type RequiredStatusChecks struct {
// ListBranches lists branches for the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/#list-branches
-func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListOptions) ([]Branch, *Response, error) {
+func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListOptions) ([]*Branch, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/branches", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -511,7 +526,7 @@ func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListO
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
- branches := new([]Branch)
+ branches := new([]*Branch)
resp, err := s.client.Do(req, branches)
if err != nil {
return nil, resp, err
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 61dc4ef..68a9f46 100644
--- a/vendor/github.com/google/go-github/github/repos_collaborators.go
+++ b/vendor/github.com/google/go-github/github/repos_collaborators.go
@@ -10,7 +10,7 @@ import "fmt"
// ListCollaborators lists the Github users that have access to the repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/collaborators/#list
-func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOptions) ([]User, *Response, error) {
+func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOptions) ([]*User, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -22,9 +22,7 @@ func (s *RepositoriesService) ListCollaborators(owner, repo string, opt *ListOpt
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
-
- users := new([]User)
+ users := new([]*User)
resp, err := s.client.Do(req, users)
if err != nil {
return nil, resp, err
@@ -60,13 +58,13 @@ type RepositoryAddCollaboratorOptions struct {
// push - team members can pull and push, but not administer this repository
// admin - team members can pull, push and administer this repository
//
- // Default value is "pull". This option is only valid for organization-owned repositories.
+ // Default value is "push". This option is only valid for organization-owned repositories.
Permission string `json:"permission,omitempty"`
}
// AddCollaborator adds the specified Github user as collaborator to the given repo.
//
-// GitHub API docs: http://developer.github.com/v3/repos/collaborators/#add-collaborator
+// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
func (s *RepositoriesService) AddCollaborator(owner, repo, user string, opt *RepositoryAddCollaboratorOptions) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
req, err := s.client.NewRequest("PUT", u, opt)
@@ -74,9 +72,8 @@ func (s *RepositoriesService) AddCollaborator(owner, repo, user string, opt *Rep
return nil, err
}
- if opt != nil {
- req.Header.Set("Accept", mediaTypeOrgPermissionPreview)
- }
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
return s.client.Do(req, nil)
}
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 bba0fe7..34a8d02 100644
--- a/vendor/github.com/google/go-github/github/repos_comments.go
+++ b/vendor/github.com/google/go-github/github/repos_comments.go
@@ -35,7 +35,7 @@ func (r RepositoryComment) String() string {
// ListComments lists all the comments for the repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
-func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) ([]RepositoryComment, *Response, error) {
+func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/comments", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -50,7 +50,7 @@ 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)
+ comments := new([]*RepositoryComment)
resp, err := s.client.Do(req, comments)
if err != nil {
return nil, resp, err
@@ -62,7 +62,7 @@ func (s *RepositoriesService) ListComments(owner, repo string, opt *ListOptions)
// ListCommitComments lists all the comments for a given commit SHA.
//
// GitHub API docs: http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
-func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *ListOptions) ([]RepositoryComment, *Response, error) {
+func (s *RepositoriesService) ListCommitComments(owner, repo, sha string, opt *ListOptions) ([]*RepositoryComment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
u, err := addOptions(u, opt)
if err != nil {
@@ -77,7 +77,7 @@ 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)
+ comments := new([]*RepositoryComment)
resp, err := s.client.Do(req, comments)
if err != nil {
return nil, resp, err
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 9cbdbfd..b5e6856 100644
--- a/vendor/github.com/google/go-github/github/repos_commits.go
+++ b/vendor/github.com/google/go-github/github/repos_commits.go
@@ -33,7 +33,7 @@ func (r RepositoryCommit) String() string {
return Stringify(r)
}
-// CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit.
+// CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit or GistCommit.
type CommitStats struct {
Additions *int `json:"additions,omitempty"`
Deletions *int `json:"deletions,omitempty"`
@@ -104,7 +104,7 @@ type CommitsListOptions struct {
// ListCommits lists the commits of a repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/commits/#list
-func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOptions) ([]RepositoryCommit, *Response, error) {
+func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOptions) ([]*RepositoryCommit, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -116,7 +116,7 @@ func (s *RepositoriesService) ListCommits(owner, repo string, opt *CommitsListOp
return nil, nil, err
}
- commits := new([]RepositoryCommit)
+ commits := new([]*RepositoryCommit)
resp, err := s.client.Do(req, commits)
if err != nil {
return nil, resp, err
@@ -138,6 +138,9 @@ func (s *RepositoriesService) GetCommit(owner, repo, sha string) (*RepositoryCom
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGitSigningPreview)
+
commit := new(RepositoryCommit)
resp, err := s.client.Do(req, commit)
if err != nil {
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 214b713..f3272b0 100644
--- a/vendor/github.com/google/go-github/github/repos_deployments.go
+++ b/vendor/github.com/google/go-github/github/repos_deployments.go
@@ -61,7 +61,7 @@ type DeploymentsListOptions struct {
// ListDeployments lists the deployments of a repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployments
-func (s *RepositoriesService) ListDeployments(owner, repo string, opt *DeploymentsListOptions) ([]Deployment, *Response, error) {
+func (s *RepositoriesService) ListDeployments(owner, repo string, opt *DeploymentsListOptions) ([]*Deployment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -73,7 +73,7 @@ func (s *RepositoriesService) ListDeployments(owner, repo string, opt *Deploymen
return nil, nil, err
}
- deployments := new([]Deployment)
+ deployments := new([]*Deployment)
resp, err := s.client.Do(req, deployments)
if err != nil {
return nil, resp, err
@@ -134,7 +134,7 @@ type DeploymentStatusRequest struct {
// ListDeploymentStatuses lists the statuses of a given deployment of a repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
-func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deployment int, opt *ListOptions) ([]DeploymentStatus, *Response, error) {
+func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deployment int, opt *ListOptions) ([]*DeploymentStatus, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
u, err := addOptions(u, opt)
if err != nil {
@@ -146,7 +146,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deploym
return nil, nil, err
}
- statuses := new([]DeploymentStatus)
+ statuses := new([]*DeploymentStatus)
resp, err := s.client.Do(req, statuses)
if err != nil {
return nil, resp, err
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 1fec829..92e9f27 100644
--- a/vendor/github.com/google/go-github/github/repos_forks.go
+++ b/vendor/github.com/google/go-github/github/repos_forks.go
@@ -20,7 +20,7 @@ type RepositoryListForksOptions struct {
// ListForks lists the forks of the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/forks/#list-forks
-func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListForksOptions) ([]Repository, *Response, error) {
+func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListForksOptions) ([]*Repository, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -32,7 +32,7 @@ func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListF
return nil, nil, err
}
- repos := new([]Repository)
+ repos := new([]*Repository)
resp, err := s.client.Do(req, repos)
if err != nil {
return nil, resp, err
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 4370c16..fe725b4 100644
--- a/vendor/github.com/google/go-github/github/repos_hooks.go
+++ b/vendor/github.com/google/go-github/github/repos_hooks.go
@@ -105,7 +105,7 @@ func (s *RepositoriesService) CreateHook(owner, repo string, hook *Hook) (*Hook,
// ListHooks lists all Hooks for the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/hooks/#list
-func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([]Hook, *Response, error) {
+func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([]*Hook, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -117,7 +117,7 @@ func (s *RepositoriesService) ListHooks(owner, repo string, opt *ListOptions) ([
return nil, nil, err
}
- hooks := new([]Hook)
+ hooks := new([]*Hook)
resp, err := s.client.Do(req, hooks)
if err != nil {
return nil, resp, err
@@ -191,6 +191,6 @@ func (s *RepositoriesService) TestHook(owner, repo string, id int) (*Response, e
}
// ListServiceHooks is deprecated. Use Client.ListServiceHooks instead.
-func (s *RepositoriesService) ListServiceHooks() ([]ServiceHook, *Response, error) {
+func (s *RepositoriesService) ListServiceHooks() ([]*ServiceHook, *Response, error) {
return s.client.ListServiceHooks()
}
diff --git a/vendor/github.com/google/go-github/github/repos_invitations.go b/vendor/github.com/google/go-github/github/repos_invitations.go
new file mode 100644
index 0000000..f2806d1
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/repos_invitations.go
@@ -0,0 +1,91 @@
+// Copyright 2016 The go-github AUTHORS. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package github
+
+import "fmt"
+
+// RepositoryInvitation represents an invitation to collaborate on a repo.
+type RepositoryInvitation struct {
+ ID *int `json:"id,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Invitee *User `json:"invitee,omitempty"`
+ Inviter *User `json:"inviter,omitempty"`
+
+ // Permissions represents the permissions that the associated user will have
+ // on the repository. Possible values are: "read", "write", "admin".
+ Permissions *string `json:"permissions,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ URL *string `json:"url,omitempty"`
+ HTMLURL *string `json:"html_url,omitempty"`
+}
+
+// ListInvitations lists all currently-open repository invitations.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository
+func (s *RepositoriesService) ListInvitations(repoID int, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) {
+ u := fmt.Sprintf("repositories/%v/invitations", repoID)
+ 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", mediaTypeRepositoryInvitationsPreview)
+
+ invites := []*RepositoryInvitation{}
+ resp, err := s.client.Do(req, &invites)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return invites, resp, err
+}
+
+// DeleteInvitation deletes a repository invitation.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation
+func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Response, error) {
+ u := fmt.Sprintf("repositories/%v/invitations/%v", repoID, invitationID)
+ req, err := s.client.NewRequest("DELETE", u, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
+
+ return s.client.Do(req, nil)
+}
+
+// UpdateInvitation updates the permissions associated with a repository
+// invitation.
+//
+// permissions represents the permissions that the associated user will have
+// on the repository. Possible values are: "read", "write", "admin".
+//
+// GitHub API docs: https://developer.github.com/v3/repos/invitations/#update-a-repository-invitation
+func (s *RepositoriesService) UpdateInvitation(repoID, invitationID int, permissions string) (*RepositoryInvitation, *Response, error) {
+ opts := &struct {
+ Permissions string `json:"permissions"`
+ }{Permissions: permissions}
+ u := fmt.Sprintf("repositories/%v/invitations/%v", repoID, invitationID)
+ req, err := s.client.NewRequest("PATCH", u, opts)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
+
+ invite := &RepositoryInvitation{}
+ resp, err := s.client.Do(req, invite)
+ return invite, resp, err
+}
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 0d12ec9..0bb404a 100644
--- a/vendor/github.com/google/go-github/github/repos_keys.go
+++ b/vendor/github.com/google/go-github/github/repos_keys.go
@@ -12,7 +12,7 @@ import "fmt"
// ListKeys lists the deploy keys for a repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/keys/#list
-func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptions) ([]Key, *Response, error) {
+func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptions) ([]*Key, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -24,7 +24,7 @@ func (s *RepositoriesService) ListKeys(owner string, repo string, opt *ListOptio
return nil, nil, err
}
- keys := new([]Key)
+ keys := new([]*Key)
resp, err := s.client.Do(req, keys)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/repos_pages.go b/vendor/github.com/google/go-github/github/repos_pages.go
index 2384eaf..8594edc 100644
--- a/vendor/github.com/google/go-github/github/repos_pages.go
+++ b/vendor/github.com/google/go-github/github/repos_pages.go
@@ -54,14 +54,14 @@ func (s *RepositoriesService) GetPagesInfo(owner string, repo string) (*Pages, *
// ListPagesBuilds lists the builds for a GitHub Pages site.
//
// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-pages-builds
-func (s *RepositoriesService) ListPagesBuilds(owner string, repo string) ([]PagesBuild, *Response, error) {
+func (s *RepositoriesService) ListPagesBuilds(owner string, repo string) ([]*PagesBuild, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
- var pages []PagesBuild
+ var pages []*PagesBuild
resp, err := s.client.Do(req, &pages)
if err != nil {
return nil, resp, err
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 37e356a..e889b0d 100644
--- a/vendor/github.com/google/go-github/github/repos_releases.go
+++ b/vendor/github.com/google/go-github/github/repos_releases.go
@@ -64,7 +64,7 @@ func (r ReleaseAsset) String() string {
// ListReleases lists the releases for a repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
-func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions) ([]RepositoryRelease, *Response, error) {
+func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions) ([]*RepositoryRelease, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -76,7 +76,7 @@ func (s *RepositoriesService) ListReleases(owner, repo string, opt *ListOptions)
return nil, nil, err
}
- releases := new([]RepositoryRelease)
+ releases := new([]*RepositoryRelease)
resp, err := s.client.Do(req, releases)
if err != nil {
return nil, resp, err
@@ -176,7 +176,7 @@ func (s *RepositoriesService) DeleteRelease(owner, repo string, id int) (*Respon
// ListReleaseAssets lists the release's assets.
//
// GitHub API docs : http://developer.github.com/v3/repos/releases/#list-assets-for-a-release
-func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt *ListOptions) ([]ReleaseAsset, *Response, error) {
+func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt *ListOptions) ([]*ReleaseAsset, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
u, err := addOptions(u, opt)
if err != nil {
@@ -188,7 +188,7 @@ func (s *RepositoriesService) ListReleaseAssets(owner, repo string, id int, opt
return nil, nil, err
}
- assets := new([]ReleaseAsset)
+ assets := new([]*ReleaseAsset)
resp, err := s.client.Do(req, assets)
if err != nil {
return nil, resp, nil
diff --git a/vendor/github.com/google/go-github/github/repos_stats.go b/vendor/github.com/google/go-github/github/repos_stats.go
index 3474b55..e4f75a5 100644
--- a/vendor/github.com/google/go-github/github/repos_stats.go
+++ b/vendor/github.com/google/go-github/github/repos_stats.go
@@ -45,14 +45,14 @@ func (w WeeklyStats) String() string {
// delay of a second or so, should result in a successful request.
//
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#contributors
-func (s *RepositoriesService) ListContributorsStats(owner, repo string) ([]ContributorStats, *Response, error) {
+func (s *RepositoriesService) ListContributorsStats(owner, repo string) ([]*ContributorStats, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
- var contributorStats []ContributorStats
+ var contributorStats []*ContributorStats
resp, err := s.client.Do(req, &contributorStats)
if err != nil {
return nil, resp, err
@@ -84,14 +84,14 @@ func (w WeeklyCommitActivity) String() string {
// delay of a second or so, should result in a successful request.
//
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#commit-activity
-func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]WeeklyCommitActivity, *Response, error) {
+func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]*WeeklyCommitActivity, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
- var weeklyCommitActivity []WeeklyCommitActivity
+ var weeklyCommitActivity []*WeeklyCommitActivity
resp, err := s.client.Do(req, &weeklyCommitActivity)
if err != nil {
return nil, resp, err
@@ -105,7 +105,7 @@ func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]WeeklyCo
// additions and deletions, but not total commits.
//
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#code-frequency
-func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]WeeklyStats, *Response, error) {
+func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]*WeeklyStats, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@@ -116,12 +116,12 @@ func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]WeeklySta
resp, err := s.client.Do(req, &weeks)
// convert int slices into WeeklyStats
- var stats []WeeklyStats
+ var stats []*WeeklyStats
for _, week := range weeks {
if len(week) != 3 {
continue
}
- stat := WeeklyStats{
+ stat := &WeeklyStats{
Week: &Timestamp{time.Unix(int64(week[0]), 0)},
Additions: Int(week[1]),
Deletions: Int(week[2]),
@@ -186,7 +186,7 @@ type PunchCard struct {
// ListPunchCard returns the number of commits per hour in each day.
//
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#punch-card
-func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]PunchCard, *Response, error) {
+func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]*PunchCard, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@@ -197,12 +197,12 @@ func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]PunchCard, *R
resp, err := s.client.Do(req, &results)
// convert int slices into Punchcards
- var cards []PunchCard
+ var cards []*PunchCard
for _, result := range results {
if len(result) != 3 {
continue
}
- card := PunchCard{
+ card := &PunchCard{
Day: Int(result[0]),
Hour: Int(result[1]),
Commits: Int(result[2]),
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 7a6ee7c..6478ee2 100644
--- a/vendor/github.com/google/go-github/github/repos_statuses.go
+++ b/vendor/github.com/google/go-github/github/repos_statuses.go
@@ -42,7 +42,7 @@ func (r RepoStatus) String() string {
// reference. ref can be a SHA, a branch name, or a tag name.
//
// GitHub API docs: http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
-func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOptions) ([]RepoStatus, *Response, error) {
+func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOptions) ([]*RepoStatus, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, ref)
u, err := addOptions(u, opt)
if err != nil {
@@ -54,7 +54,7 @@ func (s *RepositoriesService) ListStatuses(owner, repo, ref string, opt *ListOpt
return nil, nil, err
}
- statuses := new([]RepoStatus)
+ statuses := new([]*RepoStatus)
resp, err := s.client.Do(req, statuses)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/search.go b/vendor/github.com/google/go-github/github/search.go
index 073b6c0..0c7ffcb 100644
--- a/vendor/github.com/google/go-github/github/search.go
+++ b/vendor/github.com/google/go-github/github/search.go
@@ -15,9 +15,7 @@ import (
// in the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/search/
-type SearchService struct {
- client *Client
-}
+type SearchService service
// SearchOptions specifies optional parameters to the SearchService methods.
type SearchOptions struct {
diff --git a/vendor/github.com/google/go-github/github/users.go b/vendor/github.com/google/go-github/github/users.go
index 0312724..8f63746 100644
--- a/vendor/github.com/google/go-github/github/users.go
+++ b/vendor/github.com/google/go-github/github/users.go
@@ -11,9 +11,7 @@ import "fmt"
// methods of the GitHub API.
//
// GitHub API docs: http://developer.github.com/v3/users/
-type UsersService struct {
- client *Client
-}
+type UsersService service
// User represents a GitHub user.
type User struct {
@@ -138,12 +136,16 @@ func (s *UsersService) Edit(user *User) (*User, *Response, error) {
type UserListOptions struct {
// ID of the last user seen
Since int `url:"since,omitempty"`
+
+ ListOptions
}
// ListAll lists all GitHub users.
//
+// To paginate through all users, populate 'Since' with the ID of the last user.
+//
// GitHub API docs: http://developer.github.com/v3/users/#get-all-users
-func (s *UsersService) ListAll(opt *UserListOptions) ([]User, *Response, error) {
+func (s *UsersService) ListAll(opt *UserListOptions) ([]*User, *Response, error) {
u, err := addOptions("users", opt)
if err != nil {
return nil, nil, err
@@ -154,7 +156,7 @@ func (s *UsersService) ListAll(opt *UserListOptions) ([]User, *Response, error)
return nil, nil, err
}
- users := new([]User)
+ users := new([]*User)
resp, err := s.client.Do(req, users)
if err != nil {
return nil, resp, err
@@ -162,3 +164,59 @@ func (s *UsersService) ListAll(opt *UserListOptions) ([]User, *Response, error)
return *users, resp, err
}
+
+// ListInvitations lists all currently-open repository invitations for the
+// authenticated user.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations
+func (s *UsersService) ListInvitations() ([]*RepositoryInvitation, *Response, error) {
+ req, err := s.client.NewRequest("GET", "user/repository_invitations", nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
+
+ invites := []*RepositoryInvitation{}
+ resp, err := s.client.Do(req, &invites)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return invites, resp, err
+}
+
+// AcceptInvitation accepts the currently-open repository invitation for the
+// authenticated user.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation
+func (s *UsersService) AcceptInvitation(invitationID int) (*Response, error) {
+ u := fmt.Sprintf("user/repository_invitations/%v", invitationID)
+ req, err := s.client.NewRequest("PATCH", u, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
+
+ return s.client.Do(req, nil)
+}
+
+// DeclineInvitation declines the currently-open repository invitation for the
+// authenticated user.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/invitations/#decline-a-repository-invitation
+func (s *UsersService) DeclineInvitation(invitationID int) (*Response, error) {
+ u := fmt.Sprintf("user/repository_invitations/%v", invitationID)
+ req, err := s.client.NewRequest("DELETE", u, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
+
+ return s.client.Do(req, nil)
+}
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 7553191..e4a5898 100644
--- a/vendor/github.com/google/go-github/github/users_emails.go
+++ b/vendor/github.com/google/go-github/github/users_emails.go
@@ -15,7 +15,7 @@ type UserEmail struct {
// ListEmails lists all email addresses for the authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
-func (s *UsersService) ListEmails(opt *ListOptions) ([]UserEmail, *Response, error) {
+func (s *UsersService) ListEmails(opt *ListOptions) ([]*UserEmail, *Response, error) {
u := "user/emails"
u, err := addOptions(u, opt)
if err != nil {
@@ -27,7 +27,7 @@ func (s *UsersService) ListEmails(opt *ListOptions) ([]UserEmail, *Response, err
return nil, nil, err
}
- emails := new([]UserEmail)
+ emails := new([]*UserEmail)
resp, err := s.client.Do(req, emails)
if err != nil {
return nil, resp, err
@@ -39,14 +39,14 @@ func (s *UsersService) ListEmails(opt *ListOptions) ([]UserEmail, *Response, err
// AddEmails adds email addresses of the authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/users/emails/#add-email-addresses
-func (s *UsersService) AddEmails(emails []string) ([]UserEmail, *Response, error) {
+func (s *UsersService) AddEmails(emails []string) ([]*UserEmail, *Response, error) {
u := "user/emails"
req, err := s.client.NewRequest("POST", u, emails)
if err != nil {
return nil, nil, err
}
- e := new([]UserEmail)
+ e := new([]*UserEmail)
resp, err := s.client.Do(req, e)
if err != nil {
return nil, resp, err
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 7ecbed9..38a1662 100644
--- a/vendor/github.com/google/go-github/github/users_followers.go
+++ b/vendor/github.com/google/go-github/github/users_followers.go
@@ -11,7 +11,7 @@ import "fmt"
// fetch followers for the authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/users/followers/#list-followers-of-a-user
-func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]User, *Response, error) {
+func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]*User, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/followers", user)
@@ -28,7 +28,7 @@ func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]User, *Re
return nil, nil, err
}
- users := new([]User)
+ users := new([]*User)
resp, err := s.client.Do(req, users)
if err != nil {
return nil, resp, err
@@ -41,7 +41,7 @@ func (s *UsersService) ListFollowers(user string, opt *ListOptions) ([]User, *Re
// string will list people the authenticated user is following.
//
// GitHub API docs: http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user
-func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]User, *Response, error) {
+func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]*User, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/following", user)
@@ -58,7 +58,7 @@ func (s *UsersService) ListFollowing(user string, opt *ListOptions) ([]User, *Re
return nil, nil, err
}
- users := new([]User)
+ users := new([]*User)
resp, err := s.client.Do(req, users)
if err != nil {
return nil, resp, err
diff --git a/vendor/github.com/google/go-github/github/users_gpg_keys.go b/vendor/github.com/google/go-github/github/users_gpg_keys.go
new file mode 100644
index 0000000..08cfbed
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/users_gpg_keys.go
@@ -0,0 +1,127 @@
+// Copyright 2016 The go-github AUTHORS. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package github
+
+import (
+ "fmt"
+ "time"
+)
+
+// GPGKey represents a GitHub user's public GPG key used to verify GPG signed commits and tags.
+//
+// https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
+type GPGKey struct {
+ ID *int `json:"id,omitempty"`
+ PrimaryKeyID *int `json:"primary_key_id,omitempty"`
+ KeyID *string `json:"key_id,omitempty"`
+ PublicKey *string `json:"public_key,omitempty"`
+ Emails []GPGEmail `json:"emails,omitempty"`
+ Subkeys []GPGKey `json:"subkeys,omitempty"`
+ CanSign *bool `json:"can_sign,omitempty"`
+ CanEncryptComms *bool `json:"can_encrypt_comms,omitempty"`
+ CanEncryptStorage *bool `json:"can_encrypt_storage,omitempty"`
+ CanCertify *bool `json:"can_certify,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ ExpiresAt *time.Time `json:"expires_at,omitempty"`
+}
+
+// String stringifies a GPGKey.
+func (k GPGKey) String() string {
+ return Stringify(k)
+}
+
+// GPGEmail represents an email address associated to a GPG key.
+type GPGEmail struct {
+ Email *string `json:"email,omitempty"`
+ Verified *bool `json:"verified,omitempty"`
+}
+
+// ListGPGKeys lists the current user's GPG keys. It requires authentication
+// via Basic Auth or via OAuth with at least read:gpg_key scope.
+//
+// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#list-your-gpg-keys
+func (s *UsersService) ListGPGKeys() ([]*GPGKey, *Response, error) {
+ req, err := s.client.NewRequest("GET", "user/gpg_keys", nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGitSigningPreview)
+
+ var keys []*GPGKey
+ resp, err := s.client.Do(req, &keys)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return keys, resp, err
+}
+
+// GetGPGKey gets extended details for a single GPG key. It requires authentication
+// via Basic Auth or via OAuth with at least read:gpg_key scope.
+//
+// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#get-a-single-gpg-key
+func (s *UsersService) GetGPGKey(id int) (*GPGKey, *Response, error) {
+ u := fmt.Sprintf("user/gpg_keys/%v", id)
+ 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", mediaTypeGitSigningPreview)
+
+ key := &GPGKey{}
+ resp, err := s.client.Do(req, key)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return key, resp, err
+}
+
+// CreateGPGKey creates a GPG key. It requires authenticatation via Basic Auth
+// or OAuth with at least write:gpg_key scope.
+//
+// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#create-a-gpg-key
+func (s *UsersService) CreateGPGKey(armoredPublicKey string) (*GPGKey, *Response, error) {
+ gpgKey := &struct {
+ ArmoredPublicKey string `json:"armored_public_key"`
+ }{ArmoredPublicKey: armoredPublicKey}
+ req, err := s.client.NewRequest("POST", "user/gpg_keys", gpgKey)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGitSigningPreview)
+
+ key := &GPGKey{}
+ resp, err := s.client.Do(req, key)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return key, resp, err
+}
+
+// DeleteGPGKey deletes a GPG key. It requires authentication via Basic Auth or
+// via OAuth with at least admin:gpg_key scope.
+//
+// GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#delete-a-gpg-key
+func (s *UsersService) DeleteGPGKey(id int) (*Response, error) {
+ u := fmt.Sprintf("user/gpg_keys/%v", id)
+ req, err := s.client.NewRequest("DELETE", u, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGitSigningPreview)
+
+ return s.client.Do(req, nil)
+}
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 dcbd773..e4c255f 100644
--- a/vendor/github.com/google/go-github/github/users_keys.go
+++ b/vendor/github.com/google/go-github/github/users_keys.go
@@ -9,10 +9,11 @@ import "fmt"
// Key represents a public SSH key used to authenticate a user or deploy script.
type Key struct {
- ID *int `json:"id,omitempty"`
- Key *string `json:"key,omitempty"`
- URL *string `json:"url,omitempty"`
- Title *string `json:"title,omitempty"`
+ ID *int `json:"id,omitempty"`
+ Key *string `json:"key,omitempty"`
+ URL *string `json:"url,omitempty"`
+ Title *string `json:"title,omitempty"`
+ ReadOnly *bool `json:"read_only,omitempty"`
}
func (k Key) String() string {
@@ -23,7 +24,7 @@ func (k Key) String() string {
// string will fetch keys for the authenticated user.
//
// GitHub API docs: http://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
-func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]Key, *Response, error) {
+func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]*Key, *Response, error) {
var u string
if user != "" {
u = fmt.Sprintf("users/%v/keys", user)
@@ -40,7 +41,7 @@ func (s *UsersService) ListKeys(user string, opt *ListOptions) ([]Key, *Response
return nil, nil, err
}
- keys := new([]Key)
+ keys := new([]*Key)
resp, err := s.client.Do(req, keys)
if err != nil {
return nil, resp, err