github

package
v0.0.0-...-993d511 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPRNotFound = errors.New("no such pull request")
View Source
var ErrUnauthorized = errors.New("invalid authorization")
View Source
var FakeContext = Context{
	Repo: Repo{
		Owner: "owner",
		Name:  "name",
	},
	GithubAccessToken: "access_token",
	PullRequestNumber: 1,
}

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

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 *github.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) (*github.PullRequest, error)

GetPullRequest mocks base method

func (*MockClient) GetPullRequestComments

func (_m *MockClient) GetPullRequestComments(ctx context.Context, c *Context) ([]*github.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 string, 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(arg0, arg1, arg2 interface{}) *gomock.Call

CreateReview indicates an expected call of CreateReview

func (*MockClientMockRecorder) GetPullRequest

func (_mr *MockClientMockRecorder) GetPullRequest(arg0, arg1 interface{}) *gomock.Call

GetPullRequest indicates an expected call of GetPullRequest

func (*MockClientMockRecorder) GetPullRequestComments

func (_mr *MockClientMockRecorder) GetPullRequestComments(arg0, arg1 interface{}) *gomock.Call

GetPullRequestComments indicates an expected call of GetPullRequestComments

func (*MockClientMockRecorder) GetPullRequestPatch

func (_mr *MockClientMockRecorder) GetPullRequestPatch(arg0, arg1 interface{}) *gomock.Call

GetPullRequestPatch indicates an expected call of GetPullRequestPatch

func (*MockClientMockRecorder) SetCommitStatus

func (_mr *MockClientMockRecorder) SetCommitStatus(arg0, arg1, arg2, arg3, arg4, arg5 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
}

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