github

package
v0.0.0-...-081ecb4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: AGPL-3.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package github is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPRNotFound            = errors.New("no such pull request")
	ErrUnauthorized          = errors.New("invalid authorization")
	ErrUserIsBlocked         = errors.New("user is blocked")
	ErrCommitIsNotPartOfPull = errors.New("commit is not part of the pull request")
)

Functions

func IsRecoverableError

func IsRecoverableError(err error) bool

Types

type Client

type Client interface {
	GetPullRequest(ctx context.Context, c *Context) (*gh.PullRequest, error)
	GetPullRequestComments(ctx context.Context, c *Context) ([]*gh.PullRequestComment, error)
	GetPullRequestPatch(ctx context.Context, c *Context) (string, error)
	CreateReview(ctx context.Context, c *Context, review *gh.PullRequestReviewRequest) error
	SetCommitStatus(ctx context.Context, c *Context, ref string, status Status, desc, url string) error
}

type Context

type Context struct {
	Repo              Repo
	GithubAccessToken string
	PullRequestNumber int
}

func (Context) GetClient

func (c Context) GetClient(ctx context.Context) *github.Client

func (Context) GetCloneURL

func (c Context) GetCloneURL(repo *gh.Repository) string

func (Context) GetHTTPClient

func (c Context) GetHTTPClient(ctx context.Context) *http.Client

type MockClient

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

MockClient is a mock of Client interface

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance

func (*MockClient) CreateReview

func (m *MockClient) CreateReview(ctx context.Context, c *Context, review *github0.PullRequestReviewRequest) error

CreateReview mocks base method

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockClient) GetPullRequest

func (m *MockClient) GetPullRequest(ctx context.Context, c *Context) (*github0.PullRequest, error)

GetPullRequest mocks base method

func (*MockClient) GetPullRequestComments

func (m *MockClient) GetPullRequestComments(ctx context.Context, c *Context) ([]*github0.PullRequestComment, error)

GetPullRequestComments mocks base method

func (*MockClient) GetPullRequestPatch

func (m *MockClient) GetPullRequestPatch(ctx context.Context, c *Context) (string, error)

GetPullRequestPatch mocks base method

func (*MockClient) SetCommitStatus

func (m *MockClient) SetCommitStatus(ctx context.Context, c *Context, ref string, status Status, desc, url string) error

SetCommitStatus mocks base method

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient

func (*MockClientMockRecorder) CreateReview

func (mr *MockClientMockRecorder) CreateReview(ctx, c, review interface{}) *gomock.Call

CreateReview indicates an expected call of CreateReview

func (*MockClientMockRecorder) GetPullRequest

func (mr *MockClientMockRecorder) GetPullRequest(ctx, c interface{}) *gomock.Call

GetPullRequest indicates an expected call of GetPullRequest

func (*MockClientMockRecorder) GetPullRequestComments

func (mr *MockClientMockRecorder) GetPullRequestComments(ctx, c interface{}) *gomock.Call

GetPullRequestComments indicates an expected call of GetPullRequestComments

func (*MockClientMockRecorder) GetPullRequestPatch

func (mr *MockClientMockRecorder) GetPullRequestPatch(ctx, c interface{}) *gomock.Call

GetPullRequestPatch indicates an expected call of GetPullRequestPatch

func (*MockClientMockRecorder) SetCommitStatus

func (mr *MockClientMockRecorder) SetCommitStatus(ctx, c, ref, status, desc, url interface{}) *gomock.Call

SetCommitStatus indicates an expected call of SetCommitStatus

type MyClient

type MyClient struct{}

func NewMyClient

func NewMyClient() *MyClient

func (*MyClient) CreateReview

func (gc *MyClient) CreateReview(ctx context.Context, c *Context, review *gh.PullRequestReviewRequest) error

func (*MyClient) GetPullRequest

func (gc *MyClient) GetPullRequest(ctx context.Context, c *Context) (*gh.PullRequest, error)

func (*MyClient) GetPullRequestComments

func (gc *MyClient) GetPullRequestComments(ctx context.Context, c *Context) ([]*gh.PullRequestComment, error)

func (*MyClient) GetPullRequestPatch

func (gc *MyClient) GetPullRequestPatch(ctx context.Context, c *Context) (string, error)

func (*MyClient) SetCommitStatus

func (gc *MyClient) SetCommitStatus(ctx context.Context, c *Context, ref string, status Status, desc, url string) error

type Repo

type Repo struct {
	Owner, Name string
	IsPrivate   bool
}

func (Repo) FullName

func (r Repo) FullName() string

type Status

type Status string
const (
	StatusPending Status = "pending"
	StatusFailure Status = "failure"
	StatusError   Status = "error"
	StatusSuccess Status = "success"
)

Jump to

Keyboard shortcuts

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