Skip to content

Commit

Permalink
Add 'Get the path to repository storage' feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyril Dupont committed Nov 30, 2022
1 parent 9260b24 commit 53df52d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions projects.go
Expand Up @@ -2007,3 +2007,35 @@ func (s *ProjectsService) StartHousekeepingProject(pid interface{}, options ...R

return resp, err
}

// 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"`
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
}

0 comments on commit 53df52d

Please sign in to comment.