Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) AddComment(ctx context.Context, token, owner, name string, issueNumber int, body string) (Comment, error)
- func (c *Client) CreateIssue(ctx context.Context, token, owner, name, title, body string, ...) (Issue, error)
- func (c *Client) CreatePR(ctx context.Context, token, owner, name, title, body, head, base string, ...) (PullRequest, error)
- func (c *Client) GetBlob(ctx context.Context, token, owner, name, sha string) ([]byte, error)
- func (c *Client) GetCommitTreeSHA(ctx context.Context, token, owner, name, ref string) (string, error)
- func (c *Client) GetFileContent(ctx context.Context, token, owner, name, path, ref string) ([]byte, error)
- func (c *Client) GetRepoDefaultBranch(ctx context.Context, token, owner, name string) (string, error)
- func (c *Client) GetTreeRecursive(ctx context.Context, token, owner, name, treeSha string) ([]TreeEntry, bool, error)
- func (c *Client) ListComments(ctx context.Context, token, owner, name string, issueNumber int) ([]Comment, error)
- func (c *Client) ListContents(ctx context.Context, token, owner, name, path, ref string) ([]ContentItem, error)
- func (c *Client) ListRepoIssues(ctx context.Context, token, owner, name, state string) ([]Issue, error)
- func (c *Client) ListRepoPRs(ctx context.Context, token, owner, name, state string) ([]PullRequest, error)
- func (c *Client) ListRepos(ctx context.Context, token, visibility, affiliation string, perPage int) ([]Repo, error)
- func (c *Client) SearchIssues(ctx context.Context, token, query string, perPage int) ([]Issue, error)
- func (c *Client) ValidateRef(ctx context.Context, token, owner, name, ref string) error
- func (c *Client) ValidateToken(ctx context.Context, token string) error
- type Comment
- type ContentItem
- type Issue
- type PullRequest
- type Repo
- type TreeEntry
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddComment ¶
func (*Client) CreateIssue ¶
func (*Client) GetCommitTreeSHA ¶
func (c *Client) GetCommitTreeSHA(ctx context.Context, token, owner, name, ref string) (string, error)
GetCommitTreeSHA resolves a ref (branch/tag/commit) to its tree SHA via commits API.
func (*Client) GetFileContent ¶
func (c *Client) GetFileContent(ctx context.Context, token, owner, name, path, ref string) ([]byte, error)
GetFileContent fetches raw file bytes via the contents API.
func (*Client) GetRepoDefaultBranch ¶
func (c *Client) GetRepoDefaultBranch(ctx context.Context, token, owner, name string) (string, error)
GetRepoDefaultBranch returns the default branch name (e.g., "main" or "master").
func (*Client) GetTreeRecursive ¶
func (c *Client) GetTreeRecursive(ctx context.Context, token, owner, name, treeSha string) ([]TreeEntry, bool, error)
GetTreeRecursive fetches a full tree listing with recursive=1. Returns entries and whether it was truncated.
func (*Client) ListComments ¶
func (*Client) ListContents ¶
func (c *Client) ListContents(ctx context.Context, token, owner, name, path, ref string) ([]ContentItem, error)
ListContents lists directory entries at path, or returns a single item if path points to a file.
func (*Client) ListRepoIssues ¶
func (*Client) ListRepoPRs ¶
func (*Client) SearchIssues ¶
func (*Client) ValidateRef ¶
ValidateRef checks whether a ref (branch/tag/sha) is usable with the Contents API by probing the repository root contents with the supplied ref. It returns nil on any 2xx response, ErrUnauthorized on 401, and an error otherwise.
type ContentItem ¶
type ContentItem struct {
Type string `json:"type"` // "file" or "dir"
Name string `json:"name"`
Path string `json:"path"`
Sha string `json:"sha"`
Size int `json:"size"`
DownloadURL string `json:"download_url"`
}
ContentItem represents a file or directory in the repo contents API.