mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-01 07:23:19 +00:00
@@ -43,7 +43,7 @@ const (
|
|||||||
pathHookEnabled = "%s/rest/api/1.0/projects/%s/repos/%s/settings/hooks/%s/enabled"
|
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"
|
pathHookSettings = "%s/rest/api/1.0/projects/%s/repos/%s/settings/hooks/%s/settings"
|
||||||
pathStatus = "%s/rest/build-status/1.0/commits/%s"
|
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 {
|
type Client struct {
|
||||||
@@ -326,12 +326,10 @@ func (c *Client) paginatedRepos(start int) ([]*Repo, error) {
|
|||||||
func (c *Client) ListBranches(owner, name string) ([]*Branch, error) {
|
func (c *Client) ListBranches(owner, name string) ([]*Branch, error) {
|
||||||
uri := fmt.Sprintf(pathBranches, c.base, owner, name)
|
uri := fmt.Sprintf(pathBranches, c.base, owner, name)
|
||||||
response, err := c.doGet(uri)
|
response, err := c.doGet(uri)
|
||||||
if response != nil {
|
|
||||||
defer response.Body.Close()
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
defer response.Body.Close()
|
||||||
out := new(BranchResp)
|
out := new(BranchResp)
|
||||||
err = json.NewDecoder(response.Body).Decode(&out)
|
err = json.NewDecoder(response.Body).Decode(&out)
|
||||||
return out.Values, err
|
return out.Values, err
|
||||||
|
@@ -211,5 +211,5 @@ type BranchResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Branch struct {
|
type Branch struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"displayId"`
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user