diff --git a/go.mod b/go.mod index 2d36bc6..bbc0462 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.93.2 + github.com/xanzy/go-gitlab v0.94.0 golang.org/x/oauth2 v0.14.0 ) diff --git a/go.sum b/go.sum index 525ef87..e69660e 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.93.2 h1:kNNf3BYNYn/Zkig0B89fma12l36VLcYSGu7OnaRlRDg= -github.com/xanzy/go-gitlab v0.93.2/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw= +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= 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 1652705..3058715 100644 --- a/vendor/github.com/xanzy/go-gitlab/README.md +++ b/vendor/github.com/xanzy/go-gitlab/README.md @@ -133,7 +133,7 @@ to list all projects for user "svanharmelen": ```go git := gitlab.NewClient("yourtokengoeshere") -opt := &gitlab.ListProjectsOptions{Search: gitlab.String("svanharmelen")} +opt := &gitlab.ListProjectsOptions{Search: gitlab.Ptr("svanharmelen")} projects, _, err := git.Projects.ListProjects(opt) ``` @@ -159,11 +159,11 @@ func main() { // Create new project p := &gitlab.CreateProjectOptions{ - Name: gitlab.String("My Project"), - Description: gitlab.String("Just a test project to play with"), - MergeRequestsEnabled: gitlab.Bool(true), - SnippetsEnabled: gitlab.Bool(true), - Visibility: gitlab.Visibility(gitlab.PublicVisibility), + Name: gitlab.Ptr("My Project"), + Description: gitlab.Ptr("Just a test project to play with"), + MergeRequestsEnabled: gitlab.Ptr(true), + SnippetsEnabled: gitlab.Ptr(true), + Visibility: gitlab.Ptr(gitlab.PublicVisibility), } project, _, err := git.Projects.CreateProject(p) if err != nil { @@ -172,10 +172,10 @@ func main() { // Add a new snippet s := &gitlab.CreateProjectSnippetOptions{ - Title: gitlab.String("Dummy Snippet"), - FileName: gitlab.String("snippet.go"), - Content: gitlab.String("package main...."), - Visibility: gitlab.Visibility(gitlab.PublicVisibility), + Title: gitlab.Ptr("Dummy Snippet"), + FileName: gitlab.Ptr("snippet.go"), + Content: gitlab.Ptr("package main...."), + Visibility: gitlab.Ptr(gitlab.PublicVisibility), } _, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s) if err != nil { diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go index 88d5505..0ed07f2 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitlab.go +++ b/vendor/github.com/xanzy/go-gitlab/gitlab.go @@ -164,6 +164,7 @@ type Client struct { LicenseTemplates *LicenseTemplatesService ManagedLicenses *ManagedLicensesService Markdown *MarkdownService + MemberRolesService *MemberRolesService MergeRequestApprovals *MergeRequestApprovalsService MergeRequests *MergeRequestsService MergeTrains *MergeTrainsService @@ -227,11 +228,17 @@ type Client struct { // ListOptions specifies the optional parameters to various List methods that // support pagination. type ListOptions struct { - // For paginated result sets, page of results to retrieve. + // For offset-based paginated result sets, page of results to retrieve. Page int `url:"page,omitempty" json:"page,omitempty"` - - // For paginated result sets, the number of results to include per page. + // For offset-based and keyset-based paginated result sets, the number of results to include per page. PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"` + + // For keyset-based paginated result sets, name of the column by which to order + OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"` + // For keyset-based paginated result sets, the value must be `"keyset"` + Pagination string `url:"pagination,omitempty" json:"pagination,omitempty"` + // For keyset-based paginated result sets, sort order (`"asc"`` or `"desc"`) + Sort string `url:"sort,omitempty" json:"sort,omitempty"` } // RateLimiter describes the interface that all (custom) rate limiters must implement. @@ -389,6 +396,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) { c.LicenseTemplates = &LicenseTemplatesService{client: c} c.ManagedLicenses = &ManagedLicensesService{client: c} c.Markdown = &MarkdownService{client: c} + c.MemberRolesService = &MemberRolesService{client: c} c.MergeRequestApprovals = &MergeRequestApprovalsService{client: c} c.MergeRequests = &MergeRequestsService{client: c, timeStats: timeStats} c.MergeTrains = &MergeTrainsService{client: c} @@ -710,32 +718,43 @@ func (c *Client) UploadRequest(method, path string, content io.Reader, filename type Response struct { *http.Response - // These fields provide the page values for paginating through a set of - // results. Any or all of these may be set to the zero value for - // responses that are not part of a paginated set, or for which there - // are no additional pages. + // Fields used for offset-based pagination. TotalItems int TotalPages int ItemsPerPage int CurrentPage int NextPage int PreviousPage int + + // Fields used for keyset-based pagination. + PreviousLink string + NextLink string + FirstLink string + LastLink string } // newResponse creates a new Response for the provided http.Response. func newResponse(r *http.Response) *Response { response := &Response{Response: r} response.populatePageValues() + response.populateLinkValues() return response } const ( + // Headers used for offset-based pagination. xTotal = "X-Total" xTotalPages = "X-Total-Pages" xPerPage = "X-Per-Page" xPage = "X-Page" xNextPage = "X-Next-Page" xPrevPage = "X-Prev-Page" + + // Headers used for keyset-based pagination. + linkPrev = "prev" + linkNext = "next" + linkFirst = "first" + linkLast = "last" ) // populatePageValues parses the HTTP Link response headers and populates the @@ -761,6 +780,31 @@ func (r *Response) populatePageValues() { } } +func (r *Response) populateLinkValues() { + if link := r.Header.Get("Link"); link != "" { + for _, link := range strings.Split(link, ",") { + parts := strings.Split(link, ";") + if len(parts) < 2 { + continue + } + + linkType := strings.Trim(strings.Split(parts[1], "=")[1], "\"") + linkValue := strings.Trim(parts[0], "< >") + + switch linkType { + case linkPrev: + r.PreviousLink = linkValue + case linkNext: + r.NextLink = linkValue + case linkFirst: + r.FirstLink = linkValue + case linkLast: + r.LastLink = linkValue + } + } + } +} + // Do sends an API request and returns the API response. The API response is // JSON decoded and stored in the value pointed to by v, or returned as an // error if an API error has occurred. If v implements the io.Writer diff --git a/vendor/github.com/xanzy/go-gitlab/member_roles.go b/vendor/github.com/xanzy/go-gitlab/member_roles.go new file mode 100644 index 0000000..e3f1285 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/member_roles.go @@ -0,0 +1,115 @@ +package gitlab + +import ( + "fmt" + "net/http" +) + +// MemberRolesService handles communication with the member roles related +// methods of the GitLab API. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/member_roles.html +type MemberRolesService struct { + client *Client +} + +// MemberRole represents a GitLab member role. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/member_roles.html +type MemberRole struct { + ID int `json:"id"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + GroupId int `json:"group_id"` + BaseAccessLevel AccessLevelValue `json:"base_access_level"` + AdminMergeRequests bool `json:"admin_merge_requests,omitempty"` + AdminVulnerability bool `json:"admin_vulnerability,omitempty"` + ReadCode bool `json:"read_code,omitempty"` + ReadDependency bool `json:"read_dependency,omitempty"` + ReadVulnerability bool `json:"read_vulnerability,omitempty"` + ManageProjectAccessToken bool `json:"manage_project_access_token,omitempty"` +} + +// ListMemberRoles gets a list of member roles for a specified group. +// +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/member_roles.html#list-all-member-roles-of-a-group +func (s *MemberRolesService) ListMemberRoles(gid interface{}, options ...RequestOptionFunc) ([]*MemberRole, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/member_roles", PathEscape(group)) + + req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + if err != nil { + return nil, nil, err + } + + var mrs []*MemberRole + resp, err := s.client.Do(req, &mrs) + if err != nil { + return nil, resp, err + } + + return mrs, resp, nil +} + +// CreateMemberRoleOptions represents the available CreateMemberRole() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/member_roles.html#add-a-member-role-to-a-group +type CreateMemberRoleOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + BaseAccessLevel *AccessLevelValue `url:"base_access_level,omitempty" json:"base_access_level,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + AdminMergeRequest *bool `url:"admin_merge_request,omitempty" json:"admin_merge_request,omitempty"` + AdminVulnerability *bool `url:"admin_vulnerability,omitempty" json:"admin_vulnerability,omitempty"` + ReadCode *bool `url:"read_code,omitempty" json:"read_code,omitempty"` + ReadDependency *bool `url:"read_dependency,omitempty" json:"read_dependency,omitempty"` + ReadVulnerability *bool `url:"read_vulnerability,omitempty" json:"read_vulnerability,omitempty"` +} + +// CreateMemberRole creates a new member role for a specified group. +// +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/member_roles.html#add-a-member-role-to-a-group +func (s *MemberRolesService) CreateMemberRole(gid interface{}, opt *CreateMemberRoleOptions, options ...RequestOptionFunc) (*MemberRole, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/member_roles", PathEscape(group)) + + req, err := s.client.NewRequest(http.MethodPost, u, opt, options) + if err != nil { + return nil, nil, err + } + + mr := new(MemberRole) + resp, err := s.client.Do(req, mr) + if err != nil { + return nil, resp, err + } + + return mr, resp, nil +} + +// DeleteMemberRole deletes a member role from a specified group. +// +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/member_roles.html#remove-member-role-of-a-group +func (s *MemberRolesService) DeleteMemberRole(gid interface{}, memberRole int, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/member_roles/%d", PathEscape(group), memberRole) + + 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/pipelines.go b/vendor/github.com/xanzy/go-gitlab/pipelines.go index 75a8b6c..6dee9df 100644 --- a/vendor/github.com/xanzy/go-gitlab/pipelines.go +++ b/vendor/github.com/xanzy/go-gitlab/pipelines.go @@ -49,6 +49,7 @@ type Pipeline struct { Status string `json:"status"` Source string `json:"source"` Ref string `json:"ref"` + Name string `json:"name"` SHA string `json:"sha"` BeforeSHA string `json:"before_sha"` Tag bool `json:"tag"` diff --git a/vendor/github.com/xanzy/go-gitlab/project_mirror.go b/vendor/github.com/xanzy/go-gitlab/project_mirror.go index 129040c..16f030d 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_mirror.go +++ b/vendor/github.com/xanzy/go-gitlab/project_mirror.go @@ -40,6 +40,7 @@ type ProjectMirror struct { LastSuccessfulUpdateAt *time.Time `json:"last_successful_update_at"` LastUpdateAt *time.Time `json:"last_update_at"` LastUpdateStartedAt *time.Time `json:"last_update_started_at"` + MirrorBranchRegex string `json:"mirror_branch_regex"` OnlyProtectedBranches bool `json:"only_protected_branches"` KeepDivergentRefs bool `json:"keep_divergent_refs"` UpdateStatus string `json:"update_status"` @@ -107,8 +108,9 @@ func (s *ProjectMirrorService) GetProjectMirror(pid interface{}, mirror int, opt type AddProjectMirrorOptions struct { URL *string `url:"url,omitempty" json:"url,omitempty"` Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` - OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` + OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` } // AddProjectMirror creates a new mirror on the project. @@ -142,9 +144,10 @@ func (s *ProjectMirrorService) AddProjectMirror(pid interface{}, opt *AddProject // GitLab API docs: // https://docs.gitlab.com/ee/api/remote_mirrors.html#update-a-remote-mirrors-attributes type EditProjectMirrorOptions struct { - Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` - OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` - KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` + Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` + KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` + OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` } // EditProjectMirror updates a project team member to a specified access level.. diff --git a/vendor/github.com/xanzy/go-gitlab/projects.go b/vendor/github.com/xanzy/go-gitlab/projects.go index 6a2b3be..9bf0689 100644 --- a/vendor/github.com/xanzy/go-gitlab/projects.go +++ b/vendor/github.com/xanzy/go-gitlab/projects.go @@ -325,6 +325,8 @@ type ListProjectsOptions struct { IDAfter *int `url:"id_after,omitempty" json:"id_after,omitempty"` IDBefore *int `url:"id_before,omitempty" json:"id_before,omitempty"` Imported *bool `url:"imported,omitempty" json:"imported,omitempty"` + IncludeHidden *bool `url:"include_hidden,omitempty" json:"include_hidden,omitempty"` + IncludePendingDelete *bool `url:"include_pending_delete,omitempty" json:"include_pending_delete,omitempty"` LastActivityAfter *time.Time `url:"last_activity_after,omitempty" json:"last_activity_after,omitempty"` LastActivityBefore *time.Time `url:"last_activity_before,omitempty" json:"last_activity_before,omitempty"` Membership *bool `url:"membership,omitempty" json:"membership,omitempty"` @@ -860,6 +862,7 @@ type EditProjectOptions struct { MergeRequestsTemplate *string `url:"merge_requests_template,omitempty" json:"merge_requests_template,omitempty"` MergeTrainsEnabled *bool `url:"merge_trains_enabled,omitempty" json:"merge_trains_enabled,omitempty"` Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` MirrorOverwritesDivergedBranches *bool `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"` MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"` MirrorUserID *int `url:"mirror_user_id,omitempty" json:"mirror_user_id,omitempty"` diff --git a/vendor/github.com/xanzy/go-gitlab/request_options.go b/vendor/github.com/xanzy/go-gitlab/request_options.go index bc01b91..d158047 100644 --- a/vendor/github.com/xanzy/go-gitlab/request_options.go +++ b/vendor/github.com/xanzy/go-gitlab/request_options.go @@ -18,6 +18,7 @@ package gitlab import ( "context" + "net/url" retryablehttp "github.com/hashicorp/go-retryablehttp" ) @@ -52,6 +53,27 @@ func WithHeaders(headers map[string]string) RequestOptionFunc { } } +// WithKeysetPaginationParameters takes a "next" link from the Link header of a +// response to a keyset-based paginated request and modifies the values of each +// query parameter in the request with its corresponding response parameter. +func WithKeysetPaginationParameters(nextLink string) RequestOptionFunc { + return func(req *retryablehttp.Request) error { + nextUrl, err := url.Parse(nextLink) + if err != nil { + return err + } + q := req.URL.Query() + for k, values := range nextUrl.Query() { + q.Del(k) + for _, v := range values { + q.Add(k, v) + } + } + req.URL.RawQuery = q.Encode() + return nil + } +} + // WithSudo takes either a username or user ID and sets the SUDO request header. func WithSudo(uid interface{}) RequestOptionFunc { return func(req *retryablehttp.Request) error { diff --git a/vendor/github.com/xanzy/go-gitlab/types.go b/vendor/github.com/xanzy/go-gitlab/types.go index cd8aad7..d737aec 100644 --- a/vendor/github.com/xanzy/go-gitlab/types.go +++ b/vendor/github.com/xanzy/go-gitlab/types.go @@ -26,6 +26,11 @@ import ( "time" ) +// Ptr is a helper returns a pointer to v. +func Ptr[T any](v T) *T { + return &v +} + // AccessControlValue represents an access control value within GitLab, // used for managing access to certain project features. // @@ -44,10 +49,10 @@ const ( // AccessControl is a helper routine that allocates a new AccessControlValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func AccessControl(v AccessControlValue) *AccessControlValue { - p := new(AccessControlValue) - *p = v - return p + return Ptr(v) } // AccessLevelValue represents a permission level within GitLab. @@ -76,10 +81,10 @@ const ( // AccessLevel is a helper routine that allocates a new AccessLevelValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func AccessLevel(v AccessLevelValue) *AccessLevelValue { - p := new(AccessLevelValue) - *p = v - return p + return Ptr(v) } // UserIDValue represents a user ID value within GitLab. @@ -217,10 +222,10 @@ const ( // Availability is a helper routine that allocates a new AvailabilityValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func Availability(v AvailabilityValue) *AvailabilityValue { - p := new(AvailabilityValue) - *p = v - return p + return Ptr(v) } // BuildStateValue represents a GitLab build state. @@ -243,10 +248,10 @@ const ( // BuildState is a helper routine that allocates a new BuildStateValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func BuildState(v BuildStateValue) *BuildStateValue { - p := new(BuildStateValue) - *p = v - return p + return Ptr(v) } // DeploymentStatusValue represents a Gitlab deployment status. @@ -263,10 +268,10 @@ const ( // DeploymentStatus is a helper routine that allocates a new // DeploymentStatusValue to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func DeploymentStatus(v DeploymentStatusValue) *DeploymentStatusValue { - p := new(DeploymentStatusValue) - *p = v - return p + return Ptr(v) } // EventTypeValue represents actions type for contribution events @@ -321,10 +326,10 @@ const ( // FileAction is a helper routine that allocates a new FileActionValue value // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func FileAction(v FileActionValue) *FileActionValue { - p := new(FileActionValue) - *p = v - return p + return Ptr(v) } // GenericPackageSelectValue represents a generic package select value. @@ -337,10 +342,10 @@ const ( // GenericPackageSelect is a helper routine that allocates a new // GenericPackageSelectValue value to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func GenericPackageSelect(v GenericPackageSelectValue) *GenericPackageSelectValue { - p := new(GenericPackageSelectValue) - *p = v - return p + return Ptr(v) } // GenericPackageStatusValue represents a generic package status. @@ -354,10 +359,10 @@ const ( // GenericPackageStatus is a helper routine that allocates a new // GenericPackageStatusValue value to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func GenericPackageStatus(v GenericPackageStatusValue) *GenericPackageStatusValue { - p := new(GenericPackageStatusValue) - *p = v - return p + return Ptr(v) } // ISOTime represents an ISO 8601 formatted date. @@ -434,10 +439,10 @@ const ( // LinkType is a helper routine that allocates a new LinkType value // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func LinkType(v LinkTypeValue) *LinkTypeValue { - p := new(LinkTypeValue) - *p = v - return p + return Ptr(v) } // LicenseApprovalStatusValue describe the approval statuses of a license. @@ -455,10 +460,10 @@ const ( // LicenseApprovalStatus is a helper routine that allocates a new license // approval status value to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func LicenseApprovalStatus(v LicenseApprovalStatusValue) *LicenseApprovalStatusValue { - p := new(LicenseApprovalStatusValue) - *p = v - return p + return Ptr(v) } // MergeMethodValue represents a project merge type within GitLab. @@ -476,11 +481,11 @@ const ( ) // MergeMethod is a helper routine that allocates a new MergeMethod -// to sotre v and returns a pointer to it. +// to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func MergeMethod(v MergeMethodValue) *MergeMethodValue { - p := new(MergeMethodValue) - *p = v - return p + return Ptr(v) } // NoteTypeValue represents the type of a Note. @@ -496,10 +501,10 @@ const ( // NoteType is a helper routine that allocates a new NoteTypeValue to // store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func NoteType(v NoteTypeValue) *NoteTypeValue { - p := new(NoteTypeValue) - *p = v - return p + return Ptr(v) } // NotificationLevelValue represents a notification level. @@ -566,10 +571,10 @@ var notificationLevelTypes = map[string]NotificationLevelValue{ // NotificationLevel is a helper routine that allocates a new NotificationLevelValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue { - p := new(NotificationLevelValue) - *p = v - return p + return Ptr(v) } // ProjectCreationLevelValue represents a project creation level within GitLab. @@ -588,10 +593,9 @@ const ( // ProjectCreationLevel is a helper routine that allocates a new ProjectCreationLevelValue // to store v and returns a pointer to it. +// Please use Ptr instead. func ProjectCreationLevel(v ProjectCreationLevelValue) *ProjectCreationLevelValue { - p := new(ProjectCreationLevelValue) - *p = v - return p + return Ptr(v) } // SharedRunnersSettingValue determines whether shared runners are enabled for a @@ -616,10 +620,10 @@ const ( // SharedRunnersSetting is a helper routine that allocates a new SharedRunnersSettingValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func SharedRunnersSetting(v SharedRunnersSettingValue) *SharedRunnersSettingValue { - p := new(SharedRunnersSettingValue) - *p = v - return p + return Ptr(v) } // SubGroupCreationLevelValue represents a sub group creation level within GitLab. @@ -637,10 +641,10 @@ const ( // SubGroupCreationLevel is a helper routine that allocates a new SubGroupCreationLevelValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func SubGroupCreationLevel(v SubGroupCreationLevelValue) *SubGroupCreationLevelValue { - p := new(SubGroupCreationLevelValue) - *p = v - return p + return Ptr(v) } // SquashOptionValue represents a squash optional level within GitLab. @@ -660,10 +664,10 @@ const ( // SquashOption is a helper routine that allocates a new SquashOptionValue // to store s and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func SquashOption(s SquashOptionValue) *SquashOptionValue { - p := new(SquashOptionValue) - *p = s - return p + return Ptr(s) } // TasksCompletionStatus represents tasks of the issue/merge request. @@ -723,10 +727,10 @@ const ( // VariableType is a helper routine that allocates a new VariableTypeValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func VariableType(v VariableTypeValue) *VariableTypeValue { - p := new(VariableTypeValue) - *p = v - return p + return Ptr(v) } // VisibilityValue represents a visibility level within GitLab. @@ -745,10 +749,10 @@ const ( // Visibility is a helper routine that allocates a new VisibilityValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func Visibility(v VisibilityValue) *VisibilityValue { - p := new(VisibilityValue) - *p = v - return p + return Ptr(v) } // WikiFormatValue represents the available wiki formats. @@ -766,42 +770,42 @@ const ( // WikiFormat is a helper routine that allocates a new WikiFormatValue // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func WikiFormat(v WikiFormatValue) *WikiFormatValue { - p := new(WikiFormatValue) - *p = v - return p + return Ptr(v) } // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func Bool(v bool) *bool { - p := new(bool) - *p = v - return p + return Ptr(v) } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func Int(v int) *int { - p := new(int) - *p = v - return p + return Ptr(v) } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func String(v string) *string { - p := new(string) - *p = v - return p + return Ptr(v) } // Time is a helper routine that allocates a new time.Time value // to store v and returns a pointer to it. +// +// Deprecated: Please use Ptr instead. func Time(v time.Time) *time.Time { - p := new(time.Time) - *p = v - return p + return Ptr(v) } // BoolValue is a boolean value with advanced json unmarshaling features. diff --git a/vendor/modules.txt b/vendor/modules.txt index 66ee71c..6058717 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -23,8 +23,8 @@ 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.93.2 -## explicit; go 1.18 +# github.com/xanzy/go-gitlab v0.94.0 +## explicit; go 1.19 github.com/xanzy/go-gitlab # golang.org/x/net v0.18.0 ## explicit; go 1.18