Skip to content

Commit

Permalink
Merge pull request #1585 from cyd01/master
Browse files Browse the repository at this point in the history
Add 'start housekeeping task for a project' and 'Get the path to repository storage' features
  • Loading branch information
svanharmelen authored Dec 10, 2022
2 parents f203bb0 + 98b08c6 commit 05207f5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -1985,3 +1985,54 @@ 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
}

return s.client.Do(req, nil)
}

// 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 *time.Time `json:"created_at"`
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

0 comments on commit 05207f5

Please sign in to comment.