mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-28 11:20:30 +00:00
parent
0fb978fa98
commit
4b4d078377
2 changed files with 3 additions and 5 deletions
|
@ -43,7 +43,7 @@ const (
|
|||
pathHookEnabled = "%s/rest/api/1.0/projects/%s/repos/%s/settings/hooks/%s/enabled"
|
||||
pathHookSettings = "%s/rest/api/1.0/projects/%s/repos/%s/settings/hooks/%s/settings"
|
||||
pathStatus = "%s/rest/build-status/1.0/commits/%s"
|
||||
pathBranches = "%s/2.0/repositories/%s/%s/refs/branches"
|
||||
pathBranches = "%s/rest/api/1.0/projects/%s/repos/%s/branches"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
@ -326,12 +326,10 @@ func (c *Client) paginatedRepos(start int) ([]*Repo, error) {
|
|||
func (c *Client) ListBranches(owner, name string) ([]*Branch, error) {
|
||||
uri := fmt.Sprintf(pathBranches, c.base, owner, name)
|
||||
response, err := c.doGet(uri)
|
||||
if response != nil {
|
||||
defer response.Body.Close()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer response.Body.Close()
|
||||
out := new(BranchResp)
|
||||
err = json.NewDecoder(response.Body).Decode(&out)
|
||||
return out.Values, err
|
||||
|
|
|
@ -211,5 +211,5 @@ type BranchResp struct {
|
|||
}
|
||||
|
||||
type Branch struct {
|
||||
Name string `json:"name"`
|
||||
Name string `json:"displayId"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue