mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	[Vendor] Update xanzy/go-gitlab v0.31.0 => v0.37.0 (#12701)
* update github.com/xanzy/go-gitlab v0.31.0 => v0.37.0 * vendor * adapt changes Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		
							
								
								
									
										3
									
								
								vendor/github.com/xanzy/go-gitlab/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/xanzy/go-gitlab/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -44,6 +44,7 @@ to add new and/or missing endpoints. Currently the following services are suppor | ||||
| - [x] Group Milestones | ||||
| - [x] Group-Level Variables | ||||
| - [x] Groups | ||||
| - [x] Instance Clusters | ||||
| - [x] Issue Boards | ||||
| - [x] Issues | ||||
| - [x] Jobs | ||||
| @@ -161,7 +162,7 @@ func main() { | ||||
| 	s := &gitlab.CreateProjectSnippetOptions{ | ||||
| 		Title:           gitlab.String("Dummy Snippet"), | ||||
| 		FileName:        gitlab.String("snippet.go"), | ||||
| 		Code:            gitlab.String("package main...."), | ||||
| 		Content:         gitlab.String("package main...."), | ||||
| 		Visibility:      gitlab.Visibility(gitlab.PublicVisibility), | ||||
| 	} | ||||
| 	_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s) | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/xanzy/go-gitlab/branches.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/xanzy/go-gitlab/branches.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -38,8 +38,10 @@ type Branch struct { | ||||
| 	Protected          bool    `json:"protected"` | ||||
| 	Merged             bool    `json:"merged"` | ||||
| 	Default            bool    `json:"default"` | ||||
| 	CanPush            bool    `json:"can_push"` | ||||
| 	DevelopersCanPush  bool    `json:"developers_can_push"` | ||||
| 	DevelopersCanMerge bool    `json:"developers_can_merge"` | ||||
| 	WebURL             string  `json:"web_url"` | ||||
| } | ||||
|  | ||||
| func (b Branch) String() string { | ||||
|   | ||||
							
								
								
									
										10
									
								
								vendor/github.com/xanzy/go-gitlab/client_options.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/xanzy/go-gitlab/client_options.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -24,6 +24,16 @@ func WithCustomBackoff(backoff retryablehttp.Backoff) ClientOptionFunc { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // WithCustomLimiter injects a custom rate limiter to the client. | ||||
| func WithCustomLimiter(limiter RateLimiter) ClientOptionFunc { | ||||
| 	return func(c *Client) error { | ||||
| 		c.configureLimiterOnce.Do(func() { | ||||
| 			c.limiter = limiter | ||||
| 		}) | ||||
| 		return nil | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // WithCustomRetry can be used to configure a custom retry policy. | ||||
| func WithCustomRetry(checkRetry retryablehttp.CheckRetry) ClientOptionFunc { | ||||
| 	return func(c *Client) error { | ||||
|   | ||||
							
								
								
									
										13
									
								
								vendor/github.com/xanzy/go-gitlab/commits.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/github.com/xanzy/go-gitlab/commits.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -50,6 +50,7 @@ type Commit struct { | ||||
| 	Status         *BuildStateValue `json:"status"` | ||||
| 	LastPipeline   *PipelineInfo    `json:"last_pipeline"` | ||||
| 	ProjectID      int              `json:"project_id"` | ||||
| 	WebURL         string           `json:"web_url"` | ||||
| } | ||||
|  | ||||
| // CommitStats represents the number of added and deleted files in a commit. | ||||
| @@ -118,11 +119,13 @@ const ( | ||||
|  | ||||
| // 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"` | ||||
| 	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. | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/xanzy/go-gitlab/deployments.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/xanzy/go-gitlab/deployments.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -35,6 +35,7 @@ type Deployment struct { | ||||
| 	Ref         string       `json:"ref"` | ||||
| 	SHA         string       `json:"sha"` | ||||
| 	CreatedAt   *time.Time   `json:"created_at"` | ||||
| 	UpdatedAt   *time.Time   `json:"updated_at"` | ||||
| 	User        *ProjectUser `json:"user"` | ||||
| 	Environment *Environment `json:"environment"` | ||||
| 	Deployable  struct { | ||||
|   | ||||
							
								
								
									
										133
									
								
								vendor/github.com/xanzy/go-gitlab/epic_issues.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								vendor/github.com/xanzy/go-gitlab/epic_issues.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,133 @@ | ||||
| package gitlab | ||||
|  | ||||
| import "fmt" | ||||
|  | ||||
| // EpicIssuesService handles communication with the epic issue related methods | ||||
| // of the GitLab API. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/epic_issues.html | ||||
| type EpicIssuesService struct { | ||||
| 	client *Client | ||||
| } | ||||
|  | ||||
| // EpicIssueAssignment contains both the epic and issue objects returned from | ||||
| // Gitlab with the assignment ID. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/epic_issues.html | ||||
| type EpicIssueAssignment struct { | ||||
| 	ID    int    `json:"id"` | ||||
| 	Epic  *Epic  `json:"epic"` | ||||
| 	Issue *Issue `json:"issue"` | ||||
| } | ||||
|  | ||||
| // ListEpicIssues get a list of epic issues. | ||||
| // | ||||
| // Gitlab API docs: | ||||
| // https://docs.gitlab.com/ee/api/epic_issues.html#list-issues-for-an-epic | ||||
| func (s *EpicIssuesService) ListEpicIssues(gid interface{}, epic int, opt *ListOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/epics/%d/issues", pathEscape(group), epic) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var is []*Issue | ||||
| 	resp, err := s.client.Do(req, &is) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return is, resp, err | ||||
| } | ||||
|  | ||||
| // AssignEpicIssue assigns an existing issue to an epic. | ||||
| // | ||||
| // Gitlab API Docs: | ||||
| // https://docs.gitlab.com/ee/api/epic_issues.html#assign-an-issue-to-the-epic | ||||
| func (s *EpicIssuesService) AssignEpicIssue(gid interface{}, epic, issue int, options ...RequestOptionFunc) (*EpicIssueAssignment, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/epics/%d/issues/%d", pathEscape(group), epic, issue) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("POST", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	a := new(EpicIssueAssignment) | ||||
| 	resp, err := s.client.Do(req, a) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return a, resp, err | ||||
| } | ||||
|  | ||||
| // RemoveEpicIssue removes an issue from an epic. | ||||
| // | ||||
| // Gitlab API Docs: | ||||
| // https://docs.gitlab.com/ee/api/epic_issues.html#remove-an-issue-from-the-epic | ||||
| func (s *EpicIssuesService) RemoveEpicIssue(gid interface{}, epic, epicIssue int, options ...RequestOptionFunc) (*EpicIssueAssignment, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/epics/%d/issues/%d", pathEscape(group), epic, epicIssue) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("DELETE", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	a := new(EpicIssueAssignment) | ||||
| 	resp, err := s.client.Do(req, a) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return a, resp, err | ||||
| } | ||||
|  | ||||
| // UpdateEpicIsssueAssignmentOptions describes the UpdateEpicIssueAssignment() | ||||
| // options. | ||||
| // | ||||
| // Gitlab API Docs: | ||||
| // https://docs.gitlab.com/ee/api/epic_issues.html#update-epic---issue-association | ||||
| type UpdateEpicIsssueAssignmentOptions struct { | ||||
| 	*ListOptions | ||||
| 	MoveBeforeID *int `url:"move_before_id,omitempty" json:"move_before_id,omitempty"` | ||||
| 	MoveAfterID  *int `url:"move_after_id,omitempty" json:"move_after_id,omitempty"` | ||||
| } | ||||
|  | ||||
| // UpdateEpicIssueAssignment moves an issue before or after another issue in an | ||||
| // epic issue list. | ||||
| // | ||||
| // Gitlab API Docs: | ||||
| // https://docs.gitlab.com/ee/api/epic_issues.html#update-epic---issue-association | ||||
| func (s *EpicIssuesService) UpdateEpicIssueAssignment(gid interface{}, epic, epicIssue int, opt *UpdateEpicIsssueAssignmentOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/epics/%d/issues/%d", pathEscape(group), epic, epicIssue) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("PUT", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var is []*Issue | ||||
| 	resp, err := s.client.Do(req, &is) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return is, resp, err | ||||
| } | ||||
							
								
								
									
										63
									
								
								vendor/github.com/xanzy/go-gitlab/epics.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										63
									
								
								vendor/github.com/xanzy/go-gitlab/epics.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -30,16 +30,12 @@ type Epic struct { | ||||
| 	ID                      int         `json:"id"` | ||||
| 	IID                     int         `json:"iid"` | ||||
| 	GroupID                 int         `json:"group_id"` | ||||
| 	Author                  *EpicAuthor `json:"author"` | ||||
| 	ParentID                int         `json:"parent_id"` | ||||
| 	Title                   string      `json:"title"` | ||||
| 	Description             string      `json:"description"` | ||||
| 	State                   string      `json:"state"` | ||||
| 	Upvotes                 int         `json:"upvotes"` | ||||
| 	Downvotes               int         `json:"downvotes"` | ||||
| 	Labels                  []string    `json:"labels"` | ||||
| 	Title                   string      `json:"title"` | ||||
| 	UpdatedAt               *time.Time  `json:"updated_at"` | ||||
| 	CreatedAt               *time.Time  `json:"created_at"` | ||||
| 	UserNotesCount          int         `json:"user_notes_count"` | ||||
| 	WebURL                  string      `json:"web_url"` | ||||
| 	Author                  *EpicAuthor `json:"author"` | ||||
| 	StartDate               *ISOTime    `json:"start_date"` | ||||
| 	StartDateIsFixed        bool        `json:"start_date_is_fixed"` | ||||
| 	StartDateFixed          *ISOTime    `json:"start_date_fixed"` | ||||
| @@ -48,6 +44,13 @@ type Epic struct { | ||||
| 	DueDateIsFixed          bool        `json:"due_date_is_fixed"` | ||||
| 	DueDateFixed            *ISOTime    `json:"due_date_fixed"` | ||||
| 	DueDateFromMilestones   *ISOTime    `json:"due_date_from_milestones"` | ||||
| 	CreatedAt               *time.Time  `json:"created_at"` | ||||
| 	UpdatedAt               *time.Time  `json:"updated_at"` | ||||
| 	Labels                  []string    `json:"labels"` | ||||
| 	Upvotes                 int         `json:"upvotes"` | ||||
| 	Downvotes               int         `json:"downvotes"` | ||||
| 	UserNotesCount          int         `json:"user_notes_count"` | ||||
| 	URL                     string      `json:"url"` | ||||
| } | ||||
|  | ||||
| func (e Epic) String() string { | ||||
| @@ -59,12 +62,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 | ||||
| 	State    *string `url:"state,omitempty" json:"state,omitempty"` | ||||
| 	Labels   Labels  `url:"labels,comma,omitempty" json:"labels,omitempty"` | ||||
| 	AuthorID *int    `url:"author_id,omitempty" json:"author_id,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"` | ||||
| 	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"` | ||||
| } | ||||
|  | ||||
| // ListGroupEpics gets a list of group epics. This function accepts pagination | ||||
| @@ -116,6 +127,30 @@ func (s *EpicsService) GetEpic(gid interface{}, epic int, options ...RequestOpti | ||||
| 	return e, resp, err | ||||
| } | ||||
|  | ||||
| // GetEpicLinks gets all child epics of an epic. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/epic_links.html | ||||
| func (s *EpicsService) GetEpicLinks(gid interface{}, epic int, options ...RequestOptionFunc) ([]*Epic, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/epics/%d/epics", pathEscape(group), epic) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var e []*Epic | ||||
| 	resp, err := s.client.Do(req, &e) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return e, resp, err | ||||
| } | ||||
|  | ||||
| // CreateEpicOptions represents the available CreateEpic() options. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#new-epic | ||||
|   | ||||
							
								
								
									
										9
									
								
								vendor/github.com/xanzy/go-gitlab/event_webhook_types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/xanzy/go-gitlab/event_webhook_types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -85,6 +85,7 @@ type TagEvent struct { | ||||
| 	UserID      int    `json:"user_id"` | ||||
| 	UserName    string `json:"user_name"` | ||||
| 	UserAvatar  string `json:"user_avatar"` | ||||
| 	UserEmail   string `json:"user_email"` | ||||
| 	ProjectID   int    `json:"project_id"` | ||||
| 	Message     string `json:"message"` | ||||
| 	Project     struct { | ||||
| @@ -443,8 +444,8 @@ type IssueCommentEvent struct { | ||||
| 		TimeEstimate        int      `json:"time_estimate"` | ||||
| 		Confidential        bool     `json:"confidential"` | ||||
| 		TotalTimeSpent      int      `json:"total_time_spent"` | ||||
| 		HumanTotalTimeSpent int      `json:"human_total_time_spent"` | ||||
| 		HumanTimeEstimate   int      `json:"human_time_estimate"` | ||||
| 		HumanTotalTimeSpent string   `json:"human_total_time_spent"` | ||||
| 		HumanTimeEstimate   string   `json:"human_time_estimate"` | ||||
| 		AssigneeIDs         []int    `json:"assignee_ids"` | ||||
| 		AssigneeID          int      `json:"assignee_id"` | ||||
| 	} `json:"issue"` | ||||
| @@ -593,6 +594,10 @@ type MergeEvent struct { | ||||
| 			Previous int `json:"previous"` | ||||
| 			Current  int `json:"current"` | ||||
| 		} `json:"source_project_id"` | ||||
| 		StateID struct { | ||||
| 			Previous int `json:"previous"` | ||||
| 			Current  int `json:"current"` | ||||
| 		} `json:"state_id"` | ||||
| 		TargetBranch struct { | ||||
| 			Previous string `json:"previous"` | ||||
| 			Current  string `json:"current"` | ||||
|   | ||||
							
								
								
									
										496
									
								
								vendor/github.com/xanzy/go-gitlab/gitlab.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										496
									
								
								vendor/github.com/xanzy/go-gitlab/gitlab.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -20,7 +20,6 @@ package gitlab | ||||
| import ( | ||||
| 	"context" | ||||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"io/ioutil" | ||||
| @@ -63,268 +62,6 @@ const ( | ||||
| 	privateToken | ||||
| ) | ||||
|  | ||||
| // AccessLevelValue represents a permission level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html | ||||
| type AccessLevelValue int | ||||
|  | ||||
| // List of available access levels | ||||
| // | ||||
| // 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 | ||||
|  | ||||
| 	// These are deprecated and should be removed in a future version | ||||
| 	MasterPermissions AccessLevelValue = 40 | ||||
| 	OwnerPermission   AccessLevelValue = 50 | ||||
| ) | ||||
|  | ||||
| // BuildStateValue represents a GitLab build state. | ||||
| type BuildStateValue string | ||||
|  | ||||
| // These constants represent all valid build states. | ||||
| const ( | ||||
| 	Pending  BuildStateValue = "pending" | ||||
| 	Created  BuildStateValue = "created" | ||||
| 	Running  BuildStateValue = "running" | ||||
| 	Success  BuildStateValue = "success" | ||||
| 	Failed   BuildStateValue = "failed" | ||||
| 	Canceled BuildStateValue = "canceled" | ||||
| 	Skipped  BuildStateValue = "skipped" | ||||
| 	Manual   BuildStateValue = "manual" | ||||
| ) | ||||
|  | ||||
| // DeploymentStatusValue represents a Gitlab deployment status. | ||||
| type DeploymentStatusValue string | ||||
|  | ||||
| // These constants represent all valid deployment statuses. | ||||
| const ( | ||||
| 	DeploymentStatusCreated  DeploymentStatusValue = "created" | ||||
| 	DeploymentStatusRunning  DeploymentStatusValue = "running" | ||||
| 	DeploymentStatusSuccess  DeploymentStatusValue = "success" | ||||
| 	DeploymentStatusFailed   DeploymentStatusValue = "failed" | ||||
| 	DeploymentStatusCanceled DeploymentStatusValue = "canceled" | ||||
| ) | ||||
|  | ||||
| // ISOTime represents an ISO 8601 formatted date | ||||
| type ISOTime time.Time | ||||
|  | ||||
| // ISO 8601 date format | ||||
| const iso8601 = "2006-01-02" | ||||
|  | ||||
| // MarshalJSON implements the json.Marshaler interface | ||||
| func (t ISOTime) MarshalJSON() ([]byte, error) { | ||||
| 	if y := time.Time(t).Year(); y < 0 || y >= 10000 { | ||||
| 		// ISO 8901 uses 4 digits for the years | ||||
| 		return nil, errors.New("json: ISOTime year outside of range [0,9999]") | ||||
| 	} | ||||
|  | ||||
| 	b := make([]byte, 0, len(iso8601)+2) | ||||
| 	b = append(b, '"') | ||||
| 	b = time.Time(t).AppendFormat(b, iso8601) | ||||
| 	b = append(b, '"') | ||||
|  | ||||
| 	return b, nil | ||||
| } | ||||
|  | ||||
| // UnmarshalJSON implements the json.Unmarshaler interface | ||||
| func (t *ISOTime) UnmarshalJSON(data []byte) error { | ||||
| 	// Ignore null, like in the main JSON package | ||||
| 	if string(data) == "null" { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	isotime, err := time.Parse(`"`+iso8601+`"`, string(data)) | ||||
| 	*t = ISOTime(isotime) | ||||
|  | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| // EncodeValues implements the query.Encoder interface | ||||
| func (t *ISOTime) EncodeValues(key string, v *url.Values) error { | ||||
| 	if t == nil || (time.Time(*t)).IsZero() { | ||||
| 		return nil | ||||
| 	} | ||||
| 	v.Add(key, t.String()) | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // String implements the Stringer interface | ||||
| func (t ISOTime) String() string { | ||||
| 	return time.Time(t).Format(iso8601) | ||||
| } | ||||
|  | ||||
| // NotificationLevelValue represents a notification level. | ||||
| type NotificationLevelValue int | ||||
|  | ||||
| // String implements the fmt.Stringer interface. | ||||
| func (l NotificationLevelValue) String() string { | ||||
| 	return notificationLevelNames[l] | ||||
| } | ||||
|  | ||||
| // MarshalJSON implements the json.Marshaler interface. | ||||
| func (l NotificationLevelValue) MarshalJSON() ([]byte, error) { | ||||
| 	return json.Marshal(l.String()) | ||||
| } | ||||
|  | ||||
| // UnmarshalJSON implements the json.Unmarshaler interface. | ||||
| func (l *NotificationLevelValue) UnmarshalJSON(data []byte) error { | ||||
| 	var raw interface{} | ||||
| 	if err := json.Unmarshal(data, &raw); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	switch raw := raw.(type) { | ||||
| 	case float64: | ||||
| 		*l = NotificationLevelValue(raw) | ||||
| 	case string: | ||||
| 		*l = notificationLevelTypes[raw] | ||||
| 	case nil: | ||||
| 		// No action needed. | ||||
| 	default: | ||||
| 		return fmt.Errorf("json: cannot unmarshal %T into Go value of type %T", raw, *l) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // List of valid notification levels. | ||||
| const ( | ||||
| 	DisabledNotificationLevel NotificationLevelValue = iota | ||||
| 	ParticipatingNotificationLevel | ||||
| 	WatchNotificationLevel | ||||
| 	GlobalNotificationLevel | ||||
| 	MentionNotificationLevel | ||||
| 	CustomNotificationLevel | ||||
| ) | ||||
|  | ||||
| var notificationLevelNames = [...]string{ | ||||
| 	"disabled", | ||||
| 	"participating", | ||||
| 	"watch", | ||||
| 	"global", | ||||
| 	"mention", | ||||
| 	"custom", | ||||
| } | ||||
|  | ||||
| var notificationLevelTypes = map[string]NotificationLevelValue{ | ||||
| 	"disabled":      DisabledNotificationLevel, | ||||
| 	"participating": ParticipatingNotificationLevel, | ||||
| 	"watch":         WatchNotificationLevel, | ||||
| 	"global":        GlobalNotificationLevel, | ||||
| 	"mention":       MentionNotificationLevel, | ||||
| 	"custom":        CustomNotificationLevel, | ||||
| } | ||||
|  | ||||
| // VisibilityValue represents a visibility level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type VisibilityValue string | ||||
|  | ||||
| // List of available visibility levels. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	PrivateVisibility  VisibilityValue = "private" | ||||
| 	InternalVisibility VisibilityValue = "internal" | ||||
| 	PublicVisibility   VisibilityValue = "public" | ||||
| ) | ||||
|  | ||||
| // ProjectCreationLevelValue represents a project creation level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type ProjectCreationLevelValue string | ||||
|  | ||||
| // List of available project creation levels. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	NoOneProjectCreation      ProjectCreationLevelValue = "noone" | ||||
| 	MaintainerProjectCreation ProjectCreationLevelValue = "maintainer" | ||||
| 	DeveloperProjectCreation  ProjectCreationLevelValue = "developer" | ||||
| ) | ||||
|  | ||||
| // SubGroupCreationLevelValue represents a sub group creation level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type SubGroupCreationLevelValue string | ||||
|  | ||||
| // List of available sub group creation levels. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	OwnerSubGroupCreationLevelValue      SubGroupCreationLevelValue = "owner" | ||||
| 	MaintainerSubGroupCreationLevelValue SubGroupCreationLevelValue = "maintainer" | ||||
| ) | ||||
|  | ||||
| // VariableTypeValue represents a variable type within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type VariableTypeValue string | ||||
|  | ||||
| // List of available variable types. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	EnvVariableType  VariableTypeValue = "env_var" | ||||
| 	FileVariableType VariableTypeValue = "file" | ||||
| ) | ||||
|  | ||||
| // MergeMethodValue represents a project merge type within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method | ||||
| type MergeMethodValue string | ||||
|  | ||||
| // List of available merge type | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method | ||||
| const ( | ||||
| 	NoFastForwardMerge MergeMethodValue = "merge" | ||||
| 	FastForwardMerge   MergeMethodValue = "ff" | ||||
| 	RebaseMerge        MergeMethodValue = "rebase_merge" | ||||
| ) | ||||
|  | ||||
| // EventTypeValue represents actions type for contribution events | ||||
| type EventTypeValue string | ||||
|  | ||||
| // List of available action type | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/events.html#action-types | ||||
| const ( | ||||
| 	CreatedEventType   EventTypeValue = "created" | ||||
| 	UpdatedEventType   EventTypeValue = "updated" | ||||
| 	ClosedEventType    EventTypeValue = "closed" | ||||
| 	ReopenedEventType  EventTypeValue = "reopened" | ||||
| 	PushedEventType    EventTypeValue = "pushed" | ||||
| 	CommentedEventType EventTypeValue = "commented" | ||||
| 	MergedEventType    EventTypeValue = "merged" | ||||
| 	JoinedEventType    EventTypeValue = "joined" | ||||
| 	LeftEventType      EventTypeValue = "left" | ||||
| 	DestroyedEventType EventTypeValue = "destroyed" | ||||
| 	ExpiredEventType   EventTypeValue = "expired" | ||||
| ) | ||||
|  | ||||
| // EventTargetTypeValue represents actions type value for contribution events | ||||
| type EventTargetTypeValue string | ||||
|  | ||||
| // List of available action type | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/events.html#target-types | ||||
| const ( | ||||
| 	IssueEventTargetType        EventTargetTypeValue = "issue" | ||||
| 	MilestoneEventTargetType    EventTargetTypeValue = "milestone" | ||||
| 	MergeRequestEventTargetType EventTargetTypeValue = "merge_request" | ||||
| 	NoteEventTargetType         EventTargetTypeValue = "note" | ||||
| 	ProjectEventTargetType      EventTargetTypeValue = "project" | ||||
| 	SnippetEventTargetType      EventTargetTypeValue = "snippet" | ||||
| 	UserEventTargetType         EventTargetTypeValue = "user" | ||||
| ) | ||||
|  | ||||
| // A Client manages communication with the GitLab API. | ||||
| type Client struct { | ||||
| 	// HTTP client used to communicate with the API. | ||||
| @@ -338,12 +75,12 @@ type Client struct { | ||||
| 	// disableRetries is used to disable the default retry logic. | ||||
| 	disableRetries bool | ||||
|  | ||||
| 	// configLimiter is used to make sure the limiter is configured exactly | ||||
| 	// configureLimiterOnce is used to make sure the limiter is configured exactly | ||||
| 	// once and block all other calls until the initial (one) call is done. | ||||
| 	configureLimiterOnce sync.Once | ||||
|  | ||||
| 	// Limiter is used to limit API calls and prevent 429 responses. | ||||
| 	limiter *rate.Limiter | ||||
| 	limiter RateLimiter | ||||
|  | ||||
| 	// Token type used to make authenticated API calls. | ||||
| 	authType authType | ||||
| @@ -354,6 +91,9 @@ type Client struct { | ||||
| 	// Token used to make authenticated API calls. | ||||
| 	token string | ||||
|  | ||||
| 	// Protects the token field from concurrent read/write accesses. | ||||
| 	tokenLock sync.RWMutex | ||||
|  | ||||
| 	// User agent used when communicating with the GitLab API. | ||||
| 	UserAgent string | ||||
|  | ||||
| @@ -373,6 +113,7 @@ type Client struct { | ||||
| 	Deployments           *DeploymentsService | ||||
| 	Discussions           *DiscussionsService | ||||
| 	Environments          *EnvironmentsService | ||||
| 	EpicIssues            *EpicIssuesService | ||||
| 	Epics                 *EpicsService | ||||
| 	Events                *EventsService | ||||
| 	Features              *FeaturesService | ||||
| @@ -385,8 +126,11 @@ type Client struct { | ||||
| 	GroupMilestones       *GroupMilestonesService | ||||
| 	GroupVariables        *GroupVariablesService | ||||
| 	Groups                *GroupsService | ||||
| 	InstanceCluster       *InstanceClustersService | ||||
| 	InstanceVariables     *InstanceVariablesService | ||||
| 	IssueLinks            *IssueLinksService | ||||
| 	Issues                *IssuesService | ||||
| 	IssuesStatistics      *IssuesStatisticsService | ||||
| 	Jobs                  *JobsService | ||||
| 	Keys                  *KeysService | ||||
| 	Labels                *LabelsService | ||||
| @@ -406,6 +150,7 @@ type Client struct { | ||||
| 	ProjectCluster        *ProjectClustersService | ||||
| 	ProjectImportExport   *ProjectImportExportService | ||||
| 	ProjectMembers        *ProjectMembersService | ||||
| 	ProjectMirrors        *ProjectMirrorService | ||||
| 	ProjectSnippets       *ProjectSnippetsService | ||||
| 	ProjectVariables      *ProjectVariablesService | ||||
| 	Projects              *ProjectsService | ||||
| @@ -441,6 +186,11 @@ type ListOptions struct { | ||||
| 	PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"` | ||||
| } | ||||
|  | ||||
| // RateLimiter describes the interface that all (custom) rate limiters must implement. | ||||
| type RateLimiter interface { | ||||
| 	Wait(context.Context) error | ||||
| } | ||||
|  | ||||
| // NewClient returns a new GitLab API client. To use API methods which require | ||||
| // authentication, provide a valid private or personal token. | ||||
| func NewClient(token string, options ...ClientOptionFunc) (*Client, error) { | ||||
| @@ -465,11 +215,6 @@ func NewBasicAuthClient(username, password string, options ...ClientOptionFunc) | ||||
| 	client.username = username | ||||
| 	client.password = password | ||||
|  | ||||
| 	err = client.requestOAuthToken(context.Background()) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return client, nil | ||||
| } | ||||
|  | ||||
| @@ -485,22 +230,6 @@ func NewOAuthClient(token string, options ...ClientOptionFunc) (*Client, error) | ||||
| 	return client, nil | ||||
| } | ||||
|  | ||||
| func (c *Client) requestOAuthToken(ctx context.Context) error { | ||||
| 	config := &oauth2.Config{ | ||||
| 		Endpoint: oauth2.Endpoint{ | ||||
| 			AuthURL:  fmt.Sprintf("%s://%s/oauth/authorize", c.BaseURL().Scheme, c.BaseURL().Host), | ||||
| 			TokenURL: fmt.Sprintf("%s://%s/oauth/token", c.BaseURL().Scheme, c.BaseURL().Host), | ||||
| 		}, | ||||
| 	} | ||||
| 	ctx = context.WithValue(ctx, oauth2.HTTPClient, c.client) | ||||
| 	t, err := config.PasswordCredentialsToken(ctx, c.username, c.password) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	c.token = t.AccessToken | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func newClient(options ...ClientOptionFunc) (*Client, error) { | ||||
| 	c := &Client{UserAgent: userAgent} | ||||
|  | ||||
| @@ -547,6 +276,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) { | ||||
| 	c.Deployments = &DeploymentsService{client: c} | ||||
| 	c.Discussions = &DiscussionsService{client: c} | ||||
| 	c.Environments = &EnvironmentsService{client: c} | ||||
| 	c.EpicIssues = &EpicIssuesService{client: c} | ||||
| 	c.Epics = &EpicsService{client: c} | ||||
| 	c.Events = &EventsService{client: c} | ||||
| 	c.Features = &FeaturesService{client: c} | ||||
| @@ -559,8 +289,10 @@ func newClient(options ...ClientOptionFunc) (*Client, error) { | ||||
| 	c.GroupMilestones = &GroupMilestonesService{client: c} | ||||
| 	c.GroupVariables = &GroupVariablesService{client: c} | ||||
| 	c.Groups = &GroupsService{client: c} | ||||
| 	c.InstanceCluster = &InstanceClustersService{client: c} | ||||
| 	c.IssueLinks = &IssueLinksService{client: c} | ||||
| 	c.Issues = &IssuesService{client: c, timeStats: timeStats} | ||||
| 	c.IssuesStatistics = &IssuesStatisticsService{client: c} | ||||
| 	c.Jobs = &JobsService{client: c} | ||||
| 	c.Keys = &KeysService{client: c} | ||||
| 	c.Labels = &LabelsService{client: c} | ||||
| @@ -580,6 +312,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) { | ||||
| 	c.ProjectCluster = &ProjectClustersService{client: c} | ||||
| 	c.ProjectImportExport = &ProjectImportExportService{client: c} | ||||
| 	c.ProjectMembers = &ProjectMembersService{client: c} | ||||
| 	c.ProjectMirrors = &ProjectMirrorService{client: c} | ||||
| 	c.ProjectSnippets = &ProjectSnippetsService{client: c} | ||||
| 	c.ProjectVariables = &ProjectVariablesService{client: c} | ||||
| 	c.Projects = &ProjectsService{client: c} | ||||
| @@ -755,13 +488,6 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Requ | ||||
| 	reqHeaders := make(http.Header) | ||||
| 	reqHeaders.Set("Accept", "application/json") | ||||
|  | ||||
| 	switch c.authType { | ||||
| 	case basicAuth, oAuthToken: | ||||
| 		reqHeaders.Set("Authorization", "Bearer "+c.token) | ||||
| 	case privateToken: | ||||
| 		reqHeaders.Set("PRIVATE-TOKEN", c.token) | ||||
| 	} | ||||
|  | ||||
| 	if c.UserAgent != "" { | ||||
| 		reqHeaders.Set("User-Agent", c.UserAgent) | ||||
| 	} | ||||
| @@ -875,23 +601,47 @@ func (c *Client) Do(req *retryablehttp.Request, v interface{}) (*Response, error | ||||
| 	c.configureLimiterOnce.Do(func() { c.configureLimiter() }) | ||||
|  | ||||
| 	// Wait will block until the limiter can obtain a new token. | ||||
| 	if err := c.limiter.Wait(req.Context()); err != nil { | ||||
| 	err := c.limiter.Wait(req.Context()) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	// Set the correct authentication header. If using basic auth, then check | ||||
| 	// if we already have a token and if not first authenticate and get one. | ||||
| 	var basicAuthToken string | ||||
| 	switch c.authType { | ||||
| 	case basicAuth: | ||||
| 		c.tokenLock.RLock() | ||||
| 		basicAuthToken = c.token | ||||
| 		c.tokenLock.RUnlock() | ||||
| 		if basicAuthToken == "" { | ||||
| 			// If we don't have a token yet, we first need to request one. | ||||
| 			basicAuthToken, err = c.requestOAuthToken(req.Context(), basicAuthToken) | ||||
| 			if err != nil { | ||||
| 				return nil, err | ||||
| 			} | ||||
| 		} | ||||
| 		req.Header.Set("Authorization", "Bearer "+basicAuthToken) | ||||
| 	case oAuthToken: | ||||
| 		req.Header.Set("Authorization", "Bearer "+c.token) | ||||
| 	case privateToken: | ||||
| 		req.Header.Set("PRIVATE-TOKEN", c.token) | ||||
| 	} | ||||
|  | ||||
| 	resp, err := c.client.Do(req) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer resp.Body.Close() | ||||
|  | ||||
| 	if resp.StatusCode == http.StatusUnauthorized && c.authType == basicAuth { | ||||
| 		err = c.requestOAuthToken(req.Context()) | ||||
| 		if err != nil { | ||||
| 		resp.Body.Close() | ||||
| 		// The token most likely expired, so we need to request a new one and try again. | ||||
| 		if _, err := c.requestOAuthToken(req.Context(), basicAuthToken); err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 		return c.Do(req, v) | ||||
| 	} | ||||
| 	defer resp.Body.Close() | ||||
|  | ||||
| 	response := newResponse(resp) | ||||
|  | ||||
| @@ -913,6 +663,32 @@ func (c *Client) Do(req *retryablehttp.Request, v interface{}) (*Response, error | ||||
| 	return response, err | ||||
| } | ||||
|  | ||||
| func (c *Client) requestOAuthToken(ctx context.Context, token string) (string, error) { | ||||
| 	c.tokenLock.Lock() | ||||
| 	defer c.tokenLock.Unlock() | ||||
|  | ||||
| 	// Return early if the token was updated while waiting for the lock. | ||||
| 	if c.token != token { | ||||
| 		return c.token, nil | ||||
| 	} | ||||
|  | ||||
| 	config := &oauth2.Config{ | ||||
| 		Endpoint: oauth2.Endpoint{ | ||||
| 			AuthURL:  strings.TrimSuffix(c.baseURL.String(), apiVersionPath) + "oauth/authorize", | ||||
| 			TokenURL: strings.TrimSuffix(c.baseURL.String(), apiVersionPath) + "oauth/token", | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	ctx = context.WithValue(ctx, oauth2.HTTPClient, c.client.HTTPClient) | ||||
| 	t, err := config.PasswordCredentialsToken(ctx, c.username, c.password) | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
| 	c.token = t.AccessToken | ||||
|  | ||||
| 	return c.token, nil | ||||
| } | ||||
|  | ||||
| // Helper function to accept and format both the project ID or name as project | ||||
| // identifier for all API calls. | ||||
| func parseID(id interface{}) (string, error) { | ||||
| @@ -1012,129 +788,3 @@ func parseError(raw interface{}) string { | ||||
| 		return fmt.Sprintf("failed to parse unexpected error type: %T", raw) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // Bool is a helper routine that allocates a new bool value | ||||
| // to store v and returns a pointer to it. | ||||
| func Bool(v bool) *bool { | ||||
| 	p := new(bool) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // Int is a helper routine that allocates a new int32 value | ||||
| // to store v and returns a pointer to it, but unlike Int32 | ||||
| // its argument value is an int. | ||||
| func Int(v int) *int { | ||||
| 	p := new(int) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // String is a helper routine that allocates a new string value | ||||
| // to store v and returns a pointer to it. | ||||
| func String(v string) *string { | ||||
| 	p := new(string) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // Time is a helper routine that allocates a new time.Time value | ||||
| // to store v and returns a pointer to it. | ||||
| func Time(v time.Time) *time.Time { | ||||
| 	p := new(time.Time) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // AccessLevel is a helper routine that allocates a new AccessLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func AccessLevel(v AccessLevelValue) *AccessLevelValue { | ||||
| 	p := new(AccessLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // BuildState is a helper routine that allocates a new BuildStateValue | ||||
| // to store v and returns a pointer to it. | ||||
| func BuildState(v BuildStateValue) *BuildStateValue { | ||||
| 	p := new(BuildStateValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // DeploymentStatus is a helper routine that allocates a new | ||||
| // DeploymentStatusValue to store v and returns a pointer to it. | ||||
| func DeploymentStatus(v DeploymentStatusValue) *DeploymentStatusValue { | ||||
| 	p := new(DeploymentStatusValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // NotificationLevel is a helper routine that allocates a new NotificationLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue { | ||||
| 	p := new(NotificationLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // VariableType is a helper routine that allocates a new VariableTypeValue | ||||
| // to store v and returns a pointer to it. | ||||
| func VariableType(v VariableTypeValue) *VariableTypeValue { | ||||
| 	p := new(VariableTypeValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // Visibility is a helper routine that allocates a new VisibilityValue | ||||
| // to store v and returns a pointer to it. | ||||
| func Visibility(v VisibilityValue) *VisibilityValue { | ||||
| 	p := new(VisibilityValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // ProjectCreationLevel is a helper routine that allocates a new ProjectCreationLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func ProjectCreationLevel(v ProjectCreationLevelValue) *ProjectCreationLevelValue { | ||||
| 	p := new(ProjectCreationLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // SubGroupCreationLevel is a helper routine that allocates a new SubGroupCreationLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func SubGroupCreationLevel(v SubGroupCreationLevelValue) *SubGroupCreationLevelValue { | ||||
| 	p := new(SubGroupCreationLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // MergeMethod is a helper routine that allocates a new MergeMethod | ||||
| // to sotre v and returns a pointer to it. | ||||
| func MergeMethod(v MergeMethodValue) *MergeMethodValue { | ||||
| 	p := new(MergeMethodValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // BoolValue is a boolean value with advanced json unmarshaling features. | ||||
| type BoolValue bool | ||||
|  | ||||
| // UnmarshalJSON allows 1 and 0 to be considered as boolean values | ||||
| // Needed for https://gitlab.com/gitlab-org/gitlab-ce/issues/50122 | ||||
| func (t *BoolValue) UnmarshalJSON(b []byte) error { | ||||
| 	switch string(b) { | ||||
| 	case `"1"`: | ||||
| 		*t = true | ||||
| 		return nil | ||||
| 	case `"0"`: | ||||
| 		*t = false | ||||
| 		return nil | ||||
| 	default: | ||||
| 		var v bool | ||||
| 		err := json.Unmarshal(b, &v) | ||||
| 		*t = BoolValue(v) | ||||
| 		return err | ||||
| 	} | ||||
| } | ||||
|   | ||||
							
								
								
									
										18
									
								
								vendor/github.com/xanzy/go-gitlab/group_clusters.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/github.com/xanzy/go-gitlab/group_clusters.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -93,13 +93,13 @@ func (s *GroupClustersService) GetCluster(pid interface{}, cluster int, options | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	pc := new(GroupCluster) | ||||
| 	resp, err := s.client.Do(req, &pc) | ||||
| 	gc := new(GroupCluster) | ||||
| 	resp, err := s.client.Do(req, &gc) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return pc, resp, err | ||||
| 	return gc, resp, err | ||||
| } | ||||
|  | ||||
| // AddGroupClusterOptions represents the available AddCluster() options. | ||||
| @@ -141,13 +141,13 @@ func (s *GroupClustersService) AddCluster(pid interface{}, opt *AddGroupClusterO | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	pc := new(GroupCluster) | ||||
| 	resp, err := s.client.Do(req, pc) | ||||
| 	gc := new(GroupCluster) | ||||
| 	resp, err := s.client.Do(req, gc) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return pc, resp, err | ||||
| 	return gc, resp, err | ||||
| } | ||||
|  | ||||
| // EditGroupClusterOptions represents the available EditCluster() options. | ||||
| @@ -185,13 +185,13 @@ func (s *GroupClustersService) EditCluster(pid interface{}, cluster int, opt *Ed | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	pc := new(GroupCluster) | ||||
| 	resp, err := s.client.Do(req, pc) | ||||
| 	gc := new(GroupCluster) | ||||
| 	resp, err := s.client.Do(req, gc) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return pc, resp, err | ||||
| 	return gc, resp, err | ||||
| } | ||||
|  | ||||
| // DeleteCluster deletes an existing group cluster. | ||||
|   | ||||
							
								
								
									
										29
									
								
								vendor/github.com/xanzy/go-gitlab/group_labels.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										29
									
								
								vendor/github.com/xanzy/go-gitlab/group_labels.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -51,6 +51,35 @@ func (s *GroupLabelsService) ListGroupLabels(gid interface{}, opt *ListGroupLabe | ||||
| 	return l, resp, err | ||||
| } | ||||
|  | ||||
| // GetGroupLabel get a single label for a given group. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/group_labels.html#get-a-single-group-label | ||||
| func (s *GroupLabelsService) GetGroupLabel(gid interface{}, labelID interface{}, options ...RequestOptionFunc) (*GroupLabel, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	label, err := parseID(labelID) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/labels/%s", pathEscape(group), label) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var l *GroupLabel | ||||
| 	resp, err := s.client.Do(req, &l) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return l, resp, err | ||||
| } | ||||
|  | ||||
| // CreateGroupLabelOptions represents the available CreateGroupLabel() options. | ||||
| // | ||||
| // GitLab API docs: | ||||
|   | ||||
							
								
								
									
										44
									
								
								vendor/github.com/xanzy/go-gitlab/group_members.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										44
									
								
								vendor/github.com/xanzy/go-gitlab/group_members.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -176,6 +176,50 @@ func (s *GroupMembersService) AddGroupMember(gid interface{}, opt *AddGroupMembe | ||||
| 	return gm, resp, err | ||||
| } | ||||
|  | ||||
| // ShareWithGroup shares a group with the group. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/groups.html#share-groups-with-groups | ||||
| func (s *GroupMembersService) ShareWithGroup(gid interface{}, opt *ShareWithGroupOptions, options ...RequestOptionFunc) (*Group, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/share", pathEscape(group)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("POST", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	g := new(Group) | ||||
| 	resp, err := s.client.Do(req, g) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return g, resp, err | ||||
| } | ||||
|  | ||||
| // DeleteShareWithGroup allows to unshare a group from a group. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/groups.html#delete-link-sharing-group-with-another-group | ||||
| func (s *GroupMembersService) DeleteShareWithGroup(gid interface{}, groupID int, options ...RequestOptionFunc) (*Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/share/%d", pathEscape(group), groupID) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("DELETE", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
|  | ||||
| // EditGroupMemberOptions represents the available EditGroupMember() | ||||
| // options. | ||||
| // | ||||
|   | ||||
							
								
								
									
										39
									
								
								vendor/github.com/xanzy/go-gitlab/group_milestones.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										39
									
								
								vendor/github.com/xanzy/go-gitlab/group_milestones.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -247,3 +247,42 @@ func (s *GroupMilestonesService) GetGroupMilestoneMergeRequests(gid interface{}, | ||||
|  | ||||
| 	return mr, resp, err | ||||
| } | ||||
|  | ||||
| type BurndownChartEvent struct { | ||||
| 	CreatedAt *time.Time `json:"created_at"` | ||||
| 	Weight    *int       `json:"weight"` | ||||
| 	Action    *string    `json:"action"` | ||||
| } | ||||
|  | ||||
| // GetGroupMilestoneBurndownChartEventsOptions represents the available | ||||
| // GetGroupMilestoneBurndownChartEventsOptions() options. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/group_milestones.html#get-all-burndown-chart-events-for-a-single-milestone-starter | ||||
| type GetGroupMilestoneBurndownChartEventsOptions ListOptions | ||||
|  | ||||
| // GetGroupMilestoneBurndownChartEvents gets all merge requests assigned to a | ||||
| // single group milestone. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/group_milestones.html#get-all-burndown-chart-events-for-a-single-milestone-starter | ||||
| func (s *GroupMilestonesService) GetGroupMilestoneBurndownChartEvents(gid interface{}, milestone int, opt *GetGroupMilestoneBurndownChartEventsOptions, options ...RequestOptionFunc) ([]*BurndownChartEvent, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/milestones/%d/burndown_events", pathEscape(group), milestone) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var be []*BurndownChartEvent | ||||
| 	resp, err := s.client.Do(req, &be) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return be, resp, err | ||||
| } | ||||
|   | ||||
							
								
								
									
										76
									
								
								vendor/github.com/xanzy/go-gitlab/groups.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								vendor/github.com/xanzy/go-gitlab/groups.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -18,6 +18,7 @@ package gitlab | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| // GroupsService handles communication with the group related methods of | ||||
| @@ -32,38 +33,46 @@ type GroupsService struct { | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html | ||||
| type Group struct { | ||||
| 	ID                             int                        `json:"id"` | ||||
| 	Name                           string                     `json:"name"` | ||||
| 	Path                           string                     `json:"path"` | ||||
| 	Description                    string                     `json:"description"` | ||||
| 	MembershipLock                 bool                       `json:"membership_lock"` | ||||
| 	Visibility                     VisibilityValue            `json:"visibility"` | ||||
| 	LFSEnabled                     bool                       `json:"lfs_enabled"` | ||||
| 	AvatarURL                      string                     `json:"avatar_url"` | ||||
| 	WebURL                         string                     `json:"web_url"` | ||||
| 	RequestAccessEnabled           bool                       `json:"request_access_enabled"` | ||||
| 	FullName                       string                     `json:"full_name"` | ||||
| 	FullPath                       string                     `json:"full_path"` | ||||
| 	ParentID                       int                        `json:"parent_id"` | ||||
| 	Projects                       []*Project                 `json:"projects"` | ||||
| 	Statistics                     *StorageStatistics         `json:"statistics"` | ||||
| 	CustomAttributes               []*CustomAttribute         `json:"custom_attributes"` | ||||
| 	ShareWithGroupLock             bool                       `json:"share_with_group_lock"` | ||||
| 	RequireTwoFactorAuth           bool                       `json:"require_two_factor_authentication"` | ||||
| 	TwoFactorGracePeriod           int                        `json:"two_factor_grace_period"` | ||||
| 	ProjectCreationLevel           ProjectCreationLevelValue  `json:"project_creation_level"` | ||||
| 	AutoDevopsEnabled              bool                       `json:"auto_devops_enabled"` | ||||
| 	SubGroupCreationLevel          SubGroupCreationLevelValue `json:"subgroup_creation_level"` | ||||
| 	EmailsDisabled                 bool                       `json:"emails_disabled"` | ||||
| 	MentionsDisabled               bool                       `json:"mentions_disabled"` | ||||
| 	RunnersToken                   string                     `json:"runners_token"` | ||||
| 	SharedProjects                 []*Project                 `json:"shared_projects"` | ||||
| 	LDAPCN                         string                     `json:"ldap_cn"` | ||||
| 	LDAPAccess                     AccessLevelValue           `json:"ldap_access"` | ||||
| 	LDAPGroupLinks                 []*LDAPGroupLink           `json:"ldap_group_links"` | ||||
| 	SharedRunnersMinutesLimit      int                        `json:"shared_runners_minutes_limit"` | ||||
| 	ExtraSharedRunnersMinutesLimit int                        `json:"extra_shared_runners_minutes_limit"` | ||||
| 	MarkedForDeletionOn            *ISOTime                   `json:"marked_for_deletion_on"` | ||||
| 	ID                    int                        `json:"id"` | ||||
| 	Name                  string                     `json:"name"` | ||||
| 	Path                  string                     `json:"path"` | ||||
| 	Description           string                     `json:"description"` | ||||
| 	MembershipLock        bool                       `json:"membership_lock"` | ||||
| 	Visibility            VisibilityValue            `json:"visibility"` | ||||
| 	LFSEnabled            bool                       `json:"lfs_enabled"` | ||||
| 	AvatarURL             string                     `json:"avatar_url"` | ||||
| 	WebURL                string                     `json:"web_url"` | ||||
| 	RequestAccessEnabled  bool                       `json:"request_access_enabled"` | ||||
| 	FullName              string                     `json:"full_name"` | ||||
| 	FullPath              string                     `json:"full_path"` | ||||
| 	ParentID              int                        `json:"parent_id"` | ||||
| 	Projects              []*Project                 `json:"projects"` | ||||
| 	Statistics            *StorageStatistics         `json:"statistics"` | ||||
| 	CustomAttributes      []*CustomAttribute         `json:"custom_attributes"` | ||||
| 	ShareWithGroupLock    bool                       `json:"share_with_group_lock"` | ||||
| 	RequireTwoFactorAuth  bool                       `json:"require_two_factor_authentication"` | ||||
| 	TwoFactorGracePeriod  int                        `json:"two_factor_grace_period"` | ||||
| 	ProjectCreationLevel  ProjectCreationLevelValue  `json:"project_creation_level"` | ||||
| 	AutoDevopsEnabled     bool                       `json:"auto_devops_enabled"` | ||||
| 	SubGroupCreationLevel SubGroupCreationLevelValue `json:"subgroup_creation_level"` | ||||
| 	EmailsDisabled        bool                       `json:"emails_disabled"` | ||||
| 	MentionsDisabled      bool                       `json:"mentions_disabled"` | ||||
| 	RunnersToken          string                     `json:"runners_token"` | ||||
| 	SharedProjects        []*Project                 `json:"shared_projects"` | ||||
| 	SharedWithGroups      []struct { | ||||
| 		GroupID          int      `json:"group_id"` | ||||
| 		GroupName        string   `json:"group_name"` | ||||
| 		GroupFullPath    string   `json:"group_full_path"` | ||||
| 		GroupAccessLevel int      `json:"group_access_level"` | ||||
| 		ExpiresAt        *ISOTime `json:"expires_at"` | ||||
| 	} `json:"shared_with_groups"` | ||||
| 	LDAPCN                         string           `json:"ldap_cn"` | ||||
| 	LDAPAccess                     AccessLevelValue `json:"ldap_access"` | ||||
| 	LDAPGroupLinks                 []*LDAPGroupLink `json:"ldap_group_links"` | ||||
| 	SharedRunnersMinutesLimit      int              `json:"shared_runners_minutes_limit"` | ||||
| 	ExtraSharedRunnersMinutesLimit int              `json:"extra_shared_runners_minutes_limit"` | ||||
| 	MarkedForDeletionOn            *ISOTime         `json:"marked_for_deletion_on"` | ||||
| 	CreatedAt                      *time.Time       `json:"created_at"` | ||||
| } | ||||
|  | ||||
| type LDAPGroupLink struct { | ||||
| @@ -85,6 +94,7 @@ type ListGroupsOptions struct { | ||||
| 	SkipGroups           []int             `url:"skip_groups,omitempty" json:"skip_groups,omitempty"` | ||||
| 	Sort                 *string           `url:"sort,omitempty" json:"sort,omitempty"` | ||||
| 	Statistics           *bool             `url:"statistics,omitempty" json:"statistics,omitempty"` | ||||
| 	TopLevelOnly         *bool             `url:"top_level_only,omitempty" json:"top_level_only,omitempty"` | ||||
| 	WithCustomAttributes *bool             `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` | ||||
| } | ||||
|  | ||||
| @@ -388,7 +398,7 @@ func (s *GroupsService) ListGroupLDAPLinks(gid interface{}, options ...RequestOp | ||||
| type AddGroupLDAPLinkOptions struct { | ||||
| 	CN          *string `url:"cn,omitempty" json:"cn,omitempty"` | ||||
| 	GroupAccess *int    `url:"group_access,omitempty" json:"group_access,omitempty"` | ||||
| 	Provider    *string `url:"provider,omitempty" json:"provider,ommitempty"` | ||||
| 	Provider    *string `url:"provider,omitempty" json:"provider,omitempty"` | ||||
| } | ||||
|  | ||||
| // AddGroupLDAPLink creates a new group LDAP link. Available only for users who | ||||
|   | ||||
							
								
								
									
										151
									
								
								vendor/github.com/xanzy/go-gitlab/instance_clusters.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								vendor/github.com/xanzy/go-gitlab/instance_clusters.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,151 @@ | ||||
| // | ||||
| // Copyright 2020, Serena Fang | ||||
| // | ||||
| // 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" | ||||
| ) | ||||
|  | ||||
| // InstanceClustersService handles communication with the | ||||
| // instance clusters related methods of the GitLab API. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_clusters.html | ||||
| type InstanceClustersService struct { | ||||
| 	client *Client | ||||
| } | ||||
|  | ||||
| // InstanceCluster represents a GitLab Instance Cluster. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/instance_clusters.html | ||||
| type InstanceCluster struct { | ||||
| 	ID                 int                 `json:"id"` | ||||
| 	Name               string              `json:"name"` | ||||
| 	Domain             string              `json:"domain"` | ||||
| 	CreatedAt          *time.Time          `json:"created_at"` | ||||
| 	ProviderType       string              `json:"provider_type"` | ||||
| 	PlatformType       string              `json:"platform_type"` | ||||
| 	EnvironmentScope   string              `json:"environment_scope"` | ||||
| 	ClusterType        string              `json:"cluster_type"` | ||||
| 	User               *User               `json:"user"` | ||||
| 	PlatformKubernetes *PlatformKubernetes `json:"platform_kubernetes"` | ||||
| 	ManagementProject  *ManagementProject  `json:"management_project"` | ||||
| } | ||||
|  | ||||
| func (v InstanceCluster) String() string { | ||||
| 	return Stringify(v) | ||||
| } | ||||
|  | ||||
| // ListClusters gets a list of all instance clusters. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_clusters.html#list-instance-clusters | ||||
| func (s *InstanceClustersService) ListClusters(options ...RequestOptionFunc) ([]*InstanceCluster, *Response, error) { | ||||
| 	u := "admin/clusters" | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var ics []*InstanceCluster | ||||
| 	resp, err := s.client.Do(req, &ics) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return ics, resp, err | ||||
| } | ||||
|  | ||||
| // GetCluster gets an instance cluster. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_clusters.html#get-a-single-instance-cluster | ||||
| func (s *InstanceClustersService) GetCluster(cluster int, options ...RequestOptionFunc) (*InstanceCluster, *Response, error) { | ||||
| 	u := fmt.Sprintf("admin/clusters/%d", cluster) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	ic := new(InstanceCluster) | ||||
| 	resp, err := s.client.Do(req, &ic) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return ic, resp, err | ||||
| } | ||||
|  | ||||
| // AddCluster adds an existing cluster to the instance. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_clusters.html#add-existing-instance-cluster | ||||
| func (s *InstanceClustersService) AddCluster(opt *AddClusterOptions, options ...RequestOptionFunc) (*InstanceCluster, *Response, error) { | ||||
| 	u := "admin/clusters/add" | ||||
|  | ||||
| 	req, err := s.client.NewRequest("POST", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	ic := new(InstanceCluster) | ||||
| 	resp, err := s.client.Do(req, ic) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return ic, resp, err | ||||
| } | ||||
|  | ||||
| // EditCluster updates an existing instance cluster. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_clusters.html#edit-instance-cluster | ||||
| func (s *InstanceClustersService) EditCluster(cluster int, opt *EditClusterOptions, options ...RequestOptionFunc) (*InstanceCluster, *Response, error) { | ||||
| 	u := fmt.Sprintf("admin/clusters/%d", cluster) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("PUT", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	ic := new(InstanceCluster) | ||||
| 	resp, err := s.client.Do(req, ic) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return ic, resp, err | ||||
| } | ||||
|  | ||||
| // DeleteCluster deletes an existing instance cluster. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_clusters.html#delete-instance-cluster | ||||
| func (s *InstanceClustersService) DeleteCluster(cluster int, options ...RequestOptionFunc) (*Response, error) { | ||||
| 	u := fmt.Sprintf("admin/clusters/%d", cluster) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("DELETE", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
							
								
								
									
										179
									
								
								vendor/github.com/xanzy/go-gitlab/instance_variables.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								vendor/github.com/xanzy/go-gitlab/instance_variables.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,179 @@ | ||||
| // | ||||
| // Copyright 2018, Patrick Webster | ||||
| // | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| //     http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
| // | ||||
|  | ||||
| package gitlab | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"net/url" | ||||
| ) | ||||
|  | ||||
| // InstanceVariablesService handles communication with the | ||||
| // instance level CI variables related methods of the GitLab API. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html | ||||
| type InstanceVariablesService struct { | ||||
| 	client *Client | ||||
| } | ||||
|  | ||||
| // InstanceVariable represents a GitLab instance level CI Variable. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html | ||||
| type InstanceVariable struct { | ||||
| 	Key          string            `json:"key"` | ||||
| 	Value        string            `json:"value"` | ||||
| 	VariableType VariableTypeValue `json:"variable_type"` | ||||
| 	Protected    bool              `json:"protected"` | ||||
| 	Masked       bool              `json:"masked"` | ||||
| } | ||||
|  | ||||
| func (v InstanceVariable) String() string { | ||||
| 	return Stringify(v) | ||||
| } | ||||
|  | ||||
| // ListInstanceVariablesOptions represents the available options for listing variables | ||||
| // for an instance. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#list-all-instance-variables | ||||
| type ListInstanceVariablesOptions ListOptions | ||||
|  | ||||
| // ListVariables gets a list of all variables for an instance. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#list-all-instance-variables | ||||
| func (s *InstanceVariablesService) ListVariables(opt *ListInstanceVariablesOptions, options ...RequestOptionFunc) ([]*InstanceVariable, *Response, error) { | ||||
| 	u := "admin/ci/variables" | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var vs []*InstanceVariable | ||||
| 	resp, err := s.client.Do(req, &vs) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return vs, resp, err | ||||
| } | ||||
|  | ||||
| // GetVariable gets a variable. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#show-instance-variable-details | ||||
| func (s *InstanceVariablesService) GetVariable(key string, options ...RequestOptionFunc) (*InstanceVariable, *Response, error) { | ||||
| 	u := fmt.Sprintf("admin/ci/variables/%s", url.PathEscape(key)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	v := new(InstanceVariable) | ||||
| 	resp, err := s.client.Do(req, v) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return v, resp, err | ||||
| } | ||||
|  | ||||
| // CreateInstanceVariableOptions represents the available CreateVariable() | ||||
| // options. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#create-instance-variable | ||||
| type CreateInstanceVariableOptions struct { | ||||
| 	Key          *string            `url:"key,omitempty" json:"key,omitempty"` | ||||
| 	Value        *string            `url:"value,omitempty" json:"value,omitempty"` | ||||
| 	VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` | ||||
| 	Protected    *bool              `url:"protected,omitempty" json:"protected,omitempty"` | ||||
| 	Masked       *bool              `url:"masked,omitempty" json:"masked,omitempty"` | ||||
| } | ||||
|  | ||||
| // CreateVariable creates a new instance level CI variable. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#create-instance-variable | ||||
| func (s *InstanceVariablesService) CreateVariable(opt *CreateInstanceVariableOptions, options ...RequestOptionFunc) (*InstanceVariable, *Response, error) { | ||||
| 	u := "admin/ci/variables" | ||||
|  | ||||
| 	req, err := s.client.NewRequest("POST", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	v := new(InstanceVariable) | ||||
| 	resp, err := s.client.Do(req, v) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return v, resp, err | ||||
| } | ||||
|  | ||||
| // UpdateInstanceVariableOptions represents the available UpdateVariable() | ||||
| // options. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#update-instance-variable | ||||
| type UpdateInstanceVariableOptions struct { | ||||
| 	Value        *string            `url:"value,omitempty" json:"value,omitempty"` | ||||
| 	VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` | ||||
| 	Protected    *bool              `url:"protected,omitempty" json:"protected,omitempty"` | ||||
| 	Masked       *bool              `url:"masked,omitempty" json:"masked,omitempty"` | ||||
| } | ||||
|  | ||||
| // UpdateVariable updates the position of an existing | ||||
| // instance level CI variable. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#update-instance-variable | ||||
| func (s *InstanceVariablesService) UpdateVariable(key string, opt *UpdateInstanceVariableOptions, options ...RequestOptionFunc) (*InstanceVariable, *Response, error) { | ||||
| 	u := fmt.Sprintf("admin/ci/variables/%s", url.PathEscape(key)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("PUT", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	v := new(InstanceVariable) | ||||
| 	resp, err := s.client.Do(req, v) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return v, resp, err | ||||
| } | ||||
|  | ||||
| // RemoveVariable removes an instance level CI variable. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/instance_level_ci_variables.html#remove-instance-variable | ||||
| func (s *InstanceVariablesService) RemoveVariable(key string, options ...RequestOptionFunc) (*Response, error) { | ||||
| 	u := fmt.Sprintf("admin/ci/variables/%s", url.PathEscape(key)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("DELETE", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
							
								
								
									
										220
									
								
								vendor/github.com/xanzy/go-gitlab/issues.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										220
									
								
								vendor/github.com/xanzy/go-gitlab/issues.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -17,6 +17,7 @@ | ||||
| package gitlab | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| 	"net/url" | ||||
| @@ -60,6 +61,16 @@ type IssueReferences struct { | ||||
| 	Full     string `json:"full"` | ||||
| } | ||||
|  | ||||
| // IssueCloser represents a closer of the issue. | ||||
| type IssueCloser struct { | ||||
| 	ID        int    `json:"id"` | ||||
| 	State     string `json:"state"` | ||||
| 	WebURL    string `json:"web_url"` | ||||
| 	Name      string `json:"name"` | ||||
| 	AvatarURL string `json:"avatar_url"` | ||||
| 	Username  string `json:"username"` | ||||
| } | ||||
|  | ||||
| // IssueLinks represents links of the issue. | ||||
| type IssueLinks struct { | ||||
| 	Self       string `json:"self"` | ||||
| @@ -83,9 +94,11 @@ type Issue struct { | ||||
| 	Assignee             *IssueAssignee   `json:"assignee"` | ||||
| 	UpdatedAt            *time.Time       `json:"updated_at"` | ||||
| 	ClosedAt             *time.Time       `json:"closed_at"` | ||||
| 	ClosedBy             *IssueCloser     `json:"closed_by"` | ||||
| 	Title                string           `json:"title"` | ||||
| 	CreatedAt            *time.Time       `json:"created_at"` | ||||
| 	Labels               Labels           `json:"labels"` | ||||
| 	LabelDetails         []*LabelDetails  `json:"label_details"` | ||||
| 	Upvotes              int              `json:"upvotes"` | ||||
| 	Downvotes            int              `json:"downvotes"` | ||||
| 	DueDate              *ISOTime         `json:"due_date"` | ||||
| @@ -100,6 +113,8 @@ type Issue struct { | ||||
| 	Links                *IssueLinks      `json:"_links"` | ||||
| 	IssueLinkID          int              `json:"issue_link_id"` | ||||
| 	MergeRequestCount    int              `json:"merge_requests_count"` | ||||
| 	EpicIssueID          int              `json:"epic_issue_id"` | ||||
| 	Epic                 *Epic            `json:"epic"` | ||||
| 	TaskCompletionStatus struct { | ||||
| 		Count          int `json:"count"` | ||||
| 		CompletedCount int `json:"completed_count"` | ||||
| @@ -110,42 +125,104 @@ func (i Issue) String() string { | ||||
| 	return Stringify(i) | ||||
| } | ||||
|  | ||||
| func (i *Issue) UnmarshalJSON(data []byte) error { | ||||
| 	type alias Issue | ||||
|  | ||||
| 	raw := make(map[string]interface{}) | ||||
| 	err := json.Unmarshal(data, &raw) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	labelDetails, ok := raw["labels"].([]interface{}) | ||||
| 	if ok && len(labelDetails) > 0 { | ||||
| 		// We only want to change anything if we got label details. | ||||
| 		if _, ok := labelDetails[0].(map[string]interface{}); !ok { | ||||
| 			return json.Unmarshal(data, (*alias)(i)) | ||||
| 		} | ||||
|  | ||||
| 		labels := make([]interface{}, len(labelDetails)) | ||||
| 		for i, details := range labelDetails { | ||||
| 			labels[i] = details.(map[string]interface{})["name"] | ||||
| 		} | ||||
|  | ||||
| 		// Set the correct values | ||||
| 		raw["labels"] = labels | ||||
| 		raw["label_details"] = labelDetails | ||||
|  | ||||
| 		data, err = json.Marshal(raw) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	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"` | ||||
| 	Name            string `json:"name"` | ||||
| 	Color           string `json:"color"` | ||||
| 	Description     string `json:"description"` | ||||
| 	DescriptionHTML string `json:"description_html"` | ||||
| 	TextColor       string `json:"text_color"` | ||||
| } | ||||
|  | ||||
| // ListIssuesOptions represents the available ListIssues() options. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues | ||||
| type ListIssuesOptions struct { | ||||
| 	ListOptions | ||||
| 	State            *string    `url:"state,omitempty" json:"state,omitempty"` | ||||
| 	Labels           Labels     `url:"labels,comma,omitempty" json:"labels,omitempty"` | ||||
| 	WithLabelDetails *bool      `url:"with_labels_details,omitempty" json:"with_labels_details,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"` | ||||
| 	AssigneeID       *int       `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` | ||||
| 	MyReactionEmoji  *string    `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` | ||||
| 	IIDs             []int      `url:"iids[],omitempty" json:"iids,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"` | ||||
| 	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"` | ||||
| 	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"` | ||||
| 	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"` | ||||
| 	AssigneeID         *int       `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` | ||||
| 	NotAssigneeID      []int      `url:"not[assignee_id],omitempty" json:"not[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"` | ||||
| 	NotMyReactionEmoji []string   `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"` | ||||
| 	IIDs               []int      `url:"iids[],omitempty" json:"iids,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"` | ||||
| 	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"` | ||||
| } | ||||
|  | ||||
| // ListIssues gets all issues created by authenticated user. This function | ||||
| @@ -172,22 +249,30 @@ func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...RequestOpt | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/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"` | ||||
| 	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"` | ||||
| 	AssigneeID      *int       `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` | ||||
| 	MyReactionEmoji *string    `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,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"` | ||||
| 	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"` | ||||
| 	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"` | ||||
| 	AssigneeID         *int       `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` | ||||
| 	NotAssigneeID      []int      `url:"not[assignee_id],omitempty" json:"not[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"` | ||||
| 	NotMyReactionEmoji []string   `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],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"` | ||||
| 	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"` | ||||
| } | ||||
|  | ||||
| // ListGroupIssues gets a list of group issues. This function accepts | ||||
| @@ -220,24 +305,30 @@ func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOpt | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues | ||||
| 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"` | ||||
| 	WithLabelDetails *bool      `url:"with_labels_details,omitempty" json:"with_labels_details,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"` | ||||
| 	AssigneeID       *int       `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` | ||||
| 	MyReactionEmoji  *string    `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,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"` | ||||
| 	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"` | ||||
| 	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"` | ||||
| 	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"` | ||||
| 	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"` | ||||
| 	AssigneeID         *int       `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` | ||||
| 	NotAssigneeID      []int      `url:"not[assignee_id],omitempty" json:"not[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"` | ||||
| 	NotMyReactionEmoji []string   `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],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"` | ||||
| 	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"` | ||||
| } | ||||
|  | ||||
| // ListProjectIssues gets a list of project issues. This function accepts | ||||
| @@ -341,6 +432,8 @@ type UpdateIssueOptions struct { | ||||
| 	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"` | ||||
| @@ -585,3 +678,28 @@ func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...Re | ||||
| func (s *IssuesService) GetTimeSpent(pid interface{}, issue int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { | ||||
| 	return s.timeStats.getTimeSpent(pid, "issues", issue, options...) | ||||
| } | ||||
|  | ||||
| // GetParticipants gets a list of issue participants. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/issues.html#participants-on-issues | ||||
| func (s *IssuesService) GetParticipants(pid interface{}, issue int, options ...RequestOptionFunc) ([]*BasicUser, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/issues/%d/participants", pathEscape(project), issue) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var bu []*BasicUser | ||||
| 	resp, err := s.client.Do(req, &bu) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return bu, resp, err | ||||
| } | ||||
|   | ||||
							
								
								
									
										186
									
								
								vendor/github.com/xanzy/go-gitlab/issues_statistics.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										186
									
								
								vendor/github.com/xanzy/go-gitlab/issues_statistics.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,186 @@ | ||||
| // | ||||
| // Copyright 2017, Sander van Harmelen | ||||
| // | ||||
| // 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" | ||||
| ) | ||||
|  | ||||
| // IssuesStatisticsService handles communication with the issues statistics | ||||
| // related methods of the GitLab API. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/issues_statistics.html | ||||
| type IssuesStatisticsService struct { | ||||
| 	client *Client | ||||
| } | ||||
|  | ||||
| // IssuesStatistics represents a GitLab issues statistic. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/issues_statistics.html | ||||
| type IssuesStatistics struct { | ||||
| 	Statistics struct { | ||||
| 		Counts struct { | ||||
| 			All    int `json:"all"` | ||||
| 			Closed int `json:"closed"` | ||||
| 			Opened int `json:"opened"` | ||||
| 		} `json:"counts"` | ||||
| 	} `json:"statistics"` | ||||
| } | ||||
|  | ||||
| func (n IssuesStatistics) String() string { | ||||
| 	return Stringify(n) | ||||
| } | ||||
|  | ||||
| // GetIssuesStatisticsOptions represents the available GetIssuesStatistics() options. | ||||
| // | ||||
| // 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        *Milestone `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 | ||||
| // user has access to. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/issues_statistics.html#get-issues-statistics | ||||
| func (s *IssuesStatisticsService) GetIssuesStatistics(opt *GetIssuesStatisticsOptions, options ...RequestOptionFunc) (*IssuesStatistics, *Response, error) { | ||||
| 	req, err := s.client.NewRequest("GET", "issues_statistics", opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	is := new(IssuesStatistics) | ||||
| 	resp, err := s.client.Do(req, is) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return is, resp, err | ||||
| } | ||||
|  | ||||
| // GetGroupIssuesStatisticsOptions represents the available GetGroupIssuesStatistics() | ||||
| // options. | ||||
| // | ||||
| // 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        *Milestone `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. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/issues_statistics.html#get-group-issues-statistics | ||||
| func (s *IssuesStatisticsService) GetGroupIssuesStatistics(gid interface{}, opt *GetGroupIssuesStatisticsOptions, options ...RequestOptionFunc) (*IssuesStatistics, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/issues_statistics", pathEscape(group)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	is := new(IssuesStatistics) | ||||
| 	resp, err := s.client.Do(req, is) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return is, resp, err | ||||
| } | ||||
|  | ||||
| // GetProjectIssuesStatisticsOptions represents the available | ||||
| // GetProjectIssuesStatistics() options. | ||||
| // | ||||
| // 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        *Milestone `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. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/issues_statistics.html#get-project-issues-statistics | ||||
| func (s *IssuesStatisticsService) GetProjectIssuesStatistics(pid interface{}, opt *GetProjectIssuesStatisticsOptions, options ...RequestOptionFunc) (*IssuesStatistics, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/issues_statistics", pathEscape(project)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	is := new(IssuesStatistics) | ||||
| 	resp, err := s.client.Do(req, is) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return is, resp, err | ||||
| } | ||||
							
								
								
									
										57
									
								
								vendor/github.com/xanzy/go-gitlab/labels.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										57
									
								
								vendor/github.com/xanzy/go-gitlab/labels.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -73,7 +73,11 @@ func (l Label) String() string { | ||||
| // ListLabelsOptions represents the available ListLabels() options. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels | ||||
| type ListLabelsOptions ListOptions | ||||
| type ListLabelsOptions struct { | ||||
| 	ListOptions | ||||
| 	WithCounts            *bool `url:"with_counts,omitempty" json:"with_counts,omitempty"` | ||||
| 	IncludeAncestorGroups *bool `url:"include_ancestor_groups,omitempty" json:"include_ancestor_groups,omitempty"` | ||||
| } | ||||
|  | ||||
| // ListLabels gets all labels for given project. | ||||
| // | ||||
| @@ -99,6 +103,34 @@ func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, opti | ||||
| 	return l, resp, err | ||||
| } | ||||
|  | ||||
| // GetLabel get a single label for a given project. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#get-a-single-project-label | ||||
| func (s *LabelsService) GetLabel(pid interface{}, labelID interface{}, options ...RequestOptionFunc) (*Label, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	label, err := parseID(labelID) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/labels/%s", pathEscape(project), label) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var l *Label | ||||
| 	resp, err := s.client.Do(req, &l) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return l, resp, err | ||||
| } | ||||
|  | ||||
| // CreateLabelOptions represents the available CreateLabel() options. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label | ||||
| @@ -248,3 +280,26 @@ func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{ | ||||
|  | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
|  | ||||
| // PromoteLabel Promotes a project label to a group label. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/labels.html#promote-a-project-label-to-a-group-label | ||||
| func (s *LabelsService) PromoteLabel(pid interface{}, labelID interface{}, options ...RequestOptionFunc) (*Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	label, err := parseID(labelID) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/labels/%s/promote", pathEscape(project), label) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("PUT", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
|   | ||||
							
								
								
									
										29
									
								
								vendor/github.com/xanzy/go-gitlab/license.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										29
									
								
								vendor/github.com/xanzy/go-gitlab/license.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -16,6 +16,8 @@ | ||||
|  | ||||
| package gitlab | ||||
|  | ||||
| import "time" | ||||
|  | ||||
| // LicenseService handles communication with the license | ||||
| // related methods of the GitLab API. | ||||
| // | ||||
| @@ -30,17 +32,30 @@ type LicenseService struct { | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/license.html | ||||
| type License struct { | ||||
| 	StartsAt  *ISOTime `json:"starts_at"` | ||||
| 	ExpiresAt *ISOTime `json:"expires_at"` | ||||
| 	Licensee  struct { | ||||
| 	ID               int        `json:"id"` | ||||
| 	Plan             string     `json:"plan"` | ||||
| 	CreatedAt        *time.Time `json:"created_at"` | ||||
| 	StartsAt         *ISOTime   `json:"starts_at"` | ||||
| 	ExpiresAt        *ISOTime   `json:"expires_at"` | ||||
| 	HistoricalMax    int        `json:"historical_max"` | ||||
| 	MaximumUserCount int        `json:"maximum_user_count"` | ||||
| 	Expired          bool       `json:"expired"` | ||||
| 	Overage          int        `json:"overage"` | ||||
| 	UserLimit        int        `json:"user_limit"` | ||||
| 	ActiveUsers      int        `json:"active_users"` | ||||
| 	Licensee         struct { | ||||
| 		Name    string `json:"Name"` | ||||
| 		Company string `json:"Company"` | ||||
| 		Email   string `json:"Email"` | ||||
| 	} `json:"licensee"` | ||||
| 	UserLimit   int `json:"user_limit"` | ||||
| 	ActiveUsers int `json:"active_users"` | ||||
| 	AddOns      struct { | ||||
| 		GitLabFileLocks int `json:"GitLabFileLocks"` | ||||
| 	// Add on codes that may occur in legacy licenses that don't have a plan yet. | ||||
| 	// https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/license.rb | ||||
| 	AddOns struct { | ||||
| 		GitLabAuditorUser int `json:"GitLab_Auditor_User"` | ||||
| 		GitLabDeployBoard int `json:"GitLab_DeployBoard"` | ||||
| 		GitLabFileLocks   int `json:"GitLab_FileLocks"` | ||||
| 		GitLabGeo         int `json:"GitLab_Geo"` | ||||
| 		GitLabServiceDesk int `json:"GitLab_ServiceDesk"` | ||||
| 	} `json:"add_ons"` | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										52
									
								
								vendor/github.com/xanzy/go-gitlab/merge_requests.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								vendor/github.com/xanzy/go-gitlab/merge_requests.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -240,7 +240,7 @@ type ListProjectMergeRequestsOptions struct { | ||||
| 	Sort            *string    `url:"sort,omitempty" json:"sort,omitempty"` | ||||
| 	Milestone       *string    `url:"milestone,omitempty" json:"milestone,omitempty"` | ||||
| 	View            *string    `url:"view,omitempty" json:"view,omitempty"` | ||||
| 	Labels          *Labels    `url:"labels,omitempty" json:"labels,omitempty"` | ||||
| 	Labels          Labels     `url:"labels,comma,omitempty" json:"labels,omitempty"` | ||||
| 	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"` | ||||
| @@ -399,6 +399,31 @@ func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequ | ||||
| 	return m, resp, err | ||||
| } | ||||
|  | ||||
| // GetMergeRequestParticipants gets a list of merge request participants. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/merge_requests.html#get-single-mr-participants | ||||
| func (s *MergeRequestsService) GetMergeRequestParticipants(pid interface{}, mergeRequest int, options ...RequestOptionFunc) ([]*BasicUser, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/merge_requests/%d/participants", pathEscape(project), mergeRequest) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var ps []*BasicUser | ||||
| 	resp, err := s.client.Do(req, &ps) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return ps, resp, err | ||||
| } | ||||
|  | ||||
| // ListMergeRequestPipelines gets all pipelines for the provided merge request. | ||||
| // | ||||
| // GitLab API docs: | ||||
| @@ -424,6 +449,31 @@ func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeR | ||||
| 	return p, resp, err | ||||
| } | ||||
|  | ||||
| // CreateMergeRequestPipeline creates a new pipeline for a merge request. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/merge_requests.html#create-mr-pipeline | ||||
| func (s *MergeRequestsService) CreateMergeRequestPipeline(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*PipelineInfo, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", pathEscape(project), mergeRequest) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("POST", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	p := new(PipelineInfo) | ||||
| 	resp, err := s.client.Do(req, p) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return p, resp, err | ||||
| } | ||||
|  | ||||
| // GetIssuesClosedOnMergeOptions represents the available GetIssuesClosedOnMerge() | ||||
| // options. | ||||
| // | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/xanzy/go-gitlab/milestones.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/xanzy/go-gitlab/milestones.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -41,6 +41,7 @@ type Milestone struct { | ||||
| 	StartDate   *ISOTime   `json:"start_date"` | ||||
| 	DueDate     *ISOTime   `json:"due_date"` | ||||
| 	State       string     `json:"state"` | ||||
| 	WebURL      string     `json:"web_url"` | ||||
| 	UpdatedAt   *time.Time `json:"updated_at"` | ||||
| 	CreatedAt   *time.Time `json:"created_at"` | ||||
| } | ||||
|   | ||||
							
								
								
									
										19
									
								
								vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -230,6 +230,25 @@ func (s *PipelineSchedulesService) DeletePipelineSchedule(pid interface{}, sched | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
|  | ||||
| // RunPipelineSchedule triggers a new scheduled pipeline to run immediately. | ||||
| // | ||||
| // Gitlab API docs: | ||||
| // https://docs.gitlab.com/ce/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately | ||||
| func (s *PipelineSchedulesService) RunPipelineSchedule(pid interface{}, schedule int, options ...RequestOptionFunc) (*Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/play", pathEscape(project), schedule) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("POST", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
|  | ||||
| // CreatePipelineScheduleVariableOptions represents the available | ||||
| // CreatePipelineScheduleVariable() options. | ||||
| // | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/xanzy/go-gitlab/pipelines.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/xanzy/go-gitlab/pipelines.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -109,7 +109,7 @@ type ListProjectPipelinesOptions struct { | ||||
| 	Name          *string          `url:"name,omitempty" json:"name,omitempty"` | ||||
| 	Username      *string          `url:"username,omitempty" json:"username,omitempty"` | ||||
| 	UpdatedAfter  *time.Time       `url:"updated_after,omitempty" json:"updated_after,omitempty"` | ||||
| 	UpdatedBefore *time.Time       `url:"update_before,omitempty" json:"updated_before,omitempty"` | ||||
| 	UpdatedBefore *time.Time       `url:"updated_before,omitempty" json:"updated_before,omitempty"` | ||||
| 	OrderBy       *string          `url:"order_by,omitempty" json:"order_by,omitempty"` | ||||
| 	Sort          *string          `url:"sort,omitempty" json:"sort,omitempty"` | ||||
| } | ||||
|   | ||||
							
								
								
									
										145
									
								
								vendor/github.com/xanzy/go-gitlab/project_mirror.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								vendor/github.com/xanzy/go-gitlab/project_mirror.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,145 @@ | ||||
| // | ||||
| // Copyright 2017, Sander van Harmelen | ||||
| // | ||||
| // 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" | ||||
| ) | ||||
|  | ||||
| // ProjectMirrorService handles communication with the project mirror | ||||
| // related methods of the GitLab API. | ||||
| // | ||||
| // GitLAb API docs: https://docs.gitlab.com/ce/api/remote_mirrors.html | ||||
| type ProjectMirrorService struct { | ||||
| 	client *Client | ||||
| } | ||||
|  | ||||
| // ProjectMirror represents a project mirror configuration. | ||||
| // | ||||
| // GitLAb API docs: https://docs.gitlab.com/ce/api/remote_mirrors.html | ||||
| type ProjectMirror struct { | ||||
| 	Enabled                bool       `json:"enabled"` | ||||
| 	ID                     int        `json:"id"` | ||||
| 	LastError              string     `json:"last_error"` | ||||
| 	LastSuccessfulUpdateAt *time.Time `json:"last_successful_update_at"` | ||||
| 	LastUpdateAt           *time.Time `json:"last_update_at"` | ||||
| 	LastUpdateStartedAt    *time.Time `json:"last_update_started_at"` | ||||
| 	OnlyProtectedBranches  bool       `json:"only_protected_branches"` | ||||
| 	KeepDivergentRefs      bool       `json:"keep_divergent_refs"` | ||||
| 	UpdateStatus           string     `json:"update_status"` | ||||
| 	URL                    string     `json:"url"` | ||||
| } | ||||
|  | ||||
| // ListProjectMirror gets a list of mirrors configured on the project. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/remote_mirrors.html#list-a-projects-remote-mirrors | ||||
| func (s *ProjectMirrorService) ListProjectMirror(pid interface{}, options ...RequestOptionFunc) ([]*ProjectMirror, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/remote_mirrors", pathEscape(project)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var pm []*ProjectMirror | ||||
| 	resp, err := s.client.Do(req, &pm) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return pm, resp, err | ||||
|  | ||||
| } | ||||
|  | ||||
| // AddProjectMirrorOptions contains the properties requires to create | ||||
| // a new project mirror. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/remote_mirrors.html#create-a-remote-mirror | ||||
| 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"` | ||||
| } | ||||
|  | ||||
| // AddProjectMirror creates a new mirror on the project. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/remote_mirrors.html#create-a-remote-mirror | ||||
| func (s *ProjectMirrorService) AddProjectMirror(pid interface{}, opt *AddProjectMirrorOptions, options ...RequestOptionFunc) (*ProjectMirror, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/remote_mirrors", pathEscape(project)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("POST", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	pm := new(ProjectMirror) | ||||
| 	resp, err := s.client.Do(req, pm) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return pm, resp, err | ||||
| } | ||||
|  | ||||
| // EditProjectMirrorOptions contains the properties requires to edit | ||||
| // an existing project mirror. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/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"` | ||||
| } | ||||
|  | ||||
| // EditProjectMirror updates a project team member to a specified access level.. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/remote_mirrors.html#update-a-remote-mirrors-attributes | ||||
| func (s *ProjectMirrorService) EditProjectMirror(pid interface{}, mirror int, opt *EditProjectMirrorOptions, options ...RequestOptionFunc) (*ProjectMirror, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/remote_mirrors/%d", pathEscape(project), mirror) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("PUT", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	pm := new(ProjectMirror) | ||||
| 	resp, err := s.client.Do(req, pm) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return pm, resp, err | ||||
| } | ||||
							
								
								
									
										4
									
								
								vendor/github.com/xanzy/go-gitlab/project_snippets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/xanzy/go-gitlab/project_snippets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -91,7 +91,7 @@ type CreateProjectSnippetOptions struct { | ||||
| 	Title       *string          `url:"title,omitempty" json:"title,omitempty"` | ||||
| 	FileName    *string          `url:"file_name,omitempty" json:"file_name,omitempty"` | ||||
| 	Description *string          `url:"description,omitempty" json:"description,omitempty"` | ||||
| 	Code        *string          `url:"code,omitempty" json:"code,omitempty"` | ||||
| 	Content     *string          `url:"content,omitempty" json:"content,omitempty"` | ||||
| 	Visibility  *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"` | ||||
| } | ||||
|  | ||||
| @@ -129,7 +129,7 @@ type UpdateProjectSnippetOptions struct { | ||||
| 	Title       *string          `url:"title,omitempty" json:"title,omitempty"` | ||||
| 	FileName    *string          `url:"file_name,omitempty" json:"file_name,omitempty"` | ||||
| 	Description *string          `url:"description,omitempty" json:"description,omitempty"` | ||||
| 	Code        *string          `url:"code,omitempty" json:"code,omitempty"` | ||||
| 	Content     *string          `url:"content,omitempty" json:"content,omitempty"` | ||||
| 	Visibility  *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"` | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										300
									
								
								vendor/github.com/xanzy/go-gitlab/projects.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										300
									
								
								vendor/github.com/xanzy/go-gitlab/projects.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -38,57 +38,68 @@ type ProjectsService struct { | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html | ||||
| type Project struct { | ||||
| 	ID                                        int               `json:"id"` | ||||
| 	Description                               string            `json:"description"` | ||||
| 	DefaultBranch                             string            `json:"default_branch"` | ||||
| 	Public                                    bool              `json:"public"` | ||||
| 	Visibility                                VisibilityValue   `json:"visibility"` | ||||
| 	SSHURLToRepo                              string            `json:"ssh_url_to_repo"` | ||||
| 	HTTPURLToRepo                             string            `json:"http_url_to_repo"` | ||||
| 	WebURL                                    string            `json:"web_url"` | ||||
| 	ReadmeURL                                 string            `json:"readme_url"` | ||||
| 	TagList                                   []string          `json:"tag_list"` | ||||
| 	Owner                                     *User             `json:"owner"` | ||||
| 	Name                                      string            `json:"name"` | ||||
| 	NameWithNamespace                         string            `json:"name_with_namespace"` | ||||
| 	Path                                      string            `json:"path"` | ||||
| 	PathWithNamespace                         string            `json:"path_with_namespace"` | ||||
| 	IssuesEnabled                             bool              `json:"issues_enabled"` | ||||
| 	OpenIssuesCount                           int               `json:"open_issues_count"` | ||||
| 	MergeRequestsEnabled                      bool              `json:"merge_requests_enabled"` | ||||
| 	ApprovalsBeforeMerge                      int               `json:"approvals_before_merge"` | ||||
| 	JobsEnabled                               bool              `json:"jobs_enabled"` | ||||
| 	WikiEnabled                               bool              `json:"wiki_enabled"` | ||||
| 	SnippetsEnabled                           bool              `json:"snippets_enabled"` | ||||
| 	ResolveOutdatedDiffDiscussions            bool              `json:"resolve_outdated_diff_discussions"` | ||||
| 	ContainerRegistryEnabled                  bool              `json:"container_registry_enabled"` | ||||
| 	CreatedAt                                 *time.Time        `json:"created_at,omitempty"` | ||||
| 	LastActivityAt                            *time.Time        `json:"last_activity_at,omitempty"` | ||||
| 	CreatorID                                 int               `json:"creator_id"` | ||||
| 	Namespace                                 *ProjectNamespace `json:"namespace"` | ||||
| 	ImportStatus                              string            `json:"import_status"` | ||||
| 	ImportError                               string            `json:"import_error"` | ||||
| 	Permissions                               *Permissions      `json:"permissions"` | ||||
| 	MarkedForDeletionAt                       *ISOTime          `json:"marked_for_deletion_at"` | ||||
| 	Archived                                  bool              `json:"archived"` | ||||
| 	AvatarURL                                 string            `json:"avatar_url"` | ||||
| 	SharedRunnersEnabled                      bool              `json:"shared_runners_enabled"` | ||||
| 	ForksCount                                int               `json:"forks_count"` | ||||
| 	StarCount                                 int               `json:"star_count"` | ||||
| 	RunnersToken                              string            `json:"runners_token"` | ||||
| 	PublicBuilds                              bool              `json:"public_builds"` | ||||
| 	OnlyAllowMergeIfPipelineSucceeds          bool              `json:"only_allow_merge_if_pipeline_succeeds"` | ||||
| 	OnlyAllowMergeIfAllDiscussionsAreResolved bool              `json:"only_allow_merge_if_all_discussions_are_resolved"` | ||||
| 	RemoveSourceBranchAfterMerge              bool              `json:"remove_source_branch_after_merge"` | ||||
| 	LFSEnabled                                bool              `json:"lfs_enabled"` | ||||
| 	RequestAccessEnabled                      bool              `json:"request_access_enabled"` | ||||
| 	MergeMethod                               MergeMethodValue  `json:"merge_method"` | ||||
| 	ForkedFromProject                         *ForkParent       `json:"forked_from_project"` | ||||
| 	Mirror                                    bool              `json:"mirror"` | ||||
| 	MirrorUserID                              int               `json:"mirror_user_id"` | ||||
| 	MirrorTriggerBuilds                       bool              `json:"mirror_trigger_builds"` | ||||
| 	OnlyMirrorProtectedBranches               bool              `json:"only_mirror_protected_branches"` | ||||
| 	MirrorOverwritesDivergedBranches          bool              `json:"mirror_overwrites_diverged_branches"` | ||||
| 	ID                                        int                `json:"id"` | ||||
| 	Description                               string             `json:"description"` | ||||
| 	DefaultBranch                             string             `json:"default_branch"` | ||||
| 	Public                                    bool               `json:"public"` | ||||
| 	Visibility                                VisibilityValue    `json:"visibility"` | ||||
| 	SSHURLToRepo                              string             `json:"ssh_url_to_repo"` | ||||
| 	HTTPURLToRepo                             string             `json:"http_url_to_repo"` | ||||
| 	WebURL                                    string             `json:"web_url"` | ||||
| 	ReadmeURL                                 string             `json:"readme_url"` | ||||
| 	TagList                                   []string           `json:"tag_list"` | ||||
| 	Owner                                     *User              `json:"owner"` | ||||
| 	Name                                      string             `json:"name"` | ||||
| 	NameWithNamespace                         string             `json:"name_with_namespace"` | ||||
| 	Path                                      string             `json:"path"` | ||||
| 	PathWithNamespace                         string             `json:"path_with_namespace"` | ||||
| 	IssuesEnabled                             bool               `json:"issues_enabled"` | ||||
| 	OpenIssuesCount                           int                `json:"open_issues_count"` | ||||
| 	MergeRequestsEnabled                      bool               `json:"merge_requests_enabled"` | ||||
| 	ApprovalsBeforeMerge                      int                `json:"approvals_before_merge"` | ||||
| 	JobsEnabled                               bool               `json:"jobs_enabled"` | ||||
| 	WikiEnabled                               bool               `json:"wiki_enabled"` | ||||
| 	SnippetsEnabled                           bool               `json:"snippets_enabled"` | ||||
| 	ResolveOutdatedDiffDiscussions            bool               `json:"resolve_outdated_diff_discussions"` | ||||
| 	ContainerRegistryEnabled                  bool               `json:"container_registry_enabled"` | ||||
| 	CreatedAt                                 *time.Time         `json:"created_at,omitempty"` | ||||
| 	LastActivityAt                            *time.Time         `json:"last_activity_at,omitempty"` | ||||
| 	CreatorID                                 int                `json:"creator_id"` | ||||
| 	Namespace                                 *ProjectNamespace  `json:"namespace"` | ||||
| 	ImportStatus                              string             `json:"import_status"` | ||||
| 	ImportError                               string             `json:"import_error"` | ||||
| 	Permissions                               *Permissions       `json:"permissions"` | ||||
| 	MarkedForDeletionAt                       *ISOTime           `json:"marked_for_deletion_at"` | ||||
| 	Archived                                  bool               `json:"archived"` | ||||
| 	AvatarURL                                 string             `json:"avatar_url"` | ||||
| 	SharedRunnersEnabled                      bool               `json:"shared_runners_enabled"` | ||||
| 	ForksCount                                int                `json:"forks_count"` | ||||
| 	StarCount                                 int                `json:"star_count"` | ||||
| 	RunnersToken                              string             `json:"runners_token"` | ||||
| 	PublicBuilds                              bool               `json:"public_builds"` | ||||
| 	OnlyAllowMergeIfPipelineSucceeds          bool               `json:"only_allow_merge_if_pipeline_succeeds"` | ||||
| 	OnlyAllowMergeIfAllDiscussionsAreResolved bool               `json:"only_allow_merge_if_all_discussions_are_resolved"` | ||||
| 	RemoveSourceBranchAfterMerge              bool               `json:"remove_source_branch_after_merge"` | ||||
| 	LFSEnabled                                bool               `json:"lfs_enabled"` | ||||
| 	RequestAccessEnabled                      bool               `json:"request_access_enabled"` | ||||
| 	MergeMethod                               MergeMethodValue   `json:"merge_method"` | ||||
| 	ForkedFromProject                         *ForkParent        `json:"forked_from_project"` | ||||
| 	Mirror                                    bool               `json:"mirror"` | ||||
| 	MirrorUserID                              int                `json:"mirror_user_id"` | ||||
| 	MirrorTriggerBuilds                       bool               `json:"mirror_trigger_builds"` | ||||
| 	OnlyMirrorProtectedBranches               bool               `json:"only_mirror_protected_branches"` | ||||
| 	MirrorOverwritesDivergedBranches          bool               `json:"mirror_overwrites_diverged_branches"` | ||||
| 	ServiceDeskEnabled                        bool               `json:"service_desk_enabled"` | ||||
| 	ServiceDeskAddress                        string             `json:"service_desk_address"` | ||||
| 	IssuesAccessLevel                         AccessControlValue `json:"issues_access_level"` | ||||
| 	RepositoryAccessLevel                     AccessControlValue `json:"repository_access_level"` | ||||
| 	MergeRequestsAccessLevel                  AccessControlValue `json:"merge_requests_access_level"` | ||||
| 	ForkingAccessLevel                        AccessControlValue `json:"forking_access_level"` | ||||
| 	WikiAccessLevel                           AccessControlValue `json:"wiki_access_level"` | ||||
| 	BuildsAccessLevel                         AccessControlValue `json:"builds_access_level"` | ||||
| 	SnippetsAccessLevel                       AccessControlValue `json:"snippets_access_level"` | ||||
| 	PagesAccessLevel                          AccessControlValue `json:"pages_access_level"` | ||||
| 	AutocloseReferencedIssues                 bool               `json:"autoclose_referenced_issues"` | ||||
| 	SharedWithGroups                          []struct { | ||||
| 		GroupID          int    `json:"group_id"` | ||||
| 		GroupName        string `json:"group_name"` | ||||
| @@ -213,20 +224,27 @@ func (s ProjectApprovalRule) String() string { | ||||
| type ListProjectsOptions struct { | ||||
| 	ListOptions | ||||
| 	Archived                 *bool             `url:"archived,omitempty" json:"archived,omitempty"` | ||||
| 	Visibility               *VisibilityValue  `url:"visibility,omitempty" json:"visibility,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"` | ||||
| 	SearchNamespaces         *bool             `url:"search_namespaces,omitempty" json:"search_namespaces,omitempty"` | ||||
| 	Simple                   *bool             `url:"simple,omitempty" json:"simple,omitempty"` | ||||
| 	Owned                    *bool             `url:"owned,omitempty" json:"owned,omitempty"` | ||||
| 	Membership               *bool             `url:"membership,omitempty" json:"membership,omitempty"` | ||||
| 	Starred                  *bool             `url:"starred,omitempty" json:"starred,omitempty"` | ||||
| 	Statistics               *bool             `url:"statistics,omitempty" json:"statistics,omitempty"` | ||||
| 	Visibility               *VisibilityValue  `url:"visibility,omitempty" json:"visibility,omitempty"` | ||||
| 	WithCustomAttributes     *bool             `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` | ||||
| 	WithIssuesEnabled        *bool             `url:"with_issues_enabled,omitempty" json:"with_issues_enabled,omitempty"` | ||||
| 	WithMergeRequestsEnabled *bool             `url:"with_merge_requests_enabled,omitempty" json:"with_merge_requests_enabled,omitempty"` | ||||
| 	MinAccessLevel           *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"` | ||||
| 	WithCustomAttributes     *bool             `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` | ||||
| 	WithProgrammingLanguage  *string           `url:"with_programming_language,omitempty" json:"with_programming_language,omitempty"` | ||||
| 	WikiChecksumFailed       *bool             `url:"wiki_checksum_failed,omitempty" json:"wiki_checksum_failed,omitempty"` | ||||
| 	RepositoryChecksumFailed *bool             `url:"repository_checksum_failed,omitempty" json:"repository_checksum_failed,omitempty"` | ||||
| 	MinAccessLevel           *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"` | ||||
| 	IDAfter                  *int              `url:"id_after,omitempty" json:"id_after,omitempty"` | ||||
| 	IDBefore                 *int              `url:"id_before,omitempty" json:"id_before,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"` | ||||
| } | ||||
|  | ||||
| // ListProjects gets a list of projects accessible by the authenticated user. | ||||
| @@ -444,39 +462,60 @@ func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEvent | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#create-project | ||||
| type CreateProjectOptions struct { | ||||
| 	Name                                      *string           `url:"name,omitempty" json:"name,omitempty"` | ||||
| 	Path                                      *string           `url:"path,omitempty" json:"path,omitempty"` | ||||
| 	DefaultBranch                             *string           `url:"default_branch,omitempty" json:"default_branch,omitempty"` | ||||
| 	NamespaceID                               *int              `url:"namespace_id,omitempty" json:"namespace_id,omitempty"` | ||||
| 	Description                               *string           `url:"description,omitempty" json:"description,omitempty"` | ||||
| 	IssuesEnabled                             *bool             `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"` | ||||
| 	MergeRequestsEnabled                      *bool             `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"` | ||||
| 	JobsEnabled                               *bool             `url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"` | ||||
| 	WikiEnabled                               *bool             `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"` | ||||
| 	SnippetsEnabled                           *bool             `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"` | ||||
| 	ResolveOutdatedDiffDiscussions            *bool             `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"` | ||||
| 	ContainerRegistryEnabled                  *bool             `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"` | ||||
| 	SharedRunnersEnabled                      *bool             `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"` | ||||
| 	Visibility                                *VisibilityValue  `url:"visibility,omitempty" json:"visibility,omitempty"` | ||||
| 	ImportURL                                 *string           `url:"import_url,omitempty" json:"import_url,omitempty"` | ||||
| 	PublicBuilds                              *bool             `url:"public_builds,omitempty" json:"public_builds,omitempty"` | ||||
| 	OnlyAllowMergeIfPipelineSucceeds          *bool             `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"` | ||||
| 	OnlyAllowMergeIfAllDiscussionsAreResolved *bool             `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` | ||||
| 	MergeMethod                               *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"` | ||||
| 	RemoveSourceBranchAfterMerge              *bool             `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"` | ||||
| 	LFSEnabled                                *bool             `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` | ||||
| 	RequestAccessEnabled                      *bool             `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` | ||||
| 	TagList                                   *[]string         `url:"tag_list,omitempty" json:"tag_list,omitempty"` | ||||
| 	PrintingMergeRequestLinkEnabled           *bool             `url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"` | ||||
| 	BuildCoverageRegex                        *string           `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"` | ||||
| 	CIConfigPath                              *string           `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"` | ||||
| 	ApprovalsBeforeMerge                      *int              `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"` | ||||
| 	Mirror                                    *bool             `url:"mirror,omitempty" json:"mirror,omitempty"` | ||||
| 	MirrorTriggerBuilds                       *bool             `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"` | ||||
| 	InitializeWithReadme                      *bool             `url:"initialize_with_readme,omitempty" json:"initialize_with_readme,omitempty"` | ||||
| 	TemplateName                              *string           `url:"template_name,omitempty" json:"template_name,omitempty"` | ||||
| 	UseCustomTemplate                         *bool             `url:"use_custom_template,omitempty" json:"use_custom_template,omitempty"` | ||||
| 	GroupWithProjectTemplatesID               *int              `url:"group_with_project_templates_id,omitempty" json:"group_with_project_templates_id,omitempty"` | ||||
| 	Name                                      *string             `url:"name,omitempty" json:"name,omitempty"` | ||||
| 	Path                                      *string             `url:"path,omitempty" json:"path,omitempty"` | ||||
| 	NamespaceID                               *int                `url:"namespace_id,omitempty" json:"namespace_id,omitempty"` | ||||
| 	DefaultBranch                             *string             `url:"default_branch,omitempty" json:"default_branch,omitempty"` | ||||
| 	Description                               *string             `url:"description,omitempty" json:"description,omitempty"` | ||||
| 	IssuesAccessLevel                         *AccessControlValue `url:"issues_access_level,omitempty" json:"issues_access_level,omitempty"` | ||||
| 	RepositoryAccessLevel                     *AccessControlValue `url:"repository_access_level,omitempty" json:"repository_access_level,omitempty"` | ||||
| 	MergeRequestsAccessLevel                  *AccessControlValue `url:"merge_requests_access_level,omitempty" json:"merge_requests_access_level,omitempty"` | ||||
| 	ForkingAccessLevel                        *AccessControlValue `url:"forking_access_level,omitempty" json:"forking_access_level,omitempty"` | ||||
| 	BuildsAccessLevel                         *AccessControlValue `url:"builds_access_level,omitempty" json:"builds_access_level,omitempty"` | ||||
| 	WikiAccessLevel                           *AccessControlValue `url:"wiki_access_level,omitempty" json:"wiki_access_level,omitempty"` | ||||
| 	SnippetsAccessLevel                       *AccessControlValue `url:"snippets_access_level,omitempty" json:"snippets_access_level,omitempty"` | ||||
| 	PagesAccessLevel                          *AccessControlValue `url:"pages_access_level,omitempty" json:"pages_access_level,omitempty"` | ||||
| 	EmailsDisabled                            *bool               `url:"emails_disabled,omitempty" json:"emails_disabled,omitempty"` | ||||
| 	ResolveOutdatedDiffDiscussions            *bool               `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"` | ||||
| 	ContainerRegistryEnabled                  *bool               `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"` | ||||
| 	SharedRunnersEnabled                      *bool               `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"` | ||||
| 	Visibility                                *VisibilityValue    `url:"visibility,omitempty" json:"visibility,omitempty"` | ||||
| 	ImportURL                                 *string             `url:"import_url,omitempty" json:"import_url,omitempty"` | ||||
| 	PublicBuilds                              *bool               `url:"public_builds,omitempty" json:"public_builds,omitempty"` | ||||
| 	OnlyAllowMergeIfPipelineSucceeds          *bool               `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"` | ||||
| 	OnlyAllowMergeIfAllDiscussionsAreResolved *bool               `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` | ||||
| 	MergeMethod                               *MergeMethodValue   `url:"merge_method,omitempty" json:"merge_method,omitempty"` | ||||
| 	RemoveSourceBranchAfterMerge              *bool               `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"` | ||||
| 	LFSEnabled                                *bool               `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` | ||||
| 	RequestAccessEnabled                      *bool               `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` | ||||
| 	TagList                                   *[]string           `url:"tag_list,omitempty" json:"tag_list,omitempty"` | ||||
| 	PrintingMergeRequestLinkEnabled           *bool               `url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"` | ||||
| 	BuildGitStrategy                          *string             `url:"build_git_strategy,omitempty" json:"build_git_strategy,omitempty"` | ||||
| 	BuildTimeout                              *int                `url:"build_timeout,omitempty" json:"build_timeout,omitempty"` | ||||
| 	AutoCancelPendingPipelines                *string             `url:"auto_cancel_pending_pipelines,omitempty" json:"auto_cancel_pending_pipelines,omitempty"` | ||||
| 	BuildCoverageRegex                        *string             `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"` | ||||
| 	CIConfigPath                              *string             `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"` | ||||
| 	AutoDevopsEnabled                         *bool               `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"` | ||||
| 	AutoDevopsDeployStrategy                  *string             `url:"auto_devops_deploy_strategy,omitempty" json:"auto_devops_deploy_strategy,omitempty"` | ||||
| 	ApprovalsBeforeMerge                      *int                `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"` | ||||
| 	ExternalAuthorizationClassificationLabel  *string             `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"` | ||||
| 	Mirror                                    *bool               `url:"mirror,omitempty" json:"mirror,omitempty"` | ||||
| 	MirrorTriggerBuilds                       *bool               `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"` | ||||
| 	InitializeWithReadme                      *bool               `url:"initialize_with_readme,omitempty" json:"initialize_with_readme,omitempty"` | ||||
| 	TemplateName                              *string             `url:"template_name,omitempty" json:"template_name,omitempty"` | ||||
| 	TemplateProjectID                         *int                `url:"template_project_id,omitempty" json:"template_project_id,omitempty"` | ||||
| 	UseCustomTemplate                         *bool               `url:"use_custom_template,omitempty" json:"use_custom_template,omitempty"` | ||||
| 	GroupWithProjectTemplatesID               *int                `url:"group_with_project_templates_id,omitempty" json:"group_with_project_templates_id,omitempty"` | ||||
| 	PackagesEnabled                           *bool               `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"` | ||||
| 	ServiceDeskEnabled                        *bool               `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"` | ||||
| 	AutocloseReferencedIssues                 *bool               `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"` | ||||
|  | ||||
| 	// Deprecated members | ||||
| 	IssuesEnabled        *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"` | ||||
| 	MergeRequestsEnabled *bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"` | ||||
| 	JobsEnabled          *bool `url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"` | ||||
| 	WikiEnabled          *bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"` | ||||
| 	SnippetsEnabled      *bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"` | ||||
| } | ||||
|  | ||||
| // CreateProject creates a new project owned by the authenticated user. | ||||
| @@ -530,39 +569,57 @@ func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUs | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project | ||||
| type EditProjectOptions struct { | ||||
| 	Name                                      *string           `url:"name,omitempty" json:"name,omitempty"` | ||||
| 	Path                                      *string           `url:"path,omitempty" json:"path,omitempty"` | ||||
| 	DefaultBranch                             *string           `url:"default_branch,omitempty" json:"default_branch,omitempty"` | ||||
| 	Description                               *string           `url:"description,omitempty" json:"description,omitempty"` | ||||
| 	IssuesEnabled                             *bool             `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"` | ||||
| 	MergeRequestsEnabled                      *bool             `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"` | ||||
| 	JobsEnabled                               *bool             `url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"` | ||||
| 	WikiEnabled                               *bool             `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"` | ||||
| 	SnippetsEnabled                           *bool             `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"` | ||||
| 	ResolveOutdatedDiffDiscussions            *bool             `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"` | ||||
| 	ContainerRegistryEnabled                  *bool             `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"` | ||||
| 	SharedRunnersEnabled                      *bool             `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"` | ||||
| 	Visibility                                *VisibilityValue  `url:"visibility,omitempty" json:"visibility,omitempty"` | ||||
| 	ImportURL                                 *string           `url:"import_url,omitempty" json:"import_url,omitempty"` | ||||
| 	PublicBuilds                              *bool             `url:"public_builds,omitempty" json:"public_builds,omitempty"` | ||||
| 	OnlyAllowMergeIfPipelineSucceeds          *bool             `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"` | ||||
| 	OnlyAllowMergeIfAllDiscussionsAreResolved *bool             `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` | ||||
| 	MergeMethod                               *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"` | ||||
| 	RemoveSourceBranchAfterMerge              *bool             `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"` | ||||
| 	LFSEnabled                                *bool             `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` | ||||
| 	RequestAccessEnabled                      *bool             `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` | ||||
| 	TagList                                   *[]string         `url:"tag_list,omitempty" json:"tag_list,omitempty"` | ||||
| 	BuildCoverageRegex                        *string           `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"` | ||||
| 	CIConfigPath                              *string           `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"` | ||||
| 	CIDefaultGitDepth                         *int              `url:"ci_default_git_depth,omitempty" json:"ci_default_git_depth,omitempty"` | ||||
| 	ApprovalsBeforeMerge                      *int              `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"` | ||||
| 	ExternalAuthorizationClassificationLabel  *string           `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"` | ||||
| 	Mirror                                    *bool             `url:"mirror,omitempty" json:"mirror,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"` | ||||
| 	OnlyMirrorProtectedBranches               *bool             `url:"only_mirror_protected_branches,omitempty" json:"only_mirror_protected_branches,omitempty"` | ||||
| 	MirrorOverwritesDivergedBranches          *bool             `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"` | ||||
| 	PackagesEnabled                           *bool             `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"` | ||||
| 	Name                                      *string             `url:"name,omitempty" json:"name,omitempty"` | ||||
| 	Path                                      *string             `url:"path,omitempty" json:"path,omitempty"` | ||||
| 	DefaultBranch                             *string             `url:"default_branch,omitempty" json:"default_branch,omitempty"` | ||||
| 	Description                               *string             `url:"description,omitempty" json:"description,omitempty"` | ||||
| 	IssuesAccessLevel                         *AccessControlValue `url:"issues_access_level,omitempty" json:"issues_access_level,omitempty"` | ||||
| 	RepositoryAccessLevel                     *AccessControlValue `url:"repository_access_level,omitempty" json:"repository_access_level,omitempty"` | ||||
| 	MergeRequestsAccessLevel                  *AccessControlValue `url:"merge_requests_access_level,omitempty" json:"merge_requests_access_level,omitempty"` | ||||
| 	ForkingAccessLevel                        *AccessControlValue `url:"forking_access_level,omitempty" json:"forking_access_level,omitempty"` | ||||
| 	BuildsAccessLevel                         *AccessControlValue `url:"builds_access_level,omitempty" json:"builds_access_level,omitempty"` | ||||
| 	WikiAccessLevel                           *AccessControlValue `url:"wiki_access_level,omitempty" json:"wiki_access_level,omitempty"` | ||||
| 	SnippetsAccessLevel                       *AccessControlValue `url:"snippets_access_level,omitempty" json:"snippets_access_level,omitempty"` | ||||
| 	PagesAccessLevel                          *AccessControlValue `url:"pages_access_level,omitempty" json:"pages_access_level,omitempty"` | ||||
| 	EmailsDisabled                            *bool               `url:"emails_disabled,omitempty" json:"emails_disabled,omitempty"` | ||||
| 	ResolveOutdatedDiffDiscussions            *bool               `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"` | ||||
| 	ContainerRegistryEnabled                  *bool               `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"` | ||||
| 	SharedRunnersEnabled                      *bool               `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"` | ||||
| 	Visibility                                *VisibilityValue    `url:"visibility,omitempty" json:"visibility,omitempty"` | ||||
| 	ImportURL                                 *string             `url:"import_url,omitempty" json:"import_url,omitempty"` | ||||
| 	PublicBuilds                              *bool               `url:"public_builds,omitempty" json:"public_builds,omitempty"` | ||||
| 	OnlyAllowMergeIfPipelineSucceeds          *bool               `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"` | ||||
| 	OnlyAllowMergeIfAllDiscussionsAreResolved *bool               `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` | ||||
| 	MergeMethod                               *MergeMethodValue   `url:"merge_method,omitempty" json:"merge_method,omitempty"` | ||||
| 	RemoveSourceBranchAfterMerge              *bool               `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"` | ||||
| 	LFSEnabled                                *bool               `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` | ||||
| 	RequestAccessEnabled                      *bool               `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` | ||||
| 	TagList                                   *[]string           `url:"tag_list,omitempty" json:"tag_list,omitempty"` | ||||
| 	BuildGitStrategy                          *string             `url:"build_git_strategy,omitempty" json:"build_git_strategy,omitempty"` | ||||
| 	BuildTimeout                              *int                `url:"build_timeout,omitempty" json:"build_timeout,omitempty"` | ||||
| 	AutoCancelPendingPipelines                *string             `url:"auto_cancel_pending_pipelines,omitempty" json:"auto_cancel_pending_pipelines,omitempty"` | ||||
| 	BuildCoverageRegex                        *string             `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"` | ||||
| 	CIConfigPath                              *string             `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"` | ||||
| 	CIDefaultGitDepth                         *int                `url:"ci_default_git_depth,omitempty" json:"ci_default_git_depth,omitempty"` | ||||
| 	AutoDevopsEnabled                         *bool               `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"` | ||||
| 	AutoDevopsDeployStrategy                  *string             `url:"auto_devops_deploy_strategy,omitempty" json:"auto_devops_deploy_strategy,omitempty"` | ||||
| 	ApprovalsBeforeMerge                      *int                `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"` | ||||
| 	ExternalAuthorizationClassificationLabel  *string             `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"` | ||||
| 	Mirror                                    *bool               `url:"mirror,omitempty" json:"mirror,omitempty"` | ||||
| 	MirrorUserID                              *int                `url:"mirror_user_id,omitempty" json:"mirror_user_id,omitempty"` | ||||
| 	MirrorTriggerBuilds                       *bool               `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"` | ||||
| 	OnlyMirrorProtectedBranches               *bool               `url:"only_mirror_protected_branches,omitempty" json:"only_mirror_protected_branches,omitempty"` | ||||
| 	MirrorOverwritesDivergedBranches          *bool               `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"` | ||||
| 	PackagesEnabled                           *bool               `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"` | ||||
| 	ServiceDeskEnabled                        *bool               `url:"service_desk_enabled,omitempty" json:"service_desk_enabled,omitempty"` | ||||
| 	AutocloseReferencedIssues                 *bool               `url:"autoclose_referenced_issues,omitempty" json:"autoclose_referenced_issues,omitempty"` | ||||
|  | ||||
| 	// Deprecated members | ||||
| 	IssuesEnabled        *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"` | ||||
| 	MergeRequestsEnabled *bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"` | ||||
| 	JobsEnabled          *bool `url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"` | ||||
| 	WikiEnabled          *bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"` | ||||
| 	SnippetsEnabled      *bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"` | ||||
| } | ||||
|  | ||||
| // EditProject updates an existing project. | ||||
| @@ -816,6 +873,7 @@ type ProjectHook struct { | ||||
| 	ConfidentialNoteEvents   bool       `json:"confidential_note_events"` | ||||
| 	ProjectID                int        `json:"project_id"` | ||||
| 	PushEvents               bool       `json:"push_events"` | ||||
| 	PushEventsBranchFilter   string     `json:"push_events_branch_filter"` | ||||
| 	IssuesEvents             bool       `json:"issues_events"` | ||||
| 	ConfidentialIssuesEvents bool       `json:"confidential_issues_events"` | ||||
| 	MergeRequestsEvents      bool       `json:"merge_requests_events"` | ||||
| @@ -891,6 +949,7 @@ type AddProjectHookOptions struct { | ||||
| 	URL                      *string `url:"url,omitempty" json:"url,omitempty"` | ||||
| 	ConfidentialNoteEvents   *bool   `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` | ||||
| 	PushEvents               *bool   `url:"push_events,omitempty" json:"push_events,omitempty"` | ||||
| 	PushEventsBranchFilter   *string `url:"push_events_branch_filter,omitempty" json:"push_events_branch_filter,omitempty"` | ||||
| 	IssuesEvents             *bool   `url:"issues_events,omitempty" json:"issues_events,omitempty"` | ||||
| 	ConfidentialIssuesEvents *bool   `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` | ||||
| 	MergeRequestsEvents      *bool   `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` | ||||
| @@ -936,6 +995,7 @@ type EditProjectHookOptions struct { | ||||
| 	URL                      *string `url:"url,omitempty" json:"url,omitempty"` | ||||
| 	ConfidentialNoteEvents   *bool   `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` | ||||
| 	PushEvents               *bool   `url:"push_events,omitempty" json:"push_events,omitempty"` | ||||
| 	PushEventsBranchFilter   *string `url:"push_events_branch_filter,omitempty" json:"push_events_branch_filter,omitempty"` | ||||
| 	IssuesEvents             *bool   `url:"issues_events,omitempty" json:"issues_events,omitempty"` | ||||
| 	ConfidentialIssuesEvents *bool   `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` | ||||
| 	MergeRequestsEvents      *bool   `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` | ||||
|   | ||||
							
								
								
									
										25
									
								
								vendor/github.com/xanzy/go-gitlab/protected_branches.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										25
									
								
								vendor/github.com/xanzy/go-gitlab/protected_branches.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -37,6 +37,8 @@ type ProtectedBranchesService struct { | ||||
| // https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api | ||||
| type BranchAccessDescription struct { | ||||
| 	AccessLevel            AccessLevelValue `json:"access_level"` | ||||
| 	UserID                 int              `json:"user_id"` | ||||
| 	GroupID                int              `json:"group_id"` | ||||
| 	AccessLevelDescription string           `json:"access_level_description"` | ||||
| } | ||||
|  | ||||
| @@ -49,6 +51,7 @@ type ProtectedBranch struct { | ||||
| 	Name                      string                     `json:"name"` | ||||
| 	PushAccessLevels          []*BranchAccessDescription `json:"push_access_levels"` | ||||
| 	MergeAccessLevels         []*BranchAccessDescription `json:"merge_access_levels"` | ||||
| 	UnprotectAccessLevels     []*BranchAccessDescription `json:"unprotect_access_levels"` | ||||
| 	CodeOwnerApprovalRequired bool                       `json:"code_owner_approval_required"` | ||||
| } | ||||
|  | ||||
| @@ -115,10 +118,24 @@ func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch st | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches | ||||
| type ProtectRepositoryBranchesOptions struct { | ||||
| 	Name                      *string           `url:"name,omitempty" json:"name,omitempty"` | ||||
| 	PushAccessLevel           *AccessLevelValue `url:"push_access_level,omitempty" json:"push_access_level,omitempty"` | ||||
| 	MergeAccessLevel          *AccessLevelValue `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"` | ||||
| 	CodeOwnerApprovalRequired *bool             `url:"code_owner_approval_required,omitempty" json:"code_owner_approval_required,omitempty"` | ||||
| 	Name                      *string                           `url:"name,omitempty" json:"name,omitempty"` | ||||
| 	PushAccessLevel           *AccessLevelValue                 `url:"push_access_level,omitempty" json:"push_access_level,omitempty"` | ||||
| 	MergeAccessLevel          *AccessLevelValue                 `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"` | ||||
| 	UnprotectAccessLevel      *AccessLevelValue                 `url:"unprotect_access_level,omitempty" json:"unprotect_access_level,omitempty"` | ||||
| 	AllowedToPush             []*ProtectBranchPermissionOptions `url:"allowed_to_push,omitempty" json:"allowed_to_push,omitempty"` | ||||
| 	AllowedToMerge            []*ProtectBranchPermissionOptions `url:"allowed_to_merge,omitempty" json:"allowed_to_merge,omitempty"` | ||||
| 	AllowedToUnprotect        []*ProtectBranchPermissionOptions `url:"allowed_to_unprotect,omitempty" json:"allowed_to_unprotect,omitempty"` | ||||
| 	CodeOwnerApprovalRequired *bool                             `url:"code_owner_approval_required,omitempty" json:"code_owner_approval_required,omitempty"` | ||||
| } | ||||
|  | ||||
| // ProtectBranchPermissionOptions represents a branch permission option. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches | ||||
| type ProtectBranchPermissionOptions struct { | ||||
| 	UserID      *int              `url:"user_id,omitempty" json:"user_id,omitempty"` | ||||
| 	GroupID     *int              `url:"group_id,omitempty" json:"group_id,omitempty"` | ||||
| 	AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"` | ||||
| } | ||||
|  | ||||
| // ProtectRepositoryBranches protects a single repository branch or several | ||||
|   | ||||
							
								
								
									
										97
									
								
								vendor/github.com/xanzy/go-gitlab/repository_files.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										97
									
								
								vendor/github.com/xanzy/go-gitlab/repository_files.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -21,6 +21,7 @@ import ( | ||||
| 	"fmt" | ||||
| 	"net/url" | ||||
| 	"strconv" | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| // RepositoryFilesService handles communication with the repository files | ||||
| @@ -35,15 +36,16 @@ type RepositoryFilesService struct { | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html | ||||
| type File struct { | ||||
| 	FileName string `json:"file_name"` | ||||
| 	FilePath string `json:"file_path"` | ||||
| 	Size     int    `json:"size"` | ||||
| 	Encoding string `json:"encoding"` | ||||
| 	Content  string `json:"content"` | ||||
| 	Ref      string `json:"ref"` | ||||
| 	BlobID   string `json:"blob_id"` | ||||
| 	CommitID string `json:"commit_id"` | ||||
| 	SHA256   string `json:"content_sha256"` | ||||
| 	FileName     string `json:"file_name"` | ||||
| 	FilePath     string `json:"file_path"` | ||||
| 	Size         int    `json:"size"` | ||||
| 	Encoding     string `json:"encoding"` | ||||
| 	Content      string `json:"content"` | ||||
| 	Ref          string `json:"ref"` | ||||
| 	BlobID       string `json:"blob_id"` | ||||
| 	CommitID     string `json:"commit_id"` | ||||
| 	SHA256       string `json:"content_sha256"` | ||||
| 	LastCommitID string `json:"last_commit_id"` | ||||
| } | ||||
|  | ||||
| func (r File) String() string { | ||||
| @@ -123,13 +125,14 @@ func (s *RepositoryFilesService) GetFileMetaData(pid interface{}, fileName strin | ||||
| 	} | ||||
|  | ||||
| 	f := &File{ | ||||
| 		BlobID:   resp.Header.Get("X-Gitlab-Blob-Id"), | ||||
| 		CommitID: resp.Header.Get("X-Gitlab-Last-Commit-Id"), | ||||
| 		Encoding: resp.Header.Get("X-Gitlab-Encoding"), | ||||
| 		FileName: resp.Header.Get("X-Gitlab-File-Name"), | ||||
| 		FilePath: resp.Header.Get("X-Gitlab-File-Path"), | ||||
| 		Ref:      resp.Header.Get("X-Gitlab-Ref"), | ||||
| 		SHA256:   resp.Header.Get("X-Gitlab-Content-Sha256"), | ||||
| 		BlobID:       resp.Header.Get("X-Gitlab-Blob-Id"), | ||||
| 		CommitID:     resp.Header.Get("X-Gitlab-Last-Commit-Id"), | ||||
| 		Encoding:     resp.Header.Get("X-Gitlab-Encoding"), | ||||
| 		FileName:     resp.Header.Get("X-Gitlab-File-Name"), | ||||
| 		FilePath:     resp.Header.Get("X-Gitlab-File-Path"), | ||||
| 		Ref:          resp.Header.Get("X-Gitlab-Ref"), | ||||
| 		SHA256:       resp.Header.Get("X-Gitlab-Content-Sha256"), | ||||
| 		LastCommitID: resp.Header.Get("X-Gitlab-Last-Commit-Id"), | ||||
| 	} | ||||
|  | ||||
| 	if sizeString := resp.Header.Get("X-Gitlab-Size"); sizeString != "" { | ||||
| @@ -142,6 +145,66 @@ func (s *RepositoryFilesService) GetFileMetaData(pid interface{}, fileName strin | ||||
| 	return f, resp, err | ||||
| } | ||||
|  | ||||
| // FileBlameRange represents one item of blame information. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html | ||||
| type FileBlameRange struct { | ||||
| 	Commit struct { | ||||
| 		ID             string     `json:"id"` | ||||
| 		ParentIDs      []string   `json:"parent_ids"` | ||||
| 		Message        string     `json:"message"` | ||||
| 		AuthoredDate   *time.Time `json:"authored_date"` | ||||
| 		AuthorName     string     `json:"author_name"` | ||||
| 		AuthorEmail    string     `json:"author_email"` | ||||
| 		CommittedDate  *time.Time `json:"committed_date"` | ||||
| 		CommitterName  string     `json:"committer_name"` | ||||
| 		CommitterEmail string     `json:"committer_email"` | ||||
| 	} `json:"commit"` | ||||
| 	Lines []string `json:"lines"` | ||||
| } | ||||
|  | ||||
| func (b FileBlameRange) String() string { | ||||
| 	return Stringify(b) | ||||
| } | ||||
|  | ||||
| // GetFileBlameOptions represents the available GetFileBlame() options. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/repository_files.html#get-file-blame-from-repository | ||||
| type GetFileBlameOptions struct { | ||||
| 	Ref *string `url:"ref,omitempty" json:"ref,omitempty"` | ||||
| } | ||||
|  | ||||
| // GetFileBlame allows you to receive blame information. Each blame range | ||||
| // contains lines and corresponding commit info. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/repository_files.html#get-file-blame-from-repository | ||||
| func (s *RepositoryFilesService) GetFileBlame(pid interface{}, file string, opt *GetFileBlameOptions, options ...RequestOptionFunc) ([]*FileBlameRange, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf( | ||||
| 		"projects/%s/repository/files/%s/blame", | ||||
| 		pathEscape(project), | ||||
| 		url.PathEscape(file), | ||||
| 	) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var br []*FileBlameRange | ||||
| 	resp, err := s.client.Do(req, &br) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return br, resp, err | ||||
| } | ||||
|  | ||||
| // GetRawFileOptions represents the available GetRawFile() options. | ||||
| // | ||||
| // GitLab API docs: | ||||
| @@ -282,9 +345,11 @@ func (s *RepositoryFilesService) UpdateFile(pid interface{}, fileName string, op | ||||
| // https://docs.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository | ||||
| type DeleteFileOptions struct { | ||||
| 	Branch        *string `url:"branch,omitempty" json:"branch,omitempty"` | ||||
| 	StartBranch   *string `url:"start_branch,omitempty" json:"start_branch,omitempty"` | ||||
| 	AuthorEmail   *string `url:"author_email,omitempty" json:"author_email,omitempty"` | ||||
| 	AuthorName    *string `url:"author_name,omitempty" json:"author_name,omitempty"` | ||||
| 	CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"` | ||||
| 	LastCommitID  *string `url:"last_commit_id,omitempty" json:"last_commit_id,omitempty"` | ||||
| } | ||||
|  | ||||
| // DeleteFile deletes an existing file in a repository | ||||
|   | ||||
							
								
								
									
										38
									
								
								vendor/github.com/xanzy/go-gitlab/runners.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/xanzy/go-gitlab/runners.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -336,6 +336,44 @@ func (s *RunnersService) DisableProjectRunner(pid interface{}, runner int, optio | ||||
| 	return s.client.Do(req, nil) | ||||
| } | ||||
|  | ||||
| // ListGroupsRunnersOptions represents the available ListGroupsRunners() options. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/runners.html#list-groups-runners | ||||
| type ListGroupsRunnersOptions struct { | ||||
| 	ListOptions | ||||
| 	Type    *string  `url:"type,omitempty" json:"type,omitempty"` | ||||
| 	Status  *string  `url:"status,omitempty" json:"status,omitempty"` | ||||
| 	TagList []string `url:"tag_list,comma,omitempty" json:"tag_list,omitempty"` | ||||
| } | ||||
|  | ||||
| // ListGroupsRunners lists all runners (specific and shared) available in the | ||||
| // group as well it’s ancestor groups. Shared runners are listed if at least one | ||||
| // shared runner is defined. | ||||
| // | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ee/api/runners.html#list-groups-runners | ||||
| func (s *RunnersService) ListGroupsRunners(gid interface{}, opt *ListGroupsRunnersOptions, options ...RequestOptionFunc) ([]*Runner, *Response, error) { | ||||
| 	group, err := parseID(gid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("groups/%s/runners", pathEscape(group)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, opt, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var rs []*Runner | ||||
| 	resp, err := s.client.Do(req, &rs) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return rs, resp, err | ||||
| } | ||||
|  | ||||
| // RegisterNewRunnerOptions represents the available RegisterNewRunner() | ||||
| // options. | ||||
| // | ||||
|   | ||||
							
								
								
									
										52
									
								
								vendor/github.com/xanzy/go-gitlab/services.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								vendor/github.com/xanzy/go-gitlab/services.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -54,6 +54,30 @@ type Service struct { | ||||
| 	WikiPageEvents           bool       `json:"wiki_page_events"` | ||||
| } | ||||
|  | ||||
| // ListServices gets a list of all active services. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/services.html#list-all-active-services | ||||
| func (s *ServicesService) ListServices(pid interface{}, options ...RequestOptionFunc) ([]*Service, *Response, error) { | ||||
| 	project, err := parseID(pid) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
| 	u := fmt.Sprintf("projects/%s/services", pathEscape(project)) | ||||
|  | ||||
| 	req, err := s.client.NewRequest("GET", u, nil, options) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, err | ||||
| 	} | ||||
|  | ||||
| 	var svcs []*Service | ||||
| 	resp, err := s.client.Do(req, &svcs) | ||||
| 	if err != nil { | ||||
| 		return nil, resp, err | ||||
| 	} | ||||
|  | ||||
| 	return svcs, resp, err | ||||
| } | ||||
|  | ||||
| // DroneCIService represents Drone CI service settings. | ||||
| // | ||||
| // GitLab API docs: | ||||
| @@ -251,7 +275,7 @@ type GithubService struct { | ||||
| // https://docs.gitlab.com/ce/api/services.html#github-premium | ||||
| type GithubServiceProperties struct { | ||||
| 	RepositoryURL string `json:"repository_url,omitempty"` | ||||
| 	StaticContext string `json:"static_context,omitempty"` | ||||
| 	StaticContext bool   `json:"static_context,omitempty"` | ||||
| } | ||||
|  | ||||
| // GetGithubService gets Github service settings for a project. | ||||
| @@ -665,7 +689,17 @@ type MicrosoftTeamsService struct { | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/services.html#microsoft-teams | ||||
| type MicrosoftTeamsServiceProperties struct { | ||||
| 	WebHook string `json:"webhook"` | ||||
| 	WebHook                   string    `json:"webhook"` | ||||
| 	NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"` | ||||
| 	BranchesToBeNotified      string    `json:"branches_to_be_notified"` | ||||
| 	IssuesEvents              BoolValue `json:"issues_events"` | ||||
| 	ConfidentialIssuesEvents  BoolValue `json:"confidential_issues_events"` | ||||
| 	MergeRequestsEvents       BoolValue `json:"merge_requests_events"` | ||||
| 	TagPushEvents             BoolValue `json:"tag_push_events"` | ||||
| 	NoteEvents                BoolValue `json:"note_events"` | ||||
| 	ConfidentialNoteEvents    BoolValue `json:"confidential_note_events"` | ||||
| 	PipelineEvents            BoolValue `json:"pipeline_events"` | ||||
| 	WikiPageEvents            BoolValue `json:"wiki_page_events"` | ||||
| } | ||||
|  | ||||
| // GetMicrosoftTeamsService gets MicrosoftTeams service settings for a project. | ||||
| @@ -699,7 +733,18 @@ func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...R | ||||
| // GitLab API docs: | ||||
| // https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service | ||||
| type SetMicrosoftTeamsServiceOptions struct { | ||||
| 	WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` | ||||
| 	WebHook                   *string `url:"webhook,omitempty" json:"webhook,omitempty"` | ||||
| 	NotifyOnlyBrokenPipelines *bool   `url:"notify_only_broken_pipelines" json:"notify_only_broken_pipelines"` | ||||
| 	BranchesToBeNotified      *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` | ||||
| 	PushEvents                *bool   `url:"push_events,omitempty" json:"push_events,omitempty"` | ||||
| 	IssuesEvents              *bool   `url:"issues_events,omitempty" json:"issues_events,omitempty"` | ||||
| 	ConfidentialIssuesEvents  *bool   `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` | ||||
| 	MergeRequestsEvents       *bool   `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` | ||||
| 	TagPushEvents             *bool   `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` | ||||
| 	NoteEvents                *bool   `url:"note_events,omitempty" json:"note_events,omitempty"` | ||||
| 	ConfidentialNoteEvents    *bool   `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` | ||||
| 	PipelineEvents            *bool   `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` | ||||
| 	WikiPageEvents            *bool   `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` | ||||
| } | ||||
|  | ||||
| // SetMicrosoftTeamsService sets Microsoft Teams service for a project | ||||
| @@ -756,6 +801,7 @@ type PipelinesEmailProperties struct { | ||||
| 	Recipients                string    `json:"recipients,omitempty"` | ||||
| 	NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines,omitempty"` | ||||
| 	NotifyOnlyDefaultBranch   BoolValue `json:"notify_only_default_branch,omitempty"` | ||||
| 	BranchesToBeNotified      string    `json:"branches_to_be_notified,omitempty"` | ||||
| } | ||||
|  | ||||
| // GetPipelinesEmailService gets Pipelines Email service settings for a project. | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/xanzy/go-gitlab/tags.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/xanzy/go-gitlab/tags.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -58,6 +58,7 @@ func (t Tag) String() string { | ||||
| type ListTagsOptions struct { | ||||
| 	ListOptions | ||||
| 	OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` | ||||
| 	Search  *string `url:"search,omitempty" json:"search,omitempty"` | ||||
| 	Sort    *string `url:"sort,omitempty" json:"sort,omitempty"` | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										430
									
								
								vendor/github.com/xanzy/go-gitlab/types.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										430
									
								
								vendor/github.com/xanzy/go-gitlab/types.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,430 @@ | ||||
| package gitlab | ||||
|  | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"net/url" | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| // AccessControlValue represents an access control value within GitLab, | ||||
| // used for managing access to certain project features. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html | ||||
| type AccessControlValue string | ||||
|  | ||||
| // List of available access control values. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html | ||||
| const ( | ||||
| 	DisabledAccessControl AccessControlValue = "disabled" | ||||
| 	EnabledAccessControl  AccessControlValue = "enabled" | ||||
| 	PrivateAccessControl  AccessControlValue = "private" | ||||
| 	PublicAccessControl   AccessControlValue = "public" | ||||
| ) | ||||
|  | ||||
| // AccessControl is a helper routine that allocates a new AccessControlValue | ||||
| // to store v and returns a pointer to it. | ||||
| func AccessControl(v AccessControlValue) *AccessControlValue { | ||||
| 	p := new(AccessControlValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // AccessLevelValue represents a permission level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html | ||||
| type AccessLevelValue int | ||||
|  | ||||
| // List of available access levels | ||||
| // | ||||
| // 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 | ||||
|  | ||||
| 	// These are deprecated and should be removed in a future version | ||||
| 	MasterPermissions AccessLevelValue = 40 | ||||
| 	OwnerPermission   AccessLevelValue = 50 | ||||
| ) | ||||
|  | ||||
| // AccessLevel is a helper routine that allocates a new AccessLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func AccessLevel(v AccessLevelValue) *AccessLevelValue { | ||||
| 	p := new(AccessLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // BuildStateValue represents a GitLab build state. | ||||
| type BuildStateValue string | ||||
|  | ||||
| // These constants represent all valid build states. | ||||
| const ( | ||||
| 	Pending  BuildStateValue = "pending" | ||||
| 	Created  BuildStateValue = "created" | ||||
| 	Running  BuildStateValue = "running" | ||||
| 	Success  BuildStateValue = "success" | ||||
| 	Failed   BuildStateValue = "failed" | ||||
| 	Canceled BuildStateValue = "canceled" | ||||
| 	Skipped  BuildStateValue = "skipped" | ||||
| 	Manual   BuildStateValue = "manual" | ||||
| ) | ||||
|  | ||||
| // BuildState is a helper routine that allocates a new BuildStateValue | ||||
| // to store v and returns a pointer to it. | ||||
| func BuildState(v BuildStateValue) *BuildStateValue { | ||||
| 	p := new(BuildStateValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // DeploymentStatusValue represents a Gitlab deployment status. | ||||
| type DeploymentStatusValue string | ||||
|  | ||||
| // These constants represent all valid deployment statuses. | ||||
| const ( | ||||
| 	DeploymentStatusCreated  DeploymentStatusValue = "created" | ||||
| 	DeploymentStatusRunning  DeploymentStatusValue = "running" | ||||
| 	DeploymentStatusSuccess  DeploymentStatusValue = "success" | ||||
| 	DeploymentStatusFailed   DeploymentStatusValue = "failed" | ||||
| 	DeploymentStatusCanceled DeploymentStatusValue = "canceled" | ||||
| ) | ||||
|  | ||||
| // DeploymentStatus is a helper routine that allocates a new | ||||
| // DeploymentStatusValue to store v and returns a pointer to it. | ||||
| func DeploymentStatus(v DeploymentStatusValue) *DeploymentStatusValue { | ||||
| 	p := new(DeploymentStatusValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // ISOTime represents an ISO 8601 formatted date | ||||
| type ISOTime time.Time | ||||
|  | ||||
| // ISO 8601 date format | ||||
| const iso8601 = "2006-01-02" | ||||
|  | ||||
| // MarshalJSON implements the json.Marshaler interface | ||||
| func (t ISOTime) MarshalJSON() ([]byte, error) { | ||||
| 	if y := time.Time(t).Year(); y < 0 || y >= 10000 { | ||||
| 		// ISO 8901 uses 4 digits for the years | ||||
| 		return nil, errors.New("json: ISOTime year outside of range [0,9999]") | ||||
| 	} | ||||
|  | ||||
| 	b := make([]byte, 0, len(iso8601)+2) | ||||
| 	b = append(b, '"') | ||||
| 	b = time.Time(t).AppendFormat(b, iso8601) | ||||
| 	b = append(b, '"') | ||||
|  | ||||
| 	return b, nil | ||||
| } | ||||
|  | ||||
| // UnmarshalJSON implements the json.Unmarshaler interface | ||||
| func (t *ISOTime) UnmarshalJSON(data []byte) error { | ||||
| 	// Ignore null, like in the main JSON package | ||||
| 	if string(data) == "null" { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	isotime, err := time.Parse(`"`+iso8601+`"`, string(data)) | ||||
| 	*t = ISOTime(isotime) | ||||
|  | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| // EncodeValues implements the query.Encoder interface | ||||
| func (t *ISOTime) EncodeValues(key string, v *url.Values) error { | ||||
| 	if t == nil || (time.Time(*t)).IsZero() { | ||||
| 		return nil | ||||
| 	} | ||||
| 	v.Add(key, t.String()) | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // String implements the Stringer interface | ||||
| func (t ISOTime) String() string { | ||||
| 	return time.Time(t).Format(iso8601) | ||||
| } | ||||
|  | ||||
| // NotificationLevelValue represents a notification level. | ||||
| type NotificationLevelValue int | ||||
|  | ||||
| // String implements the fmt.Stringer interface. | ||||
| func (l NotificationLevelValue) String() string { | ||||
| 	return notificationLevelNames[l] | ||||
| } | ||||
|  | ||||
| // MarshalJSON implements the json.Marshaler interface. | ||||
| func (l NotificationLevelValue) MarshalJSON() ([]byte, error) { | ||||
| 	return json.Marshal(l.String()) | ||||
| } | ||||
|  | ||||
| // UnmarshalJSON implements the json.Unmarshaler interface. | ||||
| func (l *NotificationLevelValue) UnmarshalJSON(data []byte) error { | ||||
| 	var raw interface{} | ||||
| 	if err := json.Unmarshal(data, &raw); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	switch raw := raw.(type) { | ||||
| 	case float64: | ||||
| 		*l = NotificationLevelValue(raw) | ||||
| 	case string: | ||||
| 		*l = notificationLevelTypes[raw] | ||||
| 	case nil: | ||||
| 		// No action needed. | ||||
| 	default: | ||||
| 		return fmt.Errorf("json: cannot unmarshal %T into Go value of type %T", raw, *l) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // List of valid notification levels. | ||||
| const ( | ||||
| 	DisabledNotificationLevel NotificationLevelValue = iota | ||||
| 	ParticipatingNotificationLevel | ||||
| 	WatchNotificationLevel | ||||
| 	GlobalNotificationLevel | ||||
| 	MentionNotificationLevel | ||||
| 	CustomNotificationLevel | ||||
| ) | ||||
|  | ||||
| var notificationLevelNames = [...]string{ | ||||
| 	"disabled", | ||||
| 	"participating", | ||||
| 	"watch", | ||||
| 	"global", | ||||
| 	"mention", | ||||
| 	"custom", | ||||
| } | ||||
|  | ||||
| var notificationLevelTypes = map[string]NotificationLevelValue{ | ||||
| 	"disabled":      DisabledNotificationLevel, | ||||
| 	"participating": ParticipatingNotificationLevel, | ||||
| 	"watch":         WatchNotificationLevel, | ||||
| 	"global":        GlobalNotificationLevel, | ||||
| 	"mention":       MentionNotificationLevel, | ||||
| 	"custom":        CustomNotificationLevel, | ||||
| } | ||||
|  | ||||
| // NotificationLevel is a helper routine that allocates a new NotificationLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue { | ||||
| 	p := new(NotificationLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // VisibilityValue represents a visibility level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type VisibilityValue string | ||||
|  | ||||
| // List of available visibility levels. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	PrivateVisibility  VisibilityValue = "private" | ||||
| 	InternalVisibility VisibilityValue = "internal" | ||||
| 	PublicVisibility   VisibilityValue = "public" | ||||
| ) | ||||
|  | ||||
| // Visibility is a helper routine that allocates a new VisibilityValue | ||||
| // to store v and returns a pointer to it. | ||||
| func Visibility(v VisibilityValue) *VisibilityValue { | ||||
| 	p := new(VisibilityValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // ProjectCreationLevelValue represents a project creation level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type ProjectCreationLevelValue string | ||||
|  | ||||
| // List of available project creation levels. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	NoOneProjectCreation      ProjectCreationLevelValue = "noone" | ||||
| 	MaintainerProjectCreation ProjectCreationLevelValue = "maintainer" | ||||
| 	DeveloperProjectCreation  ProjectCreationLevelValue = "developer" | ||||
| ) | ||||
|  | ||||
| // ProjectCreationLevel is a helper routine that allocates a new ProjectCreationLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func ProjectCreationLevel(v ProjectCreationLevelValue) *ProjectCreationLevelValue { | ||||
| 	p := new(ProjectCreationLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // SubGroupCreationLevelValue represents a sub group creation level within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type SubGroupCreationLevelValue string | ||||
|  | ||||
| // List of available sub group creation levels. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	OwnerSubGroupCreationLevelValue      SubGroupCreationLevelValue = "owner" | ||||
| 	MaintainerSubGroupCreationLevelValue SubGroupCreationLevelValue = "maintainer" | ||||
| ) | ||||
|  | ||||
| // SubGroupCreationLevel is a helper routine that allocates a new SubGroupCreationLevelValue | ||||
| // to store v and returns a pointer to it. | ||||
| func SubGroupCreationLevel(v SubGroupCreationLevelValue) *SubGroupCreationLevelValue { | ||||
| 	p := new(SubGroupCreationLevelValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // VariableTypeValue represents a variable type within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| type VariableTypeValue string | ||||
|  | ||||
| // List of available variable types. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/ | ||||
| const ( | ||||
| 	EnvVariableType  VariableTypeValue = "env_var" | ||||
| 	FileVariableType VariableTypeValue = "file" | ||||
| ) | ||||
|  | ||||
| // VariableType is a helper routine that allocates a new VariableTypeValue | ||||
| // to store v and returns a pointer to it. | ||||
| func VariableType(v VariableTypeValue) *VariableTypeValue { | ||||
| 	p := new(VariableTypeValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // MergeMethodValue represents a project merge type within GitLab. | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method | ||||
| type MergeMethodValue string | ||||
|  | ||||
| // List of available merge type | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method | ||||
| const ( | ||||
| 	NoFastForwardMerge MergeMethodValue = "merge" | ||||
| 	FastForwardMerge   MergeMethodValue = "ff" | ||||
| 	RebaseMerge        MergeMethodValue = "rebase_merge" | ||||
| ) | ||||
|  | ||||
| // MergeMethod is a helper routine that allocates a new MergeMethod | ||||
| // to sotre v and returns a pointer to it. | ||||
| func MergeMethod(v MergeMethodValue) *MergeMethodValue { | ||||
| 	p := new(MergeMethodValue) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // EventTypeValue represents actions type for contribution events | ||||
| type EventTypeValue string | ||||
|  | ||||
| // List of available action type | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/events.html#action-types | ||||
| const ( | ||||
| 	CreatedEventType   EventTypeValue = "created" | ||||
| 	UpdatedEventType   EventTypeValue = "updated" | ||||
| 	ClosedEventType    EventTypeValue = "closed" | ||||
| 	ReopenedEventType  EventTypeValue = "reopened" | ||||
| 	PushedEventType    EventTypeValue = "pushed" | ||||
| 	CommentedEventType EventTypeValue = "commented" | ||||
| 	MergedEventType    EventTypeValue = "merged" | ||||
| 	JoinedEventType    EventTypeValue = "joined" | ||||
| 	LeftEventType      EventTypeValue = "left" | ||||
| 	DestroyedEventType EventTypeValue = "destroyed" | ||||
| 	ExpiredEventType   EventTypeValue = "expired" | ||||
| ) | ||||
|  | ||||
| // EventTargetTypeValue represents actions type value for contribution events | ||||
| type EventTargetTypeValue string | ||||
|  | ||||
| // List of available action type | ||||
| // | ||||
| // GitLab API docs: https://docs.gitlab.com/ce/api/events.html#target-types | ||||
| const ( | ||||
| 	IssueEventTargetType        EventTargetTypeValue = "issue" | ||||
| 	MilestoneEventTargetType    EventTargetTypeValue = "milestone" | ||||
| 	MergeRequestEventTargetType EventTargetTypeValue = "merge_request" | ||||
| 	NoteEventTargetType         EventTargetTypeValue = "note" | ||||
| 	ProjectEventTargetType      EventTargetTypeValue = "project" | ||||
| 	SnippetEventTargetType      EventTargetTypeValue = "snippet" | ||||
| 	UserEventTargetType         EventTargetTypeValue = "user" | ||||
| ) | ||||
|  | ||||
| // Bool is a helper routine that allocates a new bool value | ||||
| // to store v and returns a pointer to it. | ||||
| func Bool(v bool) *bool { | ||||
| 	p := new(bool) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // Int is a helper routine that allocates a new int32 value | ||||
| // to store v and returns a pointer to it, but unlike Int32 | ||||
| // its argument value is an int. | ||||
| func Int(v int) *int { | ||||
| 	p := new(int) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // String is a helper routine that allocates a new string value | ||||
| // to store v and returns a pointer to it. | ||||
| func String(v string) *string { | ||||
| 	p := new(string) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // Time is a helper routine that allocates a new time.Time value | ||||
| // to store v and returns a pointer to it. | ||||
| func Time(v time.Time) *time.Time { | ||||
| 	p := new(time.Time) | ||||
| 	*p = v | ||||
| 	return p | ||||
| } | ||||
|  | ||||
| // BoolValue is a boolean value with advanced json unmarshaling features. | ||||
| type BoolValue bool | ||||
|  | ||||
| // UnmarshalJSON allows 1, 0, "true", and "false" to be considered as boolean values | ||||
| // Needed for: | ||||
| // https://gitlab.com/gitlab-org/gitlab-ce/issues/50122 | ||||
| // https://gitlab.com/gitlab-org/gitlab/-/issues/233941 | ||||
| // https://github.com/gitlabhq/terraform-provider-gitlab/issues/348 | ||||
| func (t *BoolValue) UnmarshalJSON(b []byte) error { | ||||
| 	switch string(b) { | ||||
| 	case `"1"`: | ||||
| 		*t = true | ||||
| 		return nil | ||||
| 	case `"0"`: | ||||
| 		*t = false | ||||
| 		return nil | ||||
| 	case `"true"`: | ||||
| 		*t = true | ||||
| 		return nil | ||||
| 	case `"false"`: | ||||
| 		*t = false | ||||
| 		return nil | ||||
| 	default: | ||||
| 		var v bool | ||||
| 		err := json.Unmarshal(b, &v) | ||||
| 		*t = BoolValue(v) | ||||
| 		return err | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										2
									
								
								vendor/github.com/xanzy/go-gitlab/users.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/xanzy/go-gitlab/users.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -112,6 +112,7 @@ type ListUsersOptions struct { | ||||
| 	CreatedAfter         *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"` | ||||
| 	OrderBy              *string    `url:"order_by,omitempty" json:"order_by,omitempty"` | ||||
| 	Sort                 *string    `url:"sort,omitempty" json:"sort,omitempty"` | ||||
| 	External             *bool      `url:"external,omitempty" json:"external,omitempty"` | ||||
| 	WithCustomAttributes *bool      `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` | ||||
| } | ||||
|  | ||||
| @@ -829,6 +830,7 @@ type UserActivity struct { | ||||
| // GitLap API docs: | ||||
| // https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only | ||||
| type GetUserActivitiesOptions struct { | ||||
| 	ListOptions | ||||
| 	From *ISOTime `url:"from,omitempty" json:"from,omitempty"` | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user