aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-12-28 21:18:36 +0000
committerNiall Sheridan <nsheridan@gmail.com>2016-12-28 21:18:36 +0000
commit73ef85bc5db590c22689e11be20737a3dd88168f (patch)
treefe393a6f0776bca1889b2113ab341a2922e25d10 /vendor/github.com/google
parent9e573e571fe878ed32947cae5a6d43cb5d72d3bb (diff)
Update dependencies
Diffstat (limited to 'vendor/github.com/google')
-rw-r--r--vendor/github.com/google/go-github/github/activity_events.go12
-rw-r--r--vendor/github.com/google/go-github/github/activity_watching.go7
-rw-r--r--vendor/github.com/google/go-github/github/admin.go98
-rw-r--r--vendor/github.com/google/go-github/github/authorizations.go9
-rw-r--r--vendor/github.com/google/go-github/github/doc.go15
-rw-r--r--vendor/github.com/google/go-github/github/event_types.go65
-rw-r--r--vendor/github.com/google/go-github/github/github.go47
-rw-r--r--vendor/github.com/google/go-github/github/issues.go5
-rw-r--r--vendor/github.com/google/go-github/github/licenses.go31
-rw-r--r--vendor/github.com/google/go-github/github/messages.go8
-rw-r--r--vendor/github.com/google/go-github/github/projects.go417
-rw-r--r--vendor/github.com/google/go-github/github/pulls.go52
-rw-r--r--vendor/github.com/google/go-github/github/pulls_reviews.go19
-rw-r--r--vendor/github.com/google/go-github/github/repos.go130
-rw-r--r--vendor/github.com/google/go-github/github/repos_commits.go18
-rw-r--r--vendor/github.com/google/go-github/github/repos_contents.go8
-rw-r--r--vendor/github.com/google/go-github/github/repos_deployments.go21
-rw-r--r--vendor/github.com/google/go-github/github/repos_forks.go6
-rw-r--r--vendor/github.com/google/go-github/github/repos_pages.go29
-rw-r--r--vendor/github.com/google/go-github/github/repos_projects.go417
-rw-r--r--vendor/github.com/google/go-github/github/repos_stats.go29
21 files changed, 949 insertions, 494 deletions
diff --git a/vendor/github.com/google/go-github/github/activity_events.go b/vendor/github.com/google/go-github/github/activity_events.go
index 6bf38b4..557001e 100644
--- a/vendor/github.com/google/go-github/github/activity_events.go
+++ b/vendor/github.com/google/go-github/github/activity_events.go
@@ -55,16 +55,24 @@ func (e *Event) Payload() (payload interface{}) {
payload = &IssueCommentEvent{}
case "IssuesEvent":
payload = &IssuesEvent{}
+ case "LabelEvent":
+ payload = &LabelEvent{}
case "MemberEvent":
payload = &MemberEvent{}
case "MembershipEvent":
payload = &MembershipEvent{}
+ case "MilestoneEvent":
+ payload = &MilestoneEvent{}
case "PageBuildEvent":
payload = &PageBuildEvent{}
+ case "PingEvent":
+ payload = &PingEvent{}
case "PublicEvent":
payload = &PublicEvent{}
case "PullRequestEvent":
payload = &PullRequestEvent{}
+ case "PullRequestReviewEvent":
+ payload = &PullRequestReviewEvent{}
case "PullRequestReviewCommentEvent":
payload = &PullRequestReviewCommentEvent{}
case "PushEvent":
@@ -136,7 +144,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) ([]*IssueEvent, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@@ -148,7 +156,7 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *
return nil, nil, err
}
- events := new([]*Event)
+ events := new([]*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/activity_watching.go b/vendor/github.com/google/go-github/github/activity_watching.go
index 6bf91dd..9a27541 100644
--- a/vendor/github.com/google/go-github/github/activity_watching.go
+++ b/vendor/github.com/google/go-github/github/activity_watching.go
@@ -103,6 +103,10 @@ func (s *ActivityService) GetRepositorySubscription(owner, repo string) (*Subscr
// SetRepositorySubscription sets the subscription for the specified repository
// for the authenticated user.
//
+// To watch a repository, set subscription.Subscribed to true.
+// To ignore notifications made within a repository, set subscription.Ignored to true.
+// To stop watching a repository, use DeleteRepositorySubscription.
+//
// GitHub API Docs: https://developer.github.com/v3/activity/watching/#set-a-repository-subscription
func (s *ActivityService) SetRepositorySubscription(owner, repo string, subscription *Subscription) (*Subscription, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
@@ -124,6 +128,9 @@ func (s *ActivityService) SetRepositorySubscription(owner, repo string, subscrip
// DeleteRepositorySubscription deletes the subscription for the specified
// repository for the authenticated user.
//
+// This is used to stop watching a repository. To control whether or not to
+// receive notifications from a repository, use SetRepositorySubscription.
+//
// GitHub API Docs: https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription
func (s *ActivityService) DeleteRepositorySubscription(owner, repo string) (*Response, error) {
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
diff --git a/vendor/github.com/google/go-github/github/admin.go b/vendor/github.com/google/go-github/github/admin.go
new file mode 100644
index 0000000..44d7a9f
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/admin.go
@@ -0,0 +1,98 @@
+// 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"
+
+// AdminService handles communication with the admin related methods of the
+// GitHub API. These API routes are normally only accessible for GitHub
+// Enterprise installations.
+//
+// GitHub API docs: https://developer.github.com/v3/enterprise/
+type AdminService service
+
+// TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group.
+type TeamLDAPMapping struct {
+ ID *int `json:"id,omitempty"`
+ LDAPDN *string `json:"ldap_dn,omitempty"`
+ URL *string `json:"url,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Slug *string `json:"slug,omitempty"`
+ Description *string `json:"description,omitempty"`
+ Privacy *string `json:"privacy,omitempty"`
+ Permission *string `json:"permission,omitempty"`
+
+ MembersURL *string `json:"members_url,omitempty"`
+ RepositoriesURL *string `json:"repositories_url,omitempty"`
+}
+
+func (m TeamLDAPMapping) String() string {
+ return Stringify(m)
+}
+
+// UserLDAPMapping represents the mapping between a GitHub user and an LDAP user.
+type UserLDAPMapping struct {
+ ID *int `json:"id,omitempty"`
+ LDAPDN *string `json:"ldap_dn,omitempty"`
+ Login *string `json:"login,omitempty"`
+ AvatarURL *string `json:"avatar_url,omitempty"`
+ GravatarID *string `json:"gravatar_id,omitempty"`
+ Type *string `json:"type,omitempty"`
+ SiteAdmin *bool `json:"site_admin,omitempty"`
+
+ URL *string `json:"url,omitempty"`
+ EventsURL *string `json:"events_url,omitempty"`
+ FollowingURL *string `json:"following_url,omitempty"`
+ FollowersURL *string `json:"followers_url,omitempty"`
+ GistsURL *string `json:"gists_url,omitempty"`
+ OrganizationsURL *string `json:"organizations_url,omitempty"`
+ ReceivedEventsURL *string `json:"received_events_url,omitempty"`
+ ReposURL *string `json:"repos_url,omitempty"`
+ StarredURL *string `json:"starred_url,omitempty"`
+ SubscriptionsURL *string `json:"subscriptions_url,omitempty"`
+}
+
+func (m UserLDAPMapping) String() string {
+ return Stringify(m)
+}
+
+// UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user.
+//
+// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user
+func (s *AdminService) UpdateUserLDAPMapping(user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) {
+ u := fmt.Sprintf("admin/ldap/users/%v/mapping", user)
+ req, err := s.client.NewRequest("PATCH", u, mapping)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ m := new(UserLDAPMapping)
+ resp, err := s.client.Do(req, m)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return m, resp, err
+}
+
+// UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group.
+//
+// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team
+func (s *AdminService) UpdateTeamLDAPMapping(team int, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) {
+ u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team)
+ req, err := s.client.NewRequest("PATCH", u, mapping)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ m := new(TeamLDAPMapping)
+ resp, err := s.client.Do(req, m)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return m, 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 35ce9a9..d5a5e63 100644
--- a/vendor/github.com/google/go-github/github/authorizations.go
+++ b/vendor/github.com/google/go-github/github/authorizations.go
@@ -346,9 +346,6 @@ func (s *AuthorizationsService) ListGrants() ([]*Grant, *Response, error) {
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 {
@@ -368,9 +365,6 @@ func (s *AuthorizationsService) GetGrant(id int) (*Grant, *Response, error) {
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 {
@@ -392,9 +386,6 @@ func (s *AuthorizationsService) DeleteGrant(id int) (*Response, error) {
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeOAuthGrantAuthorizationsPreview)
-
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 2b61068..659dd82 100644
--- a/vendor/github.com/google/go-github/github/doc.go
+++ b/vendor/github.com/google/go-github/github/doc.go
@@ -86,6 +86,21 @@ To detect an API rate limit error, you can check if its type is *github.RateLimi
Learn more about GitHub rate limiting at
http://developer.github.com/v3/#rate-limiting.
+Accepted Status
+
+Some endpoints may return a 202 Accepted status code, meaning that the
+information required is not yet ready and was scheduled to be gathered on
+the GitHub side. Methods known to behave like this are documented specifying
+this behavior.
+
+To detect this condition of error, you can check if its type is
+*github.AcceptedError:
+
+ stats, _, err := client.Repositories.ListContributorsStats(org, repo)
+ if _, ok := err.(*github.AcceptedError); ok {
+ log.Println("scheduled on GitHub side")
+ }
+
Conditional Requests
The GitHub API has good support for conditional requests which will help
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 16f89b0..a1ffa69 100644
--- a/vendor/github.com/google/go-github/github/event_types.go
+++ b/vendor/github.com/google/go-github/github/event_types.go
@@ -209,6 +209,22 @@ type IssuesEvent struct {
Sender *User `json:"sender,omitempty"`
}
+// LabelEvent is triggered when a repository's label is created, edited, or deleted.
+// The Webhook event name is "label"
+//
+// GitHub docs: https://developer.github.com/v3/activity/events/types/#labelevent
+type LabelEvent struct {
+ // Action is the action that was performed. Possible values are:
+ // "created", "edited", "deleted"
+ Action *string `json:"action,omitempty"`
+ Label *Label `json:"label,omitempty"`
+
+ // The following fields are only populated by Webhook events.
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Org *Organization `json:"organization,omitempty"`
+}
+
// MemberEvent is triggered when a user is added as a collaborator to a repository.
// The Webhook event name is "member".
//
@@ -243,6 +259,23 @@ type MembershipEvent struct {
Sender *User `json:"sender,omitempty"`
}
+// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
+// The Webhook event name is "milestone".
+//
+// Github docs: https://developer.github.com/v3/activity/events/types/#milestoneevent
+type MilestoneEvent struct {
+ // Action is the action that was performed. Possible values are:
+ // "created", "closed", "opened", "edited", "deleted"
+ Action *string `json:"action,omitempty"`
+ Milestone *Milestone `json:"milestone,omitempty"`
+
+ // The following fields are only populated by Webhook events.
+ Changes *EditChange `json:"changes,omitempty"`
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+ Org *Organization `json:"organization,omitempty"`
+}
+
// PageBuildEvent represents an attempted build of a GitHub Pages site, whether
// successful or not.
// The Webhook event name is "page_build".
@@ -262,6 +295,18 @@ type PageBuildEvent struct {
Sender *User `json:"sender,omitempty"`
}
+// PingEvent is triggered when a Webhook is added to GitHub.
+//
+// GitHub docs: https://developer.github.com/webhooks/#ping-event
+type PingEvent struct {
+ // Random string of GitHub zen.
+ Zen *string `json:"zen,omitempty"`
+ // The ID of the webhook that triggered the ping.
+ HookID *int `json:"hook_id,omitempty"`
+ // The webhook configuration.
+ Hook *Hook `json:"hook,omitempty"`
+}
+
// PublicEvent is triggered when a private repository is open sourced.
// According to GitHub: "Without a doubt: the best GitHub event."
// The Webhook event name is "public".
@@ -294,6 +339,26 @@ type PullRequestEvent struct {
Sender *User `json:"sender,omitempty"`
}
+// PullRequestReviewEvent is triggered when a review is submitted on a pull
+// request.
+// The Webhook event name is "pull_request_review".
+//
+// GitHub docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent
+type PullRequestReviewEvent struct {
+ // Action is always "submitted".
+ Action *string `json:"action,omitempty"`
+ Review *PullRequestReview `json:"review,omitempty"`
+ PullRequest *PullRequest `json:"pull_request,omitempty"`
+
+ // The following fields are only populated by Webhook events.
+ Repo *Repository `json:"repository,omitempty"`
+ Sender *User `json:"sender,omitempty"`
+
+ // The following field is only present when the webhook is triggered on
+ // a repository belonging to an organization.
+ Organization *Organization `json:"organization,omitempty"`
+}
+
// PullRequestReviewCommentEvent is triggered when a comment is created on a
// portion of the unified diff of a pull request.
// The Webhook event name is "pull_request_review_comment".
diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go
index 465574b..3d7421f 100644
--- a/vendor/github.com/google/go-github/github/github.go
+++ b/vendor/github.com/google/go-github/github/github.go
@@ -42,6 +42,8 @@ const (
mediaTypeV3 = "application/vnd.github.v3+json"
defaultMediaType = "application/octet-stream"
mediaTypeV3SHA = "application/vnd.github.v3.sha"
+ mediaTypeV3Diff = "application/vnd.github.v3.diff"
+ mediaTypeV3Patch = "application/vnd.github.v3.patch"
mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json"
// Media Type values to access preview APIs
@@ -68,6 +70,7 @@ const (
mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
// https://developer.github.com/changes/2016-04-01-squash-api-preview/
+ // https://developer.github.com/changes/2016-09-26-pull-request-merge-api-update/
mediaTypeSquashPreview = "application/vnd.github.polaris-preview+json"
// https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
@@ -79,9 +82,6 @@ const (
// 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"
-
// https://developer.github.com/changes/2016-07-06-github-pages-preiew-api/
mediaTypePagesPreview = "application/vnd.github.mister-fantastic-preview+json"
@@ -119,6 +119,7 @@ type Client struct {
// Services used for talking to different parts of the GitHub API.
Activity *ActivityService
+ Admin *AdminService
Authorizations *AuthorizationsService
Gists *GistsService
Git *GitService
@@ -126,6 +127,7 @@ type Client struct {
Integrations *IntegrationsService
Issues *IssuesService
Organizations *OrganizationsService
+ Projects *ProjectsService
PullRequests *PullRequestsService
Repositories *RepositoriesService
Search *SearchService
@@ -154,6 +156,22 @@ type UploadOptions struct {
Name string `url:"name,omitempty"`
}
+// RawType represents type of raw format of a request instead of JSON.
+type RawType uint8
+
+const (
+ // Diff format.
+ Diff RawType = 1 + iota
+ // Patch format.
+ Patch
+)
+
+// RawOptions specifies parameters when user wants to get raw format of
+// a response instead of JSON.
+type RawOptions struct {
+ Type RawType
+}
+
// addOptions adds the parameters in opt as URL query parameters to s. opt
// must be a struct whose fields may contain "url" tags.
func addOptions(s string, opt interface{}) (string, error) {
@@ -190,6 +208,7 @@ func NewClient(httpClient *http.Client) *Client {
c := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, UploadURL: uploadURL}
c.common.client = c
c.Activity = (*ActivityService)(&c.common)
+ c.Admin = (*AdminService)(&c.common)
c.Authorizations = (*AuthorizationsService)(&c.common)
c.Gists = (*GistsService)(&c.common)
c.Git = (*GitService)(&c.common)
@@ -199,6 +218,7 @@ func NewClient(httpClient *http.Client) *Client {
c.Licenses = (*LicensesService)(&c.common)
c.Migrations = (*MigrationService)(&c.common)
c.Organizations = (*OrganizationsService)(&c.common)
+ c.Projects = (*ProjectsService)(&c.common)
c.PullRequests = (*PullRequestsService)(&c.common)
c.Reactions = (*ReactionsService)(&c.common)
c.Repositories = (*RepositoriesService)(&c.common)
@@ -499,6 +519,18 @@ func (r *RateLimitError) Error() string {
r.Response.StatusCode, r.Message, r.Rate.Reset.Time.Sub(time.Now()))
}
+// AcceptedError occurs when GitHub returns 202 Accepted response with an
+// empty body, which means a job was scheduled on the GitHub side to process
+// the information needed and cache it.
+// Technically, 202 Accepted is not a real error, it's just used to
+// indicate that results are not ready yet, but should be available soon.
+// The request can be repeated after some time.
+type AcceptedError struct{}
+
+func (*AcceptedError) Error() string {
+ return "job scheduled on GitHub side; try again later"
+}
+
// 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 {
@@ -562,14 +594,19 @@ func (e *Error) Error() string {
}
// CheckResponse checks the API response for errors, and returns them if
-// present. A response is considered an error if it has a status code outside
-// the 200 range. API error responses are expected to have either no response
+// present. A response is considered an error if it has a status code outside
+// the 200 range or equal to 202 Accepted.
+// API error responses are expected to have either no response
// body, or a JSON response body that maps to ErrorResponse. Any other
// response body will be silently ignored.
//
// The error type will be *RateLimitError for rate limit exceeded errors,
+// *AcceptedError for 202 Accepted status codes,
// and *TwoFactorAuthError for two-factor authentication errors.
func CheckResponse(r *http.Response) error {
+ if r.StatusCode == http.StatusAccepted {
+ return &AcceptedError{}
+ }
if c := r.StatusCode; 200 <= c && c <= 299 {
return nil
}
diff --git a/vendor/github.com/google/go-github/github/issues.go b/vendor/github.com/google/go-github/github/issues.go
index 02c82cd..d8e7d41 100644
--- a/vendor/github.com/google/go-github/github/issues.go
+++ b/vendor/github.com/google/go-github/github/issues.go
@@ -17,6 +17,11 @@ import (
type IssuesService service
// Issue represents a GitHub issue on a repository.
+//
+// Note: As far as the GitHub API is concerned, every pull request is an issue,
+// but not every issue is a pull request. Some endpoints, events, and webhooks
+// may also return pull requests via this struct. If PullRequestLinks is nil,
+// this is an issue, and if PullRequestLinks is not nil, this is a pull request.
type Issue struct {
ID *int `json:"id,omitempty"`
Number *int `json:"number,omitempty"`
diff --git a/vendor/github.com/google/go-github/github/licenses.go b/vendor/github.com/google/go-github/github/licenses.go
index 35cd234..0b5e8b3 100644
--- a/vendor/github.com/google/go-github/github/licenses.go
+++ b/vendor/github.com/google/go-github/github/licenses.go
@@ -10,23 +10,44 @@ import "fmt"
// LicensesService handles communication with the license related
// methods of the GitHub API.
//
-// GitHub API docs: http://developer.github.com/v3/pulls/
+// GitHub API docs: https://developer.github.com/v3/licenses/
type LicensesService service
+// RepositoryLicense represents the license for a repository.
+type RepositoryLicense struct {
+ Name *string `json:"name,omitempty"`
+ Path *string `json:"path,omitempty"`
+
+ SHA *string `json:"sha,omitempty"`
+ Size *int `json:"size,omitempty"`
+ URL *string `json:"url,omitempty"`
+ HTMLURL *string `json:"html_url,omitempty"`
+ GitURL *string `json:"git_url,omitempty"`
+ DownloadURL *string `json:"download_url,omitempty"`
+ Type *string `json:"type,omitempty"`
+ Content *string `json:"content,omitempty"`
+ Encoding *string `json:"encoding,omitempty"`
+ License *License `json:"license,omitempty"`
+}
+
+func (l RepositoryLicense) String() string {
+ return Stringify(l)
+}
+
// License represents an open source license.
type License struct {
Key *string `json:"key,omitempty"`
Name *string `json:"name,omitempty"`
URL *string `json:"url,omitempty"`
+ SPDXID *string `json:"spdx_id,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
Featured *bool `json:"featured,omitempty"`
Description *string `json:"description,omitempty"`
- Category *string `json:"category,omitempty"`
Implementation *string `json:"implementation,omitempty"`
- Required *[]string `json:"required,omitempty"`
- Permitted *[]string `json:"permitted,omitempty"`
- Forbidden *[]string `json:"forbidden,omitempty"`
+ Permissions *[]string `json:"permissions,omitempty"`
+ Conditions *[]string `json:"conditions,omitempty"`
+ Limitations *[]string `json:"limitations,omitempty"`
Body *string `json:"body,omitempty"`
}
diff --git a/vendor/github.com/google/go-github/github/messages.go b/vendor/github.com/google/go-github/github/messages.go
index eedb190..5e167ee 100644
--- a/vendor/github.com/google/go-github/github/messages.go
+++ b/vendor/github.com/google/go-github/github/messages.go
@@ -49,10 +49,14 @@ var (
"integration_installation_repositories": "IntegrationInstallationRepositoriesEvent",
"issue_comment": "IssueCommentEvent",
"issues": "IssuesEvent",
+ "label": "LabelEvent",
"member": "MemberEvent",
"membership": "MembershipEvent",
+ "milestone": "MilestoneEvent",
"page_build": "PageBuildEvent",
+ "ping": "PingEvent",
"public": "PublicEvent",
+ "pull_request_review": "PullRequestReviewEvent",
"pull_request_review_comment": "PullRequestReviewCommentEvent",
"pull_request": "PullRequestEvent",
"push": "PushEvent",
@@ -168,9 +172,9 @@ func WebHookType(r *http.Request) string {
// event, err := github.ParseWebHook(github.WebHookType(r), payload)
// if err != nil { ... }
// switch event := event.(type) {
-// case CommitCommentEvent:
+// case *github.CommitCommentEvent:
// processCommitCommentEvent(event)
-// case CreateEvent:
+// case *github.CreateEvent:
// processCreateEvent(event)
// ...
// }
diff --git a/vendor/github.com/google/go-github/github/projects.go b/vendor/github.com/google/go-github/github/projects.go
new file mode 100644
index 0000000..2330056
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/projects.go
@@ -0,0 +1,417 @@
+// 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"
+
+// ProjectsService provides access to the projects functions in the
+// GitHub API.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/
+type ProjectsService service
+
+// Project represents a GitHub Project.
+type Project struct {
+ ID *int `json:"id,omitempty"`
+ URL *string `json:"url,omitempty"`
+ OwnerURL *string `json:"owner_url,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Body *string `json:"body,omitempty"`
+ Number *int `json:"number,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+
+ // The User object that generated the project.
+ Creator *User `json:"creator,omitempty"`
+}
+
+func (p Project) String() string {
+ return Stringify(p)
+}
+
+// GetProject gets a GitHub Project for a repo.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/#get-a-project
+func (s *ProjectsService) GetProject(id int) (*Project, *Response, error) {
+ u := fmt.Sprintf("projects/%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", mediaTypeProjectsPreview)
+
+ project := &Project{}
+ resp, err := s.client.Do(req, project)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return project, resp, err
+}
+
+// ProjectOptions specifies the parameters to the
+// RepositoriesService.CreateProject and
+// ProjectsService.UpdateProject methods.
+type ProjectOptions struct {
+ // The name of the project. (Required for creation; optional for update.)
+ Name string `json:"name,omitempty"`
+ // The body of the project. (Optional.)
+ Body string `json:"body,omitempty"`
+}
+
+// UpdateProject updates a repository project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/#update-a-project
+func (s *ProjectsService) UpdateProject(id int, opt *ProjectOptions) (*Project, *Response, error) {
+ u := fmt.Sprintf("projects/%v", id)
+ req, err := s.client.NewRequest("PATCH", u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeProjectsPreview)
+
+ project := &Project{}
+ resp, err := s.client.Do(req, project)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return project, resp, err
+}
+
+// DeleteProject deletes a GitHub Project from a repository.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/#delete-a-project
+func (s *ProjectsService) DeleteProject(id int) (*Response, error) {
+ u := fmt.Sprintf("projects/%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", mediaTypeProjectsPreview)
+
+ return s.client.Do(req, nil)
+}
+
+// ProjectColumn represents a column of a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/projects/
+type ProjectColumn struct {
+ ID *int `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ ProjectURL *string `json:"project_url,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+}
+
+// ListProjectColumns lists the columns of a GitHub Project for a repo.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/columns/#list-project-columns
+func (s *ProjectsService) ListProjectColumns(projectID int, opt *ListOptions) ([]*ProjectColumn, *Response, error) {
+ u := fmt.Sprintf("projects/%v/columns", projectID)
+ 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", mediaTypeProjectsPreview)
+
+ columns := []*ProjectColumn{}
+ resp, err := s.client.Do(req, &columns)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return columns, resp, err
+}
+
+// GetProjectColumn gets a column of a GitHub Project for a repo.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/columns/#get-a-project-column
+func (s *ProjectsService) GetProjectColumn(id int) (*ProjectColumn, *Response, error) {
+ u := fmt.Sprintf("projects/columns/%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", mediaTypeProjectsPreview)
+
+ column := &ProjectColumn{}
+ resp, err := s.client.Do(req, column)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return column, resp, err
+}
+
+// ProjectColumnOptions specifies the parameters to the
+// ProjectsService.CreateProjectColumn and
+// ProjectsService.UpdateProjectColumn methods.
+type ProjectColumnOptions struct {
+ // The name of the project column. (Required for creation and update.)
+ Name string `json:"name"`
+}
+
+// CreateProjectColumn creates a column for the specified (by number) project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/columns/#create-a-project-column
+func (s *ProjectsService) CreateProjectColumn(projectID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
+ u := fmt.Sprintf("projects/%v/columns", projectID)
+ req, err := s.client.NewRequest("POST", u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeProjectsPreview)
+
+ column := &ProjectColumn{}
+ resp, err := s.client.Do(req, column)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return column, resp, err
+}
+
+// UpdateProjectColumn updates a column of a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/columns/#update-a-project-column
+func (s *ProjectsService) UpdateProjectColumn(columnID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
+ u := fmt.Sprintf("projects/columns/%v", columnID)
+ req, err := s.client.NewRequest("PATCH", u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeProjectsPreview)
+
+ column := &ProjectColumn{}
+ resp, err := s.client.Do(req, column)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return column, resp, err
+}
+
+// DeleteProjectColumn deletes a column from a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/columns/#delete-a-project-column
+func (s *ProjectsService) DeleteProjectColumn(columnID int) (*Response, error) {
+ u := fmt.Sprintf("projects/columns/%v", columnID)
+ 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", mediaTypeProjectsPreview)
+
+ return s.client.Do(req, nil)
+}
+
+// ProjectColumnMoveOptions specifies the parameters to the
+// ProjectsService.MoveProjectColumn method.
+type ProjectColumnMoveOptions struct {
+ // Position can be one of "first", "last", or "after:<column-id>", where
+ // <column-id> is the ID of a column in the same project. (Required.)
+ Position string `json:"position"`
+}
+
+// MoveProjectColumn moves a column within a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/columns/#move-a-project-column
+func (s *ProjectsService) MoveProjectColumn(columnID int, opt *ProjectColumnMoveOptions) (*Response, error) {
+ u := fmt.Sprintf("projects/columns/%v/moves", columnID)
+ req, err := s.client.NewRequest("POST", u, opt)
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeProjectsPreview)
+
+ return s.client.Do(req, nil)
+}
+
+// ProjectCard represents a card in a column of a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/projects/
+type ProjectCard struct {
+ ColumnURL *string `json:"column_url,omitempty"`
+ ContentURL *string `json:"content_url,omitempty"`
+ ID *int `json:"id,omitempty"`
+ Note *string `json:"note,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+}
+
+// ListProjectCards lists the cards in a column of a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards
+func (s *ProjectsService) ListProjectCards(columnID int, opt *ListOptions) ([]*ProjectCard, *Response, error) {
+ u := fmt.Sprintf("projects/columns/%v/cards", columnID)
+ 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", mediaTypeProjectsPreview)
+
+ cards := []*ProjectCard{}
+ resp, err := s.client.Do(req, &cards)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return cards, resp, err
+}
+
+// GetProjectCard gets a card in a column of a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/cards/#get-a-project-card
+func (s *ProjectsService) GetProjectCard(columnID int) (*ProjectCard, *Response, error) {
+ u := fmt.Sprintf("projects/columns/cards/%v", columnID)
+ 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", mediaTypeProjectsPreview)
+
+ card := &ProjectCard{}
+ resp, err := s.client.Do(req, card)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return card, resp, err
+}
+
+// ProjectCardOptions specifies the parameters to the
+// ProjectsService.CreateProjectCard and
+// ProjectsService.UpdateProjectCard methods.
+type ProjectCardOptions struct {
+ // The note of the card. Note and ContentID are mutually exclusive.
+ Note string `json:"note,omitempty"`
+ // The ID (not Number) of the Issue or Pull Request to associate with this card.
+ // Note and ContentID are mutually exclusive.
+ ContentID int `json:"content_id,omitempty"`
+ // The type of content to associate with this card. Possible values are: "Issue", "PullRequest".
+ ContentType string `json:"content_type,omitempty"`
+}
+
+// CreateProjectCard creates a card in the specified column of a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/cards/#create-a-project-card
+func (s *ProjectsService) CreateProjectCard(columnID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) {
+ u := fmt.Sprintf("projects/columns/%v/cards", columnID)
+ req, err := s.client.NewRequest("POST", u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeProjectsPreview)
+
+ card := &ProjectCard{}
+ resp, err := s.client.Do(req, card)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return card, resp, err
+}
+
+// UpdateProjectCard updates a card of a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/cards/#update-a-project-card
+func (s *ProjectsService) UpdateProjectCard(cardID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) {
+ u := fmt.Sprintf("projects/columns/cards/%v", cardID)
+ req, err := s.client.NewRequest("PATCH", u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeProjectsPreview)
+
+ card := &ProjectCard{}
+ resp, err := s.client.Do(req, card)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return card, resp, err
+}
+
+// DeleteProjectCard deletes a card from a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/cards/#delete-a-project-card
+func (s *ProjectsService) DeleteProjectCard(cardID int) (*Response, error) {
+ u := fmt.Sprintf("projects/columns/cards/%v", cardID)
+ 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", mediaTypeProjectsPreview)
+
+ return s.client.Do(req, nil)
+}
+
+// ProjectCardMoveOptions specifies the parameters to the
+// ProjectsService.MoveProjectCard method.
+type ProjectCardMoveOptions struct {
+ // Position can be one of "top", "bottom", or "after:<card-id>", where
+ // <card-id> is the ID of a card in the same project.
+ Position string `json:"position"`
+ // ColumnID is the ID of a column in the same project. Note that ColumnID
+ // is required when using Position "after:<card-id>" when that card is in
+ // another column; otherwise it is optional.
+ ColumnID int `json:"column_id,omitempty"`
+}
+
+// MoveProjectCard moves a card within a GitHub Project.
+//
+// GitHub API docs: https://developer.github.com/v3/projects/cards/#move-a-project-card
+func (s *ProjectsService) MoveProjectCard(cardID int, opt *ProjectCardMoveOptions) (*Response, error) {
+ u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID)
+ req, err := s.client.NewRequest("POST", u, opt)
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeProjectsPreview)
+
+ return s.client.Do(req, nil)
+}
diff --git a/vendor/github.com/google/go-github/github/pulls.go b/vendor/github.com/google/go-github/github/pulls.go
index 3c88365..51c6ccb 100644
--- a/vendor/github.com/google/go-github/github/pulls.go
+++ b/vendor/github.com/google/go-github/github/pulls.go
@@ -6,6 +6,7 @@
package github
import (
+ "bytes"
"fmt"
"time"
)
@@ -134,6 +135,32 @@ func (s *PullRequestsService) Get(owner string, repo string, number int) (*PullR
return pull, resp, err
}
+// GetRaw gets raw (diff or patch) format of a pull request.
+func (s *PullRequestsService) GetRaw(owner string, repo string, number int, opt RawOptions) (string, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return "", nil, err
+ }
+
+ switch opt.Type {
+ case Diff:
+ req.Header.Set("Accept", mediaTypeV3Diff)
+ case Patch:
+ req.Header.Set("Accept", mediaTypeV3Patch)
+ default:
+ return "", nil, fmt.Errorf("unsupported raw type %d", opt.Type)
+ }
+
+ ret := new(bytes.Buffer)
+ resp, err := s.client.Do(req, ret)
+ if err != nil {
+ return "", resp, err
+ }
+
+ return ret.String(), resp, err
+}
+
// NewPullRequest represents a new pull request to be created.
type NewPullRequest struct {
Title *string `json:"title,omitempty"`
@@ -253,32 +280,41 @@ type PullRequestMergeResult struct {
// PullRequestOptions lets you define how a pull request will be merged.
type PullRequestOptions struct {
- Squash bool
+ CommitTitle string // Extra detail to append to automatic commit message. (Optional.)
+ SHA string // SHA that pull request head must match to allow merge. (Optional.)
+
+ // The merge method to use. Possible values include: "merge", "squash", and "rebase" with the default being merge. (Optional.)
+ MergeMethod string
}
type pullRequestMergeRequest struct {
- CommitMessage *string `json:"commit_message"`
- Squash *bool `json:"squash,omitempty"`
+ CommitMessage string `json:"commit_message"`
+ CommitTitle string `json:"commit_title,omitempty"`
+ MergeMethod string `json:"merge_method,omitempty"`
+ SHA string `json:"sha,omitempty"`
}
// Merge a pull request (Merge Button™).
+// commitMessage is the title for the automatic commit message.
//
// 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, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
- pullRequestBody := &pullRequestMergeRequest{CommitMessage: &commitMessage}
+ pullRequestBody := &pullRequestMergeRequest{CommitMessage: commitMessage}
if options != nil {
- pullRequestBody.Squash = &options.Squash
+ pullRequestBody.CommitTitle = options.CommitTitle
+ pullRequestBody.MergeMethod = options.MergeMethod
+ pullRequestBody.SHA = options.SHA
}
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
}
+ // TODO: This header will be unnecessary when the API is no longer in preview.
+ req.Header.Set("Accept", mediaTypeSquashPreview)
+
mergeResult := new(PullRequestMergeResult)
resp, err := s.client.Do(req, mergeResult)
if err != nil {
diff --git a/vendor/github.com/google/go-github/github/pulls_reviews.go b/vendor/github.com/google/go-github/github/pulls_reviews.go
new file mode 100644
index 0000000..ae3cdd4
--- /dev/null
+++ b/vendor/github.com/google/go-github/github/pulls_reviews.go
@@ -0,0 +1,19 @@
+// 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 "time"
+
+// PullRequestReview represents a review of a pull request.
+type PullRequestReview struct {
+ ID *int `json:"id,omitempty"`
+ User *User `json:"user,omitempty"`
+ Body *string `json:"body,omitempty"`
+ SubmittedAt *time.Time `json:"submitted_at,omitempty"`
+
+ // State can be "approved", "rejected", or "commented".
+ State *string `json:"state,omitempty"`
+}
diff --git a/vendor/github.com/google/go-github/github/repos.go b/vendor/github.com/google/go-github/github/repos.go
index 98e4ac5..040cd31 100644
--- a/vendor/github.com/google/go-github/github/repos.go
+++ b/vendor/github.com/google/go-github/github/repos.go
@@ -5,7 +5,10 @@
package github
-import "fmt"
+import (
+ "fmt"
+ "strings"
+)
// RepositoriesService handles communication with the repository related
// methods of the GitHub API.
@@ -46,6 +49,9 @@ type Repository struct {
Source *Repository `json:"source,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Permissions *map[string]bool `json:"permissions,omitempty"`
+ AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"`
+ AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"`
+ AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"`
// Only provided when using RepositoriesService.Get while in preview
License *License `json:"license,omitempty"`
@@ -286,7 +292,8 @@ func (s *RepositoriesService) Get(owner, repo string) (*Repository, *Response, e
// TODO: remove custom Accept header when the license support fully launches
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
- req.Header.Set("Accept", mediaTypeLicensesPreview)
+ acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeSquashPreview}
+ req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
repository := new(Repository)
resp, err := s.client.Do(req, repository)
@@ -330,6 +337,9 @@ func (s *RepositoriesService) Edit(owner, repo string, repository *Repository) (
return nil, nil, err
}
+ // TODO: Remove this preview header after API is fully vetted.
+ req.Header.Add("Accept", mediaTypeSquashPreview)
+
r := new(Repository)
resp, err := s.client.Do(req, r)
if err != nil {
@@ -491,29 +501,54 @@ func (s *RepositoriesService) ListTags(owner string, repo string, opt *ListOptio
// Branch represents a repository branch
type Branch struct {
- Name *string `json:"name,omitempty"`
- Commit *Commit `json:"commit,omitempty"`
- Protection *Protection `json:"protection,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Commit *RepositoryCommit `json:"commit,omitempty"`
+ Protected *bool `json:"protected,omitempty"`
}
-// Protection represents a repository branch's protection
+// Protection represents a repository branch's protection.
type Protection struct {
- Enabled *bool `json:"enabled,omitempty"`
- RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks,omitempty"`
+ RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
+ Restrictions *BranchRestrictions `json:"restrictions"`
}
-// RequiredStatusChecks represents the protection status of a individual branch
+// ProtectionRequest represents a request to create/edit a branch's protection.
+type ProtectionRequest struct {
+ RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"`
+ Restrictions *BranchRestrictionsRequest `json:"restrictions"`
+}
+
+// RequiredStatusChecks represents the protection status of a individual branch.
type RequiredStatusChecks struct {
- // Who required status checks apply to.
- // Possible values are:
- // off
- // non_admins
- // everyone
- EnforcementLevel *string `json:"enforcement_level,omitempty"`
- // The list of status checks which are required
+ // Enforce required status checks for repository administrators.
+ IncludeAdmins *bool `json:"include_admins,omitempty"`
+ // Require branches to be up to date before merging.
+ Strict *bool `json:"strict,omitempty"`
+ // The list of status checks to require in order to merge into this
+ // branch.
Contexts *[]string `json:"contexts,omitempty"`
}
+// BranchRestrictions represents the restriction that only certain users or
+// teams may push to a branch.
+type BranchRestrictions struct {
+ // The list of user logins with push access.
+ Users []*User `json:"users,omitempty"`
+ // The list of team slugs with push access.
+ Teams []*Team `json:"teams,omitempty"`
+}
+
+// BranchRestrictionsRequest represents the request to create/edit the
+// restriction that only certain users or teams may push to a branch. It is
+// separate from BranchRestrictions above because the request structure is
+// different from the response structure.
+type BranchRestrictionsRequest struct {
+ // The list of user logins with push access.
+ Users *[]string `json:"users,omitempty"`
+ // The list of team slugs with push access.
+ Teams *[]string `json:"teams,omitempty"`
+}
+
// ListBranches lists branches for the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/#list-branches
@@ -529,6 +564,7 @@ func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListO
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
branches := new([]*Branch)
@@ -550,6 +586,7 @@ func (s *RepositoriesService) GetBranch(owner, repo, branch string) (*Branch, *R
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
b := new(Branch)
@@ -561,42 +598,81 @@ func (s *RepositoriesService) GetBranch(owner, repo, branch string) (*Branch, *R
return b, resp, err
}
-// EditBranch edits the branch (currently only Branch Protection)
+// GetBranchProtection gets the protection of a given branch.
//
-// GitHub API docs: https://developer.github.com/v3/repos/#enabling-and-disabling-branch-protection
-func (s *RepositoriesService) EditBranch(owner, repo, branchName string, branch *Branch) (*Branch, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branchName)
- req, err := s.client.NewRequest("PATCH", u, branch)
+// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-branch-protection
+func (s *RepositoriesService) GetBranchProtection(owner, repo, branch string) (*Protection, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
+ 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", mediaTypeProtectedBranchesPreview)
- b := new(Branch)
- resp, err := s.client.Do(req, b)
+ p := new(Protection)
+ resp, err := s.client.Do(req, p)
if err != nil {
return nil, resp, err
}
- return b, resp, err
+ return p, resp, err
+}
+
+// UpdateBranchProtection updates the protection of a given branch.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-branch-protection
+func (s *RepositoriesService) UpdateBranchProtection(owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
+ req, err := s.client.NewRequest("PUT", u, preq)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches
+ req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
+
+ p := new(Protection)
+ resp, err := s.client.Do(req, p)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return p, resp, err
+}
+
+// RemoveBranchProtection removes the protection of a given branch.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-branch-protection
+func (s *RepositoriesService) RemoveBranchProtection(owner, repo, branch string) (*Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
+ 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", mediaTypeProtectedBranchesPreview)
+
+ return s.client.Do(req, nil)
}
// License gets the contents of a repository's license if one is detected.
//
// GitHub API docs: https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license
-func (s *RepositoriesService) License(owner, repo string) (*License, *Response, error) {
+func (s *RepositoriesService) License(owner, repo string) (*RepositoryLicense, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/license", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
- r := &Repository{}
+ r := &RepositoryLicense{}
resp, err := s.client.Do(req, r)
if err != nil {
return nil, resp, err
}
- return r.License, resp, err
+ return r, 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 c1359f4..22e8fca 100644
--- a/vendor/github.com/google/go-github/github/repos_commits.go
+++ b/vendor/github.com/google/go-github/github/repos_commits.go
@@ -20,7 +20,6 @@ type RepositoryCommit struct {
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"`
@@ -48,13 +47,16 @@ func (c CommitStats) String() string {
// CommitFile represents a file modified in a commit.
type CommitFile struct {
- SHA *string `json:"sha,omitempty"`
- Filename *string `json:"filename,omitempty"`
- Additions *int `json:"additions,omitempty"`
- Deletions *int `json:"deletions,omitempty"`
- Changes *int `json:"changes,omitempty"`
- Status *string `json:"status,omitempty"`
- Patch *string `json:"patch,omitempty"`
+ SHA *string `json:"sha,omitempty"`
+ Filename *string `json:"filename,omitempty"`
+ Additions *int `json:"additions,omitempty"`
+ Deletions *int `json:"deletions,omitempty"`
+ Changes *int `json:"changes,omitempty"`
+ Status *string `json:"status,omitempty"`
+ Patch *string `json:"patch,omitempty"`
+ BlobURL *string `json:"blob_url,omitempty"`
+ RawURL *string `json:"raw_url,omitempty"`
+ ContentsURL *string `json:"contents_url,omitempty"`
}
func (c CommitFile) String() string {
diff --git a/vendor/github.com/google/go-github/github/repos_contents.go b/vendor/github.com/google/go-github/github/repos_contents.go
index ebf4d04..7b08cf0 100644
--- a/vendor/github.com/google/go-github/github/repos_contents.go
+++ b/vendor/github.com/google/go-github/github/repos_contents.go
@@ -267,8 +267,12 @@ func (s *RepositoriesService) GetArchiveLink(owner, repo string, archiveformat a
} else {
resp, err = s.client.client.Transport.RoundTrip(req)
}
- if err != nil || resp.StatusCode != http.StatusFound {
- return nil, newResponse(resp), err
+ if err != nil {
+ return nil, nil, err
+ }
+ resp.Body.Close()
+ if resp.StatusCode != http.StatusFound {
+ return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status)
}
parsedURL, err := url.Parse(resp.Header.Get("Location"))
return parsedURL, newResponse(resp), err
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 f3272b0..4b40fbe 100644
--- a/vendor/github.com/google/go-github/github/repos_deployments.go
+++ b/vendor/github.com/google/go-github/github/repos_deployments.go
@@ -82,6 +82,27 @@ func (s *RepositoriesService) ListDeployments(owner, repo string, opt *Deploymen
return *deployments, resp, err
}
+// GetDeployment returns a single deployment of a repository.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/deployments/
+// Note: GetDeployment uses the undocumented GitHub API endpoint /repos/:owner/:repo/deployments/:id.
+func (s *RepositoriesService) GetDeployment(owner, repo string, deploymentID int) (*Deployment, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ deployment := new(Deployment)
+ resp, err := s.client.Do(req, deployment)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return deployment, resp, err
+}
+
// CreateDeployment creates a new deployment for a repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment
diff --git a/vendor/github.com/google/go-github/github/repos_forks.go b/vendor/github.com/google/go-github/github/repos_forks.go
index 7ef4cb3..c88f3d3 100644
--- a/vendor/github.com/google/go-github/github/repos_forks.go
+++ b/vendor/github.com/google/go-github/github/repos_forks.go
@@ -50,6 +50,12 @@ type RepositoryCreateForkOptions struct {
// CreateFork creates a fork of the specified repository.
//
+// This method might return an *AcceptedError and a status code of
+// 202. This is because this is the status that GitHub returns to signify that
+// it is now computing creating the fork in a background task.
+// A follow up request, after a delay of a second or so, should result
+// in a successful request.
+//
// GitHub API docs: https://developer.github.com/v3/repos/forks/#create-a-fork
func (s *RepositoriesService) CreateFork(owner, repo string, opt *RepositoryCreateForkOptions) (*Repository, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
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 ccd24f3..ddd8301 100644
--- a/vendor/github.com/google/go-github/github/repos_pages.go
+++ b/vendor/github.com/google/go-github/github/repos_pages.go
@@ -30,13 +30,13 @@ type PagesBuild struct {
Commit *string `json:"commit,omitempty"`
Duration *int `json:"duration,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"created_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
}
// GetPagesInfo fetches information about a GitHub Pages site.
//
// GitHub API docs: https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site
-func (s *RepositoriesService) GetPagesInfo(owner string, repo string) (*Pages, *Response, error) {
+func (s *RepositoriesService) GetPagesInfo(owner, repo string) (*Pages, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@@ -58,7 +58,7 @@ 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, 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 {
@@ -77,7 +77,7 @@ func (s *RepositoriesService) ListPagesBuilds(owner string, repo string) ([]*Pag
// GetLatestPagesBuild fetches the latest build information for a GitHub pages site.
//
// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-latest-pages-build
-func (s *RepositoriesService) GetLatestPagesBuild(owner string, repo string) (*PagesBuild, *Response, error) {
+func (s *RepositoriesService) GetLatestPagesBuild(owner, repo string) (*PagesBuild, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@@ -93,10 +93,29 @@ func (s *RepositoriesService) GetLatestPagesBuild(owner string, repo string) (*P
return build, resp, err
}
+// GetPageBuild fetches the specific build information for a GitHub pages site.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-a-specific-pages-build
+func (s *RepositoriesService) GetPageBuild(owner, repo string, id int) (*PagesBuild, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id)
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ build := new(PagesBuild)
+ resp, err := s.client.Do(req, build)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return build, resp, err
+}
+
// RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit.
//
// GitHub API docs: https://developer.github.com/v3/repos/pages/#request-a-page-build
-func (s *RepositoriesService) RequestPageBuild(owner string, repo string) (*PagesBuild, *Response, error) {
+func (s *RepositoriesService) RequestPageBuild(owner, repo string) (*PagesBuild, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
req, err := s.client.NewRequest("POST", u, nil)
if err != nil {
diff --git a/vendor/github.com/google/go-github/github/repos_projects.go b/vendor/github.com/google/go-github/github/repos_projects.go
index e37e220..137f89d 100644
--- a/vendor/github.com/google/go-github/github/repos_projects.go
+++ b/vendor/github.com/google/go-github/github/repos_projects.go
@@ -5,34 +5,11 @@
package github
-import (
- "fmt"
-)
-
-// Project represents a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/
-type Project struct {
- ID *int `json:"id,omitempty"`
- URL *string `json:"url,omitempty"`
- OwnerURL *string `json:"owner_url,omitempty"`
- Name *string `json:"name,omitempty"`
- Body *string `json:"body,omitempty"`
- Number *int `json:"number,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
-
- // The User object that generated the project.
- Creator *User `json:"creator,omitempty"`
-}
-
-func (p Project) String() string {
- return Stringify(p)
-}
+import "fmt"
// ListProjects lists the projects for a repo.
//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#list-projects
+// GitHub API docs: https://developer.github.com/v3/projects/#list-repository-projects
func (s *RepositoriesService) ListProjects(owner, repo string, opt *ListOptions) ([]*Project, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
u, err := addOptions(u, opt)
@@ -57,44 +34,12 @@ func (s *RepositoriesService) ListProjects(owner, repo string, opt *ListOptions)
return projects, resp, err
}
-// GetProject gets a GitHub Project for a repo.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#get-a-project
-func (s *RepositoriesService) GetProject(owner, repo string, number int) (*Project, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/%v", owner, repo, number)
- req, err := s.client.NewRequest("GET", u, nil)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- project := &Project{}
- resp, err := s.client.Do(req, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, err
-}
-
-// ProjectOptions specifies the parameters to the
-// RepositoriesService.CreateProject and
-// RepositoriesService.UpdateProject methods.
-type ProjectOptions struct {
- // The name of the project. (Required for creation; optional for update.)
- Name string `json:"name,omitempty"`
- // The body of the project. (Optional.)
- Body string `json:"body,omitempty"`
-}
-
// CreateProject creates a GitHub Project for the specified repository.
//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#create-a-project
-func (s *RepositoriesService) CreateProject(owner, repo string, projectOptions *ProjectOptions) (*Project, *Response, error) {
+// GitHub API docs: https://developer.github.com/v3/projects/#create-a-repository-project
+func (s *RepositoriesService) CreateProject(owner, repo string, opt *ProjectOptions) (*Project, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
- req, err := s.client.NewRequest("POST", u, projectOptions)
+ req, err := s.client.NewRequest("POST", u, opt)
if err != nil {
return nil, nil, err
}
@@ -110,355 +55,3 @@ func (s *RepositoriesService) CreateProject(owner, repo string, projectOptions *
return project, resp, err
}
-
-// UpdateProject updates a repository project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#update-a-project
-func (s *RepositoriesService) UpdateProject(owner, repo string, number int, projectOptions *ProjectOptions) (*Project, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/%v", owner, repo, number)
- req, err := s.client.NewRequest("PATCH", u, projectOptions)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- project := &Project{}
- resp, err := s.client.Do(req, project)
- if err != nil {
- return nil, resp, err
- }
-
- return project, resp, err
-}
-
-// DeleteProject deletes a GitHub Project from a repository.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#delete-a-project
-func (s *RepositoriesService) DeleteProject(owner, repo string, number int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/%v", owner, repo, number)
- 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", mediaTypeProjectsPreview)
-
- return s.client.Do(req, nil)
-}
-
-// ProjectColumn represents a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/
-type ProjectColumn struct {
- ID *int `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- ProjectURL *string `json:"project_url,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
-}
-
-// ListProjectColumns lists the columns of a GitHub Project for a repo.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#list-columns
-func (s *RepositoriesService) ListProjectColumns(owner, repo string, number int, opt *ListOptions) ([]*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/%v/columns", 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", mediaTypeProjectsPreview)
-
- columns := []*ProjectColumn{}
- resp, err := s.client.Do(req, &columns)
- if err != nil {
- return nil, resp, err
- }
-
- return columns, resp, err
-}
-
-// GetProjectColumn gets a column of a GitHub Project for a repo.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#get-a-column
-func (s *RepositoriesService) GetProjectColumn(owner, repo string, columnID int) (*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/%v", owner, repo, columnID)
- 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", mediaTypeProjectsPreview)
-
- column := &ProjectColumn{}
- resp, err := s.client.Do(req, column)
- if err != nil {
- return nil, resp, err
- }
-
- return column, resp, err
-}
-
-// ProjectColumnOptions specifies the parameters to the
-// RepositoriesService.CreateProjectColumn and
-// RepositoriesService.UpdateProjectColumn methods.
-type ProjectColumnOptions struct {
- // The name of the project column. (Required for creation and update.)
- Name string `json:"name"`
-}
-
-// CreateProjectColumn creates a column for the specified (by number) project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#create-a-column
-func (s *RepositoriesService) CreateProjectColumn(owner, repo string, number int, columnOptions *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/%v/columns", owner, repo, number)
- req, err := s.client.NewRequest("POST", u, columnOptions)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- column := &ProjectColumn{}
- resp, err := s.client.Do(req, column)
- if err != nil {
- return nil, resp, err
- }
-
- return column, resp, err
-}
-
-// UpdateProjectColumn updates a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#update-a-column
-func (s *RepositoriesService) UpdateProjectColumn(owner, repo string, columnID int, columnOptions *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/%v", owner, repo, columnID)
- req, err := s.client.NewRequest("PATCH", u, columnOptions)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- column := &ProjectColumn{}
- resp, err := s.client.Do(req, column)
- if err != nil {
- return nil, resp, err
- }
-
- return column, resp, err
-}
-
-// DeleteProjectColumn deletes a column from a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#delete-a-column
-func (s *RepositoriesService) DeleteProjectColumn(owner, repo string, columnID int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/%v", owner, repo, columnID)
- 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", mediaTypeProjectsPreview)
-
- return s.client.Do(req, nil)
-}
-
-// ProjectColumnMoveOptions specifies the parameters to the
-// RepositoriesService.MoveProjectColumn method.
-type ProjectColumnMoveOptions struct {
- // Position can be one of "first", "last", or "after:<column-id>", where
- // <column-id> is the ID of a column in the same project. (Required.)
- Position string `json:"position"`
-}
-
-// MoveProjectColumn moves a column within a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#move-a-column
-func (s *RepositoriesService) MoveProjectColumn(owner, repo string, columnID int, moveOptions *ProjectColumnMoveOptions) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/%v/moves", owner, repo, columnID)
- req, err := s.client.NewRequest("POST", u, moveOptions)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- return s.client.Do(req, nil)
-}
-
-// ProjectCard represents a card in a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/
-type ProjectCard struct {
- ColumnURL *string `json:"column_url,omitempty"`
- ContentURL *string `json:"content_url,omitempty"`
- ID *int `json:"id,omitempty"`
- Note *string `json:"note,omitempty"`
- CreatedAt *Timestamp `json:"created_at,omitempty"`
- UpdatedAt *Timestamp `json:"updated_at,omitempty"`
-}
-
-// ListProjectCards lists the cards in a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#list-projects-cards
-func (s *RepositoriesService) ListProjectCards(owner, repo string, columnID int, opt *ListOptions) ([]*ProjectCard, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/%v/cards", owner, repo, columnID)
- 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", mediaTypeProjectsPreview)
-
- cards := []*ProjectCard{}
- resp, err := s.client.Do(req, &cards)
- if err != nil {
- return nil, resp, err
- }
-
- return cards, resp, err
-}
-
-// GetProjectCard gets a card in a column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#get-a-project-card
-func (s *RepositoriesService) GetProjectCard(owner, repo string, columnID int) (*ProjectCard, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/cards/%v", owner, repo, columnID)
- 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", mediaTypeProjectsPreview)
-
- card := &ProjectCard{}
- resp, err := s.client.Do(req, card)
- if err != nil {
- return nil, resp, err
- }
-
- return card, resp, err
-}
-
-// ProjectCardOptions specifies the parameters to the
-// RepositoriesService.CreateProjectCard and
-// RepositoriesService.UpdateProjectCard methods.
-type ProjectCardOptions struct {
- // The note of the card. Note and ContentID are mutually exclusive.
- Note string `json:"note,omitempty"`
- // The ID (not Number) of the Issue or Pull Request to associate with this card.
- // Note and ContentID are mutually exclusive.
- ContentID int `json:"content_id,omitempty"`
- // The type of content to associate with this card. Possible values are: "Issue", "PullRequest".
- ContentType string `json:"content_type,omitempty"`
-}
-
-// CreateProjectCard creates a card in the specified column of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#create-a-project-card
-func (s *RepositoriesService) CreateProjectCard(owner, repo string, columnID int, cardOptions *ProjectCardOptions) (*ProjectCard, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/%v/cards", owner, repo, columnID)
- req, err := s.client.NewRequest("POST", u, cardOptions)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- card := &ProjectCard{}
- resp, err := s.client.Do(req, card)
- if err != nil {
- return nil, resp, err
- }
-
- return card, resp, err
-}
-
-// UpdateProjectCard updates a card of a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#update-a-project-card
-func (s *RepositoriesService) UpdateProjectCard(owner, repo string, cardID int, cardOptions *ProjectCardOptions) (*ProjectCard, *Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/cards/%v", owner, repo, cardID)
- req, err := s.client.NewRequest("PATCH", u, cardOptions)
- if err != nil {
- return nil, nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- card := &ProjectCard{}
- resp, err := s.client.Do(req, card)
- if err != nil {
- return nil, resp, err
- }
-
- return card, resp, err
-}
-
-// DeleteProjectCard deletes a card from a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#delete-a-project-card
-func (s *RepositoriesService) DeleteProjectCard(owner, repo string, cardID int) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/cards/%v", owner, repo, cardID)
- 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", mediaTypeProjectsPreview)
-
- return s.client.Do(req, nil)
-}
-
-// ProjectCardMoveOptions specifies the parameters to the
-// RepositoriesService.MoveProjectCard method.
-type ProjectCardMoveOptions struct {
- // Position can be one of "top", "bottom", or "after:<card-id>", where
- // <card-id> is the ID of a card in the same project.
- Position string `json:"position"`
- // ColumnID is the ID of a column in the same project. Note that ColumnID
- // is required when using Position "after:<card-id>" when that card is in
- // another column; otherwise it is optional.
- ColumnID int `json:"column_id,omitempty"`
-}
-
-// MoveProjectCard moves a card within a GitHub Project.
-//
-// GitHub API docs: https://developer.github.com/v3/repos/projects/#move-a-project-card
-func (s *RepositoriesService) MoveProjectCard(owner, repo string, cardID int, moveOptions *ProjectCardMoveOptions) (*Response, error) {
- u := fmt.Sprintf("repos/%v/%v/projects/columns/cards/%v/moves", owner, repo, cardID)
- req, err := s.client.NewRequest("POST", u, moveOptions)
- if err != nil {
- return nil, err
- }
-
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
- return s.client.Do(req, 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 e4f75a5..8657bd7 100644
--- a/vendor/github.com/google/go-github/github/repos_stats.go
+++ b/vendor/github.com/google/go-github/github/repos_stats.go
@@ -39,8 +39,8 @@ func (w WeeklyStats) String() string {
// deletions and commit counts.
//
// If this is the first time these statistics are requested for the given
-// repository, this method will return a non-nil error and a status code of
-// 202. This is because this is the status that github returns to signify that
+// repository, this method will return an *AcceptedError and a status code of
+// 202. This is because this is the status that GitHub returns to signify that
// it is now computing the requested statistics. A follow up request, after a
// delay of a second or so, should result in a successful request.
//
@@ -78,8 +78,8 @@ func (w WeeklyCommitActivity) String() string {
// starting on Sunday.
//
// If this is the first time these statistics are requested for the given
-// repository, this method will return a non-nil error and a status code of
-// 202. This is because this is the status that github returns to signify that
+// repository, this method will return an *AcceptedError and a status code of
+// 202. This is because this is the status that GitHub returns to signify that
// it is now computing the requested statistics. A follow up request, after a
// delay of a second or so, should result in a successful request.
//
@@ -104,6 +104,12 @@ func (s *RepositoriesService) ListCommitActivity(owner, repo string) ([]*WeeklyC
// deletions pushed to a repository. Returned WeeklyStats will contain
// additions and deletions, but not total commits.
//
+// If this is the first time these statistics are requested for the given
+// repository, this method will return an *AcceptedError and a status code of
+// 202. This is because this is the status that GitHub returns to signify that
+// it is now computing the requested statistics. A follow up request, after a
+// delay of a second or so, should result in a successful request.
+//
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#code-frequency
func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]*WeeklyStats, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo)
@@ -152,11 +158,10 @@ func (r RepositoryParticipation) String() string {
// The array order is oldest week (index 0) to most recent week.
//
// If this is the first time these statistics are requested for the given
-// repository, this method will return a non-nil error and a status code
-// of 202. This is because this is the status that github returns to
-// signify that it is now computing the requested statistics. A follow
-// up request, after a delay of a second or so, should result in a
-// successful request.
+// repository, this method will return an *AcceptedError and a status code of
+// 202. This is because this is the status that GitHub returns to signify that
+// it is now computing the requested statistics. A follow up request, after a
+// delay of a second or so, should result in a successful request.
//
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#participation
func (s *RepositoriesService) ListParticipation(owner, repo string) (*RepositoryParticipation, *Response, error) {
@@ -185,6 +190,12 @@ type PunchCard struct {
// ListPunchCard returns the number of commits per hour in each day.
//
+// If this is the first time these statistics are requested for the given
+// repository, this method will return an *AcceptedError and a status code of
+// 202. This is because this is the status that GitHub returns to signify that
+// it is now computing the requested statistics. A follow up request, after a
+// delay of a second or so, should result in a successful request.
+//
// GitHub API Docs: https://developer.github.com/v3/repos/statistics/#punch-card
func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]*PunchCard, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo)