Skip to content

Commit 8cd4eeb

Browse files
committed
added RestoreChange
1 parent 0412c6f commit 8cd4eeb

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ first. For more complete details see
99

1010
### 0.5.1
1111

12-
* Added the `AbandonChange` and `RebaseChange` functions.
12+
* Added the `AbandonChange`, `RebaseChange` and `RestoreChange` functions.
1313

1414
### 0.5.0
1515

changes.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,32 @@ func (s *ChangesService) RebaseChange(changeID string, input *RebaseInput) (*Cha
762762
return v, resp, err
763763
}
764764

765+
// RestoreChange restores a change.
766+
//
767+
// The request body does not need to include a RestoreInput entity if no review
768+
// comment is added.
769+
//
770+
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#restore-change
771+
func (s *ChangesService) RestoreChange(changeID string, input *RestoreInput) (*ChangeInfo, *Response, error) {
772+
u := fmt.Sprintf("changes/%s/restore", changeID)
773+
774+
req, err := s.client.NewRequest("POST", u, input)
775+
if err != nil {
776+
return nil, nil, err
777+
}
778+
779+
v := new(ChangeInfo)
780+
781+
resp, err := s.client.Do(req, v)
782+
if resp.StatusCode == http.StatusConflict {
783+
body, _ := ioutil.ReadAll(resp.Body)
784+
err = errors.New(string(body[:]))
785+
}
786+
return v, resp, err
787+
}
788+
789+
765790
/*
766791
Missing Change Endpoints
767-
Restore Change
768792
Revert Change
769793
*/

0 commit comments

Comments
 (0)