Skip to content

Commit

Permalink
Merge pull request #15 from perolausson/master
Browse files Browse the repository at this point in the history
Add Submit Change
  • Loading branch information
andygrunwald authored Sep 27, 2016
2 parents eba8c69 + 61d518d commit 1ef7e63
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion changes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package gerrit

import (
"errors"
"fmt"
"io/ioutil"
)

// ChangesService contains Change related REST endpoints
Expand Down Expand Up @@ -674,11 +676,28 @@ func (s *ChangesService) FixChange(changeID string, input *FixInput) (*ChangeInf
return v, resp, err
}

func (s *ChangesService) SubmitChange(changeID string, input *SubmitInput) (*ChangeInfo, *Response, error) {
u := fmt.Sprintf("changes/%s/submit", changeID)

req, err := s.client.NewRequest("POST", u, input)
if err != nil {
return nil, nil, err
}

v := new(ChangeInfo)

resp, err := s.client.Do(req, v)
if 409 == resp.StatusCode {
body, _ := ioutil.ReadAll(resp.Body)
err = errors.New(string(body[:]))
}
return v, resp, err
}

/*
Missing Change Endpoints
Abandon Change
Restore Change
Rebase Change
Revert Change
Submit Change
*/

0 comments on commit 1ef7e63

Please sign in to comment.