feat(gitea): branch list and commit-status endpoints

This commit is contained in:
2026-08-29 15:57:56 -05:00
parent 7c11987b00
commit c251cd6a98
3 changed files with 250 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
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
}