ghclient

package
v0.0.0-...-a196a74 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AroundFunctionCreator

type AroundFunctionCreator interface {
	// contains filtered or unexported methods
}

AroundFunctionCreator creates function that does operations around nested inner function

func NewPaginationChecker

func NewPaginationChecker() AroundFunctionCreator

NewPaginationChecker creates an instance of paginationChecker that checks if there is a next page with additional results

func NewRateLimitWatcher

func NewRateLimitWatcher(c Client, logger log.Logger, threshold int) AroundFunctionCreator

NewRateLimitWatcher creates an instance of rateLimitWatcher that watches GH API rate limits

func NewRetryWrapper

func NewRetryWrapper(retries int, sleep time.Duration) AroundFunctionCreator

NewRetryWrapper creates an instance of retryWrapper that retries requests until either there is no error or limit is reached

type Client

type Client interface {
	GetPermissionLevel(owner, repo, user string) (*gogh.RepositoryPermissionLevel, error)
	GetPullRequest(owner, repo string, prNumber int) (*gogh.PullRequest, error)
	ListPullRequestFiles(owner, repo string, prNumber int) ([]scm.ChangedFile, error)
	GetPullRequestReviews(owner, repo string, prNumber int) ([]*gogh.PullRequestReview, error)
	ListIssueComments(issue scm.RepositoryIssue) ([]*gogh.IssueComment, error)
	CreateIssueComment(issue scm.RepositoryIssue, commentMsg *string) error
	EditIssueComment(issue scm.RepositoryIssue, commentID int64, commentMsg *string) error
	CreateStatus(change scm.RepositoryChange, repoStatus *gogh.RepoStatus) error
	AddPullRequestLabel(change scm.RepositoryChange, prNumber int, label []string) error
	RemovePullRequestLabel(change scm.RepositoryChange, prNumber int, label string) error
	EditPullRequest(*gogh.PullRequest) error
	GetRateLimit() (*gogh.RateLimits, error)

	RegisterAroundFunctions(aroundCreators ...AroundFunctionCreator)
}

Client manages communication with the GitHub API.

func NewClient

func NewClient(c *gogh.Client, logger log.Logger) Client

NewClient creates a Client instance with the given instance of go-github client which will be used as a delegate

func NewOauthClient

func NewOauthClient(oauthSecret []byte, logger log.Logger) Client

NewOauthClient creates a Client instance with the given oauth secret used as a access token. Underneath it creates go-github client which is used as delegate

Jump to

Keyboard shortcuts

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