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) 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) 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, 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) RequestWithContext(ctx context.Context, method string, path string, body io.Reader) (*http.Response, error)
Constants ¶
View Source
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) (*RESTClient, error)
Create new REST API client. The rate limit of the API will be checked upfront.
func (RESTClient) DoWithContext ¶
func (c RESTClient) DoWithContext(ctx context.Context, method string, path string, body io.Reader, response any) error
Implements 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) 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 ¶
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.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.