restclient

package
v2.7.10 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 18 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, 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

func (c *RESTClient) ClosePullRequest(ctx context.Context, owner, repo string, number int) error

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) 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) ReopenPullRequest added in v2.7.1

func (c *RESTClient) ReopenPullRequest(ctx context.Context, owner, repo string, number int) error

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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