Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions projects.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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