Commit 1c570e60 authored by Lucas Jenss's avatar Lucas Jenss

Add archive/unarchive support

parent a5f785c2
......@@ -908,3 +908,55 @@ func (s *ProjectsService) DeleteProjectForkRelation(pid int) (*Response, error)
return resp, err
}
// Archives the project if the user is either admin or the project owner
// of this project.
//
// GitLab API docs:
// http://docs.gitlab.com/ce/api/projects.html#archive-a-project
func (s *ProjectsService) ArchiveProject(pid interface{}) (*Project, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/archive", url.QueryEscape(project))
req, err := s.client.NewRequest("POST", u, nil)
if err != nil {
return nil, nil, err
}
p := new(Project)
resp, err := s.client.Do(req, p)
if err != nil {
return nil, resp, err
}
return p, resp, err
}
// Unarchives the project if the user is either admin or the project owner
// of this project.
//
// GitLab API docs:
// http://docs.gitlab.com/ce/api/projects.html#unarchive-a-project
func (s *ProjectsService) UnarchiveProject(pid interface{}) (*Project, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/unarchive", url.QueryEscape(project))
req, err := s.client.NewRequest("POST", u, nil)
if err != nil {
return nil, nil, err
}
p := new(Project)
resp, err := s.client.Do(req, p)
if err != nil {
return nil, resp, err
}
return p, resp, err
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment