Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'start housekeeping task for a project' and 'Get the path to repository storage' features #1585

Merged
merged 6 commits into from Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 56 additions & 0 deletions projects.go
Expand Up @@ -1983,3 +1983,59 @@ func (s *ProjectsService) TransferProject(pid interface{}, opt *TransferProjectO

return p, resp, err
}

// StartHousekeepingProject start the Housekeeping task for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/projects.html#start-the-housekeeping-task-for-a-project
func (s *ProjectsService) StartHousekeepingProject(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/housekeeping", PathEscape(project))

req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, err
}

resp, err := s.client.Do(req, nil)
if err != nil {
return resp, err
}

return resp, err
cyd01 marked this conversation as resolved.
Show resolved Hide resolved
}

// GetRepositoryStorage Get the path to repository storage.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/projects.html#get-the-path-to-repository-storage
type ProjectReposityStorage struct {
ProjectID int `json:"project_id"`
DiskPath string `json:"disk_path"`
CreatedAt string `json:"created_at"`
cyd01 marked this conversation as resolved.
Show resolved Hide resolved
RepositoryStorage string `json:"repository_storage"`
}

func (s *ProjectsService) GetRepositoryStorage(pid interface{}, options ...RequestOptionFunc) (*ProjectReposityStorage, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/storage", PathEscape(project))

req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

prs := new(ProjectReposityStorage)
resp, err := s.client.Do(req, prs)
if err != nil {
return nil, resp, err
}

return prs, resp, err
}
1 change: 1 addition & 0 deletions users.go
Expand Up @@ -258,6 +258,7 @@ type ModifyUserOptions struct {
Note *string `url:"note,omitempty" json:"note,omitempty"`
ThemeID *int `url:"theme_id,omitempty" json:"theme_id,omitempty"`
PublicEmail *string `url:"public_email,omitempty" json:"public_email,omitempty"`
CommitEmail *string `url:"commit_email,omitempty" json:"commit_email,omitempty"`
}

// ModifyUser modifies an existing user. Only administrators can change attributes
Expand Down