diff options
author | 6543 <6543@obermui.de> | 2021-04-23 02:08:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 20:08:53 -0400 |
commit | 792b4dba2cc1b011e25f4a0c18fb648849cd885c (patch) | |
tree | fc5679ced43137a7b04ab1fb73dd2a4bd3ca9815 /vendor/github.com/xanzy | |
parent | 834fc74873e8047552e9181e130bd53d8e890eb0 (diff) | |
download | gitea-792b4dba2cc1b011e25f4a0c18fb648849cd885c.tar.gz gitea-792b4dba2cc1b011e25f4a0c18fb648849cd885c.zip |
[Vendor] Update directly used dependencys (#15593)
* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3
* github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0
* github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2
* github.com/go-chi/cors v1.1.1 -> v1.2.0
* github.com/go-git/go-billy v5.0.0 -> v5.1.0
* github.com/go-git/go-git v5.2.0 -> v5.3.0
* github.com/go-ldap/ldap v3.2.4 -> v3.3.0
* github.com/go-redis/redis v8.6.0 -> v8.8.2
* github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0
* github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0
* github.com/lib/pq v1.9.0 -> v1.10.1
* github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7
* github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0
* github.com/issue9/identicon v1.0.1 -> v1.2.0
* github.com/klauspost/compress v1.11.8 -> v1.12.1
* github.com/mgechev/revive v1.0.3 -> v1.0.6
* github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8
* github.com/niklasfasching/go-org v1.4.0 -> v1.5.0
* github.com/olivere/elastic v7.0.22 -> v7.0.24
* github.com/pelletier/go-toml v1.8.1 -> v1.9.0
* github.com/prometheus/client_golang v1.9.0 -> v1.10.0
* github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0
* github.com/yuin/goldmark v1.3.3 -> v1.3.5
* github.com/6543/go-version v1.2.4 -> v1.3.1
* do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
Diffstat (limited to 'vendor/github.com/xanzy')
23 files changed, 1025 insertions, 496 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/README.md b/vendor/github.com/xanzy/go-gitlab/README.md index 8866f48af4..3c8e401c3c 100644 --- a/vendor/github.com/xanzy/go-gitlab/README.md +++ b/vendor/github.com/xanzy/go-gitlab/README.md @@ -58,6 +58,7 @@ to add new and/or missing endpoints. Currently the following services are suppor - [x] Notification Settings - [x] Open Source License Templates - [x] Pages Domains +- [x] Personal Access Tokens - [x] Pipeline Schedules - [x] Pipeline Triggers - [x] Pipelines diff --git a/vendor/github.com/xanzy/go-gitlab/client_options.go b/vendor/github.com/xanzy/go-gitlab/client_options.go index 276e1eb271..b09ae07817 100644 --- a/vendor/github.com/xanzy/go-gitlab/client_options.go +++ b/vendor/github.com/xanzy/go-gitlab/client_options.go @@ -22,7 +22,7 @@ import ( retryablehttp "github.com/hashicorp/go-retryablehttp" ) -// ClientOptionFunc can be used customize a new GitLab API client. +// ClientOptionFunc can be used to customize a new GitLab API client. type ClientOptionFunc func(*Client) error // WithBaseURL sets the base URL for API requests to a custom endpoint. diff --git a/vendor/github.com/xanzy/go-gitlab/registry.go b/vendor/github.com/xanzy/go-gitlab/container_registry.go index 2101d64dc2..dd2b5b3f2e 100644 --- a/vendor/github.com/xanzy/go-gitlab/registry.go +++ b/vendor/github.com/xanzy/go-gitlab/container_registry.go @@ -34,14 +34,14 @@ type ContainerRegistryService struct { // // GitLab API docs: https://docs.gitlab.com/ee/api/container_registry.html type RegistryRepository struct { - ID int `json:"id"` - Name string `json:"name"` - Path string `json:"path"` - Location string `json:"location"` - CreatedAt *time.Time `json:"created_at"` - CreatePolicyStartedAt *time.Time `json:"cleanup_policy_started_at"` - TagsCount int `json:"tags_count"` - Tags []*RegistryRepositoryTag `json:"tags"` + ID int `json:"id"` + Name string `json:"name"` + Path string `json:"path"` + Location string `json:"location"` + CreatedAt *time.Time `json:"created_at"` + CleanupPolicyStartedAt *time.Time `json:"cleanup_policy_started_at"` + TagsCount int `json:"tags_count"` + Tags []*RegistryRepositoryTag `json:"tags"` } func (s RegistryRepository) String() string { diff --git a/vendor/github.com/xanzy/go-gitlab/deployments.go b/vendor/github.com/xanzy/go-gitlab/deployments.go index c13c2b7468..86b372d54f 100644 --- a/vendor/github.com/xanzy/go-gitlab/deployments.go +++ b/vendor/github.com/xanzy/go-gitlab/deployments.go @@ -75,7 +75,7 @@ type ListProjectDeploymentsOptions struct { OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` Sort *string `url:"sort,omitempty" json:"sort,omitempty"` UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` - UpdatedBefore *time.Time `url:"update_before,omitempty" json:"updated_before,omitempty"` + UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` Environment *string `url:"environment,omitempty" json:"environment,omitempty"` Status *string `url:"status,omitempty" json:"status,omitempty"` } diff --git a/vendor/github.com/xanzy/go-gitlab/environments.go b/vendor/github.com/xanzy/go-gitlab/environments.go index 9dd7a1b9bd..c5d66db65f 100644 --- a/vendor/github.com/xanzy/go-gitlab/environments.go +++ b/vendor/github.com/xanzy/go-gitlab/environments.go @@ -50,7 +50,12 @@ func (env Environment) String() string { // // GitLab API docs: // https://docs.gitlab.com/ee/api/environments.html#list-environments -type ListEnvironmentsOptions ListOptions +type ListEnvironmentsOptions struct { + ListOptions + Name *string `url:"name,omitempty" json:"name,omitempty"` + Search *string `url:"search,omitempty" json:"search,omitempty"` + States *string `url:"states,omitempty" json:"states,omitempty"` +} // ListEnvironments gets a list of environments from a project, sorted by name // alphabetically. diff --git a/vendor/github.com/xanzy/go-gitlab/event_parsing.go b/vendor/github.com/xanzy/go-gitlab/event_parsing.go index 6585db87f7..3c03ed1690 100644 --- a/vendor/github.com/xanzy/go-gitlab/event_parsing.go +++ b/vendor/github.com/xanzy/go-gitlab/event_parsing.go @@ -37,6 +37,7 @@ const ( EventConfidentialNote EventType = "Confidential Note Hook" EventTypePipeline EventType = "Pipeline Hook" EventTypePush EventType = "Push Hook" + EventTypeRelease EventType = "Release Hook" EventTypeSystemHook EventType = "System Hook" EventTypeTagPush EventType = "Tag Push Hook" EventTypeWikiPage EventType = "Wiki Page Hook" @@ -212,6 +213,8 @@ func ParseWebhook(eventType EventType, payload []byte) (event interface{}, err e event = &PipelineEvent{} case EventTypePush: event = &PushEvent{} + case EventTypeRelease: + event = &ReleaseEvent{} case EventTypeTagPush: event = &TagEvent{} case EventTypeWikiPage: diff --git a/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go b/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go index c8cf0cc569..f59b831a29 100644 --- a/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go +++ b/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go @@ -23,23 +23,54 @@ import ( "time" ) -// PushEvent represents a push event. +//BuildEvent represents a build event // // GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#push-events -type PushEvent struct { - ObjectKind string `json:"object_kind"` - Before string `json:"before"` - After string `json:"after"` - Ref string `json:"ref"` - CheckoutSHA string `json:"checkout_sha"` - UserID int `json:"user_id"` - UserName string `json:"user_name"` - UserUsername string `json:"user_username"` - UserEmail string `json:"user_email"` - UserAvatar string `json:"user_avatar"` - ProjectID int `json:"project_id"` - Project struct { +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#build-events +type BuildEvent struct { + ObjectKind string `json:"object_kind"` + Ref string `json:"ref"` + Tag bool `json:"tag"` + BeforeSHA string `json:"before_sha"` + SHA string `json:"sha"` + BuildID int `json:"build_id"` + BuildName string `json:"build_name"` + BuildStage string `json:"build_stage"` + BuildStatus string `json:"build_status"` + BuildStartedAt string `json:"build_started_at"` + BuildFinishedAt string `json:"build_finished_at"` + BuildDuration float64 `json:"build_duration"` + BuildAllowFailure bool `json:"build_allow_failure"` + ProjectID int `json:"project_id"` + ProjectName string `json:"project_name"` + User struct { + ID int `json:"id"` + Name string `json:"name"` + Email string `json:"email"` + } `json:"user"` + Commit struct { + ID int `json:"id"` + SHA string `json:"sha"` + Message string `json:"message"` + AuthorName string `json:"author_name"` + AuthorEmail string `json:"author_email"` + Status string `json:"status"` + Duration int `json:"duration"` + StartedAt string `json:"started_at"` + FinishedAt string `json:"finished_at"` + } `json:"commit"` + Repository *Repository `json:"repository"` +} + +// CommitCommentEvent represents a comment on a commit event. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-commit +type CommitCommentEvent struct { + ObjectKind string `json:"object_kind"` + User *User `json:"user"` + ProjectID int `json:"project_id"` + Project struct { Name string `json:"name"` Description string `json:"description"` AvatarURL string `json:"avatar_url"` @@ -55,8 +86,32 @@ type PushEvent struct { WebURL string `json:"web_url"` Visibility VisibilityValue `json:"visibility"` } `json:"project"` - Repository *Repository `json:"repository"` - Commits []*struct { + Repository *Repository `json:"repository"` + ObjectAttributes struct { + ID int `json:"id"` + Note string `json:"note"` + NoteableType string `json:"noteable_type"` + AuthorID int `json:"author_id"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + ProjectID int `json:"project_id"` + Attachment string `json:"attachment"` + LineCode string `json:"line_code"` + CommitID string `json:"commit_id"` + NoteableID int `json:"noteable_id"` + System bool `json:"system"` + StDiff struct { + Diff string `json:"diff"` + NewPath string `json:"new_path"` + OldPath string `json:"old_path"` + AMode string `json:"a_mode"` + BMode string `json:"b_mode"` + NewFile bool `json:"new_file"` + RenamedFile bool `json:"renamed_file"` + DeletedFile bool `json:"deleted_file"` + } `json:"st_diff"` + } `json:"object_attributes"` + Commit *struct { ID string `json:"id"` Message string `json:"message"` Timestamp *time.Time `json:"timestamp"` @@ -65,30 +120,58 @@ type PushEvent struct { Name string `json:"name"` Email string `json:"email"` } `json:"author"` - Added []string `json:"added"` - Modified []string `json:"modified"` - Removed []string `json:"removed"` - } `json:"commits"` - TotalCommitsCount int `json:"total_commits_count"` + } `json:"commit"` } -// TagEvent represents a tag event. +// DeploymentEvent represents a deployment event // // GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#tag-events -type TagEvent struct { - ObjectKind string `json:"object_kind"` - Before string `json:"before"` - After string `json:"after"` - Ref string `json:"ref"` - CheckoutSHA string `json:"checkout_sha"` - UserID int `json:"user_id"` - UserName string `json:"user_name"` - UserAvatar string `json:"user_avatar"` - UserEmail string `json:"user_email"` - ProjectID int `json:"project_id"` - Message string `json:"message"` - Project struct { +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#deployment-events +type DeploymentEvent struct { + ObjectKind string `json:"object_kind"` + Status string `json:"status"` + DeployableID int `json:"deployable_id"` + DeployableURL string `json:"deployable_url"` + Environment string `json:"environment"` + Project struct { + ID int `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + WebURL string `json:"web_url"` + AvatarURL *string `json:"avatar_url"` + GitSSHURL string `json:"git_ssh_url"` + GitHTTPURL string `json:"git_http_url"` + Namespace string `json:"namespace"` + VisibilityLevel int `json:"visibility_level"` + PathWithNamespace string `json:"path_with_namespace"` + DefaultBranch string `json:"default_branch"` + CIConfigPath string `json:"ci_config_path"` + Homepage string `json:"homepage"` + URL string `json:"url"` + SSHURL string `json:"ssh_url"` + HTTPURL string `json:"http_url"` + } `json:"project"` + ShortSHA string `json:"short_sha"` + User struct { + Name string `json:"name"` + Username string `json:"username"` + AvatarURL string `json:"avatar_url"` + Email string `json:"email"` + } `json:"user"` + UserURL string `json:"user_url"` + CommitURL string `json:"commit_url"` + CommitTitle string `json:"commit_title"` +} + +// IssueCommentEvent represents a comment on an issue event. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-issue +type IssueCommentEvent struct { + ObjectKind string `json:"object_kind"` + User *User `json:"user"` + ProjectID int `json:"project_id"` + Project struct { Name string `json:"name"` Description string `json:"description"` AvatarURL string `json:"avatar_url"` @@ -104,21 +187,49 @@ type TagEvent struct { WebURL string `json:"web_url"` Visibility VisibilityValue `json:"visibility"` } `json:"project"` - Repository *Repository `json:"repository"` - Commits []*struct { - ID string `json:"id"` - Message string `json:"message"` - Timestamp *time.Time `json:"timestamp"` - URL string `json:"url"` - Author struct { - Name string `json:"name"` - Email string `json:"email"` - } `json:"author"` - Added []string `json:"added"` - Modified []string `json:"modified"` - Removed []string `json:"removed"` - } `json:"commits"` - TotalCommitsCount int `json:"total_commits_count"` + Repository *Repository `json:"repository"` + ObjectAttributes struct { + ID int `json:"id"` + Note string `json:"note"` + NoteableType string `json:"noteable_type"` + AuthorID int `json:"author_id"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + ProjectID int `json:"project_id"` + Attachment string `json:"attachment"` + LineCode string `json:"line_code"` + CommitID string `json:"commit_id"` + NoteableID int `json:"noteable_id"` + System bool `json:"system"` + StDiff []*Diff `json:"st_diff"` + URL string `json:"url"` + } `json:"object_attributes"` + Issue struct { + ID int `json:"id"` + IID int `json:"iid"` + ProjectID int `json:"project_id"` + MilestoneID int `json:"milestone_id"` + AuthorID int `json:"author_id"` + Description string `json:"description"` + State string `json:"state"` + Title string `json:"title"` + Labels []Label `json:"labels"` + LastEditedAt string `json:"last_edit_at"` + LastEditedByID int `json:"last_edited_by_id"` + UpdatedAt string `json:"updated_at"` + UpdatedByID int `json:"updated_by_id"` + CreatedAt string `json:"created_at"` + ClosedAt string `json:"closed_at"` + DueDate *ISOTime `json:"due_date"` + URL string `json:"url"` + TimeEstimate int `json:"time_estimate"` + Confidential bool `json:"confidential"` + TotalTimeSpent int `json:"total_time_spent"` + HumanTotalTimeSpent string `json:"human_total_time_spent"` + HumanTimeEstimate string `json:"human_time_estimate"` + AssigneeIDs []int `json:"assignee_ids"` + AssigneeID int `json:"assignee_id"` + } `json:"issue"` } // IssueEvent represents a issue event. @@ -247,67 +358,6 @@ type JobEvent struct { } `json:"runner"` } -// CommitCommentEvent represents a comment on a commit event. -// -// GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-commit -type CommitCommentEvent struct { - ObjectKind string `json:"object_kind"` - User *User `json:"user"` - ProjectID int `json:"project_id"` - Project struct { - Name string `json:"name"` - Description string `json:"description"` - AvatarURL string `json:"avatar_url"` - GitSSHURL string `json:"git_ssh_url"` - GitHTTPURL string `json:"git_http_url"` - Namespace string `json:"namespace"` - PathWithNamespace string `json:"path_with_namespace"` - DefaultBranch string `json:"default_branch"` - Homepage string `json:"homepage"` - URL string `json:"url"` - SSHURL string `json:"ssh_url"` - HTTPURL string `json:"http_url"` - WebURL string `json:"web_url"` - Visibility VisibilityValue `json:"visibility"` - } `json:"project"` - Repository *Repository `json:"repository"` - ObjectAttributes struct { - ID int `json:"id"` - Note string `json:"note"` - NoteableType string `json:"noteable_type"` - AuthorID int `json:"author_id"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - ProjectID int `json:"project_id"` - Attachment string `json:"attachment"` - LineCode string `json:"line_code"` - CommitID string `json:"commit_id"` - NoteableID int `json:"noteable_id"` - System bool `json:"system"` - StDiff struct { - Diff string `json:"diff"` - NewPath string `json:"new_path"` - OldPath string `json:"old_path"` - AMode string `json:"a_mode"` - BMode string `json:"b_mode"` - NewFile bool `json:"new_file"` - RenamedFile bool `json:"renamed_file"` - DeletedFile bool `json:"deleted_file"` - } `json:"st_diff"` - } `json:"object_attributes"` - Commit *struct { - ID string `json:"id"` - Message string `json:"message"` - Timestamp *time.Time `json:"timestamp"` - URL string `json:"url"` - Author struct { - Name string `json:"name"` - Email string `json:"email"` - } `json:"author"` - } `json:"commit"` -} - // MergeCommentEvent represents a comment on a merge event. // // GitLab API docs: @@ -348,8 +398,8 @@ type MergeCommentEvent struct { Position *NotePosition `json:"position"` ProjectID int `json:"project_id"` ResolvedAt string `json:"resolved_at"` - ResolvedByID string `json:"resolved_by_id"` - ResolvedByPush string `json:"resolved_by_push"` + ResolvedByID int `json:"resolved_by_id"` + ResolvedByPush bool `json:"resolved_by_push"` StDiff *Diff `json:"st_diff"` System bool `json:"system"` Type string `json:"type"` @@ -411,118 +461,6 @@ type MergeCommentEvent struct { } `json:"merge_request"` } -// IssueCommentEvent represents a comment on an issue event. -// -// GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-issue -type IssueCommentEvent struct { - ObjectKind string `json:"object_kind"` - User *User `json:"user"` - ProjectID int `json:"project_id"` - Project struct { - Name string `json:"name"` - Description string `json:"description"` - AvatarURL string `json:"avatar_url"` - GitSSHURL string `json:"git_ssh_url"` - GitHTTPURL string `json:"git_http_url"` - Namespace string `json:"namespace"` - PathWithNamespace string `json:"path_with_namespace"` - DefaultBranch string `json:"default_branch"` - Homepage string `json:"homepage"` - URL string `json:"url"` - SSHURL string `json:"ssh_url"` - HTTPURL string `json:"http_url"` - WebURL string `json:"web_url"` - Visibility VisibilityValue `json:"visibility"` - } `json:"project"` - Repository *Repository `json:"repository"` - ObjectAttributes struct { - ID int `json:"id"` - Note string `json:"note"` - NoteableType string `json:"noteable_type"` - AuthorID int `json:"author_id"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - ProjectID int `json:"project_id"` - Attachment string `json:"attachment"` - LineCode string `json:"line_code"` - CommitID string `json:"commit_id"` - NoteableID int `json:"noteable_id"` - System bool `json:"system"` - StDiff []*Diff `json:"st_diff"` - URL string `json:"url"` - } `json:"object_attributes"` - Issue struct { - ID int `json:"id"` - IID int `json:"iid"` - ProjectID int `json:"project_id"` - MilestoneID int `json:"milestone_id"` - AuthorID int `json:"author_id"` - Description string `json:"description"` - State string `json:"state"` - Title string `json:"title"` - LastEditedAt string `json:"last_edit_at"` - LastEditedByID int `json:"last_edited_by_id"` - UpdatedAt string `json:"updated_at"` - UpdatedByID int `json:"updated_by_id"` - CreatedAt string `json:"created_at"` - ClosedAt string `json:"closed_at"` - DueDate *ISOTime `json:"due_date"` - URL string `json:"url"` - TimeEstimate int `json:"time_estimate"` - Confidential bool `json:"confidential"` - TotalTimeSpent int `json:"total_time_spent"` - HumanTotalTimeSpent string `json:"human_total_time_spent"` - HumanTimeEstimate string `json:"human_time_estimate"` - AssigneeIDs []int `json:"assignee_ids"` - AssigneeID int `json:"assignee_id"` - } `json:"issue"` -} - -// SnippetCommentEvent represents a comment on a snippet event. -// -// GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-code-snippet -type SnippetCommentEvent struct { - ObjectKind string `json:"object_kind"` - User *User `json:"user"` - ProjectID int `json:"project_id"` - Project struct { - Name string `json:"name"` - Description string `json:"description"` - AvatarURL string `json:"avatar_url"` - GitSSHURL string `json:"git_ssh_url"` - GitHTTPURL string `json:"git_http_url"` - Namespace string `json:"namespace"` - PathWithNamespace string `json:"path_with_namespace"` - DefaultBranch string `json:"default_branch"` - Homepage string `json:"homepage"` - URL string `json:"url"` - SSHURL string `json:"ssh_url"` - HTTPURL string `json:"http_url"` - WebURL string `json:"web_url"` - Visibility VisibilityValue `json:"visibility"` - } `json:"project"` - Repository *Repository `json:"repository"` - ObjectAttributes struct { - ID int `json:"id"` - Note string `json:"note"` - NoteableType string `json:"noteable_type"` - AuthorID int `json:"author_id"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - ProjectID int `json:"project_id"` - Attachment string `json:"attachment"` - LineCode string `json:"line_code"` - CommitID string `json:"commit_id"` - NoteableID int `json:"noteable_id"` - System bool `json:"system"` - StDiff *Diff `json:"st_diff"` - URL string `json:"url"` - } `json:"object_attributes"` - Snippet *Snippet `json:"snippet"` -} - // MergeEvent represents a merge event. // // GitLab API docs: @@ -695,47 +633,6 @@ func (p *MergeParams) UnmarshalJSON(b []byte) error { return nil } -// WikiPageEvent represents a wiki page event. -// -// GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#wiki-page-events -type WikiPageEvent struct { - ObjectKind string `json:"object_kind"` - User *User `json:"user"` - Project struct { - Name string `json:"name"` - Description string `json:"description"` - AvatarURL string `json:"avatar_url"` - GitSSHURL string `json:"git_ssh_url"` - GitHTTPURL string `json:"git_http_url"` - Namespace string `json:"namespace"` - PathWithNamespace string `json:"path_with_namespace"` - DefaultBranch string `json:"default_branch"` - Homepage string `json:"homepage"` - URL string `json:"url"` - SSHURL string `json:"ssh_url"` - HTTPURL string `json:"http_url"` - WebURL string `json:"web_url"` - Visibility VisibilityValue `json:"visibility"` - } `json:"project"` - Wiki struct { - WebURL string `json:"web_url"` - GitSSHURL string `json:"git_ssh_url"` - GitHTTPURL string `json:"git_http_url"` - PathWithNamespace string `json:"path_with_namespace"` - DefaultBranch string `json:"default_branch"` - } `json:"wiki"` - ObjectAttributes struct { - Title string `json:"title"` - Content string `json:"content"` - Format string `json:"format"` - Message string `json:"message"` - Slug string `json:"slug"` - URL string `json:"url"` - Action string `json:"action"` - } `json:"object_attributes"` -} - // PipelineEvent represents a pipeline event. // // GitLab API docs: @@ -827,56 +724,68 @@ type PipelineEvent struct { } `json:"builds"` } -//BuildEvent represents a build event +// PushEvent represents a push event. // // GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#build-events -type BuildEvent struct { - ObjectKind string `json:"object_kind"` - Ref string `json:"ref"` - Tag bool `json:"tag"` - BeforeSHA string `json:"before_sha"` - SHA string `json:"sha"` - BuildID int `json:"build_id"` - BuildName string `json:"build_name"` - BuildStage string `json:"build_stage"` - BuildStatus string `json:"build_status"` - BuildStartedAt string `json:"build_started_at"` - BuildFinishedAt string `json:"build_finished_at"` - BuildDuration float64 `json:"build_duration"` - BuildAllowFailure bool `json:"build_allow_failure"` - ProjectID int `json:"project_id"` - ProjectName string `json:"project_name"` - User struct { - ID int `json:"id"` - Name string `json:"name"` - Email string `json:"email"` - } `json:"user"` - Commit struct { - ID int `json:"id"` - SHA string `json:"sha"` - Message string `json:"message"` - AuthorName string `json:"author_name"` - AuthorEmail string `json:"author_email"` - Status string `json:"status"` - Duration int `json:"duration"` - StartedAt string `json:"started_at"` - FinishedAt string `json:"finished_at"` - } `json:"commit"` +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#push-events +type PushEvent struct { + ObjectKind string `json:"object_kind"` + Before string `json:"before"` + After string `json:"after"` + Ref string `json:"ref"` + CheckoutSHA string `json:"checkout_sha"` + UserID int `json:"user_id"` + UserName string `json:"user_name"` + UserUsername string `json:"user_username"` + UserEmail string `json:"user_email"` + UserAvatar string `json:"user_avatar"` + ProjectID int `json:"project_id"` + Project struct { + Name string `json:"name"` + Description string `json:"description"` + AvatarURL string `json:"avatar_url"` + GitSSHURL string `json:"git_ssh_url"` + GitHTTPURL string `json:"git_http_url"` + Namespace string `json:"namespace"` + PathWithNamespace string `json:"path_with_namespace"` + DefaultBranch string `json:"default_branch"` + Homepage string `json:"homepage"` + URL string `json:"url"` + SSHURL string `json:"ssh_url"` + HTTPURL string `json:"http_url"` + WebURL string `json:"web_url"` + Visibility VisibilityValue `json:"visibility"` + } `json:"project"` Repository *Repository `json:"repository"` + Commits []*struct { + ID string `json:"id"` + Message string `json:"message"` + Timestamp *time.Time `json:"timestamp"` + URL string `json:"url"` + Author struct { + Name string `json:"name"` + Email string `json:"email"` + } `json:"author"` + Added []string `json:"added"` + Modified []string `json:"modified"` + Removed []string `json:"removed"` + } `json:"commits"` + TotalCommitsCount int `json:"total_commits_count"` } -// DeploymentEvent represents a deployment event +// ReleaseEvent represents a release event // // GitLab API docs: -// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#deployment-events -type DeploymentEvent struct { - ObjectKind string `json:"object_kind"` - Status string `json:"status"` - DeployableID int `json:"deployable_id"` - DeployableURL string `json:"deployable_url"` - Environment string `json:"environment"` - Project struct { +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#release-events +type ReleaseEvent struct { + ID int `json:"id"` + CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468) + Description string `json:"description"` + Name string `json:"name"` + Tag string `json:"tag"` + ReleasedAt string `json:"released_at"` // Should be *time.Time (see Gitlab issue #21468) + ObjectKind string `json:"object_kind"` + Project struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` @@ -894,14 +803,165 @@ type DeploymentEvent struct { SSHURL string `json:"ssh_url"` HTTPURL string `json:"http_url"` } `json:"project"` - ShortSHA string `json:"short_sha"` - User struct { - Name string `json:"name"` - Username string `json:"username"` - AvatarURL string `json:"avatar_url"` - Email string `json:"email"` - } `json:"user"` - UserURL string `json:"user_url"` - CommitURL string `json:"commit_url"` - CommitTitle string `json:"commit_title"` + URL string `json:"url"` + Action string `json:"action"` + Assets struct { + Count int `json:"count"` + Links []struct { + ID int `json:"id"` + External bool `json:"external"` + LinkType string `json:"link_type"` + Name string `json:"name"` + URL string `json:"url"` + } `json:"links"` + Sources []struct { + Format string `json:"format"` + URL string `json:"url"` + } `json:"sources"` + } `json:"assets"` + Commit struct { + ID string `json:"id"` + Message string `json:"message"` + Title string `json:"title"` + Timestamp string `json:"timestamp"` // Should be *time.Time (see Gitlab issue #21468) + URL string `json:"url"` + Author struct { + Name string `json:"name"` + Email string `json:"email"` + } `json:"author"` + } `json:"commit"` +} + +// SnippetCommentEvent represents a comment on a snippet event. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-code-snippet +type SnippetCommentEvent struct { + ObjectKind string `json:"object_kind"` + User *User `json:"user"` + ProjectID int `json:"project_id"` + Project struct { + Name string `json:"name"` + Description string `json:"description"` + AvatarURL string `json:"avatar_url"` + GitSSHURL string `json:"git_ssh_url"` + GitHTTPURL string `json:"git_http_url"` + Namespace string `json:"namespace"` + PathWithNamespace string `json:"path_with_namespace"` + DefaultBranch string `json:"default_branch"` + Homepage string `json:"homepage"` + URL string `json:"url"` + SSHURL string `json:"ssh_url"` + HTTPURL string `json:"http_url"` + WebURL string `json:"web_url"` + Visibility VisibilityValue `json:"visibility"` + } `json:"project"` + Repository *Repository `json:"repository"` + ObjectAttributes struct { + ID int `json:"id"` + Note string `json:"note"` + NoteableType string `json:"noteable_type"` + AuthorID int `json:"author_id"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + ProjectID int `json:"project_id"` + Attachment string `json:"attachment"` + LineCode string `json:"line_code"` + CommitID string `json:"commit_id"` + NoteableID int `json:"noteable_id"` + System bool `json:"system"` + StDiff *Diff `json:"st_diff"` + URL string `json:"url"` + } `json:"object_attributes"` + Snippet *Snippet `json:"snippet"` +} + +// TagEvent represents a tag event. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#tag-events +type TagEvent struct { + ObjectKind string `json:"object_kind"` + Before string `json:"before"` + After string `json:"after"` + Ref string `json:"ref"` + CheckoutSHA string `json:"checkout_sha"` + UserID int `json:"user_id"` + UserName string `json:"user_name"` + UserAvatar string `json:"user_avatar"` + UserEmail string `json:"user_email"` + ProjectID int `json:"project_id"` + Message string `json:"message"` + Project struct { + Name string `json:"name"` + Description string `json:"description"` + AvatarURL string `json:"avatar_url"` + GitSSHURL string `json:"git_ssh_url"` + GitHTTPURL string `json:"git_http_url"` + Namespace string `json:"namespace"` + PathWithNamespace string `json:"path_with_namespace"` + DefaultBranch string `json:"default_branch"` + Homepage string `json:"homepage"` + URL string `json:"url"` + SSHURL string `json:"ssh_url"` + HTTPURL string `json:"http_url"` + WebURL string `json:"web_url"` + Visibility VisibilityValue `json:"visibility"` + } `json:"project"` + Repository *Repository `json:"repository"` + Commits []*struct { + ID string `json:"id"` + Message string `json:"message"` + Timestamp *time.Time `json:"timestamp"` + URL string `json:"url"` + Author struct { + Name string `json:"name"` + Email string `json:"email"` + } `json:"author"` + Added []string `json:"added"` + Modified []string `json:"modified"` + Removed []string `json:"removed"` + } `json:"commits"` + TotalCommitsCount int `json:"total_commits_count"` +} + +// WikiPageEvent represents a wiki page event. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#wiki-page-events +type WikiPageEvent struct { + ObjectKind string `json:"object_kind"` + User *User `json:"user"` + Project struct { + Name string `json:"name"` + Description string `json:"description"` + AvatarURL string `json:"avatar_url"` + GitSSHURL string `json:"git_ssh_url"` + GitHTTPURL string `json:"git_http_url"` + Namespace string `json:"namespace"` + PathWithNamespace string `json:"path_with_namespace"` + DefaultBranch string `json:"default_branch"` + Homepage string `json:"homepage"` + URL string `json:"url"` + SSHURL string `json:"ssh_url"` + HTTPURL string `json:"http_url"` + WebURL string `json:"web_url"` + Visibility VisibilityValue `json:"visibility"` + } `json:"project"` + Wiki struct { + WebURL string `json:"web_url"` + GitSSHURL string `json:"git_ssh_url"` + GitHTTPURL string `json:"git_http_url"` + PathWithNamespace string `json:"path_with_namespace"` + DefaultBranch string `json:"default_branch"` + } `json:"wiki"` + ObjectAttributes struct { + Title string `json:"title"` + Content string `json:"content"` + Format string `json:"format"` + Message string `json:"message"` + Slug string `json:"slug"` + URL string `json:"url"` + Action string `json:"action"` + } `json:"object_attributes"` } diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go index f5794517b4..265aaf200f 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitlab.go +++ b/vendor/github.com/xanzy/go-gitlab/gitlab.go @@ -152,6 +152,7 @@ type Client struct { PipelineTriggers *PipelineTriggersService Pipelines *PipelinesService ProjectBadges *ProjectBadgesService + ProjectAccessTokens *ProjectAccessTokensService ProjectCluster *ProjectClustersService ProjectImportExport *ProjectImportExportService ProjectMembers *ProjectMembersService @@ -322,6 +323,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) { c.PipelineTriggers = &PipelineTriggersService{client: c} c.Pipelines = &PipelinesService{client: c} c.ProjectBadges = &ProjectBadgesService{client: c} + c.ProjectAccessTokens = &ProjectAccessTokensService{client: c} c.ProjectCluster = &ProjectClustersService{client: c} c.ProjectImportExport = &ProjectImportExportService{client: c} c.ProjectMembers = &ProjectMembersService{client: c} diff --git a/vendor/github.com/xanzy/go-gitlab/go.mod b/vendor/github.com/xanzy/go-gitlab/go.mod index e947c98809..eb13bcef72 100644 --- a/vendor/github.com/xanzy/go-gitlab/go.mod +++ b/vendor/github.com/xanzy/go-gitlab/go.mod @@ -3,7 +3,7 @@ module github.com/xanzy/go-gitlab require ( github.com/google/go-querystring v1.0.0 github.com/hashicorp/go-cleanhttp v0.5.1 - github.com/hashicorp/go-retryablehttp v0.6.4 + github.com/hashicorp/go-retryablehttp v0.6.8 github.com/stretchr/testify v1.4.0 golang.org/x/net v0.0.0-20181108082009-03003ca0c849 // indirect golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288 diff --git a/vendor/github.com/xanzy/go-gitlab/go.sum b/vendor/github.com/xanzy/go-gitlab/go.sum index c10598c5b1..74ea228e91 100644 --- a/vendor/github.com/xanzy/go-gitlab/go.sum +++ b/vendor/github.com/xanzy/go-gitlab/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -10,8 +9,8 @@ github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVo github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.6.4 h1:BbgctKO892xEyOXnGiaAwIoSq1QZ/SS4AhjoAh9DnfY= -github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.6.8 h1:92lWxgpa+fF3FozM4B3UZtHZMJX8T5XT+TFdCxsPyWs= +github.com/hashicorp/go-retryablehttp v0.6.8/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/vendor/github.com/xanzy/go-gitlab/group_hooks.go b/vendor/github.com/xanzy/go-gitlab/group_hooks.go index dbc84080ca..2f03c717d4 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_hooks.go +++ b/vendor/github.com/xanzy/go-gitlab/group_hooks.go @@ -40,6 +40,7 @@ type GroupHook struct { PipelineEvents bool `json:"pipeline_events"` WikiPageEvents bool `json:"wiki_page_events"` DeploymentEvents bool `json:"deployment_events"` + ReleasesEvents bool `json:"releases_events"` EnableSSLVerification bool `json:"enable_ssl_verification"` CreatedAt *time.Time `json:"created_at"` } @@ -108,6 +109,7 @@ type AddGroupHookOptions struct { PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` + ReleasesEvents *bool `url:"releases_events,omitempty" json:"releases_events,omitempty"` EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` Token *string `url:"token,omitempty" json:"token,omitempty"` } @@ -153,6 +155,7 @@ type EditGroupHookOptions struct { PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` + ReleasesEvents *bool `url:"releases_events,omitempty" json:"releases_events,omitempty"` EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` Token *string `url:"token,omitempty" json:"token,omitempty"` } diff --git a/vendor/github.com/xanzy/go-gitlab/groups.go b/vendor/github.com/xanzy/go-gitlab/groups.go index e6b1db07e3..8632357043 100644 --- a/vendor/github.com/xanzy/go-gitlab/groups.go +++ b/vendor/github.com/xanzy/go-gitlab/groups.go @@ -81,6 +81,7 @@ type Group struct { // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#ldap-group-links type LDAPGroupLink struct { CN string `json:"cn"` + Filter string `json:"filter"` GroupAccess AccessLevelValue `json:"group_access"` Provider string `json:"provider"` } @@ -457,9 +458,20 @@ func (s *GroupsService) ListGroupLDAPLinks(gid interface{}, options ...RequestOp // GitLab API docs: // https://docs.gitlab.com/ee/api/groups.html#add-ldap-group-link-starter type AddGroupLDAPLinkOptions struct { - CN *string `url:"cn,omitempty" json:"cn,omitempty"` - GroupAccess *int `url:"group_access,omitempty" json:"group_access,omitempty"` - Provider *string `url:"provider,omitempty" json:"provider,omitempty"` + CN *string `url:"cn,omitempty" json:"cn,omitempty"` + Filter *string `url:"filter,omitempty" json:"filter,omitempty"` + GroupAccess *AccessLevelValue `url:"group_access,omitempty" json:"group_access,omitempty"` + Provider *string `url:"provider,omitempty" json:"provider,omitempty"` +} + +// DeleteGroupLDAPLinkWithCNOrFilterOptions represents the available DeleteGroupLDAPLinkWithCNOrFilter() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#delete-ldap-group-link-with-cn-or-filter +type DeleteGroupLDAPLinkWithCNOrFilterOptions struct { + CN *string `url:"cn,omitempty" json:"cn,omitempty"` + Filter *string `url:"filter,omitempty" json:"filter,omitempty"` + Provider *string `url:"provider,omitempty" json:"provider,omitempty"` } // AddGroupLDAPLink creates a new group LDAP link. Available only for users who @@ -508,6 +520,26 @@ func (s *GroupsService) DeleteGroupLDAPLink(gid interface{}, cn string, options return s.client.Do(req, nil) } +// DeleteGroupLDAPLinkWithCNOrFilter deletes a group LDAP link. Available only for users who +// can edit groups. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#delete-ldap-group-link-with-cn-or-filter +func (s *GroupsService) DeleteGroupLDAPLinkWithCNOrFilter(gid interface{}, opts *DeleteGroupLDAPLinkWithCNOrFilterOptions, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/ldap_group_links", pathEscape(group)) + + req, err := s.client.NewRequest(http.MethodDelete, u, opts, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + // DeleteGroupLDAPLinkForProvider deletes a group LDAP link from a specific // provider. Available only for users who can edit groups. // diff --git a/vendor/github.com/xanzy/go-gitlab/issues.go b/vendor/github.com/xanzy/go-gitlab/issues.go index f162000c06..e01544a4fb 100644 --- a/vendor/github.com/xanzy/go-gitlab/issues.go +++ b/vendor/github.com/xanzy/go-gitlab/issues.go @@ -22,6 +22,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "strings" "time" ) @@ -86,6 +87,7 @@ type IssueLinks struct { type Issue struct { ID int `json:"id"` IID int `json:"iid"` + ExternalID string `json:"external_id"` State string `json:"state"` Description string `json:"description"` Author *IssueAuthor `json:"author"` @@ -98,6 +100,7 @@ type Issue struct { ClosedBy *IssueCloser `json:"closed_by"` Title string `json:"title"` CreatedAt *time.Time `json:"created_at"` + MovedToID int `json:"moved_to_id"` Labels Labels `json:"labels"` LabelDetails []*LabelDetails `json:"label_details"` Upvotes int `json:"upvotes"` @@ -136,26 +139,29 @@ func (i *Issue) UnmarshalJSON(data []byte) error { return err } + if reflect.TypeOf(raw["id"]).Kind() == reflect.String { + raw["external_id"] = raw["id"] + delete(raw, "id") + } + labelDetails, ok := raw["labels"].([]interface{}) if ok && len(labelDetails) > 0 { // We only want to change anything if we got label details. - if _, ok := labelDetails[0].(map[string]interface{}); !ok { - return json.Unmarshal(data, (*alias)(i)) + if _, ok := labelDetails[0].(map[string]interface{}); ok { + labels := make([]interface{}, len(labelDetails)) + for i, details := range labelDetails { + labels[i] = details.(map[string]interface{})["name"] + } + + // Set the correct values + raw["labels"] = labels + raw["label_details"] = labelDetails } + } - labels := make([]interface{}, len(labelDetails)) - for i, details := range labelDetails { - labels[i] = details.(map[string]interface{})["name"] - } - - // Set the correct values - raw["labels"] = labels - raw["label_details"] = labelDetails - - data, err = json.Marshal(raw) - if err != nil { - return err - } + data, err = json.Marshal(raw) + if err != nil { + return err } return json.Unmarshal(data, (*alias)(i)) diff --git a/vendor/github.com/xanzy/go-gitlab/jobs.go b/vendor/github.com/xanzy/go-gitlab/jobs.go index e6470485e4..410e5a6f10 100644 --- a/vendor/github.com/xanzy/go-gitlab/jobs.go +++ b/vendor/github.com/xanzy/go-gitlab/jobs.go @@ -43,6 +43,7 @@ type Job struct { FinishedAt *time.Time `json:"finished_at"` Duration float64 `json:"duration"` ArtifactsExpireAt *time.Time `json:"artifacts_expire_at"` + TagList []string `json:"tag_list"` ID int `json:"id"` Name string `json:"name"` Pipeline struct { diff --git a/vendor/github.com/xanzy/go-gitlab/labels.go b/vendor/github.com/xanzy/go-gitlab/labels.go index c81a1ef80e..ccf6b24f71 100644 --- a/vendor/github.com/xanzy/go-gitlab/labels.go +++ b/vendor/github.com/xanzy/go-gitlab/labels.go @@ -76,8 +76,9 @@ func (l Label) String() string { // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels type ListLabelsOptions struct { ListOptions - WithCounts *bool `url:"with_counts,omitempty" json:"with_counts,omitempty"` - IncludeAncestorGroups *bool `url:"include_ancestor_groups,omitempty" json:"include_ancestor_groups,omitempty"` + WithCounts *bool `url:"with_counts,omitempty" json:"with_counts,omitempty"` + IncludeAncestorGroups *bool `url:"include_ancestor_groups,omitempty" json:"include_ancestor_groups,omitempty"` + Search *string `url:"search,omitempty" json:"search,omitempty"` } // ListLabels gets all labels for given project. diff --git a/vendor/github.com/xanzy/go-gitlab/merge_requests.go b/vendor/github.com/xanzy/go-gitlab/merge_requests.go index 0a1909ceb8..9b9b2361b3 100644 --- a/vendor/github.com/xanzy/go-gitlab/merge_requests.go +++ b/vendor/github.com/xanzy/go-gitlab/merge_requests.go @@ -201,7 +201,7 @@ type ListGroupMergeRequestsOptions struct { Sort *string `url:"sort,omitempty" json:"sort,omitempty"` Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` View *string `url:"view,omitempty" json:"view,omitempty"` - Labels Labels `url:"labels,omitempty" json:"labels,omitempty"` + Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` NotLabels Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` WithLabelsDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"` WithMergeStatusRecheck *bool `url:"with_merge_status_recheck,omitempty" json:"with_merge_status_recheck,omitempty"` @@ -218,6 +218,8 @@ type ListGroupMergeRequestsOptions struct { SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"` TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"` Search *string `url:"search,omitempty" json:"search,omitempty"` + In *string `url:"in,omitempty" json:"in,omitempty"` + WIP *string `url:"wip,omitempty" json:"wip,omitempty"` } // ListGroupMergeRequests gets all merge requests for this group. @@ -709,7 +711,7 @@ func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{}, } u := fmt.Sprintf("projects/%s/merge_requests/%d/cancel_merge_when_pipeline_succeeds", pathEscape(project), mergeRequest) - req, err := s.client.NewRequest(http.MethodPut, u, nil, options) + req, err := s.client.NewRequest(http.MethodPost, u, nil, options) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/xanzy/go-gitlab/project_access_tokens.go b/vendor/github.com/xanzy/go-gitlab/project_access_tokens.go new file mode 100644 index 0000000000..9bca815d54 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/project_access_tokens.go @@ -0,0 +1,138 @@ +// +// Copyright 2021, Patrick Webster +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package gitlab + +import ( + "fmt" + "net/http" + "time" +) + +// ProjectAccessTokensService handles communication with the +// project access tokens related methods of the GitLab API. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/resource_access_tokens.html +type ProjectAccessTokensService struct { + client *Client +} + +// ProjectAccessToken represents a GitLab Project Access Token. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/resource_access_tokens.html +type ProjectAccessToken struct { + ID int `json:"id"` + UserID int `json:"user_id"` + Name string `json:"name"` + Scopes []string `json:"scopes"` + CreatedAt *time.Time `json:"created_at"` + ExpiresAt *ISOTime `json:"expires_at"` + Active bool `json:"active"` + Revoked bool `json:"revoked"` + Token string `json:"token"` +} + +func (v ProjectAccessToken) String() string { + return Stringify(v) +} + +// ListProjectAccessTokensOptions represents the available options for +// listing variables in a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/resource_access_tokens.html#list-project-access-tokens +type ListProjectAccessTokensOptions ListOptions + +// ListProjectAccessTokens gets a list of all Project Access Tokens in a +// project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/resource_access_tokens.html#list-project-access-tokens +func (s *ProjectAccessTokensService) ListProjectAccessTokens(pid interface{}, opt *ListProjectAccessTokensOptions, options ...RequestOptionFunc) ([]*ProjectAccessToken, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/access_tokens", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodGet, u, opt, options) + if err != nil { + return nil, nil, err + } + + var pats []*ProjectAccessToken + resp, err := s.client.Do(req, &pats) + if err != nil { + return nil, resp, err + } + + return pats, resp, err +} + +// CreateProjectAccessTokenOptions represents the available CreateVariable() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/resource_access_tokens.html#create-a-project-access-token +type CreateProjectAccessTokenOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + Scopes []string `url:"scopes,omitempty" json:"scopes,omitempty"` + ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"` +} + +// CreateProjectAccessToken creates a new Project Access Token. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/resource_access_tokens.html#create-a-project-access-token +func (s *ProjectAccessTokensService) CreateProjectAccessToken(pid interface{}, opt *CreateProjectAccessTokenOptions, options ...RequestOptionFunc) (*ProjectAccessToken, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/access_tokens", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) + if err != nil { + return nil, nil, err + } + + pat := new(ProjectAccessToken) + resp, err := s.client.Do(req, pat) + if err != nil { + return nil, resp, err + } + + return pat, resp, err +} + +// RemoveProjectAccessToken deletes a Project Access Token. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/resource_access_tokens.html#revoke-a-project-access-token +func (s *ProjectAccessTokensService) DeleteProjectAccessToken(pid interface{}, id int, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/access_tokens/%d", pathEscape(project), id) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/xanzy/go-gitlab/projects.go b/vendor/github.com/xanzy/go-gitlab/projects.go index cc1282b716..fb58eefbcf 100644 --- a/vendor/github.com/xanzy/go-gitlab/projects.go +++ b/vendor/github.com/xanzy/go-gitlab/projects.go @@ -20,10 +20,10 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "mime/multipart" "net/http" "os" + "path/filepath" "time" ) @@ -106,6 +106,7 @@ type Project struct { PagesAccessLevel AccessControlValue `json:"pages_access_level"` OperationsAccessLevel AccessControlValue `json:"operations_access_level"` AutocloseReferencedIssues bool `json:"autoclose_referenced_issues"` + SuggestionCommitMessage string `json:"suggestion_commit_message"` CIForwardDeploymentEnabled bool `json:"ci_forward_deployment_enabled"` SharedWithGroups []struct { GroupID int `json:"group_id"` @@ -118,6 +119,7 @@ type Project struct { CIDefaultGitDepth int `json:"ci_default_git_depth"` CustomAttributes []*CustomAttribute `json:"custom_attributes"` ComplianceFrameworks []string `json:"compliance_frameworks"` + BuildCoverageRegex string `json:"build_coverage_regex"` } // ContainerExpirationPolicy represents the container expiration policy. @@ -534,6 +536,7 @@ type CreateProjectOptions struct { PackagesEnabled *bool `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"` ServiceDeskEnabled *bool `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"` AutocloseReferencedIssues *bool `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"` + SuggestionCommitMessage *string `url:"suggestion_commit_message,omitempty" json:"suggestion_commit_message,omitempty"` // Deprecated members IssuesEnabled *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"` @@ -671,6 +674,7 @@ type EditProjectOptions struct { PackagesEnabled *bool `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"` ServiceDeskEnabled *bool `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"` AutocloseReferencedIssues *bool `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"` + SuggestionCommitMessage *string `url:"suggestion_commit_message,omitempty" json:"suggestion_commit_message,omitempty"` // Deprecated members IssuesEnabled *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"` @@ -948,6 +952,7 @@ type ProjectHook struct { PipelineEvents bool `json:"pipeline_events"` WikiPageEvents bool `json:"wiki_page_events"` DeploymentEvents bool `json:"deployment_events"` + ReleasesEvents bool `json:"releases_events"` EnableSSLVerification bool `json:"enable_ssl_verification"` CreatedAt *time.Time `json:"created_at"` } @@ -1025,6 +1030,7 @@ type AddProjectHookOptions struct { PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` + ReleasesEvents *bool `url:"releases_events,omitempty" json:"releases_events,omitempty"` EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` Token *string `url:"token,omitempty" json:"token,omitempty"` } @@ -1072,6 +1078,7 @@ type EditProjectHookOptions struct { PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` + ReleasesEvents *bool `url:"releases_events,omitempty" json:"releases_events,omitempty"` EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` Token *string `url:"token,omitempty" json:"token,omitempty"` } @@ -1198,7 +1205,8 @@ func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...Re b := &bytes.Buffer{} w := multipart.NewWriter(b) - fw, err := w.CreateFormFile("file", file) + _, filename := filepath.Split(file) + fw, err := w.CreateFormFile("file", filename) if err != nil { return nil, nil, err } @@ -1209,15 +1217,18 @@ func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...Re } w.Close() - req, err := s.client.NewRequest("", u, nil, options) + req, err := s.client.NewRequest(http.MethodPost, u, nil, options) if err != nil { return nil, nil, err } - req.Body = ioutil.NopCloser(b) - req.ContentLength = int64(b.Len()) + // Set the buffer as the request body. + if err = req.SetBody(b); err != nil { + return nil, nil, err + } + + // Overwrite the default content type. req.Header.Set("Content-Type", w.FormDataContentType()) - req.Method = http.MethodPost uf := &ProjectFile{} resp, err := s.client.Do(req, uf) diff --git a/vendor/github.com/xanzy/go-gitlab/repository_files.go b/vendor/github.com/xanzy/go-gitlab/repository_files.go index ae8a98b1ac..9c83432e77 100644 --- a/vendor/github.com/xanzy/go-gitlab/repository_files.go +++ b/vendor/github.com/xanzy/go-gitlab/repository_files.go @@ -20,7 +20,6 @@ import ( "bytes" "fmt" "net/http" - "net/url" "strconv" "time" ) @@ -74,7 +73,7 @@ func (s *RepositoryFilesService) GetFile(pid interface{}, fileName string, opt * u := fmt.Sprintf( "projects/%s/repository/files/%s", pathEscape(project), - url.PathEscape(fileName), + pathEscape(fileName), ) req, err := s.client.NewRequest(http.MethodGet, u, opt, options) @@ -112,7 +111,7 @@ func (s *RepositoryFilesService) GetFileMetaData(pid interface{}, fileName strin u := fmt.Sprintf( "projects/%s/repository/files/%s", pathEscape(project), - url.PathEscape(fileName), + pathEscape(fileName), ) req, err := s.client.NewRequest(http.MethodHead, u, opt, options) @@ -189,7 +188,7 @@ func (s *RepositoryFilesService) GetFileBlame(pid interface{}, file string, opt u := fmt.Sprintf( "projects/%s/repository/files/%s/blame", pathEscape(project), - url.PathEscape(file), + pathEscape(file), ) req, err := s.client.NewRequest(http.MethodGet, u, opt, options) @@ -226,7 +225,7 @@ func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, op u := fmt.Sprintf( "projects/%s/repository/files/%s/raw", pathEscape(project), - url.PathEscape(fileName), + pathEscape(fileName), ) req, err := s.client.NewRequest(http.MethodGet, u, opt, options) @@ -281,7 +280,7 @@ func (s *RepositoryFilesService) CreateFile(pid interface{}, fileName string, op u := fmt.Sprintf( "projects/%s/repository/files/%s", pathEscape(project), - url.PathEscape(fileName), + pathEscape(fileName), ) req, err := s.client.NewRequest(http.MethodPost, u, opt, options) @@ -325,7 +324,7 @@ func (s *RepositoryFilesService) UpdateFile(pid interface{}, fileName string, op u := fmt.Sprintf( "projects/%s/repository/files/%s", pathEscape(project), - url.PathEscape(fileName), + pathEscape(fileName), ) req, err := s.client.NewRequest(http.MethodPut, u, opt, options) @@ -367,7 +366,7 @@ func (s *RepositoryFilesService) DeleteFile(pid interface{}, fileName string, op u := fmt.Sprintf( "projects/%s/repository/files/%s", pathEscape(project), - url.PathEscape(fileName), + pathEscape(fileName), ) req, err := s.client.NewRequest(http.MethodDelete, u, opt, options) diff --git a/vendor/github.com/xanzy/go-gitlab/resource_label_events.go b/vendor/github.com/xanzy/go-gitlab/resource_label_events.go index 086f887fdc..2bc93896d5 100644 --- a/vendor/github.com/xanzy/go-gitlab/resource_label_events.go +++ b/vendor/github.com/xanzy/go-gitlab/resource_label_events.go @@ -168,12 +168,12 @@ func (s *ResourceLabelEventsService) GetGroupEpicLabelEvent(gid interface{}, epi return l, resp, err } -// ListMergeLabelEvents retrieves resource label events for the specified +// ListMergeRequestsLabelEvents retrieves resource label events for the specified // project and merge request. // // GitLab API docs: // https://docs.gitlab.com/ee/api/resource_label_events.html#list-project-merge-request-label-events -func (s *ResourceLabelEventsService) ListMergeLabelEvents(pid interface{}, request int, opt *ListLabelEventsOptions, options ...RequestOptionFunc) ([]*LabelEvent, *Response, error) { +func (s *ResourceLabelEventsService) ListMergeRequestsLabelEvents(pid interface{}, request int, opt *ListLabelEventsOptions, options ...RequestOptionFunc) ([]*LabelEvent, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/services.go b/vendor/github.com/xanzy/go-gitlab/services.go index 2255089c0a..ecfed70135 100644 --- a/vendor/github.com/xanzy/go-gitlab/services.go +++ b/vendor/github.com/xanzy/go-gitlab/services.go @@ -80,6 +80,102 @@ func (s *ServicesService) ListServices(pid interface{}, options ...RequestOption return svcs, resp, err } +// CustomIssueTrackerService represents Custom Issue Tracker service settings. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#custom-issue-tracker +type CustomIssueTrackerService struct { + Service + Properties *CustomIssueTrackerServiceProperties `json:"properties"` +} + +// CustomIssueTrackerServiceProperties represents Custom Issue Tracker specific properties. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#custom-issue-tracker +type CustomIssueTrackerServiceProperties struct { + ProjectURL string `json:"project_url,omitempty"` + IssuesURL string `json:"issues_url,omitempty"` + NewIssueURL string `json:"new_issue_url,omitempty"` +} + +// GetCustomIssueTrackerService gets Custom Issue Tracker service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#get-custom-issue-tracker-service-settings +func (s *ServicesService) GetCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*CustomIssueTrackerService, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + if err != nil { + return nil, nil, err + } + + svc := new(CustomIssueTrackerService) + resp, err := s.client.Do(req, svc) + if err != nil { + return nil, resp, err + } + + return svc, resp, err +} + +// SetCustomIssueTrackerServiceOptions represents the available SetCustomIssueTrackerService() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#createedit-custom-issue-tracker-service +type SetCustomIssueTrackerServiceOptions struct { + NewIssueURL *string `url:"new_issue_url,omitempty" json:"new_issue_url,omitempty"` + IssuesURL *string `url:"issues_url,omitempty" json:"issues_url,omitempty"` + ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` +} + +// SetCustomIssueTrackerService sets Custom Issue Tracker service for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#createedit-custom-issue-tracker-service +func (s *ServicesService) SetCustomIssueTrackerService(pid interface{}, opt *SetCustomIssueTrackerServiceOptions, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodPut, u, opt, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteCustomIssueTrackerService deletes Custom Issue Tracker service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#delete-custom-issue-tracker-service +func (s *ServicesService) DeleteCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + // DroneCIService represents Drone CI service settings. // // GitLab API docs: @@ -130,8 +226,8 @@ func (s *ServicesService) GetDroneCIService(pid interface{}, options ...RequestO // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service type SetDroneCIServiceOptions struct { - Token *string `url:"token" json:"token" ` - DroneURL *string `url:"drone_url" json:"drone_url"` + Token *string `url:"token,omitempty" json:"token,omitempty"` + DroneURL *string `url:"drone_url,omitempty" json:"drone_url,omitempty"` EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` } @@ -276,8 +372,8 @@ type GithubService struct { // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#github-premium type GithubServiceProperties struct { - RepositoryURL string `json:"repository_url,omitempty"` - StaticContext bool `json:"static_context,omitempty"` + RepositoryURL string `json:"repository_url"` + StaticContext bool `json:"static_context"` } // GetGithubService gets Github service settings for a project. @@ -464,9 +560,9 @@ type JenkinsCIService struct { // GitLab API docs: // https://docs.gitlab.com/ee/api/services.html#jenkins-ci type JenkinsCIServiceProperties struct { - URL string `json:"jenkins_url,omitempty"` - ProjectName string `json:"project_name,omitempty"` - Username string `json:"username,omitempty"` + URL string `json:"jenkins_url"` + ProjectName string `json:"project_name"` + Username string `json:"username"` } // GetJenkinsCIService gets Jenkins CI service settings for a project. @@ -558,12 +654,12 @@ type JiraService struct { // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#jira type JiraServiceProperties struct { - URL string `json:"url,omitempty"` - APIURL string `json:"api_url,omitempty"` - ProjectKey string `json:"project_key,omitempty" ` - Username string `json:"username,omitempty" ` - Password string `json:"password,omitempty" ` - JiraIssueTransitionID string `json:"jira_issue_transition_id,omitempty"` + URL string `json:"url"` + APIURL string `json:"api_url"` + ProjectKey string `json:"project_key" ` + Username string `json:"username" ` + Password string `json:"password" ` + JiraIssueTransitionID string `json:"jira_issue_transition_id"` } // UnmarshalJSON decodes the Jira Service Properties. @@ -677,6 +773,130 @@ func (s *ServicesService) DeleteJiraService(pid interface{}, options ...RequestO return s.client.Do(req, nil) } +// MattermostService represents Mattermost service settings. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#mattermost-notifications +type MattermostService struct { + Service + Properties *MattermostServiceProperties `json:"properties"` +} + +// MattermostServiceProperties represents Mattermost specific properties. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#mattermost-notifications +type MattermostServiceProperties struct { + WebHook string `json:"webhook"` + Username string `json:"username"` + Channel string `json:"channel"` + NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"` + BranchesToBeNotified string `json:"branches_to_be_notified"` + ConfidentialIssueChannel string `json:"confidential_issue_channel"` + ConfidentialNoteChannel string `json:"confidential_note_channel"` + IssueChannel string `json:"issue_channel"` + MergeRequestChannel string `json:"merge_request_channel"` + NoteChannel string `json:"note_channel"` + TagPushChannel string `json:"tag_push_channel"` + PipelineChannel string `json:"pipeline_channel"` + PushChannel string `json:"push_channel"` + WikiPageChannel string `json:"wiki_page_channel"` +} + +// GetMattermostService gets Mattermost service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings +func (s *ServicesService) GetMattermostService(pid interface{}, options ...RequestOptionFunc) (*MattermostService, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/services/mattermost", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + if err != nil { + return nil, nil, err + } + + svc := new(MattermostService) + resp, err := s.client.Do(req, svc) + if err != nil { + return nil, resp, err + } + + return svc, resp, err +} + +// SetMattermostServiceOptions represents the available SetMattermostService() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#createedit-mattermost-notifications-service +type SetMattermostServiceOptions struct { + WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + Channel *string `url:"channel,omitempty" json:"channel,omitempty"` + NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` + BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` + ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"` + ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` + ConfidentialNoteChannel *string `json:"confidential_note_channel,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` + IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"` + IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` + MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"` + TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` + NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"` + NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` + PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"` + PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` + PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` + WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"` + WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` +} + +// SetMattermostService sets Mattermost service for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#createedit-mattermost-notifications-service +func (s *ServicesService) SetMattermostService(pid interface{}, opt *SetMattermostServiceOptions, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/mattermost", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodPut, u, opt, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteMattermostService deletes Mattermost service for project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#delete-mattermost-notifications-service +func (s *ServicesService) DeleteMattermostService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/mattermost", pathEscape(project)) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + // MicrosoftTeamsService represents Microsoft Teams service settings. // // GitLab API docs: @@ -736,7 +956,7 @@ func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...R // https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service type SetMicrosoftTeamsServiceOptions struct { WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` - NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines" json:"notify_only_broken_pipelines"` + NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` @@ -800,10 +1020,10 @@ type PipelinesEmailService struct { // GitLab API docs: // https://docs.gitlab.com/ee/api/services.html#pipeline-emails type PipelinesEmailProperties struct { - Recipients string `json:"recipients,omitempty"` - NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines,omitempty"` - NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch,omitempty"` - BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` + Recipients string `json:"recipients"` + NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"` + NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch"` + BranchesToBeNotified string `json:"branches_to_be_notified"` } // GetPipelinesEmailService gets Pipelines Email service settings for a project. @@ -831,8 +1051,8 @@ func (s *ServicesService) GetPipelinesEmailService(pid interface{}, options ...R return svc, resp, err } -// SetPipelinesEmailServiceOptions represents the available SetPipelinesEmailService() -// options. +// SetPipelinesEmailServiceOptions represents the available +// SetPipelinesEmailService() options. // // GitLab API docs: // https://docs.gitlab.com/ee/api/services.html#pipeline-emails @@ -883,55 +1103,42 @@ func (s *ServicesService) DeletePipelinesEmailService(pid interface{}, options . return s.client.Do(req, nil) } -// SlackService represents Slack service settings. +// PrometheusService represents Prometheus service settings. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#slack -type SlackService struct { +// https://docs.gitlab.com/ee/api/services.html#prometheus +type PrometheusService struct { Service - Properties *SlackServiceProperties `json:"properties"` + Properties *PrometheusServiceProperties `json:"properties"` } -// SlackServiceProperties represents Slack specific properties. +// PrometheusServiceProperties represents Prometheus specific properties. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#slack -type SlackServiceProperties struct { - WebHook string `json:"webhook,omitempty"` - Username string `json:"username,omitempty"` - Channel string `json:"channel,omitempty"` - NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines,omitempty"` - NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch,omitempty"` - BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` - ConfidentialIssueChannel string `json:"confidential_issue_channel,omitempty"` - ConfidentialNoteChannel string `json:"confidential_note_channel,omitempty"` - DeploymentChannel string `json:"deployment_channel,omitempty"` - IssueChannel string `json:"issue_channel,omitempty"` - MergeRequestChannel string `json:"merge_request_channel,omitempty"` - NoteChannel string `json:"note_channel,omitempty"` - TagPushChannel string `json:"tag_push_channel,omitempty"` - PipelineChannel string `json:"pipeline_channel,omitempty"` - PushChannel string `json:"push_channel,omitempty"` - WikiPageChannel string `json:"wiki_page_channel,omitempty"` +// https://docs.gitlab.com/ee/api/services.html#prometheus +type PrometheusServiceProperties struct { + APIURL string `json:"api_url"` + GoogleIAPAudienceClientID string `json:"google_iap_audience_client_id"` + GoogleIAPServiceAccountJSON string `json:"google_iap_service_account_json"` } -// GetSlackService gets Slack service settings for a project. +// GetPrometheusService gets Prometheus service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings -func (s *ServicesService) GetSlackService(pid interface{}, options ...RequestOptionFunc) (*SlackService, *Response, error) { +// https://docs.gitlab.com/ee/api/services.html#get-prometheus-service-settings +func (s *ServicesService) GetPrometheusService(pid interface{}, options ...RequestOptionFunc) (*PrometheusService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/prometheus", pathEscape(project)) req, err := s.client.NewRequest(http.MethodGet, u, nil, options) if err != nil { return nil, nil, err } - svc := new(SlackService) + svc := new(PrometheusService) resp, err := s.client.Do(req, svc) if err != nil { return nil, resp, err @@ -940,53 +1147,27 @@ func (s *ServicesService) GetSlackService(pid interface{}, options ...RequestOpt return svc, resp, err } -// SetSlackServiceOptions represents the available SetSlackService() +// SetPrometheusServiceOptions represents the available SetPrometheusService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-slack-service -type SetSlackServiceOptions struct { - WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` - Username *string `url:"username,omitempty" json:"username,omitempty"` - Channel *string `url:"channel,omitempty" json:"channel,omitempty"` - NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` - NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"` - BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` - ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"` - ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` - // TODO: Currently, GitLab ignores this option (not implemented yet?), so - // there is no way to set it. Uncomment when this is fixed. - // See: https://gitlab.com/gitlab-org/gitlab-ce/issues/49730 - //ConfidentialNoteChannel *string `json:"confidential_note_channel,omitempty"` - ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` - DeploymentChannel *string `url:"deployment_channel,omitempty" json:"deployment_channel,omitempty"` - DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` - IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"` - IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` - MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"` - MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` - TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"` - TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` - NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"` - NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` - PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"` - PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` - PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"` - PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` - WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"` - WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` +// https://docs.gitlab.com/ee/api/services.html#createedit-prometheus-service +type SetPrometheusServiceOptions struct { + APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"` + GoogleIAPAudienceClientID *string `url:"google_iap_audience_client_id,omitempty" json:"google_iap_audience_client_id,omitempty"` + GoogleIAPServiceAccountJSON *string `url:"google_iap_service_account_json,omitempty" json:"google_iap_service_account_json,omitempty"` } -// SetSlackService sets Slack service for a project +// SetPrometheusService sets Prometheus service for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-slack-service -func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceOptions, options ...RequestOptionFunc) (*Response, error) { +// https://docs.gitlab.com/ee/api/services.html#createedit-prometheus-service +func (s *ServicesService) SetPrometheusService(pid interface{}, opt *SetPrometheusServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/prometheus", pathEscape(project)) req, err := s.client.NewRequest(http.MethodPut, u, opt, options) if err != nil { @@ -996,16 +1177,16 @@ func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceO return s.client.Do(req, nil) } -// DeleteSlackService deletes Slack service for project. +// DeletePrometheusService deletes Prometheus service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-slack-service -func (s *ServicesService) DeleteSlackService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { +// https://docs.gitlab.com/ee/api/services.html#delete-prometheus-service +func (s *ServicesService) DeletePrometheusService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/prometheus", pathEscape(project)) req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) if err != nil { @@ -1015,42 +1196,55 @@ func (s *ServicesService) DeleteSlackService(pid interface{}, options ...Request return s.client.Do(req, nil) } -// CustomIssueTrackerService represents Custom Issue Tracker service settings. +// SlackService represents Slack service settings. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#custom-issue-tracker -type CustomIssueTrackerService struct { +// https://docs.gitlab.com/ce/api/services.html#slack +type SlackService struct { Service - Properties *CustomIssueTrackerServiceProperties `json:"properties"` + Properties *SlackServiceProperties `json:"properties"` } -// CustomIssueTrackerServiceProperties represents Custom Issue Tracker specific properties. +// SlackServiceProperties represents Slack specific properties. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#custom-issue-tracker -type CustomIssueTrackerServiceProperties struct { - ProjectURL string `json:"project_url,omitempty"` - IssuesURL string `json:"issues_url,omitempty"` - NewIssueURL string `json:"new_issue_url,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#slack +type SlackServiceProperties struct { + WebHook string `json:"webhook"` + Username string `json:"username"` + Channel string `json:"channel"` + NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"` + NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch"` + BranchesToBeNotified string `json:"branches_to_be_notified"` + ConfidentialIssueChannel string `json:"confidential_issue_channel"` + ConfidentialNoteChannel string `json:"confidential_note_channel"` + DeploymentChannel string `json:"deployment_channel"` + IssueChannel string `json:"issue_channel"` + MergeRequestChannel string `json:"merge_request_channel"` + NoteChannel string `json:"note_channel"` + TagPushChannel string `json:"tag_push_channel"` + PipelineChannel string `json:"pipeline_channel"` + PushChannel string `json:"push_channel"` + WikiPageChannel string `json:"wiki_page_channel"` } -// GetCustomIssueTrackerService gets Custom Issue Tracker service settings for a project. +// GetSlackService gets Slack service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#get-custom-issue-tracker-service-settings -func (s *ServicesService) GetCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*CustomIssueTrackerService, *Response, error) { +// https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings +func (s *ServicesService) GetSlackService(pid interface{}, options ...RequestOptionFunc) (*SlackService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) req, err := s.client.NewRequest(http.MethodGet, u, nil, options) if err != nil { return nil, nil, err } - svc := new(CustomIssueTrackerService) + svc := new(SlackService) resp, err := s.client.Do(req, svc) if err != nil { return nil, resp, err @@ -1059,30 +1253,53 @@ func (s *ServicesService) GetCustomIssueTrackerService(pid interface{}, options return svc, resp, err } -// SetCustomIssueTrackerServiceOptions represents the available SetCustomIssueTrackerService() +// SetSlackServiceOptions represents the available SetSlackService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#createedit-custom-issue-tracker-service -type SetCustomIssueTrackerServiceOptions struct { - NewIssueURL *string `url:"new_issue_url,omitempty" json:"new_issue_url,omitempty"` - IssuesURL *string `url:"issues_url,omitempty" json:"issues_url,omitempty"` - ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - Title *string `url:"title,omitempty" json:"title,omitempty"` - PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#edit-slack-service +type SetSlackServiceOptions struct { + WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + Channel *string `url:"channel,omitempty" json:"channel,omitempty"` + NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` + NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"` + BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` + ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"` + ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` + // TODO: Currently, GitLab ignores this option (not implemented yet?), so + // there is no way to set it. Uncomment when this is fixed. + // See: https://gitlab.com/gitlab-org/gitlab-ce/issues/49730 + //ConfidentialNoteChannel *string `json:"confidential_note_channel,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` + DeploymentChannel *string `url:"deployment_channel,omitempty" json:"deployment_channel,omitempty"` + DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` + IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"` + IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` + MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"` + TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` + NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"` + NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` + PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"` + PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` + PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` + WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"` + WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` } -// SetCustomIssueTrackerService sets Custom Issue Tracker service for a project. +// SetSlackService sets Slack service for a project // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#createedit-custom-issue-tracker-service -func (s *ServicesService) SetCustomIssueTrackerService(pid interface{}, opt *SetCustomIssueTrackerServiceOptions, options ...RequestOptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#edit-slack-service +func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) req, err := s.client.NewRequest(http.MethodPut, u, opt, options) if err != nil { @@ -1092,16 +1309,16 @@ func (s *ServicesService) SetCustomIssueTrackerService(pid interface{}, opt *Set return s.client.Do(req, nil) } -// DeleteCustomIssueTrackerService deletes Custom Issue Tracker service settings for a project. +// DeleteSlackService deletes Slack service for project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-custom-issue-tracker-service -func (s *ServicesService) DeleteCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#delete-slack-service +func (s *ServicesService) DeleteSlackService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) if err != nil { diff --git a/vendor/github.com/xanzy/go-gitlab/users.go b/vendor/github.com/xanzy/go-gitlab/users.go index a5d4754d4a..965a0ed13b 100644 --- a/vendor/github.com/xanzy/go-gitlab/users.go +++ b/vendor/github.com/xanzy/go-gitlab/users.go @@ -828,6 +828,54 @@ func (s *UsersService) RevokeImpersonationToken(user, token int, options ...Requ return s.client.Do(req, nil) } +// PersonalAccessToken represents a personal access token. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/users.html#create-a-personal-access-token +type PersonalAccessToken struct { + ID int `json:"id"` + Name string `json:"name"` + Revoked bool `json:"revoked"` + CreatedAt *time.Time `json:"created_at"` + Scopes []string `json:"scopes"` + UserID string `json:"user_id"` + Active bool `json:"active"` + ExpiresAt *ISOTime `json:"expires_at"` + Token string `json:"token"` +} + +// CreatePersonalAccessTokenOptions represents the available +// CreatePersonalAccessToken() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/users.html#create-a-personal-access-token +type CreatePersonalAccessTokenOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"` + Scopes []string `url:"scopes,omitempty" json:"scopes,omitempty"` +} + +// CreatePersonalAccessToken creates a personal access token. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/users.html#create-a-personal-access-token +func (s *UsersService) CreatePersonalAccessToken(user int, opt *CreatePersonalAccessTokenOptions, options ...RequestOptionFunc) (*PersonalAccessToken, *Response, error) { + u := fmt.Sprintf("users/%d/personal_access_tokens", user) + + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) + if err != nil { + return nil, nil, err + } + + t := new(PersonalAccessToken) + resp, err := s.client.Do(req, &t) + if err != nil { + return nil, resp, err + } + + return t, resp, err +} + // UserActivity represents an entry in the user/activities response // // GitLab API docs: diff --git a/vendor/github.com/xanzy/go-gitlab/validate.go b/vendor/github.com/xanzy/go-gitlab/validate.go index 6881d3884c..2ca7227871 100644 --- a/vendor/github.com/xanzy/go-gitlab/validate.go +++ b/vendor/github.com/xanzy/go-gitlab/validate.go @@ -33,8 +33,9 @@ type ValidateService struct { // // GitLab API docs: https://docs.gitlab.com/ce/api/lint.html type LintResult struct { - Status string `json:"status"` - Errors []string `json:"errors"` + Status string `json:"status"` + Errors []string `json:"errors"` + Warnings []string `json:"warnings"` } // ProjectLintResult represents the linting results by project. |