ratelimit

package
v0.0.0-...-c7609e9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewThrottle

func NewThrottle(transactionsPerSecond int) <-chan struct{}

NewThrottle creates a throttle which can be used to limit the maximum number of outstanding requests. Every second, the throttle receives a dump of transactionsPerSecond tokens to

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a rate-limiting Github client which blocks API requests that would exceed the rate limit. Any requests that would exceed the rate limit block until the rate limit resets. It only implements the github APIs needed by this project.

func NewClient

func NewClient(ctx context.Context, client *github.Client) (Client, error)

NewClient constructs a new client using the provided arguments.

func (*Client) AddLabelsToIssue

func (c *Client) AddLabelsToIssue(owner, repo string, number int, labels []string) ([]*github.Label, *github.Response, error)

AddLabelsToIssue adds labels to an issue.

GitHub API docs: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue

func (*Client) CreateIssue

func (c *Client) CreateIssue(owner, repo string, req *github.IssueRequest) (*github.Issue, *github.Response, error)

CreateIssue a new issue on the specified repository.

GitHub API docs: https://developer.github.com/v3/issues/#create-an-issue

func (*Client) CreateIssueComment

func (c *Client) CreateIssueComment(owner, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)

CreateIssueComment creates a new comment on the specified issue.

GitHub API docs: https://developer.github.com/v3/issues/comments/#create-a-comment

func (*Client) EditIssue

func (c *Client) EditIssue(owner, repo string, number int, req *github.IssueRequest) (*github.Issue, *github.Response, error)

EditIssue edits an issue.

GitHub API docs: https://developer.github.com/v3/issues/#edit-an-issue

func (c *Client) GetArchiveLink(owner, repo string, format github.ArchiveFormat, opt *github.RepositoryContentGetOptions, followRedirects bool) (*url.URL, *github.Response, error)

GetArchiveLink returns an URL to download a tarball or zipball archive for a repository. The archiveFormat can be specified by either the github.Tarball or github.Zipball constant.

GitHub API docs: https://developer.github.com/v3/repos/contents/#get-archive-link

func (*Client) GetCount

func (c *Client) GetCount() int

GetCount retrieves the count of API calls.

func (*Client) GetRepository

func (c *Client) GetRepository(owner, repo string) (*github.Repository, *github.Response, error)

GetRepository fetches a repository.

GitHub API docs: https://developer.github.com/v3/repos/#get-a-repository

func (*Client) GetRepositoryBranch

func (c *Client) GetRepositoryBranch(owner, repo, branch string) (*github.Branch, *github.Response, error)

GetRepositoryBranch gets the specified branch for a repository.

GitHub API docs: https://developer.github.com/v3/repos/branches/#get-a-branch

func (*Client) ListIssueReactions

func (c *Client) ListIssueReactions(owner, repo string, number int, opt *github.ListOptions) ([]*github.Reaction, *github.Response, error)

ListIssueReactions lists the reactions for an issue.

GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue

func (*Client) ListIssuesByRepo

func (c *Client) ListIssuesByRepo(owner, repo string, opt *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error)

ListIssuesByRepo lists the issues for the specified repository.

GitHub API docs: https://developer.github.com/v3/issues/#list-issues-for-a-repository

func (*Client) RemoveLabelForIssue

func (c *Client) RemoveLabelForIssue(owner, repo string, number int, label string) (*github.Response, error)

RemoveLabelForIssue removes a label for an issue.

GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue

func (*Client) ReplaceLabelsForIssue

func (c *Client) ReplaceLabelsForIssue(owner, repo string, number int, labels []string) ([]*github.Label, *github.Response, error)

ReplaceLabelsForIssue replaces all labels for an issue.

GitHub API docs: https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue

func (*Client) ResetCount

func (c *Client) ResetCount()

ResetCount resets the count of API calls.

Jump to

Keyboard shortcuts

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