Documentation
¶
Index ¶
- func CloneURL(host, owner, repo, token string) string
- func IsRateLimitError(err error) bool
- func RetryAfterFromError(err error) time.Duration
- type Client
- func (c *Client) CreateIssue(owner, repo string, req *gh.IssueRequest) (*gh.Issue, error)
- func (c *Client) CreateIssueComment(owner, repo string, number int, body string) error
- func (c *Client) CreateLabel(owner, repo string, label *gh.Label) error
- func (c *Client) CreateRelease(owner, repo string, release *gh.RepositoryRelease) (*gh.RepositoryRelease, error)
- func (c *Client) CreateRepo(org, name, visibility string, verbose bool) error
- func (c *Client) DeleteRelease(owner, repo string, releaseID int64) error
- func (c *Client) DownloadReleaseAsset(owner, repo string, assetID int64) (*http.Response, error)
- func (c *Client) EditIssue(owner, repo string, number int, req *gh.IssueRequest) error
- func (c *Client) ListAllIssues(owner, repo string) ([]*gh.Issue, error)
- func (c *Client) ListIssueComments(owner, repo string, number int) ([]*gh.IssueComment, error)
- func (c *Client) ListLabels(owner, repo string) ([]*gh.Label, error)
- func (c *Client) ListPullRequests(owner, repo string) ([]*gh.PullRequest, error)
- func (c *Client) ListReleaseAssets(owner, repo string, releaseID int64) ([]*gh.ReleaseAsset, error)
- func (c *Client) ListReleases(owner, repo string) ([]*gh.RepositoryRelease, error)
- func (c *Client) RepoExists(owner, repo string) (bool, error)
- func (c *Client) SearchRepos(org, nameFilter string) ([]string, error)
- func (c *Client) UploadReleaseAsset(owner, repo string, releaseID int64, name string, file *UploadFile) error
- type UploadFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRateLimitError ¶
IsRateLimitError returns true if the error is a GitHub rate limit error (primary or secondary/abuse). Callers can use this to skip operations rather than retrying when rate limits are exhausted.
func RetryAfterFromError ¶
RetryAfterFromError extracts the retry-after duration from a GitHub AbuseRateLimitError. Returns 0 if the error is not an abuse rate limit error or has no RetryAfter set.
Types ¶
type Client ¶
Client wraps the GitHub API client for both Cloud and Enterprise.
func NewClient ¶
NewClient creates a GitHub API client for the given host and token. If token is empty, an unauthenticated client is created (suitable for public repos). All clients automatically handle rate limiting by sleeping until reset.
func (*Client) CreateIssue ¶
CreateIssue creates an issue in the target repository.
func (*Client) CreateIssueComment ¶
CreateIssueComment creates a comment on an issue.
func (*Client) CreateLabel ¶
CreateLabel creates a label in the target repository.
func (*Client) CreateRelease ¶
func (c *Client) CreateRelease(owner, repo string, release *gh.RepositoryRelease) (*gh.RepositoryRelease, error)
CreateRelease creates a release in the target repository.
func (*Client) CreateRepo ¶
CreateRepo creates a repository in the specified organization or user account. It first tries the org endpoint; if the target is a personal account (404), it falls back to creating under the authenticated user.
func (*Client) DeleteRelease ¶
DeleteRelease deletes a release by its ID. Does not delete the associated tag.
func (*Client) DownloadReleaseAsset ¶
DownloadReleaseAsset downloads a release asset and returns the HTTP response body. Caller is responsible for closing the response body.
func (*Client) ListAllIssues ¶
ListAllIssues returns all issues (not PRs) for a repository.
func (*Client) ListIssueComments ¶
ListIssueComments returns all comments on an issue.
func (*Client) ListLabels ¶
ListLabels returns all labels for a repository.
func (*Client) ListPullRequests ¶
func (c *Client) ListPullRequests(owner, repo string) ([]*gh.PullRequest, error)
ListPullRequests returns all pull requests for a repository.
func (*Client) ListReleaseAssets ¶
ListReleaseAssets returns all assets for a release.
func (*Client) ListReleases ¶
func (c *Client) ListReleases(owner, repo string) ([]*gh.RepositoryRelease, error)
ListReleases returns all releases for a repository.
func (*Client) RepoExists ¶
RepoExists checks whether a repository exists and is accessible.
func (*Client) SearchRepos ¶
SearchRepos finds repositories in a given org whose names contain the query string. Returns a list of repo names (not full names — just the repo part).
func (*Client) UploadReleaseAsset ¶
func (c *Client) UploadReleaseAsset(owner, repo string, releaseID int64, name string, file *UploadFile) error
UploadReleaseAsset uploads an asset to a release.
type UploadFile ¶
UploadFile wraps an io.Reader into a temporary *os.File for the GitHub API.
func NewUploadFile ¶
NewUploadFile creates a temp file from a reader for upload.