package gitea import ( "context" "net/url" ) // CommitInfo is the commit projection branches carry. type CommitInfo struct { ID string `json:"id"` Message string `json:"message,omitempty"` } // Branch is the branch projection. type Branch struct { Name string `json:"name"` Commit CommitInfo `json:"commit"` Protected bool `json:"protected"` } // ListBranches lists a repository's branches. func (c *Client) ListBranches(ctx context.Context, owner, repo string) ([]Branch, error) { var out []Branch path := "/repos/" + url.PathEscape(owner) + "/" + url.PathEscape(repo) + "/branches" if err := c.do(ctx, "GET", path, nil, nil, &out); err != nil { return nil, err } return out, nil }