1
0
Fork 0
forked from forgejo/forgejo

Vendor Update Go Libs (#13444)

* denisenkom/go-mssqldb untagged -> v0.9.0

* github.com/editorconfig/editorconfig-core-go v2.3.7 -> v2.3.8

* github.com/go-testfixtures/testfixtures v3.4.0 -> v3.4.1

* github.com/mholt/archiver v3.3.2 -> v3.5.0

* github.com/olivere/elastic v7.0.20 -> v7.0.21

* github.com/urfave/cli v1.22.4 -> v1.22.5

* github.com/xanzy/go-gitlab v0.38.1 -> v0.39.0

* github.com/yuin/goldmark-meta untagged -> v1.0.0

* github.com/ethantkoenig/rupture 0a76f03a811a -> c3b3b810dc77

* github.com/jaytaylor/html2text 8fb95d837f7d -> 3577fbdbcff7

* github.com/kballard/go-shellquote cd60e84ee657 -> 95032a82bc51

* github.com/msteinert/pam 02ccfbfaf0cc -> 913b8f8cdf8b

* github.com/unknwon/paginater 7748a72e0141 -> 042474bd0eae

* CI.restart()

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
6543 2020-11-06 19:41:42 +01:00 committed by GitHub
parent eebaa81f43
commit 30ce3731a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
184 changed files with 12387 additions and 2975 deletions

View file

@ -1,4 +1,7 @@
language: go
arch:
- amd64
- ppc64le
go:
- 1.13.x

View file

@ -109,7 +109,7 @@ There are a few `With...` option functions that can be used to customize
the API client. For example, to set a custom base URL:
```go
git, err := gitlab.NewClient("yourtokengoeshere", WithBaseURL("https://git.mydomain.com/api/v4"))
git, err := gitlab.NewClient("yourtokengoeshere", gitlab.WithBaseURL("https://git.mydomain.com/api/v4"))
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}

View file

@ -104,30 +104,6 @@ func (s *CommitsService) ListCommits(pid interface{}, opt *ListCommitsOptions, o
return c, resp, err
}
// FileAction represents the available actions that can be performed on a file.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
type FileAction string
// The available file actions.
const (
FileCreate FileAction = "create"
FileDelete FileAction = "delete"
FileMove FileAction = "move"
FileUpdate FileAction = "update"
)
// CommitAction represents a single file action within a commit.
type CommitAction struct {
Action FileAction `url:"action" json:"action"`
FilePath string `url:"file_path" json:"file_path"`
PreviousPath string `url:"previous_path,omitempty" json:"previous_path,omitempty"`
Content string `url:"content,omitempty" json:"content,omitempty"`
Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
LastCommitID string `url:"last_commit_id,omitempty" json:"last_commit_id,omitempty"`
ExecuteFilemode bool `url:"execute_filemode,omitempty" json:"execute_filemode,omitempty"`
}
// CommitRef represents the reference of branches/tags in a commit.
//
// GitLab API docs:
@ -203,16 +179,30 @@ func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...Reque
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
type CreateCommitOptions struct {
Branch *string `url:"branch" json:"branch"`
CommitMessage *string `url:"commit_message" json:"commit_message"`
StartBranch *string `url:"start_branch,omitempty" json:"start_branch,omitempty"`
StartSHA *string `url:"start_sha,omitempty" json:"start_sha,omitempty"`
StartProject *string `url:"start_project,omitempty" json:"start_project,omitempty"`
Actions []*CommitAction `url:"actions" json:"actions"`
AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
Stats *bool `url:"stats,omitempty" json:"stats,omitempty"`
Force *bool `url:"force,omitempty" json:"force,omitempty"`
Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
StartBranch *string `url:"start_branch,omitempty" json:"start_branch,omitempty"`
StartSHA *string `url:"start_sha,omitempty" json:"start_sha,omitempty"`
StartProject *string `url:"start_project,omitempty" json:"start_project,omitempty"`
Actions []*CommitActionOptions `url:"actions,omitempty" json:"actions,omitempty"`
AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
Stats *bool `url:"stats,omitempty" json:"stats,omitempty"`
Force *bool `url:"force,omitempty" json:"force,omitempty"`
}
// CommitActionOptions represents the available options for a new single
// file action.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
type CommitActionOptions struct {
Action *FileAction `url:"action,omitempty" json:"action,omitempty"`
FilePath *string `url:"file_path,omitempty" json:"file_path,omitempty"`
PreviousPath *string `url:"previous_path,omitempty" json:"previous_path,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Encoding *string `url:"encoding,omitempty" json:"encoding,omitempty"`
LastCommitID *string `url:"last_commit_id,omitempty" json:"last_commit_id,omitempty"`
ExecuteFilemode *bool `url:"execute_filemode,omitempty" json:"execute_filemode,omitempty"`
}
// CreateCommit creates a commit with multiple files and actions.

View file

@ -198,3 +198,37 @@ func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, opti
return k, resp, err
}
// UpdateDeployKeyOptions represents the available UpdateDeployKey() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/deploy_keys.html#update-deploy-key
type UpdateDeployKeyOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"`
CanPush *bool `url:"can_push,omitempty" json:"can_push,omitempty"`
}
// UpdateDeployKey updates a deploy key for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/deploy_keys.html#update-deploy-key
func (s *DeployKeysService) UpdateDeployKey(pid interface{}, deployKey int, opt *UpdateDeployKeyOptions, options ...RequestOptionFunc) (*DeployKey, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/deploy_keys/%d", pathEscape(project), deployKey)
req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
return nil, nil, err
}
k := new(DeployKey)
resp, err := s.client.Do(req, k)
if err != nil {
return nil, resp, err
}
return k, resp, err
}

193
vendor/github.com/xanzy/go-gitlab/freeze_periods.go generated vendored Normal file
View file

@ -0,0 +1,193 @@
//
// Copyright 2020 Paul Cioanca
//
// 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"
"time"
)
// FreezePeriodsService handles the communication with the freeze periods
// related methods of the GitLab API.
//
// https://docs.gitlab.com/ce/api/freeze_periods.html
type FreezePeriodsService struct {
client *Client
}
// FreezePeriod represents a freeze period object.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#list-freeze-periods
type FreezePeriod struct {
ID int `json:"id"`
FreezeStart string `json:"freeze_start"`
FreezeEnd string `json:"freeze_end"`
CronTimezone string `json:"cron_timezone"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
}
// ListFreezePeriodsOptions represents the available ListFreezePeriodsOptions()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#list-freeze-periods
type ListFreezePeriodsOptions ListOptions
// ListFreezePeriods gets a list of project project freeze periods.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#list-freeze-periods
func (s *FreezePeriodsService) ListFreezePeriods(pid interface{}, opt *ListFreezePeriodsOptions, options ...RequestOptionFunc) ([]*FreezePeriod, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/freeze_periods", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
}
var fp []*FreezePeriod
resp, err := s.client.Do(req, &fp)
if err != nil {
return nil, resp, err
}
return fp, resp, err
}
// GetFreezePeriod gets a specific freeze period for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#get-a-freeze-period-by-a-freeze_period_id
func (s *FreezePeriodsService) GetFreezePeriod(pid interface{}, freezePeriod int, options ...RequestOptionFunc) (*FreezePeriod, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/freeze_periods/%d", pathEscape(project), freezePeriod)
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
fp := new(FreezePeriod)
resp, err := s.client.Do(req, fp)
if err != nil {
return nil, resp, err
}
return fp, resp, err
}
// CreateFreezePeriodOptions represents the available CreateFreezePeriodOptions()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#create-a-freeze-period
type CreateFreezePeriodOptions struct {
FreezeStart *string `url:"freeze_start,omitempty" json:"freeze_start,omitempty"`
FreezeEnd *string `url:"freeze_end,omitempty" json:"freeze_end,omitempty"`
CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
}
// CreateFreezePeriodOptions adds a freeze period to a specified project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#create-a-freeze-period
func (s *FreezePeriodsService) CreateFreezePeriodOptions(pid interface{}, opt *CreateFreezePeriodOptions, options ...RequestOptionFunc) (*FreezePeriod, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/freeze_periods", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
return nil, nil, err
}
fp := new(FreezePeriod)
resp, err := s.client.Do(req, fp)
if err != nil {
return nil, resp, err
}
return fp, resp, err
}
// UpdateFreezePeriodOptions represents the available UpdateFreezePeriodOptions()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#update-a-freeze-period
type UpdateFreezePeriodOptions struct {
FreezeStart *string `url:"freeze_start,omitempty" json:"freeze_start,omitempty"`
FreezeEnd *string `url:"freeze_end,omitempty" json:"freeze_end,omitempty"`
CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
}
// UpdateFreezePeriodOptions edits a freeze period for a specified project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#update-a-freeze-period
func (s *FreezePeriodsService) UpdateFreezePeriodOptions(pid interface{}, freezePeriod int, opt *UpdateFreezePeriodOptions, options ...RequestOptionFunc) (*FreezePeriod, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/freeze_periods/%d", pathEscape(project), freezePeriod)
req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
return nil, nil, err
}
fp := new(FreezePeriod)
resp, err := s.client.Do(req, fp)
if err != nil {
return nil, resp, err
}
return fp, resp, err
}
// DeleteFreezePeriod removes a freeze period from a project. This is an
// idempotent method and can be called multiple times. Either the hook is
// available or not.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/freeze_periods.html#delete-a-freeze-period
func (s *FreezePeriodsService) DeleteFreezePeriod(pid interface{}, freezePeriod int, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/freeze_periods/%d", pathEscape(project), freezePeriod)
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}

View file

@ -286,8 +286,7 @@ func (s *GroupsService) SearchGroup(query string, options ...RequestOptionFunc)
return g, resp, err
}
// ListGroupProjectsOptions represents the available ListGroupProjects()
// options.
// ListGroupProjectsOptions represents the available ListGroup() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
@ -333,8 +332,7 @@ func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProject
return p, resp, err
}
// ListSubgroupsOptions represents the available ListSubgroupsOptions()
// options.
// ListSubgroupsOptions represents the available ListSubgroups() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups
@ -365,6 +363,38 @@ func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions
return g, resp, err
}
// ListDescendantGroupsOptions represents the available ListDescendantGroups()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-descendant-groups
type ListDescendantGroupsOptions ListGroupsOptions
// ListDescendantGroups gets a list of subgroups for a given project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-descendant-groups
func (s *GroupsService) ListDescendantGroups(gid interface{}, opt *ListDescendantGroupsOptions, options ...RequestOptionFunc) ([]*Group, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/descendant_groups", pathEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
}
var g []*Group
resp, err := s.client.Do(req, &g)
if err != nil {
return nil, resp, err
}
return g, resp, err
}
// ListGroupLDAPLinks lists the group's LDAP links. Available only for users who
// can edit groups.
//

View file

@ -215,6 +215,7 @@ type ListIssuesOptions struct {
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
NotMyReactionEmoji []string `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
In *string `url:"in,omitempty" json:"in,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"`

View file

@ -164,7 +164,7 @@ func (s *JobsService) GetJob(pid interface{}, jobID int, options ...RequestOptio
// GetJobArtifacts get jobs artifacts of a project
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/jobs.html#get-job-artifacts
// https://docs.gitlab.com/ce/api/job_artifacts.html#get-job-artifacts
func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...RequestOptionFunc) (io.Reader, *Response, error) {
project, err := parseID(pid)
if err != nil {
@ -190,7 +190,7 @@ func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...Req
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
// https://docs.gitlab.com/ce/api/job_artifacts.html#download-the-artifacts-archive
type DownloadArtifactsFileOptions struct {
Job *string `url:"job" json:"job"`
}
@ -199,7 +199,7 @@ type DownloadArtifactsFileOptions struct {
// reference name and job provided the job finished successfully.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
// https://docs.gitlab.com/ce/api/job_artifacts.html#download-the-artifacts-archive
func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt *DownloadArtifactsFileOptions, options ...RequestOptionFunc) (io.Reader, *Response, error) {
project, err := parseID(pid)
if err != nil {
@ -227,7 +227,7 @@ func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt
// to a client.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/jobs.html#download-a-single-artifact-file
// https://docs.gitlab.com/ce/api/job_artifacts.html#download-a-single-artifact-file-by-job-id
func (s *JobsService) DownloadSingleArtifactsFile(pid interface{}, jobID int, artifactPath string, options ...RequestOptionFunc) (io.Reader, *Response, error) {
project, err := parseID(pid)
if err != nil {
@ -360,7 +360,7 @@ func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...RequestOpt
// expiration is set.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/jobs.html#keep-artifacts
// https://docs.gitlab.com/ce/api/job_artifacts.html#keep-artifacts
func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) {
project, err := parseID(pid)
if err != nil {
@ -406,3 +406,28 @@ func (s *JobsService) PlayJob(pid interface{}, jobID int, options ...RequestOpti
return job, resp, err
}
// DeleteArtifacts delete artifacts of a job
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/job_artifacts.html#delete-artifacts
func (s *JobsService) DeleteArtifacts(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/jobs/%d/artifacts", pathEscape(project), jobID)
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, nil, err
}
job := new(Job)
resp, err := s.client.Do(req, job)
if err != nil {
return nil, resp, err
}
return job, resp, err
}

View file

@ -81,6 +81,9 @@ type MergeRequest struct {
RenamedFile bool `json:"renamed_file"`
DeletedFile bool `json:"deleted_file"`
} `json:"changes"`
User struct {
CanMerge bool `json:"can_merge"`
} `json:"user"`
TimeStats *TimeStats `json:"time_stats"`
Squash bool `json:"squash"`
Pipeline *PipelineInfo `json:"pipeline"`
@ -573,6 +576,8 @@ type UpdateMergeRequestOptions struct {
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_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"`

View file

@ -82,7 +82,7 @@ func (p Pipeline) String() string {
// PipelineTestReport contains a detailed report of a test run.
type PipelineTestReport struct {
TotalTime int `json:"total_time"`
TotalTime float64 `json:"total_time"`
TotalCount int `json:"total_count"`
SuccessCount int `json:"success_count"`
FailedCount int `json:"failed_count"`
@ -94,7 +94,7 @@ type PipelineTestReport struct {
// PipelineTestSuites contains test suites results.
type PipelineTestSuites struct {
Name string `json:"name"`
TotalTime int `json:"total_time"`
TotalTime float64 `json:"total_time"`
TotalCount int `json:"total_count"`
SuccessCount int `json:"success_count"`
FailedCount int `json:"failed_count"`
@ -105,12 +105,10 @@ type PipelineTestSuites struct {
// PipelineTestCases contains test cases details.
type PipelineTestCases struct {
Status string `json:"status"`
Name string `json:"name"`
Classname string `json:"classname"`
ExecutionTime int `json:"execution_time"`
SystemOutput string `json:"system_output"`
StackTrace string `json:"stack_trace"`
Status string `json:"status"`
Name string `json:"name"`
Classname string `json:"classname"`
ExecutionTime float64 `json:"execution_time"`
}
func (p PipelineTestReport) String() string {

View file

@ -106,11 +106,12 @@ type Project struct {
GroupName string `json:"group_name"`
GroupAccessLevel int `json:"group_access_level"`
} `json:"shared_with_groups"`
Statistics *ProjectStatistics `json:"statistics"`
Links *Links `json:"_links,omitempty"`
CIConfigPath string `json:"ci_config_path"`
CIDefaultGitDepth int `json:"ci_default_git_depth"`
CustomAttributes []*CustomAttribute `json:"custom_attributes"`
Statistics *ProjectStatistics `json:"statistics"`
Links *Links `json:"_links,omitempty"`
CIConfigPath string `json:"ci_config_path"`
CIDefaultGitDepth int `json:"ci_default_git_depth"`
CustomAttributes []*CustomAttribute `json:"custom_attributes"`
ComplianceFrameworks []string `json:"compliance_frameworks"`
}
// Repository represents a repository.
@ -133,11 +134,13 @@ type Repository struct {
// ProjectNamespace represents a project namespace.
type ProjectNamespace struct {
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Kind string `json:"kind"`
FullPath string `json:"full_path"`
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Kind string `json:"kind"`
FullPath string `json:"full_path"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
}
// StorageStatistics represents a statistics record for a group or project.

View file

@ -41,12 +41,13 @@ type AccessLevelValue int
//
// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html
const (
NoPermissions AccessLevelValue = 0
GuestPermissions AccessLevelValue = 10
ReporterPermissions AccessLevelValue = 20
DeveloperPermissions AccessLevelValue = 30
MaintainerPermissions AccessLevelValue = 40
OwnerPermissions AccessLevelValue = 50
NoPermissions AccessLevelValue = 0
MinimalAccessPermissions AccessLevelValue = 5
GuestPermissions AccessLevelValue = 10
ReporterPermissions AccessLevelValue = 20
DeveloperPermissions AccessLevelValue = 30
MaintainerPermissions AccessLevelValue = 40
OwnerPermissions AccessLevelValue = 50
// These are deprecated and should be removed in a future version
MasterPermissions AccessLevelValue = 40
@ -104,6 +105,19 @@ func DeploymentStatus(v DeploymentStatusValue) *DeploymentStatusValue {
return p
}
// FileAction represents the available actions that can be performed on a file.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
type FileAction string
// The available file actions.
const (
FileCreate FileAction = "create"
FileDelete FileAction = "delete"
FileMove FileAction = "move"
FileUpdate FileAction = "update"
)
// ISOTime represents an ISO 8601 formatted date
type ISOTime time.Time

View file

@ -931,3 +931,44 @@ func (s *UsersService) SetUserStatus(opt *UserStatusOptions, options ...RequestO
return status, resp, err
}
// UserMembership represents a membership of the user in a namespace or project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/users.html#user-memberships-admin-only
type UserMembership struct {
SourceID int `json:"source_id"`
SourceName string `json:"source_name"`
SourceType string `json:"source_type"`
AccessLevel string `json:"access_level"`
}
// GetUserMembershipOptions represents the options available to query user memberships.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/users.html#user-memberships-admin-only
type GetUserMembershipOptions struct {
ListOptions
Type *string `url:"type,omitempty" json:"type,omitempty"`
}
// GetUserMemberships retrieves a list of the user's memberships.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/users.html#user-memberships-admin-only
func (s *UsersService) GetUserMemberships(user int, opt *GetUserMembershipOptions, options ...RequestOptionFunc) ([]*UserMembership, *Response, error) {
u := fmt.Sprintf("users/%d/memberships", user)
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
}
var m []*UserMembership
resp, err := s.client.Do(req, &m)
if err != nil {
return nil, resp, err
}
return m, resp, err
}