@@ -31,9 +31,17 @@ type GitPersonInfo struct {
3131 TZ int `json:"tz"`
3232}
3333
34+ // NotifyInfo entity contains detailed information about who should be
35+ // notified about an update
36+ type NotifyInfo struct {
37+ Accounts []AccountInfo `json:"accounts"`
38+ }
39+
3440// AbandonInput entity contains information for abandoning a change.
3541type AbandonInput struct {
36- Message string `json:"message,omitempty"`
42+ Message string `json:"message,omitempty"`
43+ Notify string `json:"notify"`
44+ NotifyDetails []NotifyInfo `json:"notify_details"`
3745}
3846
3947// ApprovalInfo entity contains information about an approval from a user for a label on a change.
@@ -706,9 +714,29 @@ func (s *ChangesService) SubmitChange(changeID string, input *SubmitInput) (*Cha
706714 return v , resp , err
707715}
708716
717+ // AbandonChange abandons a change.
718+ //
719+ // Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-change
720+ func (s * ChangesService ) AbandonChange (changeID string , input * AbandonInput ) (* ChangeInfo , * Response , error ) {
721+ u := fmt .Sprintf ("changes/%s/abandon" , changeID )
722+
723+ req , err := s .client .NewRequest ("POST" , u , input )
724+ if err != nil {
725+ return nil , nil , err
726+ }
727+
728+ v := new (ChangeInfo )
729+
730+ resp , err := s .client .Do (req , v )
731+ if resp .StatusCode == http .StatusConflict {
732+ body , _ := ioutil .ReadAll (resp .Body )
733+ err = errors .New (string (body [:]))
734+ }
735+ return v , resp , err
736+ }
737+
709738/*
710739Missing Change Endpoints
711- Abandon Change
712740 Restore Change
713741 Rebase Change
714742 Revert Change
0 commit comments