From 98713510d6d80999945ba7987db2b6f0294d120f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:05:46 +0000 Subject: [PATCH] Bump github.com/xanzy/go-gitlab from 0.94.0 to 0.95.0 Bumps [github.com/xanzy/go-gitlab](https://github.com/xanzy/go-gitlab) from 0.94.0 to 0.95.0. - [Changelog](https://github.com/xanzy/go-gitlab/blob/main/releases_test.go) - [Commits](https://github.com/xanzy/go-gitlab/compare/v0.94.0...v0.95.0) --- updated-dependencies: - dependency-name: github.com/xanzy/go-gitlab dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- vendor/github.com/xanzy/go-gitlab/README.md | 1 + vendor/github.com/xanzy/go-gitlab/boards.go | 10 +- vendor/github.com/xanzy/go-gitlab/commits.go | 5 +- .../xanzy/go-gitlab/environments.go | 14 ++- vendor/github.com/xanzy/go-gitlab/epics.go | 60 ++++----- vendor/github.com/xanzy/go-gitlab/gitlab.go | 7 ++ .../xanzy/go-gitlab/group_access_tokens.go | 15 ++- .../xanzy/go-gitlab/group_boards.go | 21 ++-- .../xanzy/go-gitlab/group_labels.go | 15 ++- .../xanzy/go-gitlab/group_milestones.go | 18 +++ .../xanzy/go-gitlab/group_serviceaccounts.go | 118 +++++++++++++++++ .../xanzy/go-gitlab/group_ssh_certificates.go | 105 ++++++++++++++++ vendor/github.com/xanzy/go-gitlab/issues.go | 119 +++++++----------- .../xanzy/go-gitlab/issues_statistics.go | 92 +++++++------- vendor/github.com/xanzy/go-gitlab/labels.go | 12 +- .../xanzy/go-gitlab/merge_requests.go | 87 +++++++------ vendor/github.com/xanzy/go-gitlab/packages.go | 1 + .../xanzy/go-gitlab/personal_access_tokens.go | 16 ++- .../xanzy/go-gitlab/project_access_tokens.go | 15 ++- .../xanzy/go-gitlab/project_feature_flags.go | 6 + .../xanzy/go-gitlab/repositories.go | 1 + vendor/github.com/xanzy/go-gitlab/types.go | 31 +++++ vendor/github.com/xanzy/go-gitlab/users.go | 19 +++ vendor/modules.txt | 2 +- 26 files changed, 572 insertions(+), 224 deletions(-) create mode 100644 vendor/github.com/xanzy/go-gitlab/group_serviceaccounts.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_ssh_certificates.go diff --git a/go.mod b/go.mod index cc32112..d9526b4 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/sj14/review-bot require ( github.com/google/go-github/v25 v25.1.3 github.com/stretchr/testify v1.8.4 - github.com/xanzy/go-gitlab v0.94.0 + github.com/xanzy/go-gitlab v0.95.0 golang.org/x/oauth2 v0.15.0 ) diff --git a/go.sum b/go.sum index 01c5369..634b2f4 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/xanzy/go-gitlab v0.94.0 h1:GmBl2T5zqUHqyjkxFSvsT7CbelGdAH/dmBqUBqS+4BE= -github.com/xanzy/go-gitlab v0.94.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= +github.com/xanzy/go-gitlab v0.95.0 h1:lnYFPDsZuoSWXSC9xPLMcAWlGgndMn+erexGa+jJsS0= +github.com/xanzy/go-gitlab v0.95.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= diff --git a/vendor/github.com/xanzy/go-gitlab/README.md b/vendor/github.com/xanzy/go-gitlab/README.md index 3058715..9ed7d40 100644 --- a/vendor/github.com/xanzy/go-gitlab/README.md +++ b/vendor/github.com/xanzy/go-gitlab/README.md @@ -6,6 +6,7 @@ A GitLab API client enabling Go programs to interact with GitLab in a simple and [![Sourcegraph](https://sourcegraph.com/github.com/xanzy/go-gitlab/-/badge.svg)](https://sourcegraph.com/github.com/xanzy/go-gitlab?badge) [![GoDoc](https://godoc.org/github.com/xanzy/go-gitlab?status.svg)](https://godoc.org/github.com/xanzy/go-gitlab) [![Go Report Card](https://goreportcard.com/badge/github.com/xanzy/go-gitlab)](https://goreportcard.com/report/github.com/xanzy/go-gitlab) +[![Coverage](https://github.com/xanzy/go-gitlab/wiki/coverage.svg)](https://raw.githack.com/wiki/xanzy/go-gitlab/coverage.html) ## NOTE diff --git a/vendor/github.com/xanzy/go-gitlab/boards.go b/vendor/github.com/xanzy/go-gitlab/boards.go index 8b5eb79..22e2cd7 100644 --- a/vendor/github.com/xanzy/go-gitlab/boards.go +++ b/vendor/github.com/xanzy/go-gitlab/boards.go @@ -111,11 +111,11 @@ func (s *IssueBoardsService) CreateIssueBoard(pid interface{}, opt *CreateIssueB // // GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#update-an-issue-board type UpdateIssueBoardOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` - MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` - Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"` - Weight *int `url:"weight,omitempty" json:"weight,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` + Labels *LabelOptions `url:"labels,omitempty" json:"labels,omitempty"` + Weight *int `url:"weight,omitempty" json:"weight,omitempty"` } // UpdateIssueBoard update an issue board. diff --git a/vendor/github.com/xanzy/go-gitlab/commits.go b/vendor/github.com/xanzy/go-gitlab/commits.go index cdb548b..b87dd9f 100644 --- a/vendor/github.com/xanzy/go-gitlab/commits.go +++ b/vendor/github.com/xanzy/go-gitlab/commits.go @@ -255,7 +255,10 @@ func (d Diff) String() string { // // GitLab API docs: // https://docs.gitlab.com/ee/api/commits.html#get-the-diff-of-a-commit -type GetCommitDiffOptions ListOptions +type GetCommitDiffOptions struct { + ListOptions + Unidiff *bool `url:"unidiff,omitempty" json:"unidiff,omitempty"` +} // GetCommitDiff gets the diff of a commit in a project.. // diff --git a/vendor/github.com/xanzy/go-gitlab/environments.go b/vendor/github.com/xanzy/go-gitlab/environments.go index cee6aaf..b6d902f 100644 --- a/vendor/github.com/xanzy/go-gitlab/environments.go +++ b/vendor/github.com/xanzy/go-gitlab/environments.go @@ -204,18 +204,26 @@ func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int return s.client.Do(req, nil) } -// StopEnvironment stop an environment from a project team. +// StopEnvironmentOptions represents the available StopEnvironment() options. // // GitLab API docs: // https://docs.gitlab.com/ee/api/environments.html#stop-an-environment -func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int, options ...RequestOptionFunc) (*Environment, *Response, error) { +type StopEnvironmentOptions struct { + Force *bool `url:"force,omitempty" json:"force,omitempty"` +} + +// StopEnvironment stops an environment within a specific project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/environments.html#stop-an-environment +func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int, opt *StopEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } u := fmt.Sprintf("projects/%s/environments/%d/stop", PathEscape(project), environmentID) - req, err := s.client.NewRequest(http.MethodPost, u, nil, options) + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/xanzy/go-gitlab/epics.go b/vendor/github.com/xanzy/go-gitlab/epics.go index 553ea8d..cd553ea 100644 --- a/vendor/github.com/xanzy/go-gitlab/epics.go +++ b/vendor/github.com/xanzy/go-gitlab/epics.go @@ -81,20 +81,20 @@ func (e Epic) String() string { // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#list-epics-for-a-group type ListGroupEpicsOptions struct { ListOptions - AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"` - OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` - Sort *string `url:"sort,omitempty" json:"sort,omitempty"` - Search *string `url:"search,omitempty" json:"search,omitempty"` - State *string `url:"state,omitempty" json:"state,omitempty"` - CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` - CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` - UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` - UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` - IncludeAncestorGroups *bool `url:"include_ancestor_groups,omitempty" json:"include_ancestor_groups,omitempty"` - IncludeDescendantGroups *bool `url:"include_descendant_groups,omitempty" json:"include_descendant_groups,omitempty"` - MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` + AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"` + OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` + Sort *string `url:"sort,omitempty" json:"sort,omitempty"` + Search *string `url:"search,omitempty" json:"search,omitempty"` + State *string `url:"state,omitempty" json:"state,omitempty"` + CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` + CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` + UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` + UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` + IncludeAncestorGroups *bool `url:"include_ancestor_groups,omitempty" json:"include_ancestor_groups,omitempty"` + IncludeDescendantGroups *bool `url:"include_descendant_groups,omitempty" json:"include_descendant_groups,omitempty"` + MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` } // ListGroupEpics gets a list of group epics. This function accepts pagination @@ -174,13 +174,13 @@ func (s *EpicsService) GetEpicLinks(gid interface{}, epic int, options ...Reques // // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#new-epic type CreateEpicOptions struct { - Title *string `url:"title,omitempty" json:"title,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - StartDateIsFixed *bool `url:"start_date_is_fixed,omitempty" json:"start_date_is_fixed,omitempty"` - StartDateFixed *ISOTime `url:"start_date_fixed,omitempty" json:"start_date_fixed,omitempty"` - DueDateIsFixed *bool `url:"due_date_is_fixed,omitempty" json:"due_date_is_fixed,omitempty"` - DueDateFixed *ISOTime `url:"due_date_fixed,omitempty" json:"due_date_fixed,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + StartDateIsFixed *bool `url:"start_date_is_fixed,omitempty" json:"start_date_is_fixed,omitempty"` + StartDateFixed *ISOTime `url:"start_date_fixed,omitempty" json:"start_date_fixed,omitempty"` + DueDateIsFixed *bool `url:"due_date_is_fixed,omitempty" json:"due_date_is_fixed,omitempty"` + DueDateFixed *ISOTime `url:"due_date_fixed,omitempty" json:"due_date_fixed,omitempty"` } // CreateEpic creates a new group epic. @@ -211,15 +211,15 @@ func (s *EpicsService) CreateEpic(gid interface{}, opt *CreateEpicOptions, optio // // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#update-epic type UpdateEpicOptions struct { - Title *string `url:"title,omitempty" json:"title,omitempty"` - Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - StartDateIsFixed *bool `url:"start_date_is_fixed,omitempty" json:"start_date_is_fixed,omitempty"` - StartDateFixed *ISOTime `url:"start_date_fixed,omitempty" json:"start_date_fixed,omitempty"` - DueDateIsFixed *bool `url:"due_date_is_fixed,omitempty" json:"due_date_is_fixed,omitempty"` - DueDateFixed *ISOTime `url:"due_date_fixed,omitempty" json:"due_date_fixed,omitempty"` - StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + StartDateIsFixed *bool `url:"start_date_is_fixed,omitempty" json:"start_date_is_fixed,omitempty"` + StartDateFixed *ISOTime `url:"start_date_fixed,omitempty" json:"start_date_fixed,omitempty"` + DueDateIsFixed *bool `url:"due_date_is_fixed,omitempty" json:"due_date_is_fixed,omitempty"` + DueDateFixed *ISOTime `url:"due_date_fixed,omitempty" json:"due_date_fixed,omitempty"` + StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"` } // UpdateEpic updates an existing group epic. This function is also used diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go index 0ed07f2..c773ef5 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitlab.go +++ b/vendor/github.com/xanzy/go-gitlab/gitlab.go @@ -147,6 +147,7 @@ type Client struct { GroupMilestones *GroupMilestonesService GroupProtectedEnvironments *GroupProtectedEnvironmentsService GroupRepositoryStorageMove *GroupRepositoryStorageMoveService + GroupSSHCertificates *GroupSSHCertificatesService GroupVariables *GroupVariablesService GroupWikis *GroupWikisService Groups *GroupsService @@ -379,6 +380,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) { c.GroupMilestones = &GroupMilestonesService{client: c} c.GroupProtectedEnvironments = &GroupProtectedEnvironmentsService{client: c} c.GroupRepositoryStorageMove = &GroupRepositoryStorageMoveService{client: c} + c.GroupSSHCertificates = &GroupSSHCertificatesService{client: c} c.GroupVariables = &GroupVariablesService{client: c} c.GroupWikis = &GroupWikisService{client: c} c.Groups = &GroupsService{client: c} @@ -533,6 +535,11 @@ func (c *Client) configureLimiter(ctx context.Context, headers http.Header) { limit := rate.Limit(rateLimit * 0.66) burst := int(rateLimit * 0.33) + // Need at least one allowed to burst or x/time will throw an error + if burst == 0 { + burst = 1 + } + // Create a new limiter using the calculated values. c.limiter = rate.NewLimiter(limit, burst) diff --git a/vendor/github.com/xanzy/go-gitlab/group_access_tokens.go b/vendor/github.com/xanzy/go-gitlab/group_access_tokens.go index 15f303a..ccbe47b 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_access_tokens.go +++ b/vendor/github.com/xanzy/go-gitlab/group_access_tokens.go @@ -145,18 +145,27 @@ func (s *GroupAccessTokensService) CreateGroupAccessToken(gid interface{}, opt * return pat, resp, nil } +// RotateGroupAccessTokenOptions represents the available RotateGroupAccessToken() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/group_access_tokens.html#rotate-a-group-access-token +type RotateGroupAccessTokenOptions struct { + ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"` +} + // RotateGroupAccessToken revokes a group access token and returns a new group -// access token that expires in one week. +// access token that expires in one week per default. // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_access_tokens.html#rotate-a-group-access-token -func (s *GroupAccessTokensService) RotateGroupAccessToken(gid interface{}, id int, options ...RequestOptionFunc) (*GroupAccessToken, *Response, error) { +func (s *GroupAccessTokensService) RotateGroupAccessToken(gid interface{}, id int, opt *RotateGroupAccessTokenOptions, options ...RequestOptionFunc) (*GroupAccessToken, *Response, error) { groups, err := parseID(gid) if err != nil { return nil, nil, err } u := fmt.Sprintf("groups/%s/access_tokens/%d/rotate", PathEscape(groups), id) - req, err := s.client.NewRequest(http.MethodPost, u, nil, options) + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/xanzy/go-gitlab/group_boards.go b/vendor/github.com/xanzy/go-gitlab/group_boards.go index 645e7ee..ed9f8d5 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_boards.go +++ b/vendor/github.com/xanzy/go-gitlab/group_boards.go @@ -35,11 +35,12 @@ type GroupIssueBoardsService struct { // GitLab API docs: // https://docs.gitlab.com/ee/api/group_boards.html type GroupIssueBoard struct { - ID int `json:"id"` - Name string `json:"name"` - Group *Group `json:"group"` - Milestone *Milestone `json:"milestone"` - Lists []*BoardList `json:"lists"` + ID int `json:"id"` + Name string `json:"name"` + Group *Group `json:"group"` + Milestone *Milestone `json:"milestone"` + Labels []*GroupLabel `json:"labels"` + Lists []*BoardList `json:"lists"` } func (b GroupIssueBoard) String() string { @@ -142,11 +143,11 @@ func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int, // GitLab API docs: // https://docs.gitlab.com/ee/api/group_boards.html#update-a-group-issue-board type UpdateGroupIssueBoardOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` - MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` - Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"` - Weight *int `url:"weight,omitempty" json:"weight,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` + Labels *LabelOptions `url:"labels,omitempty" json:"labels,omitempty"` + Weight *int `url:"weight,omitempty" json:"weight,omitempty"` } // UpdateIssueBoard updates a single issue board of a group. diff --git a/vendor/github.com/xanzy/go-gitlab/group_labels.go b/vendor/github.com/xanzy/go-gitlab/group_labels.go index d19e3ed..5a39026 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_labels.go +++ b/vendor/github.com/xanzy/go-gitlab/group_labels.go @@ -142,16 +142,25 @@ func (s *GroupLabelsService) CreateGroupLabel(gid interface{}, opt *CreateGroupL // https://docs.gitlab.com/ee/api/group_labels.html#delete-a-group-label type DeleteGroupLabelOptions DeleteLabelOptions -// DeleteGroupLabel deletes a group label given by its name. +// DeleteGroupLabel deletes a group label given by its name or ID. // -// GitLab API docs: https://docs.gitlab.com/ee/api/group_labels.html#delete-a-group-label -func (s *GroupLabelsService) DeleteGroupLabel(gid interface{}, opt *DeleteGroupLabelOptions, options ...RequestOptionFunc) (*Response, error) { +// GitLab API docs: +// https://docs.gitlab.com/ee/api/group_labels.html#delete-a-group-label +func (s *GroupLabelsService) DeleteGroupLabel(gid interface{}, lid interface{}, opt *DeleteGroupLabelOptions, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err } u := fmt.Sprintf("groups/%s/labels", PathEscape(group)) + if lid != nil { + label, err := parseID(lid) + if err != nil { + return nil, err + } + u = fmt.Sprintf("groups/%s/labels/%s", PathEscape(group), PathEscape(label)) + } + req, err := s.client.NewRequest(http.MethodDelete, u, opt, options) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/group_milestones.go b/vendor/github.com/xanzy/go-gitlab/group_milestones.go index 60aa2e9..179d059 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_milestones.go +++ b/vendor/github.com/xanzy/go-gitlab/group_milestones.go @@ -188,6 +188,24 @@ func (s *GroupMilestonesService) UpdateGroupMilestone(gid interface{}, milestone return m, resp, nil } +// DeleteGroupMilestone deletes a specified group milestone. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/group_milestones.html#delete-group-milestone +func (s *GroupMilestonesService) DeleteGroupMilestone(pid interface{}, milestone int, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/milestones/%d", PathEscape(project), milestone) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) + if err != nil { + return nil, err + } + return s.client.Do(req, nil) +} + // GetGroupMilestoneIssuesOptions represents the available GetGroupMilestoneIssues() options. // // GitLab API docs: diff --git a/vendor/github.com/xanzy/go-gitlab/group_serviceaccounts.go b/vendor/github.com/xanzy/go-gitlab/group_serviceaccounts.go new file mode 100644 index 0000000..4acb0b1 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/group_serviceaccounts.go @@ -0,0 +1,118 @@ +// +// Copyright 2023, James Hong +// +// 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" +) + +// GroupServiceAccount represents a GitLab service account user. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#create-service-account-user +type GroupServiceAccount struct { + ID int `json:"id"` + Name string `json:"name"` + UserName string `json:"username"` +} + +// CreateServiceAccount create a new service account user for a group. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#create-service-account-user +func (s *GroupsService) CreateServiceAccount(gid interface{}, options ...RequestOptionFunc) (*GroupServiceAccount, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/service_accounts", PathEscape(group)) + + req, err := s.client.NewRequest(http.MethodPost, u, nil, options) + if err != nil { + return nil, nil, err + } + + sa := new(GroupServiceAccount) + resp, err := s.client.Do(req, sa) + if err != nil { + return nil, resp, err + } + + return sa, resp, nil +} + +// CreateServiceAccountPersonalAccessTokenOptions represents the available +// CreateServiceAccountPersonalAccessToken() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#create-personal-access-token-for-service-account-user +type CreateServiceAccountPersonalAccessTokenOptions struct { + Scopes *[]string `url:"scopes,omitempty" json:"scopes,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` +} + +// CreateServiceAccountPersonalAccessToken add a new Personal Access Token for a +// service account user for a group. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#create-personal-access-token-for-service-account-user +func (s *GroupsService) CreateServiceAccountPersonalAccessToken(gid interface{}, serviceAccount int, opt *CreateServiceAccountPersonalAccessTokenOptions, options ...RequestOptionFunc) (*PersonalAccessToken, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/service_accounts/%d/personal_access_tokens", PathEscape(group), serviceAccount) + + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) + if err != nil { + return nil, nil, err + } + + pat := new(PersonalAccessToken) + resp, err := s.client.Do(req, pat) + if err != nil { + return nil, resp, err + } + + return pat, resp, nil +} + +// RotateServiceAccountPersonalAccessToken rotates a Personal Access Token for a +// service account user for a group. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/groups.html#create-personal-access-token-for-service-account-user +func (s *GroupsService) RotateServiceAccountPersonalAccessToken(gid interface{}, serviceAccount, token int, options ...RequestOptionFunc) (*PersonalAccessToken, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/service_accounts/%d/personal_access_tokens/%d/rotate", PathEscape(group), serviceAccount, token) + + req, err := s.client.NewRequest(http.MethodPost, u, nil, options) + if err != nil { + return nil, nil, err + } + + pat := new(PersonalAccessToken) + resp, err := s.client.Do(req, pat) + if err != nil { + return nil, resp, err + } + + return pat, resp, nil +} diff --git a/vendor/github.com/xanzy/go-gitlab/group_ssh_certificates.go b/vendor/github.com/xanzy/go-gitlab/group_ssh_certificates.go new file mode 100644 index 0000000..c290390 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/group_ssh_certificates.go @@ -0,0 +1,105 @@ +package gitlab + +import ( + "fmt" + "net/http" + "time" +) + +// GroupSSHCertificatesService handles communication with the group +// SSH certificate related methods of the GitLab API. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/group_ssh_certificates.html +type GroupSSHCertificatesService struct { + client *Client +} + +// GroupSSHCertificate represents a GitLab Group SSH certificate. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/member_roles.html +type GroupSSHCertificate struct { + ID int `json:"id"` + Title string `json:"title"` + Key string `json:"key"` + CreatedAt *time.Time `json:"created_at"` +} + +// ListGroupSSHCertificates gets a list of SSH certificates for a specified +// group. +// +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/group_ssh_certificates.html#get-all-ssh-certificates-for-a-particular-group +func (s *GroupSSHCertificatesService) ListGroupSSHCertificates(gid interface{}, options ...RequestOptionFunc) ([]*GroupSSHCertificate, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/ssh_certificates", PathEscape(group)) + + req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + if err != nil { + return nil, nil, err + } + + var certs []*GroupSSHCertificate + resp, err := s.client.Do(req, &certs) + if err != nil { + return nil, resp, err + } + + return certs, resp, nil +} + +// CreateGroupSSHCertificateOptions represents the available +// CreateGroupSSHCertificate() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/group_ssh_certificates.html#create-ssh-certificate +type CreateGroupSSHCertificateOptions struct { + Key *string `url:"key,omitempty" json:"key,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` +} + +// CreateMemberRole creates a new member role for a specified group. +// +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/group_ssh_certificates.html#create-ssh-certificate +func (s *GroupSSHCertificatesService) CreateGroupSSHCertificate(gid interface{}, opt *CreateGroupSSHCertificateOptions, options ...RequestOptionFunc) (*GroupSSHCertificate, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/ssh_certificates", PathEscape(group)) + + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) + if err != nil { + return nil, nil, err + } + + cert := new(GroupSSHCertificate) + resp, err := s.client.Do(req, cert) + if err != nil { + return nil, resp, err + } + + return cert, resp, nil +} + +// DeleteGroupSSHCertificate deletes a SSH certificate from a specified group. +// +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/group_ssh_certificates.html#delete-group-ssh-certificate +func (s *GroupSSHCertificatesService) DeleteGroupSSHCertificate(gid interface{}, cert int, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/ssh_certificates/%d", PathEscape(group), cert) + + 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/issues.go b/vendor/github.com/xanzy/go-gitlab/issues.go index 42478c9..a0e2f88 100644 --- a/vendor/github.com/xanzy/go-gitlab/issues.go +++ b/vendor/github.com/xanzy/go-gitlab/issues.go @@ -17,13 +17,10 @@ package gitlab import ( - "bytes" "encoding/json" "fmt" "net/http" - "net/url" "reflect" - "strings" "time" ) @@ -167,32 +164,6 @@ func (i *Issue) UnmarshalJSON(data []byte) error { return json.Unmarshal(data, (*alias)(i)) } -// Labels is a custom type with specific marshaling characteristics. -type Labels []string - -// MarshalJSON implements the json.Marshaler interface. -func (l *Labels) MarshalJSON() ([]byte, error) { - if *l == nil { - return []byte(`null`), nil - } - return json.Marshal(strings.Join(*l, ",")) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (l *Labels) UnmarshalJSON(data []byte) error { - type alias Labels - if !bytes.HasPrefix(data, []byte("[")) { - data = []byte(fmt.Sprintf("[%s]", string(data))) - } - return json.Unmarshal(data, (*alias)(l)) -} - -// EncodeValues implements the query.EncodeValues interface -func (l *Labels) EncodeValues(key string, v *url.Values) error { - v.Set(key, strings.Join(*l, ",")) - return nil -} - // LabelDetails represents detailed label information. type LabelDetails struct { ID int `json:"id"` @@ -209,8 +180,8 @@ type LabelDetails struct { type ListIssuesOptions struct { ListOptions State *string `url:"state,omitempty" json:"state,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + NotLabels *LabelOptions `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"` Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"` @@ -266,18 +237,18 @@ func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...RequestOpt // GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#list-group-issues type ListGroupIssuesOptions struct { ListOptions - State *string `url:"state,omitempty" json:"state,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` - WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"` - IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` - Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` - NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"` - Scope *string `url:"scope,omitempty" json:"scope,omitempty"` - AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` - NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"` - AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` - NotAuthorUsername *string `url:"not[author_username],omitempty" json:"not[author_username],omitempty"` + State *string `url:"state,omitempty" json:"state,omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + NotLabels *LabelOptions `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` + WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"` + IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` + Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` + NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"` + Scope *string `url:"scope,omitempty" json:"scope,omitempty"` + AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` + NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"` + AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` + NotAuthorUsername *string `url:"not[author_username],omitempty" json:"not[author_username],omitempty"` AssigneeID *AssigneeIDValue `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` NotAssigneeID *[]int `url:"not[assignee_id],omitempty" json:"not[assignee_id],omitempty"` @@ -332,8 +303,8 @@ type ListProjectIssuesOptions struct { ListOptions IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` State *string `url:"state,omitempty" json:"state,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + NotLabels *LabelOptions `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"` Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"` @@ -436,20 +407,20 @@ func (s *IssuesService) GetIssue(pid interface{}, issue int, options ...RequestO // // GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#new-issue type CreateIssueOptions struct { - IID *int `url:"iid,omitempty" json:"iid,omitempty"` - Title *string `url:"title,omitempty" json:"title,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` - AssigneeIDs *[]int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` - MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"` - DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"` - EpicID *int `url:"epic_id,omitempty" json:"epic_id,omitempty"` - MergeRequestToResolveDiscussionsOf *int `url:"merge_request_to_resolve_discussions_of,omitempty" json:"merge_request_to_resolve_discussions_of,omitempty"` - DiscussionToResolve *string `url:"discussion_to_resolve,omitempty" json:"discussion_to_resolve,omitempty"` - Weight *int `url:"weight,omitempty" json:"weight,omitempty"` - IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"` + IID *int `url:"iid,omitempty" json:"iid,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` + AssigneeIDs *[]int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` + MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"` + DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"` + EpicID *int `url:"epic_id,omitempty" json:"epic_id,omitempty"` + MergeRequestToResolveDiscussionsOf *int `url:"merge_request_to_resolve_discussions_of,omitempty" json:"merge_request_to_resolve_discussions_of,omitempty"` + DiscussionToResolve *string `url:"discussion_to_resolve,omitempty" json:"discussion_to_resolve,omitempty"` + Weight *int `url:"weight,omitempty" json:"weight,omitempty"` + IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"` } // CreateIssue creates a new project issue. @@ -480,21 +451,21 @@ func (s *IssuesService) CreateIssue(pid interface{}, opt *CreateIssueOptions, op // // GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#edit-issue type UpdateIssueOptions struct { - Title *string `url:"title,omitempty" json:"title,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` - AssigneeIDs *[]int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` - MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - AddLabels *Labels `url:"add_labels,comma,omitempty" json:"add_labels,omitempty"` - RemoveLabels *Labels `url:"remove_labels,comma,omitempty" json:"remove_labels,omitempty"` - StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"` - UpdatedAt *time.Time `url:"updated_at,omitempty" json:"updated_at,omitempty"` - DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"` - EpicID *int `url:"epic_id,omitempty" json:"epic_id,omitempty"` - Weight *int `url:"weight,omitempty" json:"weight,omitempty"` - DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"` - IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` + AssigneeIDs *[]int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` + MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + AddLabels *LabelOptions `url:"add_labels,comma,omitempty" json:"add_labels,omitempty"` + RemoveLabels *LabelOptions `url:"remove_labels,comma,omitempty" json:"remove_labels,omitempty"` + StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"` + UpdatedAt *time.Time `url:"updated_at,omitempty" json:"updated_at,omitempty"` + DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"` + EpicID *int `url:"epic_id,omitempty" json:"epic_id,omitempty"` + Weight *int `url:"weight,omitempty" json:"weight,omitempty"` + DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"` + IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"` } // UpdateIssue updates an existing project issue. This function is also used diff --git a/vendor/github.com/xanzy/go-gitlab/issues_statistics.go b/vendor/github.com/xanzy/go-gitlab/issues_statistics.go index 3574733..5355578 100644 --- a/vendor/github.com/xanzy/go-gitlab/issues_statistics.go +++ b/vendor/github.com/xanzy/go-gitlab/issues_statistics.go @@ -52,22 +52,22 @@ func (n IssuesStatistics) String() string { // GitLab API docs: // https://docs.gitlab.com/ee/api/issues_statistics.html#get-issues-statistics type GetIssuesStatisticsOptions struct { - Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"` - Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` - Scope *string `url:"scope,omitempty" json:"scope,omitempty"` - AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` - AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` - AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` - AssigneeUsername *[]string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"` - MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` - IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` - Search *string `url:"search,omitempty" json:"search,omitempty"` - In *string `url:"in,omitempty" json:"in,omitempty"` - CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` - CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` - UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` - UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` - Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` + Labels *LabelOptions `url:"labels,omitempty" json:"labels,omitempty"` + Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` + Scope *string `url:"scope,omitempty" json:"scope,omitempty"` + AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` + AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` + AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + AssigneeUsername *[]string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"` + MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` + IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` + Search *string `url:"search,omitempty" json:"search,omitempty"` + In *string `url:"in,omitempty" json:"in,omitempty"` + CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` + CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` + UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` + UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` + Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` } // GetIssuesStatistics gets issues statistics on all issues the authenticated @@ -96,21 +96,21 @@ func (s *IssuesStatisticsService) GetIssuesStatistics(opt *GetIssuesStatisticsOp // GitLab API docs: // https://docs.gitlab.com/ee/api/issues_statistics.html#get-group-issues-statistics type GetGroupIssuesStatisticsOptions struct { - Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"` - IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` - Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` - Scope *string `url:"scope,omitempty" json:"scope,omitempty"` - AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` - AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` - AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` - AssigneeUsername *[]string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"` - MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` - Search *string `url:"search,omitempty" json:"search,omitempty"` - CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` - CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` - UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` - UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` - Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` + Labels *LabelOptions `url:"labels,omitempty" json:"labels,omitempty"` + IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` + Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` + Scope *string `url:"scope,omitempty" json:"scope,omitempty"` + AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` + AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` + AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + AssigneeUsername *[]string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"` + MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` + Search *string `url:"search,omitempty" json:"search,omitempty"` + CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` + CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` + UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` + UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` + Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` } // GetGroupIssuesStatistics gets issues count statistics for given group. @@ -144,21 +144,21 @@ func (s *IssuesStatisticsService) GetGroupIssuesStatistics(gid interface{}, opt // GitLab API docs: // https://docs.gitlab.com/ee/api/issues_statistics.html#get-project-issues-statistics type GetProjectIssuesStatisticsOptions struct { - IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` - Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"` - Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` - Scope *string `url:"scope,omitempty" json:"scope,omitempty"` - AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` - AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` - AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` - AssigneeUsername *[]string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"` - MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` - Search *string `url:"search,omitempty" json:"search,omitempty"` - CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` - CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` - UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` - UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` - Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` + IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"` + Labels *LabelOptions `url:"labels,omitempty" json:"labels,omitempty"` + Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` + Scope *string `url:"scope,omitempty" json:"scope,omitempty"` + AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"` + AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"` + AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + AssigneeUsername *[]string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"` + MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` + Search *string `url:"search,omitempty" json:"search,omitempty"` + CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` + CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"` + UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` + UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"` + Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` } // GetProjectIssuesStatistics gets issues count statistics for given project. diff --git a/vendor/github.com/xanzy/go-gitlab/labels.go b/vendor/github.com/xanzy/go-gitlab/labels.go index 42fc778..d36e85b 100644 --- a/vendor/github.com/xanzy/go-gitlab/labels.go +++ b/vendor/github.com/xanzy/go-gitlab/labels.go @@ -175,16 +175,24 @@ type DeleteLabelOptions struct { Name *string `url:"name,omitempty" json:"name,omitempty"` } -// DeleteLabel deletes a label given by its name. +// DeleteLabel deletes a label given by its name or ID. // // GitLab API docs: https://docs.gitlab.com/ee/api/labels.html#delete-a-label -func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions, options ...RequestOptionFunc) (*Response, error) { +func (s *LabelsService) DeleteLabel(pid interface{}, lid interface{}, opt *DeleteLabelOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } u := fmt.Sprintf("projects/%s/labels", PathEscape(project)) + if lid != nil { + label, err := parseID(lid) + if err != nil { + return nil, err + } + u = fmt.Sprintf("projects/%s/labels/%s", PathEscape(project), PathEscape(label)) + } + req, err := s.client.NewRequest(http.MethodDelete, u, opt, options) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/merge_requests.go b/vendor/github.com/xanzy/go-gitlab/merge_requests.go index 458255f..8508525 100644 --- a/vendor/github.com/xanzy/go-gitlab/merge_requests.go +++ b/vendor/github.com/xanzy/go-gitlab/merge_requests.go @@ -191,8 +191,8 @@ type ListMergeRequestsOptions 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,comma,omitempty" json:"labels,omitempty"` - NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"` + Labels *LabelOptions `url:"labels,comma,omitempty" json:"labels,omitempty"` + NotLabels *LabelOptions `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"` CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` @@ -251,8 +251,8 @@ type ListProjectMergeRequestsOptions struct { OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` 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,comma,omitempty" json:"labels,omitempty"` + View *LabelOptions `url:"view,omitempty" json:"view,omitempty"` + Labels *LabelOptions `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"` @@ -312,8 +312,8 @@ type ListGroupMergeRequestsOptions struct { State *string `url:"state,omitempty" json:"state,omitempty"` OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` Sort *string `url:"sort,omitempty" json:"sort,omitempty"` - Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"` - View *string `url:"view,omitempty" json:"view,omitempty"` + Milestone *LabelOptions `url:"milestone,omitempty" json:"milestone,omitempty"` + View *LabelOptions `url:"view,omitempty" json:"view,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"` @@ -465,6 +465,7 @@ func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequ // https://docs.gitlab.com/ee/api/merge_requests.html#get-single-merge-request-changes type GetMergeRequestChangesOptions struct { AccessRawDiffs *bool `url:"access_raw_diffs,omitempty" json:"access_raw_diffs,omitempty"` + Unidiff *bool `url:"unidiff,omitempty" json:"unidiff,omitempty"` } // GetMergeRequestChanges shows information about the merge request including @@ -501,7 +502,10 @@ func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequ // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-request-diffs -type ListMergeRequestDiffsOptions ListOptions +type ListMergeRequestDiffsOptions struct { + ListOptions + Unidiff *bool `url:"unidiff,omitempty" json:"unidiff,omitempty"` +} // ListMergeRequestDiffs List diffs of the files changed in a merge request // @@ -677,19 +681,19 @@ func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequ // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_requests.html#create-mr type CreateMergeRequestOptions struct { - Title *string `url:"title,omitempty" json:"title,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"` - TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` - AssigneeIDs *[]int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` - ReviewerIDs *[]int `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"` - TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"` - MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` - RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"` - Squash *bool `url:"squash,omitempty" json:"squash,omitempty"` - AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + Description *LabelOptions `url:"description,omitempty" json:"description,omitempty"` + SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"` + TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"` + Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` + AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + AssigneeIDs *[]int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` + ReviewerIDs *[]int `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"` + TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"` + MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` + RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"` + Squash *bool `url:"squash,omitempty" json:"squash,omitempty"` + AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"` } // CreateMergeRequest creates a new merge request. @@ -723,21 +727,21 @@ func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMe // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_requests.html#update-mr type UpdateMergeRequestOptions struct { - Title *string `url:"title,omitempty" json:"title,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"` - AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` - AssigneeIDs *[]int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` - ReviewerIDs *[]int `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"` - Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` - AddLabels *Labels `url:"add_labels,comma,omitempty" json:"add_labels,omitempty"` - RemoveLabels *Labels `url:"remove_labels,comma,omitempty" json:"remove_labels,omitempty"` - MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` - StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"` - RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"` - Squash *bool `url:"squash,omitempty" json:"squash,omitempty"` - DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"` - AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"` + AssigneeID *LabelOptions `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + AssigneeIDs *LabelOptions `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"` + ReviewerIDs *LabelOptions `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"` + Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"` + AddLabels *Labels `url:"add_labels,comma,omitempty" json:"add_labels,omitempty"` + RemoveLabels *Labels `url:"remove_labels,comma,omitempty" json:"remove_labels,omitempty"` + MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` + StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"` + RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"` + Squash *bool `url:"squash,omitempty" json:"squash,omitempty"` + DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"` + AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"` } // UpdateMergeRequest updates an existing project milestone. @@ -908,18 +912,27 @@ func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, merg return v, resp, nil } +// GetSingleMergeRequestDiffVersionOptions represents the available +// GetSingleMergeRequestDiffVersion() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_requests.html#get-a-single-merge-request-diff-version +type GetSingleMergeRequestDiffVersionOptions struct { + Unidiff *bool `url:"unidiff,omitempty" json:"unidiff,omitempty"` +} + // GetSingleMergeRequestDiffVersion get a single MR diff version // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_requests.html#get-a-single-merge-request-diff-version -func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, mergeRequest, version int, options ...RequestOptionFunc) (*MergeRequestDiffVersion, *Response, error) { +func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, mergeRequest, version int, opt *GetSingleMergeRequestDiffVersionOptions, options ...RequestOptionFunc) (*MergeRequestDiffVersion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } u := fmt.Sprintf("projects/%s/merge_requests/%d/versions/%d", PathEscape(project), mergeRequest, version) - req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + req, err := s.client.NewRequest(http.MethodGet, u, opt, options) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/xanzy/go-gitlab/packages.go b/vendor/github.com/xanzy/go-gitlab/packages.go index a63cdc4..fb7e2d1 100644 --- a/vendor/github.com/xanzy/go-gitlab/packages.go +++ b/vendor/github.com/xanzy/go-gitlab/packages.go @@ -114,6 +114,7 @@ type ListProjectPackagesOptions struct { Sort *string `url:"sort,omitempty" json:"sort,omitempty"` PackageType *string `url:"package_type,omitempty" json:"package_type,omitempty"` PackageName *string `url:"package_name,omitempty" json:"package_name,omitempty"` + PackageVersion *string `url:"package_version,omitempty" json:"package_version,omitempty"` IncludeVersionless *bool `url:"include_versionless,omitempty" json:"include_versionless,omitempty"` Status *string `url:"status,omitempty" json:"status,omitempty"` } diff --git a/vendor/github.com/xanzy/go-gitlab/personal_access_tokens.go b/vendor/github.com/xanzy/go-gitlab/personal_access_tokens.go index 63d294e..ba32bd8 100644 --- a/vendor/github.com/xanzy/go-gitlab/personal_access_tokens.go +++ b/vendor/github.com/xanzy/go-gitlab/personal_access_tokens.go @@ -120,14 +120,24 @@ func (s *PersonalAccessTokensService) GetSinglePersonalAccessToken(options ...Re return pat, resp, nil } +// RotatePersonalAccessTokenOptions represents the available RotatePersonalAccessToken() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/personal_access_tokens.html#rotate-a-personal-access-token +type RotatePersonalAccessTokenOptions struct { + ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"` +} + // RotatePersonalAccessToken revokes a token and returns a new token that -// expires in one week. +// expires in one week per default. // // GitLab API docs: // https://docs.gitlab.com/ee/api/personal_access_tokens.html#rotate-a-personal-access-token -func (s *PersonalAccessTokensService) RotatePersonalAccessToken(token int, options ...RequestOptionFunc) (*PersonalAccessToken, *Response, error) { +func (s *PersonalAccessTokensService) RotatePersonalAccessToken(token int, opt *RotatePersonalAccessTokenOptions, options ...RequestOptionFunc) (*PersonalAccessToken, *Response, error) { u := fmt.Sprintf("personal_access_tokens/%d/rotate", token) - req, err := s.client.NewRequest(http.MethodPost, u, nil, options) + + req, err := s.client.NewRequest(http.MethodPost, u, opt, 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 index 780e59a..2d6057e 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_access_tokens.go +++ b/vendor/github.com/xanzy/go-gitlab/project_access_tokens.go @@ -146,18 +146,27 @@ func (s *ProjectAccessTokensService) CreateProjectAccessToken(pid interface{}, o return pat, resp, nil } +// RotateProjectAccessTokenOptions represents the available RotateProjectAccessToken() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/project_access_tokens.html#rotate-a-project-access-token +type RotateProjectAccessTokenOptions struct { + ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"` +} + // RotateProjectAccessToken revokes a project access token and returns a new -// project access token that expires in one week. +// project access token that expires in one week per default. // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_access_tokens.html#rotate-a-project-access-token -func (s *ProjectAccessTokensService) RotateProjectAccessToken(pid interface{}, id int, options ...RequestOptionFunc) (*ProjectAccessToken, *Response, error) { +func (s *ProjectAccessTokensService) RotateProjectAccessToken(pid interface{}, id int, opt *RotateProjectAccessTokenOptions, options ...RequestOptionFunc) (*ProjectAccessToken, *Response, error) { projects, err := parseID(pid) if err != nil { return nil, nil, err } u := fmt.Sprintf("projects/%s/access_tokens/%d/rotate", PathEscape(projects), id) - req, err := s.client.NewRequest(http.MethodPost, u, nil, options) + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/xanzy/go-gitlab/project_feature_flags.go b/vendor/github.com/xanzy/go-gitlab/project_feature_flags.go index 9f75611..98c3588 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_feature_flags.go +++ b/vendor/github.com/xanzy/go-gitlab/project_feature_flags.go @@ -53,6 +53,12 @@ type ProjectFeatureFlagStrategyParameter struct { GroupID string `json:"groupId,omitempty"` UserIDs string `json:"userIds,omitempty"` Percentage string `json:"percentage,omitempty"` + + // Following fields aren't documented in Gitlab API docs, + // but are present in Gitlab API since 13.5. + // Docs: https://docs.getunleash.io/reference/activation-strategies#gradual-rollout + Rollout string `json:"rollout,omitempty"` + Stickiness string `json:"stickiness,omitempty"` } func (i ProjectFeatureFlag) String() string { diff --git a/vendor/github.com/xanzy/go-gitlab/repositories.go b/vendor/github.com/xanzy/go-gitlab/repositories.go index 986dd00..dde8761 100644 --- a/vendor/github.com/xanzy/go-gitlab/repositories.go +++ b/vendor/github.com/xanzy/go-gitlab/repositories.go @@ -223,6 +223,7 @@ type CompareOptions struct { From *string `url:"from,omitempty" json:"from,omitempty"` To *string `url:"to,omitempty" json:"to,omitempty"` Straight *bool `url:"straight,omitempty" json:"straight,omitempty"` + Unidiff *bool `url:"unidiff,omitempty" json:"unidiff,omitempty"` } // Compare compares branches, tags or commits. diff --git a/vendor/github.com/xanzy/go-gitlab/types.go b/vendor/github.com/xanzy/go-gitlab/types.go index d737aec..e0dc755 100644 --- a/vendor/github.com/xanzy/go-gitlab/types.go +++ b/vendor/github.com/xanzy/go-gitlab/types.go @@ -17,12 +17,14 @@ package gitlab import ( + "bytes" "encoding/json" "errors" "fmt" "net/url" "reflect" "strconv" + "strings" "time" ) @@ -423,6 +425,35 @@ func (t ISOTime) String() string { return time.Time(t).Format(iso8601) } +// Labels represents a list of labels. +type Labels []string + +// LabelOptions is a custom type with specific marshaling characteristics. +type LabelOptions []string + +// MarshalJSON implements the json.Marshaler interface. +func (l *LabelOptions) MarshalJSON() ([]byte, error) { + if *l == nil { + return []byte(`null`), nil + } + return json.Marshal(strings.Join(*l, ",")) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (l *LabelOptions) UnmarshalJSON(data []byte) error { + type alias LabelOptions + if !bytes.HasPrefix(data, []byte("[")) { + data = []byte(fmt.Sprintf("[%s]", string(data))) + } + return json.Unmarshal(data, (*alias)(l)) +} + +// EncodeValues implements the query.EncodeValues interface +func (l *LabelOptions) EncodeValues(key string, v *url.Values) error { + v.Set(key, strings.Join(*l, ",")) + return nil +} + // LinkTypeValue represents a release link type. type LinkTypeValue string diff --git a/vendor/github.com/xanzy/go-gitlab/users.go b/vendor/github.com/xanzy/go-gitlab/users.go index 4489034..5ad87ca 100644 --- a/vendor/github.com/xanzy/go-gitlab/users.go +++ b/vendor/github.com/xanzy/go-gitlab/users.go @@ -103,6 +103,7 @@ type User struct { UsingLicenseSeat bool `json:"using_license_seat"` CustomAttributes []*CustomAttribute `json:"custom_attributes"` NamespaceID int `json:"namespace_id"` + Locked bool `json:"locked"` } // UserIdentity represents a user identity. @@ -1488,3 +1489,21 @@ func (s *UsersService) CreateUserRunner(opts *CreateUserRunnerOptions, options . return r, resp, nil } + +// CreateServiceAccountUser creates a new service account user. Note only administrators can create new service account users. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/users.html#create-service-account-user +func (s *UsersService) CreateServiceAccountUser(options ...RequestOptionFunc) (*User, *Response, error) { + req, err := s.client.NewRequest(http.MethodPost, "service_accounts", nil, options) + if err != nil { + return nil, nil, err + } + + usr := new(User) + resp, err := s.client.Do(req, usr) + if err != nil { + return nil, resp, err + } + + return usr, resp, nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 7409d69..85a66b4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -23,7 +23,7 @@ github.com/pmezard/go-difflib/difflib ## explicit; go 1.20 github.com/stretchr/testify/assert github.com/stretchr/testify/require -# github.com/xanzy/go-gitlab v0.94.0 +# github.com/xanzy/go-gitlab v0.95.0 ## explicit; go 1.19 github.com/xanzy/go-gitlab # golang.org/x/net v0.19.0