|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
//
|
|
|
|
|
// Copyright 2017, Sander van Harmelen
|
|
|
|
|
// Copyright 2021, 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.
|
|
|
|
@ -22,6 +22,7 @@ import (
|
|
|
|
|
"io"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"mime/multipart"
|
|
|
|
|
"net/http"
|
|
|
|
|
"os"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
@ -38,71 +39,74 @@ 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"`
|
|
|
|
|
AllowMergeOnSkippedPipeline bool `json:"allow_merge_on_skipped_pipeline"`
|
|
|
|
|
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"`
|
|
|
|
|
PackagesEnabled bool `json:"packages_enabled"`
|
|
|
|
|
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"`
|
|
|
|
|
CIForwardDeploymentEnabled bool `json:"ci_forward_deployment_enabled"`
|
|
|
|
|
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"`
|
|
|
|
|
ContainerExpirationPolicy *ContainerExpirationPolicy `json:"container_expiration_policy,omitempty"`
|
|
|
|
|
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"`
|
|
|
|
|
EmptyRepo bool `json:"empty_repo"`
|
|
|
|
|
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"`
|
|
|
|
|
AllowMergeOnSkippedPipeline bool `json:"allow_merge_on_skipped_pipeline"`
|
|
|
|
|
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"`
|
|
|
|
|
PackagesEnabled bool `json:"packages_enabled"`
|
|
|
|
|
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"`
|
|
|
|
|
OperationsAccessLevel AccessControlValue `json:"operations_access_level"`
|
|
|
|
|
AutocloseReferencedIssues bool `json:"autoclose_referenced_issues"`
|
|
|
|
|
CIForwardDeploymentEnabled bool `json:"ci_forward_deployment_enabled"`
|
|
|
|
|
SharedWithGroups []struct {
|
|
|
|
|
GroupID int `json:"group_id"`
|
|
|
|
|
GroupName string `json:"group_name"`
|
|
|
|
@ -116,6 +120,17 @@ type Project struct {
|
|
|
|
|
ComplianceFrameworks []string `json:"compliance_frameworks"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ContainerExpirationPolicy represents the container expiration policy.
|
|
|
|
|
type ContainerExpirationPolicy struct {
|
|
|
|
|
Cadence string `json:"cadence"`
|
|
|
|
|
KeepN int `json:"keep_n"`
|
|
|
|
|
OlderThan string `json:"older_than"`
|
|
|
|
|
NameRegexDelete string `json:"name_regex_delete"`
|
|
|
|
|
NameRegexKeep string `json:"name_regex_keep"`
|
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
|
NextRunAt *time.Time `json:"next_run_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Repository represents a repository.
|
|
|
|
|
type Repository struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
@ -257,7 +272,7 @@ type ListProjectsOptions struct {
|
|
|
|
|
//
|
|
|
|
|
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-projects
|
|
|
|
|
func (s *ProjectsService) ListProjects(opt *ListProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) {
|
|
|
|
|
req, err := s.client.NewRequest("GET", "projects", opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, "projects", opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -282,7 +297,7 @@ func (s *ProjectsService) ListUserProjects(uid interface{}, opt *ListProjectsOpt
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("users/%s/projects", user)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -325,7 +340,7 @@ func (s *ProjectsService) ListProjectsUsers(pid interface{}, opt *ListProjectUse
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/users", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -354,7 +369,7 @@ func (s *ProjectsService) GetProjectLanguages(pid interface{}, options ...Reques
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/languages", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -389,7 +404,7 @@ func (s *ProjectsService) GetProject(pid interface{}, opt *GetProjectOptions, op
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -450,7 +465,7 @@ func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEvent
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/events", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -468,55 +483,57 @@ 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"`
|
|
|
|
|
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"`
|
|
|
|
|
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,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"`
|
|
|
|
|
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,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"`
|
|
|
|
|
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"`
|
|
|
|
|
OperationsAccessLevel *AccessControlValue `url:"operations_access_level,omitempty" json:"operations_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"`
|
|
|
|
|
ContainerExpirationPolicyAttributes *ContainerExpirationPolicyAttributes `url:"container_expiration_policy_attributes,omitempty" json:"container_expiration_policy_attributes,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"`
|
|
|
|
|
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,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"`
|
|
|
|
|
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,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"`
|
|
|
|
@ -526,11 +543,34 @@ type CreateProjectOptions struct {
|
|
|
|
|
SnippetsEnabled *bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ContainerExpirationPolicyAttributes represents the available container
|
|
|
|
|
// expiration policy attributes.
|
|
|
|
|
//
|
|
|
|
|
// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#create-project
|
|
|
|
|
type ContainerExpirationPolicyAttributes struct {
|
|
|
|
|
Cadence *string `url:"cadence,omitempty" json:"cadence,omitempty"`
|
|
|
|
|
KeepN *int `url:"keep_n,omitempty" json:"keep_n,omitempty"`
|
|
|
|
|
OlderThan *string `url:"older_than,omitempty" json:"older_than,omitempty"`
|
|
|
|
|
NameRegexDelete *string `url:"name_regex_delete,omitempty" json:"name_regex_delete,omitempty"`
|
|
|
|
|
NameRegexKeep *string `url:"name_regex_keep,omitempty" json:"name_regex_keep,omitempty"`
|
|
|
|
|
Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"`
|
|
|
|
|
|
|
|
|
|
// Deprecated members
|
|
|
|
|
NameRegex *string `url:"name_regex,omitempty" json:"name_regex,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CreateProject creates a new project owned by the authenticated user.
|
|
|
|
|
//
|
|
|
|
|
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#create-project
|
|
|
|
|
func (s *ProjectsService) CreateProject(opt *CreateProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) {
|
|
|
|
|
req, err := s.client.NewRequest("POST", "projects", opt, options)
|
|
|
|
|
if opt.ContainerExpirationPolicyAttributes != nil {
|
|
|
|
|
// This is needed to satisfy the API. Should be deleted
|
|
|
|
|
// when NameRegex is removed (it's now deprecated).
|
|
|
|
|
opt.ContainerExpirationPolicyAttributes.NameRegex =
|
|
|
|
|
opt.ContainerExpirationPolicyAttributes.NameRegexDelete
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, "projects", opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -557,9 +597,15 @@ type CreateProjectForUserOptions CreateProjectOptions
|
|
|
|
|
// GitLab API docs:
|
|
|
|
|
// https://docs.gitlab.com/ce/api/projects.html#create-project-for-user
|
|
|
|
|
func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUserOptions, options ...RequestOptionFunc) (*Project, *Response, error) {
|
|
|
|
|
u := fmt.Sprintf("projects/user/%d", user)
|
|
|
|
|
if opt.ContainerExpirationPolicyAttributes != nil {
|
|
|
|
|
// This is needed to satisfy the API. Should be deleted
|
|
|
|
|
// when NameRegex is removed (it's now deprecated).
|
|
|
|
|
opt.ContainerExpirationPolicyAttributes.NameRegex =
|
|
|
|
|
opt.ContainerExpirationPolicyAttributes.NameRegexDelete
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, opt, options)
|
|
|
|
|
u := fmt.Sprintf("projects/user/%d", user)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -577,52 +623,54 @@ 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"`
|
|
|
|
|
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"`
|
|
|
|
|
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,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"`
|
|
|
|
|
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,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"`
|
|
|
|
|
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"`
|
|
|
|
|
OperationsAccessLevel *AccessControlValue `url:"operations_access_level,omitempty" json:"operations_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"`
|
|
|
|
|
ContainerExpirationPolicyAttributes *ContainerExpirationPolicyAttributes `url:"container_expiration_policy_attributes,omitempty" json:"container_expiration_policy_attributes,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"`
|
|
|
|
|
AllowMergeOnSkippedPipeline *bool `url:"allow_merge_on_skipped_pipeline,omitempty" json:"allow_merge_on_skipped_pipeline,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"`
|
|
|
|
|
CIForwardDeploymentEnabled *bool `url:"ci_forward_deployment_enabled,omitempty" json:"ci_forward_deployment_enabled,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"`
|
|
|
|
@ -636,13 +684,20 @@ type EditProjectOptions struct {
|
|
|
|
|
//
|
|
|
|
|
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project
|
|
|
|
|
func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) {
|
|
|
|
|
if opt.ContainerExpirationPolicyAttributes != nil {
|
|
|
|
|
// This is needed to satisfy the API. Should be deleted
|
|
|
|
|
// when NameRegex is removed (it's now deprecated).
|
|
|
|
|
opt.ContainerExpirationPolicyAttributes.NameRegex =
|
|
|
|
|
opt.ContainerExpirationPolicyAttributes.NameRegexDelete
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
project, err := parseID(pid)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("PUT", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -676,7 +731,7 @@ func (s *ProjectsService) ForkProject(pid interface{}, opt *ForkProjectOptions,
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/fork", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -701,7 +756,7 @@ func (s *ProjectsService) StarProject(pid interface{}, options ...RequestOptionF
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/star", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -726,7 +781,7 @@ func (s *ProjectsService) UnstarProject(pid interface{}, options ...RequestOptio
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/unstar", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -752,7 +807,7 @@ func (s *ProjectsService) ArchiveProject(pid interface{}, options ...RequestOpti
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/archive", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -778,7 +833,7 @@ func (s *ProjectsService) UnarchiveProject(pid interface{}, options ...RequestOp
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/unarchive", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -803,7 +858,7 @@ func (s *ProjectsService) DeleteProject(pid interface{}, options ...RequestOptio
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -830,7 +885,7 @@ func (s *ProjectsService) ShareProjectWithGroup(pid interface{}, opt *ShareWithG
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/share", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -848,7 +903,7 @@ func (s *ProjectsService) DeleteSharedProjectFromGroup(pid interface{}, groupID
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/share/%d", pathEscape(project), groupID)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -913,7 +968,7 @@ func (s *ProjectsService) ListProjectHooks(pid interface{}, opt *ListProjectHook
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/hooks", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -938,7 +993,7 @@ func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...R
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -985,7 +1040,7 @@ func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOpt
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/hooks", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1032,7 +1087,7 @@ func (s *ProjectsService) EditProjectHook(pid interface{}, hook int, opt *EditPr
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("PUT", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1058,7 +1113,7 @@ func (s *ProjectsService) DeleteProjectHook(pid interface{}, hook int, options .
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -1086,7 +1141,7 @@ type ProjectForkRelation struct {
|
|
|
|
|
func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options ...RequestOptionFunc) (*ProjectForkRelation, *Response, error) {
|
|
|
|
|
u := fmt.Sprintf("projects/%d/fork/%d", pid, fork)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1107,7 +1162,7 @@ func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options .
|
|
|
|
|
func (s *ProjectsService) DeleteProjectForkRelation(pid int, options ...RequestOptionFunc) (*Response, error) {
|
|
|
|
|
u := fmt.Sprintf("projects/%d/fork", pid)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -1162,7 +1217,7 @@ func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...Re
|
|
|
|
|
req.Body = ioutil.NopCloser(b)
|
|
|
|
|
req.ContentLength = int64(b.Len())
|
|
|
|
|
req.Header.Set("Content-Type", w.FormDataContentType())
|
|
|
|
|
req.Method = "POST"
|
|
|
|
|
req.Method = http.MethodPost
|
|
|
|
|
|
|
|
|
|
uf := &ProjectFile{}
|
|
|
|
|
resp, err := s.client.Do(req, uf)
|
|
|
|
@ -1184,7 +1239,7 @@ func (s *ProjectsService) ListProjectForks(pid interface{}, opt *ListProjectsOpt
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/forks", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1230,7 +1285,7 @@ func (s *ProjectsService) GetProjectPushRules(pid interface{}, options ...Reques
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1274,7 +1329,7 @@ func (s *ProjectsService) AddProjectPushRule(pid interface{}, opt *AddProjectPus
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1318,7 +1373,7 @@ func (s *ProjectsService) EditProjectPushRule(pid interface{}, opt *EditProjectP
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("PUT", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1345,7 +1400,7 @@ func (s *ProjectsService) DeleteProjectPushRule(pid interface{}, options ...Requ
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -1378,7 +1433,7 @@ func (s *ProjectsService) GetApprovalConfiguration(pid interface{}, options ...R
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/approvals", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1416,7 +1471,7 @@ func (s *ProjectsService) ChangeApprovalConfiguration(pid interface{}, opt *Chan
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/approvals", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1441,7 +1496,7 @@ func (s *ProjectsService) GetProjectApprovalRules(pid interface{}, options ...Re
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/approval_rules", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("GET", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1479,7 +1534,7 @@ func (s *ProjectsService) CreateProjectApprovalRule(pid interface{}, opt *Create
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/approval_rules", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1517,7 +1572,7 @@ func (s *ProjectsService) UpdateProjectApprovalRule(pid interface{}, approvalRul
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/approval_rules/%d", pathEscape(project), approvalRule)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("PUT", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1542,7 +1597,7 @@ func (s *ProjectsService) DeleteProjectApprovalRule(pid interface{}, approvalRul
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/approval_rules/%d", pathEscape(project), approvalRule)
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -1571,7 +1626,7 @@ func (s *ProjectsService) ChangeAllowedApprovers(pid interface{}, opt *ChangeAll
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/approvers", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("PUT", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
@ -1596,7 +1651,7 @@ func (s *ProjectsService) StartMirroringProject(pid interface{}, options ...Requ
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/mirror/pull", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("POST", u, nil, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -1626,7 +1681,7 @@ func (s *ProjectsService) TransferProject(pid interface{}, opt *TransferProjectO
|
|
|
|
|
}
|
|
|
|
|
u := fmt.Sprintf("projects/%s/transfer", pathEscape(project))
|
|
|
|
|
|
|
|
|
|
req, err := s.client.NewRequest("PUT", u, opt, options)
|
|
|
|
|
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, nil, err
|
|
|
|
|
}
|
|
|
|
|