updated client routes

This commit is contained in:
Brad Rydzewski
2014-09-28 18:38:21 -07:00
parent 21f9aec808
commit e5cc46b4dd
4 changed files with 30 additions and 31 deletions

View File

@@ -11,17 +11,17 @@ type CommitService struct {
*Client
}
// GET /v1/repos/{host}/{owner}/{name}/branch/{branch}/commit/{commit}
// GET /api/repos/{host}/{owner}/{name}/branch/{branch}/commit/{commit}
func (s *CommitService) Get(host, owner, name, branch, sha string) (*model.Commit, error) {
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits/%s", host, owner, name, branch, sha)
var path = fmt.Sprintf("/api/repos/%s/%s/%s/branches/%s/commits/%s", host, owner, name, branch, sha)
var commit = model.Commit{}
var err = s.run("GET", path, nil, &commit)
return &commit, err
}
// GET /v1/repos/{host}/{owner}/{name}/branches/{branch}/commits/{commit}/console
// GET /api/repos/{host}/{owner}/{name}/branches/{branch}/commits/{commit}/console
func (s *CommitService) GetOutput(host, owner, name, branch, sha string) (io.ReadCloser, error) {
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits/%s/console", host, owner, name, branch, sha)
var path = fmt.Sprintf("/api/repos/%s/%s/%s/branches/%s/commits/%s/console", host, owner, name, branch, sha)
resp, err := s.do("GET", path)
if err != nil {
return nil, nil
@@ -29,23 +29,23 @@ func (s *CommitService) GetOutput(host, owner, name, branch, sha string) (io.Rea
return resp.Body, nil
}
// POST /v1/repos/{host}/{owner}/{name}/branches/{branch}/commits/{commit}?action=rebuild
// POST /api/repos/{host}/{owner}/{name}/branches/{branch}/commits/{commit}?action=rebuild
func (s *CommitService) Rebuild(host, owner, name, branch, sha string) error {
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits/%s?action=rebuild", host, owner, name, branch, sha)
var path = fmt.Sprintf("/api/repos/%s/%s/%s/branches/%s/commits/%s?action=rebuild", host, owner, name, branch, sha)
return s.run("POST", path, nil, nil)
}
// GET /v1/repos/{host}/{owner}/{name}/feed
// GET /api/repos/{host}/{owner}/{name}/feed
func (s *CommitService) List(host, owner, name string) ([]*model.Commit, error) {
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/feed", host, owner, name)
var path = fmt.Sprintf("/api/repos/%s/%s/%s/feed", host, owner, name)
var list []*model.Commit
var err = s.run("GET", path, nil, &list)
return list, err
}
// GET /v1/repos/{host}/{owner}/{name}/branch/{branch}
// GET /api/repos/{host}/{owner}/{name}/branch/{branch}
func (s *CommitService) ListBranch(host, owner, name, branch string) ([]*model.Commit, error) {
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits", host, owner, name, branch)
var path = fmt.Sprintf("/api/repos/%s/%s/%s/branches/%s/commits", host, owner, name, branch)
var list []*model.Commit
var err = s.run("GET", path, nil, &list)
return list, err