restclient

package
v2.6.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package restclient provides a REST client for the GitHub API.

Index

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

func CheckRateLimitAndExit(r *resources.RateLimit)

Checks whether the quota of the core API are exceeded.

Types

type ClientOptions

type ClientOptions = api.ClientOptions

Ship client options.

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

func (c RESTClient) GetRateLimit(ctx context.Context) (rate *resources.RateLimit, err error)

Get rate limit information.

func (RESTClient) GetUser

func (c RESTClient) GetUser(ctx context.Context) (user *resources.User, err error)

Get GitHub user.

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) RequestWithContext

func (c RESTClient) RequestWithContext(ctx context.Context, method string, path string, body io.Reader) (*http.Response, error)

Implements RequestWithContext method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL