diff --git a/Gopkg.lock b/Gopkg.lock index cf2d4090..8d56782e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -44,13 +44,13 @@ revision = "b23993cbb6353f0e6aa98d0ee318a34728f628b9" [[projects]] - branch = "master" name = "github.com/gdamore/tcell" packages = [ ".", "terminfo" ] revision = "de7e78efa4a71b3f36c7154989c529dbdf9ae623" + version = "v1.1.0" [[projects]] name = "github.com/golang/protobuf" @@ -62,7 +62,7 @@ branch = "master" name = "github.com/google/go-github" packages = ["github"] - revision = "c0b63e2f9bb198baf328c8abf1ddcbe05ff9427e" + revision = "77a604e05ff9e668b242334d116bc6d1d0a12d66" [[projects]] branch = "master" @@ -122,7 +122,7 @@ branch = "master" name = "github.com/rivo/tview" packages = ["."] - revision = "c33dd0cf8ef840e1c8905c838d5b1ce93050a825" + revision = "6614b16d9037759065eac63d8fb3d8408e63e222" [[projects]] name = "github.com/stretchr/testify" @@ -131,10 +131,10 @@ version = "v1.2.2" [[projects]] - branch = "master" name = "github.com/xanzy/go-gitlab" packages = ["."] - revision = "fb3ece09ef3e80cfa5c1e52dc75fcfb56c12e026" + revision = "4f616cbce6a5f335461881701f772d8b8e16c2f6" + version = "v0.10.8" [[projects]] branch = "master" @@ -155,7 +155,7 @@ "context", "context/ctxhttp" ] - revision = "8887df42c721e930089d31b28391090a10a497d7" + revision = "a0f8a16cb08c06df97cbdf9c47f4731ba548c33c" [[projects]] branch = "master" @@ -167,7 +167,7 @@ "jws", "jwt" ] - revision = "ef147856a6ddbb60760db74283d2424e98c87bff" + revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f" [[projects]] name = "golang.org/x/text" @@ -191,7 +191,7 @@ "googleapi/internal/uritemplates", "sheets/v4" ] - revision = "efcb5f25ac56eae06c8b5672456c0b7767522685" + revision = "31ca0e01cd791f07750cb23fc99327721f753290" [[projects]] name = "google.golang.org/appengine" @@ -219,6 +219,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "44328d9f71a21b64ed00b346dd77be8af49d0542f393f3e17c52de6125c57e24" + inputs-digest = "b36355370ccdc4bf6659b1412b29f9da474a922e52a2884f80b7205791e0d304" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/google/go-github/AUTHORS b/vendor/github.com/google/go-github/AUTHORS index 4c2ad9b4..56622a4c 100644 --- a/vendor/github.com/google/go-github/AUTHORS +++ b/vendor/github.com/google/go-github/AUTHORS @@ -146,6 +146,7 @@ Sahil Dua saisi Sam Minnée Sander van Harmelen +Sanket Payghan Sarasa Kisaragi Sean Wang Sebastian Mandrean 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 f337fcd2..a919b11c 100644 --- a/vendor/github.com/google/go-github/github/activity_events.go +++ b/vendor/github.com/google/go-github/github/activity_events.go @@ -32,6 +32,10 @@ func (e Event) String() string { // a value of the corresponding struct type will be returned. func (e *Event) ParsePayload() (payload interface{}, err error) { switch *e.Type { + case "CheckRunEvent": + payload = &CheckRunEvent{} + case "CheckSuiteEvent": + payload = &CheckSuiteEvent{} case "CommitCommentEvent": payload = &CommitCommentEvent{} case "CreateEvent": diff --git a/vendor/github.com/google/go-github/github/apps_marketplace.go b/vendor/github.com/google/go-github/github/apps_marketplace.go index 089cdbf7..3f35b915 100644 --- a/vendor/github.com/google/go-github/github/apps_marketplace.go +++ b/vendor/github.com/google/go-github/github/apps_marketplace.go @@ -74,9 +74,6 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opt *ListOptions) ([ return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMarketplacePreview) - var plans []*MarketplacePlan resp, err := s.client.Do(ctx, req, &plans) if err != nil { @@ -101,9 +98,6 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMarketplacePreview) - var accounts []*MarketplacePlanAccount resp, err := s.client.Do(ctx, req, &accounts) if err != nil { @@ -128,9 +122,6 @@ func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, acc return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMarketplacePreview) - var accounts []*MarketplacePlanAccount resp, err := s.client.Do(ctx, req, &accounts) if err != nil { @@ -159,9 +150,6 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMarketplacePreview) - var purchases []*MarketplacePurchase resp, err := s.client.Do(ctx, req, &purchases) if err != nil { diff --git a/vendor/github.com/google/go-github/github/checks.go b/vendor/github.com/google/go-github/github/checks.go new file mode 100644 index 00000000..35490899 --- /dev/null +++ b/vendor/github.com/google/go-github/github/checks.go @@ -0,0 +1,428 @@ +// Copyright 2018 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 ( + "context" + "fmt" +) + +// ChecksService provides access to the Checks API in the +// GitHub API. +// +// GitHub API docs: https://developer.github.com/v3/checks/ +type ChecksService service + +// CheckRun represents a GitHub check run on a repository associated with a GitHub app. +type CheckRun struct { + ID *int64 `json:"id,omitempty"` + HeadSHA *string `json:"head_sha,omitempty"` + ExternalID *string `json:"external_id,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + Status *string `json:"status,omitempty"` + Conclusion *string `json:"conclusion,omitempty"` + StartedAt *Timestamp `json:"started_at,omitempty"` + CompletedAt *Timestamp `json:"completed_at,omitempty"` + Output *CheckRunOutput `json:"output,omitempty"` + Name *string `json:"name,omitempty"` + CheckSuite *CheckSuite `json:"check_suite,omitempty"` + App *App `json:"app,omitempty"` + PullRequests []*PullRequest `json:"pull_requests,omitempty"` +} + +// CheckRunOutput represents the output of a CheckRun. +type CheckRunOutput struct { + Title *string `json:"title,omitempty"` + Summary *string `json:"summary,omitempty"` + Text *string `json:"text,omitempty"` + AnnotationsCount *int `json:"annotations_count,omitempty"` + AnnotationsURL *string `json:"annotations_url,omitempty"` + Annotations []*CheckRunAnnotation `json:"annotations,omitempty"` + Images []*CheckRunImage `json:"images,omitempty"` +} + +// CheckRunAnnotation represents an annotation object for a CheckRun output. +type CheckRunAnnotation struct { + FileName *string `json:"filename,omitempty"` + BlobHRef *string `json:"blob_href,omitempty"` + StartLine *int `json:"start_line,omitempty"` + EndLine *int `json:"end_line,omitempty"` + WarningLevel *string `json:"warning_level,omitempty"` + Message *string `json:"message,omitempty"` + Title *string `json:"title,omitempty"` + RawDetails *string `json:"raw_details,omitempty"` +} + +// CheckRunImage represents an image object for a CheckRun output. +type CheckRunImage struct { + Alt *string `json:"alt,omitempty"` + ImageURL *string `json:"image_url,omitempty"` + Caption *string `json:"caption,omitempty"` +} + +// CheckSuite represents a suite of check runs. +type CheckSuite struct { + ID *int64 `json:"id,omitempty"` + HeadBranch *string `json:"head_branch,omitempty"` + HeadSHA *string `json:"head_sha,omitempty"` + URL *string `json:"url,omitempty"` + BeforeSHA *string `json:"before,omitempty"` + AfterSHA *string `json:"after,omitempty"` + Status *string `json:"status,omitempty"` + Conclusion *string `json:"conclusion,omitempty"` + App *App `json:"app,omitempty"` + Repository *Repository `json:"repository,omitempty"` + PullRequests []*PullRequest `json:"pull_requests,omitempty"` +} + +func (c CheckRun) String() string { + return Stringify(c) +} + +func (c CheckSuite) String() string { + return Stringify(c) +} + +// GetCheckRun gets a check-run for a repository. +// +// GitHub API docs: https://developer.github.com/v3/checks/runs/#get-a-single-check-run +func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + checkRun := new(CheckRun) + resp, err := s.client.Do(ctx, req, checkRun) + if err != nil { + return nil, resp, err + } + + return checkRun, resp, nil +} + +// GetCheckSuite gets a single check suite. +// +// GitHub API docs: https://developer.github.com/v3/checks/suites/#get-a-single-check-suite +func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + checkSuite := new(CheckSuite) + resp, err := s.client.Do(ctx, req, checkSuite) + if err != nil { + return nil, resp, err + } + + return checkSuite, resp, nil +} + +// CreateCheckRunOptions sets up parameters needed to create a CheckRun. +type CreateCheckRunOptions struct { + Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.) + HeadBranch string `json:"head_branch"` // The name of the branch to perform a check against. (Required.) + HeadSHA string `json:"head_sha"` // The SHA of the commit. (Required.) + DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.) + ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.) + Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.) + Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".) + StartedAt *Timestamp `json:"started_at,omitempty"` // The time that the check run began. (Optional.) + CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.) + Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional) +} + +// CreateCheckRun creates a check run for repository. +// +// GitHub API docs: https://developer.github.com/v3/checks/runs/#create-a-check-run +func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opt CreateCheckRunOptions) (*CheckRun, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo) + req, err := s.client.NewRequest("POST", u, opt) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + checkRun := new(CheckRun) + resp, err := s.client.Do(ctx, req, checkRun) + if err != nil { + return nil, resp, err + } + + return checkRun, resp, nil +} + +// UpdateCheckRunOptions sets up parameters needed to update a CheckRun. +type UpdateCheckRunOptions struct { + Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.) + HeadBranch *string `json:"head_branch,omitempty"` // The name of the branch to perform a check against. (Optional.) + HeadSHA *string `json:"head_sha,omitempty"` // The SHA of the commit. (Optional.) + DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.) + ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.) + Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.) + Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".) + CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.) + Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional) +} + +// UpdateCheckRun updates a check run for a specific commit in a repository. +// +// GitHub API docs: https://developer.github.com/v3/checks/runs/#update-a-check-run +func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opt UpdateCheckRunOptions) (*CheckRun, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) + req, err := s.client.NewRequest("PATCH", u, opt) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + checkRun := new(CheckRun) + resp, err := s.client.Do(ctx, req, checkRun) + if err != nil { + return nil, resp, err + } + + return checkRun, resp, nil +} + +// ListCheckRunAnnotations lists the annotations for a check run. +// +// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run +func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opt *ListOptions) ([]*CheckRunAnnotation, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID) + 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 + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + var checkRunAnnotations []*CheckRunAnnotation + resp, err := s.client.Do(ctx, req, &checkRunAnnotations) + if err != nil { + return nil, resp, err + } + + return checkRunAnnotations, resp, nil +} + +// ListCheckRunsOptions represents parameters to list check runs. +type ListCheckRunsOptions struct { + CheckName *string `url:"check_name,omitempty"` // Returns check runs with the specified name. + Status *string `url:"status,omitempty"` // Returns check runs with the specified status. Can be one of "queued", "in_progress", or "completed". + Filter *string `url:"filter,omitempty"` // Filters check runs by their completed_at timestamp. Can be one of "latest" (returning the most recent check runs) or "all". Default: "latest" + + ListOptions +} + +// ListCheckRunsResults represents the result of a check run list. +type ListCheckRunsResults struct { + Total *int `json:"total_count,omitempty"` + CheckRuns []*CheckRun `json:"check_runs,omitempty"` +} + +// ListCheckRunsForRef lists check runs for a specific ref. +// +// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref +func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, ref) + 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 + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + var checkRunResults *ListCheckRunsResults + resp, err := s.client.Do(ctx, req, &checkRunResults) + if err != nil { + return nil, resp, err + } + + return checkRunResults, resp, nil +} + +// ListCheckRunsCheckSuite lists check runs for a check suite. +// +// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite +func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID) + 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 + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + var checkRunResults *ListCheckRunsResults + resp, err := s.client.Do(ctx, req, &checkRunResults) + if err != nil { + return nil, resp, err + } + + return checkRunResults, resp, nil +} + +// ListCheckSuiteOptions represents parameters to list check suites. +type ListCheckSuiteOptions struct { + CheckName *string `url:"check_name,omitempty"` // Filters checks suites by the name of the check run. + AppID *int `url:"app_id,omitempty"` // Filters check suites by GitHub App id. + + ListOptions +} + +// ListCheckSuiteResults represents the result of a check run list. +type ListCheckSuiteResults struct { + Total *int `json:"total_count,omitempty"` + CheckSuites []*CheckSuite `json:"check_suites,omitempty"` +} + +// ListCheckSuitesForRef lists check suite for a specific ref. +// +// GitHub API docs: https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref +func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, ref) + 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 + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + var checkSuiteResults *ListCheckSuiteResults + resp, err := s.client.Do(ctx, req, &checkSuiteResults) + if err != nil { + return nil, resp, err + } + + return checkSuiteResults, resp, nil +} + +// AutoTriggerCheck enables or disables automatic creation of CheckSuite events upon pushes to the repository. +type AutoTriggerCheck struct { + AppID *int64 `json:"app_id,omitempty"` // The id of the GitHub App. (Required.) + Setting *bool `json:"setting,omitempty"` // Set to "true" to enable automatic creation of CheckSuite events upon pushes to the repository, or "false" to disable them. Default: "true" (Required.) +} + +// CheckSuitePreferenceOptions set options for check suite preferences for a repository. +type CheckSuitePreferenceOptions struct { + PreferenceList *PreferenceList `json:"auto_trigger_checks,omitempty"` // A list of auto trigger checks that can be set for a check suite in a repository. +} + +// CheckSuitePreferenceResults represents the results of the preference set operation. +type CheckSuitePreferenceResults struct { + Preferences *PreferenceList `json:"preferences,omitempty"` + Repository *Repository `json:"repository,omitempty"` +} + +// PreferenceList represents a list of auto trigger checks for repository +type PreferenceList struct { + AutoTriggerChecks []*AutoTriggerCheck `json:"auto_trigger_checks,omitempty"` // A slice of auto trigger checks that can be set for a check suite in a repository. +} + +// SetCheckSuitePreferences changes the default automatic flow when creating check suites. +// +// GitHub API docs: https://developer.github.com/v3/checks/suites/#set-preferences-for-check-suites-on-a-repository +func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opt CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo) + req, err := s.client.NewRequest("PATCH", u, opt) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + var checkSuitePrefResults *CheckSuitePreferenceResults + resp, err := s.client.Do(ctx, req, &checkSuitePrefResults) + if err != nil { + return nil, resp, err + } + + return checkSuitePrefResults, resp, nil +} + +// CreateCheckSuiteOptions sets up parameters to manually create a check suites +type CreateCheckSuiteOptions struct { + HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.) + HeadBranch *string `json:"head_branch,omitempty"` // The name of the head branch where the code changes are implemented. +} + +// CreateCheckSuite manually creates a check suite for a repository. +// +// GitHub API docs: https://developer.github.com/v3/checks/suites/#create-a-check-suite +func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opt CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo) + req, err := s.client.NewRequest("POST", u, opt) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + checkSuite := new(CheckSuite) + resp, err := s.client.Do(ctx, req, checkSuite) + if err != nil { + return nil, resp, err + } + + return checkSuite, resp, nil +} + +// RequestCheckSuiteOptions sets up the parameters for a request check suite endpoint. +type RequestCheckSuiteOptions struct { + HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.) +} + +// RequestCheckSuite triggers GitHub to create a new check suite, without pushing new code to a repository. +// +// GitHub API docs: https://developer.github.com/v3/checks/suites/#request-check-suites +func (s *ChecksService) RequestCheckSuite(ctx context.Context, owner, repo string, opt RequestCheckSuiteOptions) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/check-suite-requests", owner, repo) + u, err := addOptions(u, opt) + if err != nil { + return nil, err + } + + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, err + } + + req.Header.Set("Accept", mediaTypeCheckRunsPreview) + + resp, err := s.client.Do(ctx, req, nil) + return resp, err +} 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 1b0055c7..cfc9290b 100644 --- a/vendor/github.com/google/go-github/github/event_types.go +++ b/vendor/github.com/google/go-github/github/event_types.go @@ -7,6 +7,38 @@ package github +// CheckRunEvent is triggered when a check run is "created", "updated", or "re-requested". +// The Webhook event name is "check_run". +// +// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checkrunevent +type CheckRunEvent struct { + CheckRun *CheckRun `json:"check_run,omitempty"` + // The action performed. Can be "created", "updated" or "re-requested". + Action *string `json:"action,omitempty"` + + // The following fields are only populated by Webhook events. + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` +} + +// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "re-requested". +// The Webhook event name is "check_suite". +// +// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checksuiteevent +type CheckSuiteEvent struct { + CheckSuite *CheckSuite `json:"check_suite,omitempty"` + // The action performed. Can be "completed", "requested" or "re-requested". + Action *string `json:"action,omitempty"` + + // The following fields are only populated by Webhook events. + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` +} + // CommitCommentEvent is triggered when a commit comment is created. // The Webhook event name is "commit_comment". // diff --git a/vendor/github.com/google/go-github/github/github-accessors.go b/vendor/github.com/google/go-github/github/github-accessors.go index f99e5887..4d3e0bc1 100644 --- a/vendor/github.com/google/go-github/github/github-accessors.go +++ b/vendor/github.com/google/go-github/github/github-accessors.go @@ -364,6 +364,22 @@ func (a *AuthorizationUpdateRequest) GetNoteURL() string { return *a.NoteURL } +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (a *AutoTriggerCheck) GetAppID() int64 { + if a == nil || a.AppID == nil { + return 0 + } + return *a.AppID +} + +// GetSetting returns the Setting field if it's non-nil, zero value otherwise. +func (a *AutoTriggerCheck) GetSetting() bool { + if a == nil || a.Setting == nil { + return false + } + return *a.Setting +} + // GetContent returns the Content field if it's non-nil, zero value otherwise. func (b *Blob) GetContent() string { if b == nil || b.Content == nil { @@ -436,6 +452,438 @@ func (b *Branch) GetProtected() bool { return *b.Protected } +// GetApp returns the App field. +func (c *CheckRun) GetApp() *App { + if c == nil { + return nil + } + return c.App +} + +// GetCheckSuite returns the CheckSuite field. +func (c *CheckRun) GetCheckSuite() *CheckSuite { + if c == nil { + return nil + } + return c.CheckSuite +} + +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetCompletedAt() Timestamp { + if c == nil || c.CompletedAt == nil { + return Timestamp{} + } + return *c.CompletedAt +} + +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetConclusion() string { + if c == nil || c.Conclusion == nil { + return "" + } + return *c.Conclusion +} + +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetExternalID() string { + if c == nil || c.ExternalID == nil { + return "" + } + return *c.ExternalID +} + +// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetHeadSHA() string { + if c == nil || c.HeadSHA == nil { + return "" + } + return *c.HeadSHA +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" + } + return *c.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetOutput returns the Output field. +func (c *CheckRun) GetOutput() *CheckRunOutput { + if c == nil { + return nil + } + return c.Output +} + +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetStartedAt() Timestamp { + if c == nil || c.StartedAt == nil { + return Timestamp{} + } + return *c.StartedAt +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetURL() string { + if c == nil || c.URL == nil { + return "" + } + return *c.URL +} + +// GetBlobHRef returns the BlobHRef field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetBlobHRef() string { + if c == nil || c.BlobHRef == nil { + return "" + } + return *c.BlobHRef +} + +// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetEndLine() int { + if c == nil || c.EndLine == nil { + return 0 + } + return *c.EndLine +} + +// GetFileName returns the FileName field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetFileName() string { + if c == nil || c.FileName == nil { + return "" + } + return *c.FileName +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetMessage() string { + if c == nil || c.Message == nil { + return "" + } + return *c.Message +} + +// GetRawDetails returns the RawDetails field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetRawDetails() string { + if c == nil || c.RawDetails == nil { + return "" + } + return *c.RawDetails +} + +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetStartLine() int { + if c == nil || c.StartLine == nil { + return 0 + } + return *c.StartLine +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetTitle() string { + if c == nil || c.Title == nil { + return "" + } + return *c.Title +} + +// GetWarningLevel returns the WarningLevel field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetWarningLevel() string { + if c == nil || c.WarningLevel == nil { + return "" + } + return *c.WarningLevel +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CheckRunEvent) GetAction() string { + if c == nil || c.Action == nil { + return "" + } + return *c.Action +} + +// GetCheckRun returns the CheckRun field. +func (c *CheckRunEvent) GetCheckRun() *CheckRun { + if c == nil { + return nil + } + return c.CheckRun +} + +// GetInstallation returns the Installation field. +func (c *CheckRunEvent) GetInstallation() *Installation { + if c == nil { + return nil + } + return c.Installation +} + +// GetOrg returns the Org field. +func (c *CheckRunEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetRepo returns the Repo field. +func (c *CheckRunEvent) GetRepo() *Repository { + if c == nil { + return nil + } + return c.Repo +} + +// GetSender returns the Sender field. +func (c *CheckRunEvent) GetSender() *User { + if c == nil { + return nil + } + return c.Sender +} + +// GetAlt returns the Alt field if it's non-nil, zero value otherwise. +func (c *CheckRunImage) GetAlt() string { + if c == nil || c.Alt == nil { + return "" + } + return *c.Alt +} + +// GetCaption returns the Caption field if it's non-nil, zero value otherwise. +func (c *CheckRunImage) GetCaption() string { + if c == nil || c.Caption == nil { + return "" + } + return *c.Caption +} + +// GetImageURL returns the ImageURL field if it's non-nil, zero value otherwise. +func (c *CheckRunImage) GetImageURL() string { + if c == nil || c.ImageURL == nil { + return "" + } + return *c.ImageURL +} + +// GetAnnotationsCount returns the AnnotationsCount field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetAnnotationsCount() int { + if c == nil || c.AnnotationsCount == nil { + return 0 + } + return *c.AnnotationsCount +} + +// GetAnnotationsURL returns the AnnotationsURL field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetAnnotationsURL() string { + if c == nil || c.AnnotationsURL == nil { + return "" + } + return *c.AnnotationsURL +} + +// GetSummary returns the Summary field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetSummary() string { + if c == nil || c.Summary == nil { + return "" + } + return *c.Summary +} + +// GetText returns the Text field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetText() string { + if c == nil || c.Text == nil { + return "" + } + return *c.Text +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetTitle() string { + if c == nil || c.Title == nil { + return "" + } + return *c.Title +} + +// GetAfterSHA returns the AfterSHA field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetAfterSHA() string { + if c == nil || c.AfterSHA == nil { + return "" + } + return *c.AfterSHA +} + +// GetApp returns the App field. +func (c *CheckSuite) GetApp() *App { + if c == nil { + return nil + } + return c.App +} + +// GetBeforeSHA returns the BeforeSHA field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetBeforeSHA() string { + if c == nil || c.BeforeSHA == nil { + return "" + } + return *c.BeforeSHA +} + +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetConclusion() string { + if c == nil || c.Conclusion == nil { + return "" + } + return *c.Conclusion +} + +// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetHeadBranch() string { + if c == nil || c.HeadBranch == nil { + return "" + } + return *c.HeadBranch +} + +// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetHeadSHA() string { + if c == nil || c.HeadSHA == nil { + return "" + } + return *c.HeadSHA +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetRepository returns the Repository field. +func (c *CheckSuite) GetRepository() *Repository { + if c == nil { + return nil + } + return c.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetURL() string { + if c == nil || c.URL == nil { + return "" + } + return *c.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CheckSuiteEvent) GetAction() string { + if c == nil || c.Action == nil { + return "" + } + return *c.Action +} + +// GetCheckSuite returns the CheckSuite field. +func (c *CheckSuiteEvent) GetCheckSuite() *CheckSuite { + if c == nil { + return nil + } + return c.CheckSuite +} + +// GetInstallation returns the Installation field. +func (c *CheckSuiteEvent) GetInstallation() *Installation { + if c == nil { + return nil + } + return c.Installation +} + +// GetOrg returns the Org field. +func (c *CheckSuiteEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetRepo returns the Repo field. +func (c *CheckSuiteEvent) GetRepo() *Repository { + if c == nil { + return nil + } + return c.Repo +} + +// GetSender returns the Sender field. +func (c *CheckSuiteEvent) GetSender() *User { + if c == nil { + return nil + } + return c.Sender +} + +// GetPreferenceList returns the PreferenceList field. +func (c *CheckSuitePreferenceOptions) GetPreferenceList() *PreferenceList { + if c == nil { + return nil + } + return c.PreferenceList +} + +// GetPreferences returns the Preferences field. +func (c *CheckSuitePreferenceResults) GetPreferences() *PreferenceList { + if c == nil { + return nil + } + return c.Preferences +} + +// GetRepository returns the Repository field. +func (c *CheckSuitePreferenceResults) GetRepository() *Repository { + if c == nil { + return nil + } + return c.Repository +} + // GetBody returns the Body field if it's non-nil, zero value otherwise. func (c *CodeOfConduct) GetBody() string { if c == nil || c.Body == nil { @@ -1060,6 +1508,14 @@ func (c *CommunityHealthFiles) GetContributing() *Metric { return c.Contributing } +// GetIssueTemplate returns the IssueTemplate field. +func (c *CommunityHealthFiles) GetIssueTemplate() *Metric { + if c == nil { + return nil + } + return c.IssueTemplate +} + // GetLicense returns the License field. func (c *CommunityHealthFiles) GetLicense() *Metric { if c == nil { @@ -1068,6 +1524,14 @@ func (c *CommunityHealthFiles) GetLicense() *Metric { return c.License } +// GetPullRequestTemplate returns the PullRequestTemplate field. +func (c *CommunityHealthFiles) GetPullRequestTemplate() *Metric { + if c == nil { + return nil + } + return c.PullRequestTemplate +} + // GetReadme returns the Readme field. func (c *CommunityHealthFiles) GetReadme() *Metric { if c == nil { @@ -1260,6 +1724,70 @@ func (c *ContributorStats) GetTotal() int { return *c.Total } +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp { + if c == nil || c.CompletedAt == nil { + return Timestamp{} + } + return *c.CompletedAt +} + +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetConclusion() string { + if c == nil || c.Conclusion == nil { + return "" + } + return *c.Conclusion +} + +// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetDetailsURL() string { + if c == nil || c.DetailsURL == nil { + return "" + } + return *c.DetailsURL +} + +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetExternalID() string { + if c == nil || c.ExternalID == nil { + return "" + } + return *c.ExternalID +} + +// GetOutput returns the Output field. +func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput { + if c == nil { + return nil + } + return c.Output +} + +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetStartedAt() Timestamp { + if c == nil || c.StartedAt == nil { + return Timestamp{} + } + return *c.StartedAt +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + +// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. +func (c *CreateCheckSuiteOptions) GetHeadBranch() string { + if c == nil || c.HeadBranch == nil { + return "" + } + return *c.HeadBranch +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (c *CreateEvent) GetDescription() string { if c == nil || c.Description == nil { @@ -4004,6 +4532,62 @@ func (l *License) GetURL() string { return *l.URL } +// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetCheckName() string { + if l == nil || l.CheckName == nil { + return "" + } + return *l.CheckName +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetFilter() string { + if l == nil || l.Filter == nil { + return "" + } + return *l.Filter +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetStatus() string { + if l == nil || l.Status == nil { + return "" + } + return *l.Status +} + +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsResults) GetTotal() int { + if l == nil || l.Total == nil { + return 0 + } + return *l.Total +} + +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (l *ListCheckSuiteOptions) GetAppID() int { + if l == nil || l.AppID == nil { + return 0 + } + return *l.AppID +} + +// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. +func (l *ListCheckSuiteOptions) GetCheckName() string { + if l == nil || l.CheckName == nil { + return "" + } + return *l.CheckName +} + +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (l *ListCheckSuiteResults) GetTotal() int { + if l == nil || l.Total == nil { + return 0 + } + return *l.Total +} + // GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise. func (m *MarketplacePlan) GetAccountsURL() string { if m == nil || m.AccountsURL == nil { @@ -5596,6 +6180,14 @@ func (p *Project) GetURL() string { return *p.URL } +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (p *ProjectCard) GetArchived() bool { + if p == nil || p.Archived == nil { + return false + } + return *p.Archived +} + // GetColumnID returns the ColumnID field if it's non-nil, zero value otherwise. func (p *ProjectCard) GetColumnID() int64 { if p == nil || p.ColumnID == nil { @@ -5740,6 +6332,22 @@ func (p *ProjectCardEvent) GetSender() *User { return p.Sender } +// GetArchivedState returns the ArchivedState field if it's non-nil, zero value otherwise. +func (p *ProjectCardListOptions) GetArchivedState() string { + if p == nil || p.ArchivedState == nil { + return "" + } + return *p.ArchivedState +} + +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (p *ProjectCardOptions) GetArchived() bool { + if p == nil || p.Archived == nil { + return false + } + return *p.Archived +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (p *ProjectColumn) GetCreatedAt() Timestamp { if p == nil || p.CreatedAt == nil { @@ -10260,6 +10868,70 @@ func (t *TreeEntry) GetURL() string { return *t.URL } +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetCompletedAt() Timestamp { + if u == nil || u.CompletedAt == nil { + return Timestamp{} + } + return *u.CompletedAt +} + +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetConclusion() string { + if u == nil || u.Conclusion == nil { + return "" + } + return *u.Conclusion +} + +// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetDetailsURL() string { + if u == nil || u.DetailsURL == nil { + return "" + } + return *u.DetailsURL +} + +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetExternalID() string { + if u == nil || u.ExternalID == nil { + return "" + } + return *u.ExternalID +} + +// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetHeadBranch() string { + if u == nil || u.HeadBranch == nil { + return "" + } + return *u.HeadBranch +} + +// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetHeadSHA() string { + if u == nil || u.HeadSHA == nil { + return "" + } + return *u.HeadSHA +} + +// GetOutput returns the Output field. +func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput { + if u == nil { + return nil + } + return u.Output +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetStatus() string { + if u == nil || u.Status == nil { + return "" + } + return *u.Status +} + // GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. func (u *User) GetAvatarURL() string { if u == nil || u.AvatarURL == nil { @@ -10724,6 +11396,70 @@ func (u *UserLDAPMapping) GetURL() string { return *u.URL } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetCreatedAt() string { + if u == nil || u.CreatedAt == nil { + return "" + } + return *u.CreatedAt +} + +// GetExcludeAttachments returns the ExcludeAttachments field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetExcludeAttachments() bool { + if u == nil || u.ExcludeAttachments == nil { + return false + } + return *u.ExcludeAttachments +} + +// GetGUID returns the GUID field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetGUID() string { + if u == nil || u.GUID == nil { + return "" + } + return *u.GUID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetID() int64 { + if u == nil || u.ID == nil { + return 0 + } + return *u.ID +} + +// GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetLockRepositories() bool { + if u == nil || u.LockRepositories == nil { + return false + } + return *u.LockRepositories +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetState() string { + if u == nil || u.State == nil { + return "" + } + return *u.State +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetUpdatedAt() string { + if u == nil || u.UpdatedAt == nil { + return "" + } + return *u.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (u *UserMigration) GetURL() string { + if u == nil || u.URL == nil { + return "" + } + return *u.URL +} + // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (u *UsersSearchResult) GetIncompleteResults() bool { if u == nil || u.IncompleteResults == nil { diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go index 8b223541..3fa46c30 100644 --- a/vendor/github.com/google/go-github/github/github.go +++ b/vendor/github.com/google/go-github/github/github.go @@ -96,9 +96,6 @@ const ( // https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/ mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json" - // https://developer.github.com/v3/apps/marketplace/ - mediaTypeMarketplacePreview = "application/vnd.github.valkyrie-preview+json" - // https://developer.github.com/changes/2017-08-30-preview-nested-teams/ mediaTypeNestedTeamsPreview = "application/vnd.github.hellcat-preview+json" @@ -116,6 +113,9 @@ const ( // https://developer.github.com/changes/2018-02-07-team-discussions-api/ mediaTypeTeamDiscussionsPreview = "application/vnd.github.echo-preview+json" + + // https://developer.github.com/changes/2018-05-07-new-checks-api-public-beta/ + mediaTypeCheckRunsPreview = "application/vnd.github.antiope-preview+json" ) // A Client manages communication with the GitHub API. @@ -144,6 +144,7 @@ type Client struct { Admin *AdminService Apps *AppsService Authorizations *AuthorizationsService + Checks *ChecksService Gists *GistsService Git *GitService Gitignores *GitignoresService @@ -235,6 +236,7 @@ func NewClient(httpClient *http.Client) *Client { c.Admin = (*AdminService)(&c.common) c.Apps = (*AppsService)(&c.common) c.Authorizations = (*AuthorizationsService)(&c.common) + c.Checks = (*ChecksService)(&c.common) c.Gists = (*GistsService)(&c.common) c.Git = (*GitService)(&c.common) c.Gitignores = (*GitignoresService)(&c.common) diff --git a/vendor/github.com/google/go-github/github/messages.go b/vendor/github.com/google/go-github/github/messages.go index 2396fd43..b8d3380e 100644 --- a/vendor/github.com/google/go-github/github/messages.go +++ b/vendor/github.com/google/go-github/github/messages.go @@ -41,6 +41,8 @@ const ( var ( // eventTypeMapping maps webhooks types to their corresponding go-github struct types. eventTypeMapping = map[string]string{ + "check_run": "CheckRunEvent", + "check_suite": "CheckSuiteEvent", "commit_comment": "CommitCommentEvent", "create": "CreateEvent", "delete": "DeleteEvent", diff --git a/vendor/github.com/google/go-github/github/migrations_user.go b/vendor/github.com/google/go-github/github/migrations_user.go new file mode 100644 index 00000000..ae53e687 --- /dev/null +++ b/vendor/github.com/google/go-github/github/migrations_user.go @@ -0,0 +1,214 @@ +// Copyright 2018 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 ( + "context" + "errors" + "fmt" + "net/http" +) + +// UserMigration represents a GitHub migration (archival). +type UserMigration struct { + ID *int64 `json:"id,omitempty"` + GUID *string `json:"guid,omitempty"` + // State is the current state of a migration. + // Possible values are: + // "pending" which means the migration hasn't started yet, + // "exporting" which means the migration is in progress, + // "exported" which means the migration finished successfully, or + // "failed" which means the migration failed. + State *string `json:"state,omitempty"` + // LockRepositories indicates whether repositories are locked (to prevent + // manipulation) while migrating data. + LockRepositories *bool `json:"lock_repositories,omitempty"` + // ExcludeAttachments indicates whether attachments should be excluded from + // the migration (to reduce migration archive file size). + ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` + URL *string `json:"url,omitempty"` + CreatedAt *string `json:"created_at,omitempty"` + UpdatedAt *string `json:"updated_at,omitempty"` + Repositories []*Repository `json:"repositories,omitempty"` +} + +func (m UserMigration) String() string { + return Stringify(m) +} + +// UserMigrationOptions specifies the optional parameters to Migration methods. +type UserMigrationOptions struct { + // LockRepositories indicates whether repositories should be locked (to prevent + // manipulation) while migrating data. + LockRepositories bool + + // ExcludeAttachments indicates whether attachments should be excluded from + // the migration (to reduce migration archive file size). + ExcludeAttachments bool +} + +// startUserMigration represents the body of a StartMigration request. +type startUserMigration struct { + // Repositories is a slice of repository names to migrate. + Repositories []string `json:"repositories,omitempty"` + + // LockRepositories indicates whether repositories should be locked (to prevent + // manipulation) while migrating data. + LockRepositories *bool `json:"lock_repositories,omitempty"` + + // ExcludeAttachments indicates whether attachments should be excluded from + // the migration (to reduce migration archive file size). + ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` +} + +// StartUserMigration starts the generation of a migration archive. +// repos is a slice of repository names to migrate. +// +// GitHub API docs: https://developer.github.com/v3/migrations/users/#start-a-user-migration +func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opt *UserMigrationOptions) (*UserMigration, *Response, error) { + u := "user/migrations" + + body := &startUserMigration{Repositories: repos} + if opt != nil { + body.LockRepositories = Bool(opt.LockRepositories) + body.ExcludeAttachments = Bool(opt.ExcludeAttachments) + } + + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + return nil, nil, err + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeMigrationsPreview) + + m := &UserMigration{} + resp, err := s.client.Do(ctx, req, m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// ListUserMigrations lists the most recent migrations. +// +// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-a-list-of-user-migrations +func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) { + u := "user/migrations" + + 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", mediaTypeMigrationsPreview) + + var m []*UserMigration + resp, err := s.client.Do(ctx, req, &m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// UserMigrationStatus gets the status of a specific migration archive. +// id is the migration ID. +// +// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-the-status-of-a-user-migration +func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) { + u := fmt.Sprintf("user/migrations/%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", mediaTypeMigrationsPreview) + + m := &UserMigration{} + resp, err := s.client.Do(ctx, req, m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// UserMigrationArchiveURL gets the URL for a specific migration archive. +// id is the migration ID. +// +// GitHub API docs: https://developer.github.com/v3/migrations/users/#download-a-user-migration-archive +func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) { + url := fmt.Sprintf("user/migrations/%v/archive", id) + + req, err := s.client.NewRequest("GET", url, nil) + if err != nil { + return "", err + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeMigrationsPreview) + + m := &UserMigration{} + + var loc string + originalRedirect := s.client.client.CheckRedirect + s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + loc = req.URL.String() + return http.ErrUseLastResponse + } + defer func() { + s.client.client.CheckRedirect = originalRedirect + }() + resp, err := s.client.Do(ctx, req, m) + if err == nil { + return "", errors.New("expected redirect, none provided") + } + loc = resp.Header.Get("Location") + return loc, nil +} + +// DeleteUserMigration will delete a previous migration archive. +// id is the migration ID. +// +// GitHub API docs: https://developer.github.com/v3/migrations/users/#delete-a-user-migration-archive +func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) { + url := fmt.Sprintf("user/migrations/%v/archive", id) + + req, err := s.client.NewRequest("DELETE", url, nil) + if err != nil { + return nil, err + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeMigrationsPreview) + + return s.client.Do(ctx, req, nil) +} + +// UnlockUserRepository will unlock a repo that was locked for migration. +// id is migration ID. +// You should unlock each migrated repository and delete them when the migration +// is complete and you no longer need the source data. +// +// GitHub API docs: https://developer.github.com/v3/migrations/users/#unlock-a-user-repository +func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) { + url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo) + + req, err := s.client.NewRequest("DELETE", url, nil) + if err != nil { + return nil, err + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeMigrationsPreview) + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/github/projects.go b/vendor/github.com/google/go-github/github/projects.go index 409ed4a2..4df8a49e 100644 --- a/vendor/github.com/google/go-github/github/projects.go +++ b/vendor/github.com/google/go-github/github/projects.go @@ -285,15 +285,26 @@ type ProjectCard struct { CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` NodeID *string `json:"node_id,omitempty"` + Archived *bool `json:"archived,omitempty"` // The following fields are only populated by Webhook events. ColumnID *int64 `json:"column_id,omitempty"` } +// ProjectCardListOptions specifies the optional parameters to the +// ProjectsService.ListProjectCards method. +type ProjectCardListOptions struct { + // ArchivedState is used to list all, archived, or not_archived project cards. + // Defaults to not_archived when you omit this parameter. + ArchivedState *string `url:"archived_state,omitempty"` + + ListOptions +} + // 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(ctx context.Context, columnID int64, opt *ListOptions) ([]*ProjectCard, *Response, error) { +func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ProjectCardListOptions) ([]*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) u, err := addOptions(u, opt) if err != nil { @@ -352,6 +363,9 @@ type ProjectCardOptions struct { ContentID int64 `json:"content_id,omitempty"` // The type of content to associate with this card. Possible values are: "Issue". ContentType string `json:"content_type,omitempty"` + // Use true to archive a project card. + // Specify false if you need to restore a previously archived project card. + Archived *bool `json:"archived,omitempty"` } // CreateProjectCard creates a card in the specified column of a GitHub Project. 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 04847373..04faa3ea 100644 --- a/vendor/github.com/google/go-github/github/repos_commits.go +++ b/vendor/github.com/google/go-github/github/repos_commits.go @@ -218,7 +218,7 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re // CompareCommits compares a range of commits with each other. // todo: support media formats - https://github.com/google/go-github/issues/6 // -// GitHub API docs: https://developer.github.com/v3/repos/commits/index.html#compare-two-commits +// GitHub API docs: https://developer.github.com/v3/repos/commits/#compare-two-commits func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) { u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head) diff --git a/vendor/github.com/google/go-github/github/repos_community_health.go b/vendor/github.com/google/go-github/github/repos_community_health.go index b5c75d6f..73d1d573 100644 --- a/vendor/github.com/google/go-github/github/repos_community_health.go +++ b/vendor/github.com/google/go-github/github/repos_community_health.go @@ -21,10 +21,12 @@ type Metric struct { // CommunityHealthFiles represents the different files in the community health metrics response. type CommunityHealthFiles struct { - CodeOfConduct *Metric `json:"code_of_conduct"` - Contributing *Metric `json:"contributing"` - License *Metric `json:"license"` - Readme *Metric `json:"readme"` + CodeOfConduct *Metric `json:"code_of_conduct"` + Contributing *Metric `json:"contributing"` + IssueTemplate *Metric `json:"issue_template"` + PullRequestTemplate *Metric `json:"pull_request_template"` + License *Metric `json:"license"` + Readme *Metric `json:"readme"` } // CommunityHealthMetrics represents a response containing the community metrics of a repository. diff --git a/vendor/github.com/rivo/tview/ansi.go b/vendor/github.com/rivo/tview/ansi.go index f5c6e833..4d14c282 100644 --- a/vendor/github.com/rivo/tview/ansi.go +++ b/vendor/github.com/rivo/tview/ansi.go @@ -166,16 +166,16 @@ func (a *ansi) Write(text []byte) (int, error) { red := (colorNumber - 16) / 36 green := ((colorNumber - 16) / 6) % 6 blue := (colorNumber - 16) % 6 - color = fmt.Sprintf("%02x%02x%02x", 255*red/5, 255*green/5, 255*blue/5) + color = fmt.Sprintf("#%02x%02x%02x", 255*red/5, 255*green/5, 255*blue/5) } else if colorNumber <= 255 { grey := 255 * (colorNumber - 232) / 23 - color = fmt.Sprintf("%02x%02x%02x", grey, grey, grey) + color = fmt.Sprintf("#%02x%02x%02x", grey, grey, grey) } } else if fields[index+1] == "2" && len(fields) > index+4 { // 24-bit colors. red, _ := strconv.Atoi(fields[index+2]) green, _ := strconv.Atoi(fields[index+3]) blue, _ := strconv.Atoi(fields[index+4]) - color = fmt.Sprintf("%02x%02x%02x", red, green, blue) + color = fmt.Sprintf("#%02x%02x%02x", red, green, blue) } } if len(color) > 0 { diff --git a/vendor/github.com/rivo/tview/application.go b/vendor/github.com/rivo/tview/application.go index f8935781..bd4c5ac8 100644 --- a/vendor/github.com/rivo/tview/application.go +++ b/vendor/github.com/rivo/tview/application.go @@ -227,13 +227,14 @@ func (a *Application) Suspend(f func()) bool { // Draw refreshes the screen. It calls the Draw() function of the application's // root primitive and then syncs the screen buffer. func (a *Application) Draw() *Application { - a.RLock() + a.Lock() + defer a.Unlock() + screen := a.screen root := a.root fullscreen := a.rootFullscreen before := a.beforeDraw after := a.afterDraw - a.RUnlock() // Maybe we're not ready yet or not anymore. if screen == nil || root == nil { diff --git a/vendor/github.com/rivo/tview/dropdown.go b/vendor/github.com/rivo/tview/dropdown.go index 14307487..ab55e3de 100644 --- a/vendor/github.com/rivo/tview/dropdown.go +++ b/vendor/github.com/rivo/tview/dropdown.go @@ -354,6 +354,7 @@ func (d *DropDown) InputHandler() func(event *tcell.EventKey, setFocus func(p Pr // Hand control over to the list. d.open = true + optionBefore := d.currentOption d.list.SetSelectedFunc(func(index int, mainText, secondaryText string, shortcut rune) { // An option was selected. Close the list again. d.open = false @@ -374,6 +375,10 @@ func (d *DropDown) InputHandler() func(event *tcell.EventKey, setFocus func(p Pr d.prefix = string(r[:len(r)-1]) } evalPrefix() + } else if event.Key() == tcell.KeyEscape { + d.open = false + d.currentOption = optionBefore + setFocus(d) } else { d.prefix = "" } diff --git a/vendor/github.com/rivo/tview/textview.go b/vendor/github.com/rivo/tview/textview.go index a88791c3..ddad69d3 100644 --- a/vendor/github.com/rivo/tview/textview.go +++ b/vendor/github.com/rivo/tview/textview.go @@ -310,6 +310,12 @@ func (t *TextView) ScrollToEnd() *TextView { return t } +// GetScrollOffset returns the number of rows and columns that are skipped at +// the top left corner when the text view has been scrolled. +func (t *TextView) GetScrollOffset() (row, column int) { + return t.lineOffset, t.columnOffset +} + // Clear removes all text from the buffer. func (t *TextView) Clear() *TextView { t.buffer = nil diff --git a/vendor/github.com/rivo/tview/treeview.go b/vendor/github.com/rivo/tview/treeview.go index f419fe5a..d90302c0 100644 --- a/vendor/github.com/rivo/tview/treeview.go +++ b/vendor/github.com/rivo/tview/treeview.go @@ -266,6 +266,9 @@ type TreeView struct { // An optional function which is called when a tree item was selected. selected func(node *TreeNode) + + // The visible nodes, top-down, as set by process(). + nodes []*TreeNode } // NewTreeView returns a new tree view. @@ -362,17 +365,14 @@ func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView { return t } -// Draw draws this primitive onto the screen. -func (t *TreeView) Draw(screen tcell.Screen) { - t.Box.Draw(screen) - if t.root == nil { - return - } - x, y, width, height := t.GetInnerRect() +// process builds the visible tree, populates the "nodes" slice, and processes +// pending selection actions. +func (t *TreeView) process() { + _, _, _, height := t.GetInnerRect() // Determine visible nodes and their placement. var graphicsOffset, maxTextX int - var nodes []*TreeNode + t.nodes = nil selectedIndex := -1 topLevelGraphicsX := -1 if t.graphics { @@ -403,7 +403,7 @@ func (t *TreeView) Draw(screen tcell.Screen) { maxTextX = node.textX } if node == t.currentNode && node.selectable { - selectedIndex = len(nodes) + selectedIndex = len(t.nodes) } // Maybe we want to skip this level. @@ -413,13 +413,13 @@ func (t *TreeView) Draw(screen tcell.Screen) { // Add and recurse (if desired). if node.level >= t.topLevel { - nodes = append(nodes, node) + t.nodes = append(t.nodes, node) } return node.expanded }) // Post-process positions. - for _, node := range nodes { + for _, node := range t.nodes { // If text must align, we correct the positions. if t.align && node.level > t.topLevel { node.textX = maxTextX @@ -441,41 +441,41 @@ func (t *TreeView) Draw(screen tcell.Screen) { case treeUp: for newSelectedIndex > 0 { newSelectedIndex-- - if nodes[newSelectedIndex].selectable { + if t.nodes[newSelectedIndex].selectable { break MovementSwitch } } newSelectedIndex = selectedIndex case treeDown: - for newSelectedIndex < len(nodes)-1 { + for newSelectedIndex < len(t.nodes)-1 { newSelectedIndex++ - if nodes[newSelectedIndex].selectable { + if t.nodes[newSelectedIndex].selectable { break MovementSwitch } } newSelectedIndex = selectedIndex case treeHome: - for newSelectedIndex = 0; newSelectedIndex < len(nodes); newSelectedIndex++ { - if nodes[newSelectedIndex].selectable { + for newSelectedIndex = 0; newSelectedIndex < len(t.nodes); newSelectedIndex++ { + if t.nodes[newSelectedIndex].selectable { break MovementSwitch } } newSelectedIndex = selectedIndex case treeEnd: - for newSelectedIndex = len(nodes) - 1; newSelectedIndex >= 0; newSelectedIndex-- { - if nodes[newSelectedIndex].selectable { + for newSelectedIndex = len(t.nodes) - 1; newSelectedIndex >= 0; newSelectedIndex-- { + if t.nodes[newSelectedIndex].selectable { break MovementSwitch } } newSelectedIndex = selectedIndex case treePageUp: - if newSelectedIndex+height < len(nodes) { + if newSelectedIndex+height < len(t.nodes) { newSelectedIndex += height } else { - newSelectedIndex = len(nodes) - 1 + newSelectedIndex = len(t.nodes) - 1 } - for ; newSelectedIndex < len(nodes); newSelectedIndex++ { - if nodes[newSelectedIndex].selectable { + for ; newSelectedIndex < len(t.nodes); newSelectedIndex++ { + if t.nodes[newSelectedIndex].selectable { break MovementSwitch } } @@ -487,13 +487,13 @@ func (t *TreeView) Draw(screen tcell.Screen) { newSelectedIndex = 0 } for ; newSelectedIndex >= 0; newSelectedIndex-- { - if nodes[newSelectedIndex].selectable { + if t.nodes[newSelectedIndex].selectable { break MovementSwitch } } newSelectedIndex = selectedIndex } - t.currentNode = nodes[newSelectedIndex] + t.currentNode = t.nodes[newSelectedIndex] if newSelectedIndex != selectedIndex { t.movement = treeNone if t.changed != nil { @@ -512,7 +512,7 @@ func (t *TreeView) Draw(screen tcell.Screen) { } else { // If selection is not visible or selectable, select the first candidate. if t.currentNode != nil { - for index, node := range nodes { + for index, node := range t.nodes { if node.selectable { selectedIndex = index t.currentNode = node @@ -524,8 +524,25 @@ func (t *TreeView) Draw(screen tcell.Screen) { t.currentNode = nil } } +} + +// Draw draws this primitive onto the screen. +func (t *TreeView) Draw(screen tcell.Screen) { + t.Box.Draw(screen) + if t.root == nil { + return + } + + // Build the tree if necessary. + if t.nodes == nil { + t.process() + } + defer func() { + t.nodes = nil // Rebuild during next call to Draw() + }() // Scroll the tree. + x, y, width, height := t.GetInnerRect() switch t.movement { case treeUp: t.offsetY-- @@ -534,7 +551,7 @@ func (t *TreeView) Draw(screen tcell.Screen) { case treeHome: t.offsetY = 0 case treeEnd: - t.offsetY = len(nodes) + t.offsetY = len(t.nodes) case treePageUp: t.offsetY -= height case treePageDown: @@ -543,8 +560,8 @@ func (t *TreeView) Draw(screen tcell.Screen) { t.movement = treeNone // Fix invalid offsets. - if t.offsetY >= len(nodes)-height { - t.offsetY = len(nodes) - height + if t.offsetY >= len(t.nodes)-height { + t.offsetY = len(t.nodes) - height } if t.offsetY < 0 { t.offsetY = 0 @@ -553,7 +570,7 @@ func (t *TreeView) Draw(screen tcell.Screen) { // Draw the tree. posY := y lineStyle := tcell.StyleDefault.Foreground(t.graphicsColor) - for index, node := range nodes { + for index, node := range t.nodes { // Skip invisible parts. if posY >= y+height+1 { break @@ -585,7 +602,7 @@ func (t *TreeView) Draw(screen tcell.Screen) { if node.textX > node.graphicsX && node.graphicsX < width { // Connect to the node above. - if posY-1 >= y && nodes[index-1].graphicsX <= node.graphicsX && nodes[index-1].textX > node.graphicsX { + if posY-1 >= y && t.nodes[index-1].graphicsX <= node.graphicsX && t.nodes[index-1].textX > node.graphicsX { PrintJoinedSemigraphics(screen, x+node.graphicsX, posY-1, Borders.TopLeft, t.graphicsColor) } @@ -610,7 +627,7 @@ func (t *TreeView) Draw(screen tcell.Screen) { // Text. if node.textX+prefixWidth < width { style := tcell.StyleDefault.Foreground(node.color) - if index == selectedIndex { + if node == t.currentNode { style = tcell.StyleDefault.Background(node.color).Foreground(t.backgroundColor) } printWithStyle(screen, node.text, x+node.textX+prefixWidth, posY, width-node.textX-prefixWidth, AlignLeft, style) @@ -661,5 +678,7 @@ func (t *TreeView) InputHandler() func(event *tcell.EventKey, setFocus func(p Pr } } } + + t.process() }) } diff --git a/vendor/github.com/xanzy/go-gitlab/.gitignore b/vendor/github.com/xanzy/go-gitlab/.gitignore index daf913b1..0c9e3298 100644 --- a/vendor/github.com/xanzy/go-gitlab/.gitignore +++ b/vendor/github.com/xanzy/go-gitlab/.gitignore @@ -6,6 +6,7 @@ # Folders _obj _test +.idea # Architecture specific extensions/prefixes *.[568vq] diff --git a/vendor/github.com/xanzy/go-gitlab/commits.go b/vendor/github.com/xanzy/go-gitlab/commits.go index 5b5dc2a7..01bfdae8 100644 --- a/vendor/github.com/xanzy/go-gitlab/commits.go +++ b/vendor/github.com/xanzy/go-gitlab/commits.go @@ -68,11 +68,12 @@ func (c Commit) String() string { // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits type ListCommitsOptions struct { ListOptions - RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"` - Since *time.Time `url:"since,omitempty" json:"since,omitempty"` - Until *time.Time `url:"until,omitempty" json:"until,omitempty"` - Path *string `url:"path,omitempty" json:"path,omitempty"` - All *bool `url:"all,omitempty" json:"all,omitempty"` + RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"` + Since *time.Time `url:"since,omitempty" json:"since,omitempty"` + Until *time.Time `url:"until,omitempty" json:"until,omitempty"` + Path *string `url:"path,omitempty" json:"path,omitempty"` + All *bool `url:"all,omitempty" json:"all,omitempty"` + WithStats *bool `url:"with_stats,omitempty" json:"with_stats,omitempty"` } // ListCommits gets a list of repository commits in a project. @@ -121,6 +122,49 @@ type CommitAction struct { Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"` } +// CommitRef represents the reference of branches/tags in a commit. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to +type CommitRef struct { + Type string `json:"type"` + Name string `json:"name"` +} + +// GetCommitRefsOptions represents the available GetCommitRefs() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to +type GetCommitRefsOptions struct { + ListOptions + Type *string `url:"type,omitempty" json:"type,omitempty"` +} + +// GetCommitRefs gets all references (from branches or tags) a commit is pushed to +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to +func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...OptionFunc) ([]CommitRef, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/repository/commits/%s/refs", url.QueryEscape(project), sha) + + req, err := s.client.NewRequest("GET", u, opt, options) + if err != nil { + return nil, nil, err + } + + var cs []CommitRef + resp, err := s.client.Do(req, &cs) + if err != nil { + return nil, resp, err + } + + return cs, resp, err +} + // GetCommit gets a specific commit identified by the commit hash or name of a // branch or tag. // diff --git a/vendor/github.com/xanzy/go-gitlab/tags.go b/vendor/github.com/xanzy/go-gitlab/tags.go index d3ac9dec..4e8a7139 100644 --- a/vendor/github.com/xanzy/go-gitlab/tags.go +++ b/vendor/github.com/xanzy/go-gitlab/tags.go @@ -55,7 +55,11 @@ func (t Tag) String() string { // // GitLab API docs: // https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags -type ListTagsOptions ListOptions +type ListTagsOptions struct { + ListOptions + OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` + Sort *string `url:"sort,omitempty" json:"sort,omitempty"` +} // ListTags gets a list of tags from a project, sorted by name in reverse // alphabetical order. diff --git a/vendor/google.golang.org/api/calendar/v3/calendar-api.json b/vendor/google.golang.org/api/calendar/v3/calendar-api.json index b6cbe80a..4a24845e 100644 --- a/vendor/google.golang.org/api/calendar/v3/calendar-api.json +++ b/vendor/google.golang.org/api/calendar/v3/calendar-api.json @@ -17,7 +17,7 @@ "description": "Manipulates events and other calendar data.", "discoveryVersion": "v1", "documentationLink": "https://developers.google.com/google-apps/calendar/firstapp", - "etag": "\"Zkyw9ACJZUvcYmlFaKGChzhmtnE/1VOFhc7FcQH_8hh6rAZ7o3yjhp8\"", + "etag": "\"J3WqvAcMk4eQjJXvfSI4Yr8VouA/ITK5FY7POTu4MHcI4-Fs0HUENwM\"", "icons": { "x16": "http://www.google.com/images/icons/product/calendar-16.png", "x32": "http://www.google.com/images/icons/product/calendar-32.png" @@ -1604,7 +1604,6 @@ } } }, - "revision": "20180424", "rootUrl": "https://www.googleapis.com/", "schemas": { "Acl": { @@ -2465,7 +2464,7 @@ "description": "The (inclusive) start time of the event. For a recurring event, this is the start time of the first instance." }, "status": { - "description": "Status of the event. Optional. Possible values are: \n- \"confirmed\" - The event is confirmed. This is the default status. \n- \"tentative\" - The event is tentatively confirmed. \n- \"cancelled\" - The event is cancelled.", + "description": "Status of the event. Optional. Possible values are: \n- \"confirmed\" - The event is confirmed. This is the default status. \n- \"tentative\" - The event is tentatively confirmed. \n- \"cancelled\" - The event is cancelled (deleted). The list method returns cancelled events only on incremental sync (when syncToken or updatedMin are specified) or if the showDeleted flag is set to true. The get method always returns them.\nA cancelled status represents two different states depending on the event type: \n- Cancelled exceptions of an uncancelled recurring event indicate that this instance should no longer be presented to the user. Clients should store these events for the lifetime of the parent recurring event.\nCancelled exceptions are only guaranteed to have values for the id, recurringEventId and originalStartTime fields populated. The other fields might be empty. \n- All other cancelled events represent deleted events. Clients should remove their locally synced copies. Such cancelled events will eventually disappear, so do not rely on them being available indefinitely.\nDeleted events are only guaranteed to have the id field populated. On the organizer's calendar, cancelled events continue to expose event details (summary, location, etc.) so that they can be restored (undeleted). Similarly, the events to which the user was invited and that they manually removed continue to provide details. However, incremental sync requests with showDeleted set to false will not return these details.\nIf an event changes its organizer (for example via the move operation) and the original organizer is not on the attendee list, it will leave behind a cancelled event where only the id field is guaranteed to be populated.", "type": "string" }, "summary": { diff --git a/vendor/google.golang.org/api/calendar/v3/calendar-gen.go b/vendor/google.golang.org/api/calendar/v3/calendar-gen.go index 191b8806..8bb77909 100644 --- a/vendor/google.golang.org/api/calendar/v3/calendar-gen.go +++ b/vendor/google.golang.org/api/calendar/v3/calendar-gen.go @@ -1375,7 +1375,34 @@ type Event struct { // - "confirmed" - The event is confirmed. This is the default status. // // - "tentative" - The event is tentatively confirmed. - // - "cancelled" - The event is cancelled. + // - "cancelled" - The event is cancelled (deleted). The list method + // returns cancelled events only on incremental sync (when syncToken or + // updatedMin are specified) or if the showDeleted flag is set to true. + // The get method always returns them. + // A cancelled status represents two different states depending on the + // event type: + // - Cancelled exceptions of an uncancelled recurring event indicate + // that this instance should no longer be presented to the user. Clients + // should store these events for the lifetime of the parent recurring + // event. + // Cancelled exceptions are only guaranteed to have values for the id, + // recurringEventId and originalStartTime fields populated. The other + // fields might be empty. + // - All other cancelled events represent deleted events. Clients should + // remove their locally synced copies. Such cancelled events will + // eventually disappear, so do not rely on them being available + // indefinitely. + // Deleted events are only guaranteed to have the id field populated. + // On the organizer's calendar, cancelled events continue to expose + // event details (summary, location, etc.) so that they can be restored + // (undeleted). Similarly, the events to which the user was invited and + // that they manually removed continue to provide details. However, + // incremental sync requests with showDeleted set to false will not + // return these details. + // If an event changes its organizer (for example via the move + // operation) and the original organizer is not on the attendee list, it + // will leave behind a cancelled event where only the id field is + // guaranteed to be populated. Status string `json:"status,omitempty"` // Summary: Title of the event.