gateway

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildContextStatus added in v0.5.0

type BuildContextStatus struct {
	Name    string
	Message string
	State   BuildState
}

BuildContextStatus is the status of a specific build context.

type BuildState added in v0.5.0

type BuildState string

BuildState indicates whether a build succeeded, failed or is pending.

const (
	BuildError   BuildState = "error"
	BuildFailure BuildState = "failure"
	BuildPending BuildState = "pending"
	BuildSuccess BuildState = "success"
)

All possible BuildStates.

type BuildStatus added in v0.5.0

type BuildStatus struct {
	State    BuildState
	Statuses []*BuildContextStatus
}

BuildStatus indicates the build status of a ref.

type FetchRequest

type FetchRequest struct {
	Remote    string // name of the remote
	RemoteRef string // ref to fetch
	LocalRef  string // name of the ref locally
}

FetchRequest is a request to fetch a branch.

type Git

type Git interface {
	// Determines the name of the current branch.
	CurrentBranch() (string, error)

	// Determines if a local branch with the given name exists.
	DoesBranchExist(name string) bool

	// Deletes the given branch.
	DeleteBranch(name string) error

	// Deletes the remote tracking branch with the given name.
	DeleteRemoteTrackingBranch(remote, name string) error

	// Create a branch with the given name and head but don't switch to it.
	CreateBranch(name, head string) error

	// Creates a branch with the given name at the given head and switches to
	// it.
	//
	// An error is returned if a branch with the same name already exists.
	CreateBranchAndCheckout(name, head string) error

	// Switches branches.
	Checkout(name string) error

	// Fetch a ref
	Fetch(*FetchRequest) error

	// Push many branches
	Push(*PushRequest) error

	// Rebase a branch
	Rebase(*RebaseRequest) error

	// Reset the given branch to the given head, overwriting the working tree
	// while at it.
	ResetBranch(branch, head string) error

	// Get the SHA1 hash for the given ref.
	SHA1(ref string) (string, error)

	// Pulls a branch from a specific remote.
	Pull(remote, name string) error

	// RemoteURL gets the URL for the given remote.
	RemoteURL(name string) (string, error)
}

Git is a gateway to access git locally.

type GitHub

type GitHub interface {
	// Checks if the given pull request branch is owned by the same
	// repository.
	IsOwned(ctx context.Context, br *github.PullRequestBranch) bool

	// Lists reviews for a pull request.
	ListPullRequestReviews(ctx context.Context, number int) ([]*PullRequestReview, error)

	// Get the build status of a specific ref.
	GetBuildStatus(ctx context.Context, ref string) (*BuildStatus, error)

	// List pull requests on this repository with the given head. If owner is
	// empty, the current repository should be used.
	ListPullRequestsByHead(ctx context.Context, owner, branch string) ([]*github.PullRequest, error)

	// List pull requests on this repository with the given merge base.
	ListPullRequestsByBase(ctx context.Context, branch string) ([]*github.PullRequest, error)

	// Retrieve the raw patch for the given pull request.
	GetPullRequestPatch(ctx context.Context, number int) (string, error)

	// Change the merge base for the given pull request.
	SetPullRequestBase(ctx context.Context, number int, base string) error

	// Merges the given pull request.
	SquashPullRequest(context.Context, *github.PullRequest) error

	// Delete the given branch.
	DeleteBranch(ctx context.Context, name string) error
}

GitHub is a gateway that provides access to GitHub operations on a specific repository.

type PullRequestReview added in v0.5.0

type PullRequestReview struct {
	// User who did the review.
	User string

	// Whether they approved or requested changes.
	Status PullRequestReviewState
}

PullRequestReview is a review of a pull request.

type PullRequestReviewState added in v0.5.0

type PullRequestReviewState string

PullRequestReviewState indicates whether a PR has been accepted or not.

const (
	// PullRequestApproved indicates that a pull request was accepted.
	PullRequestApproved PullRequestReviewState = "APPROVED"

	// PullRequestChangesRequested indicates that changes were requested for a
	// pull request.
	PullRequestChangesRequested PullRequestReviewState = "CHANGES_REQUESTED"
)

type PushRequest

type PushRequest struct {
	Remote string
	// Mapping of local ref to remote ref. Remote ref may be empty to indicate
	// that the local ref name should be used.
	Refs  map[string]string
	Force bool
}

PushRequest is a request to push refs to a remote.

type RebaseRequest added in v0.2.1

type RebaseRequest struct {
	Onto   string // --onto
	From   string // if provided, we diff against this ref
	Branch string // branch to rebase
}

RebaseRequest is a request to perform a Git rebase.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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