aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-10-31 16:36:17 +0000
committerNiall Sheridan <nsheridan@gmail.com>2016-10-31 16:40:08 +0000
commite0a1ccb64a637673195804513902cba6b1d4e97c (patch)
treeabc1598be28cda231d92cda8fb10b49eeb564c29 /vendor/github.com/google/go-github/github
parent7bad329d417f19ba4aae2b4607281c2bc5df8ad7 (diff)
Update dependencies
Diffstat (limited to 'vendor/github.com/google/go-github/github')
-rw-r--r--vendor/github.com/google/go-github/github/event_types.go24
-rw-r--r--vendor/github.com/google/go-github/github/github.go37
-rw-r--r--vendor/github.com/google/go-github/github/integration.go38
-rw-r--r--vendor/github.com/google/go-github/github/integration_installation.go46
-rw-r--r--vendor/github.com/google/go-github/github/pulls.go56
-rw-r--r--vendor/github.com/google/go-github/github/repos.go13
-rw-r--r--vendor/github.com/google/go-github/github/repos_commits.go16
-rw-r--r--vendor/github.com/google/go-github/github/repos_releases.go2
-rw-r--r--vendor/github.com/google/go-github/github/repos_traffic.go31
9 files changed, 180 insertions, 83 deletions
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 da18f71..16f89b0 100644
--- a/vendor/github.com/google/go-github/github/event_types.go
+++ b/vendor/github.com/google/go-github/github/event_types.go
@@ -172,14 +172,6 @@ type IntegrationInstallationRepositoriesEvent struct {
Sender *User `json:"sender,omitempty"`
}
-// Installation represents a GitHub integration installation.
-type Installation struct {
- ID *int `json:"id,omitempty"`
- Account *User `json:"account,omitempty"`
- AccessTokensURL *string `json:"access_tokens_url,omitempty"`
- RepositoriesURL *string `json:"repositories_url,omitempty"`
-}
-
// IssueCommentEvent is triggered when an issue comment is created on an issue
// or pull request.
// The Webhook event name is "issue_comment".
@@ -459,14 +451,14 @@ type StatusEvent struct {
Branches []*Branch `json:"branches,omitempty"`
// The following fields are only populated by Webhook events.
- ID *int `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Context *string `json:"context,omitempty"`
- Commit *PushEventCommit `json:"commit,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
- Sender *User `json:"sender,omitempty"`
+ ID *int `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Context *string `json:"context,omitempty"`
+ Commit *RepositoryCommit `json:"commit,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
}
// TeamAddEvent is triggered when a repository is added to a team.
diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go
index f04a011..465574b 100644
--- a/vendor/github.com/google/go-github/github/github.go
+++ b/vendor/github.com/google/go-github/github/github.go
@@ -90,6 +90,9 @@ const (
// https://developer.github.com/changes/2016-09-14-projects-api/
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
+
+ // https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/
+ mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"
)
// A Client manages communication with the GitHub API.
@@ -120,6 +123,7 @@ type Client struct {
Gists *GistsService
Git *GitService
Gitignores *GitignoresService
+ Integrations *IntegrationsService
Issues *IssuesService
Organizations *OrganizationsService
PullRequests *PullRequestsService
@@ -190,6 +194,7 @@ func NewClient(httpClient *http.Client) *Client {
c.Gists = (*GistsService)(&c.common)
c.Git = (*GitService)(&c.common)
c.Gitignores = (*GitignoresService)(&c.common)
+ c.Integrations = (*IntegrationsService)(&c.common)
c.Issues = (*IssuesService)(&c.common)
c.Licenses = (*LicensesService)(&c.common)
c.Migrations = (*MigrationService)(&c.common)
@@ -494,6 +499,24 @@ func (r *RateLimitError) Error() string {
r.Response.StatusCode, r.Message, r.Rate.Reset.Time.Sub(time.Now()))
}
+// AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the
+// "documentation_url" field value equal to "https://developer.github.com/v3#abuse-rate-limits".
+type AbuseRateLimitError struct {
+ Response *http.Response // HTTP response that caused this error
+ Message string `json:"message"` // error message
+
+ // RetryAfter is provided with some abuse rate limit errors. If present,
+ // it is the amount of time that the client should wait before retrying.
+ // Otherwise, the client should try again later (after an unspecified amount of time).
+ RetryAfter *time.Duration
+}
+
+func (r *AbuseRateLimitError) Error() string {
+ return fmt.Sprintf("%v %v: %d %v",
+ r.Response.Request.Method, sanitizeURL(r.Response.Request.URL),
+ r.Response.StatusCode, r.Message)
+}
+
// sanitizeURL redacts the client_secret parameter from the URL which may be
// exposed to the user, specifically in the ErrorResponse error message.
func sanitizeURL(uri *url.URL) *url.URL {
@@ -564,6 +587,20 @@ func CheckResponse(r *http.Response) error {
Response: errorResponse.Response,
Message: errorResponse.Message,
}
+ case r.StatusCode == http.StatusForbidden && errorResponse.DocumentationURL == "https://developer.github.com/v3#abuse-rate-limits":
+ abuseRateLimitError := &AbuseRateLimitError{
+ Response: errorResponse.Response,
+ Message: errorResponse.Message,
+ }
+ if v := r.Header["Retry-After"]; len(v) > 0 {
+ // According to GitHub support, the "Retry-After" header value will be
+ // an integer which represents the number of seconds that one should
+ // wait before resuming making requests.
+ retryAfterSeconds, _ := strconv.ParseInt(v[0], 10, 64) // Error handling is noop.
+ retryAfter := time.Duration(retryAfterSeconds) * time.Second
+ abuseRateLimitError.RetryAfter = &retryAfter
+ }
+ return abuseRateLimitError
default:
return errorResponse
}
diff --git a/vendor/github.com/google/go-github/github/integration.go b/vendor/github.com/google/go-github/github/integration.go
new file mode 100644
index 0000000..b8d77ca
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/integration.go
@@ -0,0 +1,38 @@
+// 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
+
+// IntegrationsService provides access to the installation related functions
+// in the GitHub API.
+//
+// GitHub API docs: https://developer.github.com/v3/integrations/
+type IntegrationsService service
+
+// ListInstallations lists the installations that the current integration has.
+//
+// GitHub API docs: https://developer.github.com/v3/integrations/#find-installations
+func (s *IntegrationsService) ListInstallations(opt *ListOptions) ([]*Installation, *Response, error) {
+ u, err := addOptions("integration/installations", 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", mediaTypeIntegrationPreview)
+
+ i := new([]*Installation)
+ resp, err := s.client.Do(req, &i)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return *i, resp, err
+}
diff --git a/vendor/github.com/google/go-github/github/integration_installation.go b/vendor/github.com/google/go-github/github/integration_installation.go
new file mode 100644
index 0000000..aa59bfe
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/integration_installation.go
@@ -0,0 +1,46 @@
+// 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
+
+// Installation represents a GitHub integration installation.
+type Installation struct {
+ ID *int `json:"id,omitempty"`
+ Account *User `json:"account,omitempty"`
+ AccessTokensURL *string `json:"access_tokens_url,omitempty"`
+ RepositoriesURL *string `json:"repositories_url,omitempty"`
+}
+
+func (i Installation) String() string {
+ return Stringify(i)
+}
+
+// ListRepos lists the repositories that the current installation has access to.
+//
+// GitHub API docs: https://developer.github.com/v3/integrations/installations/#list-repositories
+func (s *IntegrationsService) ListRepos(opt *ListOptions) ([]*Repository, *Response, error) {
+ u, err := addOptions("installation/repositories", 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", mediaTypeIntegrationPreview)
+
+ var r struct {
+ Repositories []*Repository `json:"repositories"`
+ }
+ resp, err := s.client.Do(req, &r)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return r.Repositories, resp, err
+}
diff --git a/vendor/github.com/google/go-github/github/pulls.go b/vendor/github.com/google/go-github/github/pulls.go
index a823c43..3c88365 100644
--- a/vendor/github.com/google/go-github/github/pulls.go
+++ b/vendor/github.com/google/go-github/github/pulls.go
@@ -18,33 +18,35 @@ 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"`
- Body *string `json:"body,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- ClosedAt *time.Time `json:"closed_at,omitempty"`
- MergedAt *time.Time `json:"merged_at,omitempty"`
- User *User `json:"user,omitempty"`
- Merged *bool `json:"merged,omitempty"`
- Mergeable *bool `json:"mergeable,omitempty"`
- MergedBy *User `json:"merged_by,omitempty"`
- Comments *int `json:"comments,omitempty"`
- Commits *int `json:"commits,omitempty"`
- Additions *int `json:"additions,omitempty"`
- Deletions *int `json:"deletions,omitempty"`
- ChangedFiles *int `json:"changed_files,omitempty"`
- URL *string `json:"url,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
- IssueURL *string `json:"issue_url,omitempty"`
- StatusesURL *string `json:"statuses_url,omitempty"`
- DiffURL *string `json:"diff_url,omitempty"`
- PatchURL *string `json:"patch_url,omitempty"`
- Assignee *User `json:"assignee,omitempty"`
- Assignees []*User `json:"assignees,omitempty"`
- Milestone *Milestone `json:"milestone,omitempty"`
+ ID *int `json:"id,omitempty"`
+ Number *int `json:"number,omitempty"`
+ State *string `json:"state,omitempty"`
+ Title *string `json:"title,omitempty"`
+ Body *string `json:"body,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ ClosedAt *time.Time `json:"closed_at,omitempty"`
+ MergedAt *time.Time `json:"merged_at,omitempty"`
+ User *User `json:"user,omitempty"`
+ Merged *bool `json:"merged,omitempty"`
+ Mergeable *bool `json:"mergeable,omitempty"`
+ MergedBy *User `json:"merged_by,omitempty"`
+ Comments *int `json:"comments,omitempty"`
+ Commits *int `json:"commits,omitempty"`
+ Additions *int `json:"additions,omitempty"`
+ Deletions *int `json:"deletions,omitempty"`
+ ChangedFiles *int `json:"changed_files,omitempty"`
+ URL *string `json:"url,omitempty"`
+ HTMLURL *string `json:"html_url,omitempty"`
+ IssueURL *string `json:"issue_url,omitempty"`
+ StatusesURL *string `json:"statuses_url,omitempty"`
+ DiffURL *string `json:"diff_url,omitempty"`
+ PatchURL *string `json:"patch_url,omitempty"`
+ ReviewCommentsURL *string `json:"review_comments_url,omitempty"`
+ ReviewCommentURL *string `json:"review_comment_url,omitempty"`
+ Assignee *User `json:"assignee,omitempty"`
+ Assignees []*User `json:"assignees,omitempty"`
+ Milestone *Milestone `json:"milestone,omitempty"`
Head *PullRequestBranch `json:"head,omitempty"`
Base *PullRequestBranch `json:"base,omitempty"`
diff --git a/vendor/github.com/google/go-github/github/repos.go b/vendor/github.com/google/go-github/github/repos.go
index 2bcaacc..98e4ac5 100644
--- a/vendor/github.com/google/go-github/github/repos.go
+++ b/vendor/github.com/google/go-github/github/repos.go
@@ -51,11 +51,14 @@ type Repository struct {
License *License `json:"license,omitempty"`
// Additional mutable fields when creating and editing a repository
- Private *bool `json:"private"`
- HasIssues *bool `json:"has_issues"`
- HasWiki *bool `json:"has_wiki"`
- HasPages *bool `json:"has_pages"`
- HasDownloads *bool `json:"has_downloads"`
+ Private *bool `json:"private"`
+ HasIssues *bool `json:"has_issues"`
+ HasWiki *bool `json:"has_wiki"`
+ HasPages *bool `json:"has_pages"`
+ HasDownloads *bool `json:"has_downloads"`
+ LicenseTemplate *string `json:"license_template,omitempty"`
+ GitignoreTemplate *string `json:"gitignore_template,omitempty"`
+
// Creating an organization repository. Required for non-owners.
TeamID *int `json:"team_id"`
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 b5e6856..c1359f4 100644
--- a/vendor/github.com/google/go-github/github/repos_commits.go
+++ b/vendor/github.com/google/go-github/github/repos_commits.go
@@ -15,13 +15,15 @@ import (
// Note that it's wrapping a Commit, so author/committer information is in two places,
// but contain different details about them: in RepositoryCommit "github details", in Commit - "git details".
type RepositoryCommit struct {
- SHA *string `json:"sha,omitempty"`
- Commit *Commit `json:"commit,omitempty"`
- Author *User `json:"author,omitempty"`
- Committer *User `json:"committer,omitempty"`
- Parents []Commit `json:"parents,omitempty"`
- Message *string `json:"message,omitempty"`
- HTMLURL *string `json:"html_url,omitempty"`
+ SHA *string `json:"sha,omitempty"`
+ Commit *Commit `json:"commit,omitempty"`
+ Author *User `json:"author,omitempty"`
+ Committer *User `json:"committer,omitempty"`
+ Parents []Commit `json:"parents,omitempty"`
+ Message *string `json:"message,omitempty"`
+ HTMLURL *string `json:"html_url,omitempty"`
+ URL *string `json:"url,omitempty"`
+ CommentsURL *string `json:"comments_url,omitempty"`
// Details about how many changes were made in this commit. Only filled in during GetCommit!
Stats *CommitStats `json:"stats,omitempty"`
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 e889b0d..331a4b7 100644
--- a/vendor/github.com/google/go-github/github/repos_releases.go
+++ b/vendor/github.com/google/go-github/github/repos_releases.go
@@ -34,7 +34,7 @@ type RepositoryRelease struct {
UploadURL *string `json:"upload_url,omitempty"`
ZipballURL *string `json:"zipball_url,omitempty"`
TarballURL *string `json:"tarball_url,omitempty"`
- Author *CommitAuthor `json:"author,omitempty"`
+ Author *User `json:"author,omitempty"`
}
func (r RepositoryRelease) String() string {
diff --git a/vendor/github.com/google/go-github/github/repos_traffic.go b/vendor/github.com/google/go-github/github/repos_traffic.go
index b6c8d83..9688b58 100644
--- a/vendor/github.com/google/go-github/github/repos_traffic.go
+++ b/vendor/github.com/google/go-github/github/repos_traffic.go
@@ -5,11 +5,7 @@
package github
-import (
- "fmt"
- "strconv"
- "time"
-)
+import "fmt"
// TrafficReferrer represent information about traffic from a referrer .
type TrafficReferrer struct {
@@ -26,30 +22,11 @@ type TrafficPath struct {
Uniques *int `json:"uniques,omitempty"`
}
-// TimestampMS represents a timestamp as used in datapoint.
-//
-// It's only used to parse the result given by the API which are unix timestamp in milliseonds.
-type TimestampMS struct {
- time.Time
-}
-
-// UnmarshalJSON parse unix timestamp.
-func (t *TimestampMS) UnmarshalJSON(b []byte) error {
- s := string(b)
- i, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- return err
- }
- // We can drop the reaminder as returned values are days and it will always be 0
- *t = TimestampMS{time.Unix(i/1000, 0)}
- return nil
-}
-
// TrafficData represent information about a specific timestamp in views or clones list.
type TrafficData struct {
- Timestamp *TimestampMS `json:"timestamp,omitempty"`
- Count *int `json:"count,omitempty"`
- Uniques *int `json:"uniques,omitempty"`
+ Timestamp *Timestamp `json:"timestamp,omitempty"`
+ Count *int `json:"count,omitempty"`
+ Uniques *int `json:"uniques,omitempty"`
}
// TrafficViews represent information about the number of views in the last 14 days.