Documentation
¶
Overview ¶
Package restclient provides a REST client for the GitHub API.
Index ¶
- Constants
- func CheckRateLimitAndExit(r *resources.RateLimit)
- type ClientOptions
- type RESTClient
- func (c *RESTClient) ClosePullRequest(ctx context.Context, owner, repo string, number int) error
- func (c *RESTClient) DoWithContext(ctx context.Context, method string, path string, body io.Reader, response any) error
- func (c *RESTClient) GetAllUserRepos(ctx context.Context, include, exclude []string) ([]resources.Repository, error)
- func (c *RESTClient) GetOrg(ctx context.Context, name string) (org *resources.Organization, err error)
- func (c *RESTClient) GetOrgRepoPulls(ctx context.Context, name, repo string, filter map[string]string) (out []resources.PullRequest, err error)
- func (c *RESTClient) GetOrgRepos(ctx context.Context, name string) ([]resources.Repository, error)
- func (c *RESTClient) GetOrgs(ctx context.Context) ([]resources.Organization, error)
- func (c *RESTClient) GetRateLimit(ctx context.Context) (rate *resources.RateLimit, headers http.Header, err error)
- func (c *RESTClient) GetUser(ctx context.Context) (user *resources.User, err error)
- func (c *RESTClient) GetUserOrgs(ctx context.Context) ([]resources.Organization, error)
- func (c *RESTClient) GetUserRepos(ctx context.Context) ([]resources.Repository, error)
- func (c *RESTClient) ReopenPullRequest(ctx context.Context, owner, repo string, number int) error
- func (c *RESTClient) RequestWithContext(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)
- func (c *RESTClient) SearchOrgRepoPulls(ctx context.Context, name, repo string, filter string) (out []resources.PullRequest, err error)
Constants ¶
const RateLimitExceeded = "GitHub REST API quotas have been exhausted. Please, wait until %s (%s remaining...)"
Message emitted, when API limit exceeded.
Variables ¶
This section is empty.
Functions ¶
func CheckRateLimitAndExit ¶
Checks whether the quota of the core API are exceeded.
Types ¶
type RESTClient ¶
type RESTClient struct { *api.RESTClient *configfile.Configuration *util.Progressbar }
REST API client.
func NewRESTClient ¶
func NewRESTClient(conf *configfile.Configuration, options ClientOptions, retry bool) (*RESTClient, error)
Create new REST API client. The rate limit of the API will be checked upfront.
func (*RESTClient) ClosePullRequest ¶ added in v2.7.0
Close a pull request.
func (*RESTClient) DoWithContext ¶
func (c *RESTClient) DoWithContext(ctx context.Context, method string, path string, body io.Reader, response any) error
Overwrites DoWithContext method.
func (*RESTClient) GetAllUserRepos ¶
func (c *RESTClient) GetAllUserRepos(ctx context.Context, include, exclude []string) ([]resources.Repository, error)
Get all repositories for given user and the organizations he belongs to.
func (*RESTClient) GetOrg ¶
func (c *RESTClient) GetOrg(ctx context.Context, name string) (org *resources.Organization, err error)
Get an organization.
func (*RESTClient) GetOrgRepoPulls ¶ added in v2.7.0
func (c *RESTClient) GetOrgRepoPulls(ctx context.Context, name, repo string, filter map[string]string) (out []resources.PullRequest, err error)
Get all pull requests for given organization and repository.
func (*RESTClient) GetOrgRepos ¶
func (c *RESTClient) GetOrgRepos(ctx context.Context, name string) ([]resources.Repository, error)
Get all repositories for given organization.
func (*RESTClient) GetOrgs ¶
func (c *RESTClient) GetOrgs(ctx context.Context) ([]resources.Organization, error)
Get organizations.
func (*RESTClient) GetRateLimit ¶
func (c *RESTClient) GetRateLimit(ctx context.Context) (rate *resources.RateLimit, headers http.Header, err error)
Get rate limit information.
func (*RESTClient) GetUserOrgs ¶
func (c *RESTClient) GetUserOrgs(ctx context.Context) ([]resources.Organization, error)
get all organizations for given user.
func (*RESTClient) GetUserRepos ¶
func (c *RESTClient) GetUserRepos(ctx context.Context) ([]resources.Repository, error)
Get all repositories for given user.
func (*RESTClient) ReopenPullRequest ¶ added in v2.7.1
Reopen a pull request.
func (*RESTClient) RequestWithContext ¶
func (c *RESTClient) RequestWithContext(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)
Overwrites RequestWithContext method.
func (*RESTClient) SearchOrgRepoPulls ¶ added in v2.7.2
func (c *RESTClient) SearchOrgRepoPulls(ctx context.Context, name, repo string, filter string) (out []resources.PullRequest, err error)
Search for pull requests in a repository.