From 9260b242452b895dc2aebc6f176dcb7009d70839 Mon Sep 17 00:00:00 2001 From: Cyril Dupont Date: Tue, 29 Nov 2022 16:34:27 +0100 Subject: [PATCH 1/5] Add 'start housekeeping task for a project' feature --- projects.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/projects.go b/projects.go index 676a4b7d8..ae27c6e0d 100644 --- a/projects.go +++ b/projects.go @@ -1983,3 +1983,27 @@ 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 +} From 07d2f00e4ff487b54c142c983b67afcacc150f25 Mon Sep 17 00:00:00 2001 From: Cyril Dupont Date: Wed, 30 Nov 2022 12:24:46 +0100 Subject: [PATCH 2/5] Add 'Get the path to repository storage' feature --- projects.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/projects.go b/projects.go index ae27c6e0d..7985d67bd 100644 --- a/projects.go +++ b/projects.go @@ -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 +} From a9b090f1d43de7ed891b71352ec75f8653108fbe Mon Sep 17 00:00:00 2001 From: Cyril Dupont Date: Thu, 1 Dec 2022 11:56:18 +0100 Subject: [PATCH 3/5] Add "commit email" to ModifyUserOptions structure --- users.go | 1 + 1 file changed, 1 insertion(+) diff --git a/users.go b/users.go index 61973a974..3fe977c2c 100644 --- a/users.go +++ b/users.go @@ -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 From 912ecd000c092389540b07d55a9ab91218367944 Mon Sep 17 00:00:00 2001 From: Cyd <34154246+cyd01@users.noreply.github.com> Date: Mon, 5 Dec 2022 12:16:49 +0100 Subject: [PATCH 4/5] Update projects.go Co-authored-by: Sander van Harmelen --- projects.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/projects.go b/projects.go index 7985d67bd..6f06b1bf5 100644 --- a/projects.go +++ b/projects.go @@ -2000,12 +2000,7 @@ func (s *ProjectsService) StartHousekeepingProject(pid interface{}, options ...R return nil, err } - resp, err := s.client.Do(req, nil) - if err != nil { - return resp, err - } - - return resp, err + return s.client.Do(req, nil) } // GetRepositoryStorage Get the path to repository storage. From 7a181717c8a7f65606642b3769044dc59112bb20 Mon Sep 17 00:00:00 2001 From: Cyd <34154246+cyd01@users.noreply.github.com> Date: Mon, 5 Dec 2022 12:19:02 +0100 Subject: [PATCH 5/5] Update projects.go Exact Co-authored-by: Sander van Harmelen --- projects.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects.go b/projects.go index 6f06b1bf5..ccdaed639 100644 --- a/projects.go +++ b/projects.go @@ -2010,7 +2010,7 @@ func (s *ProjectsService) StartHousekeepingProject(pid interface{}, options ...R type ProjectReposityStorage struct { ProjectID int `json:"project_id"` DiskPath string `json:"disk_path"` - CreatedAt string `json:"created_at"` + CreatedAt *time.Time `json:"created_at"` RepositoryStorage string `json:"repository_storage"` }