operations

package
v0.0.0-...-8fb4044 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptedType

type AcceptedType int

AcceptedType describes the combination of GitHub item types accepted by an operation.

const (
	// Issues means that the operation can apply to issues.
	Issues AcceptedType = 1 << iota

	// PullRequests means that the operation can apply to pull requests.
	PullRequests

	// All means that the operation can apply to both issues and pull requests.
	All = Issues | PullRequests
)

type Configuration

type Configuration map[string]interface{}

Configuration is an opaque data structure for operation-specific configuration.

type Context

type Context struct {
	// Client is the GitHub API client instance.
	Client gh.Client

	// Username is the owner of the GitHub repository.
	Username string

	// Repository is the name of the GitHub repository.
	Repository string
}

Context is the execution context for an operation.

type FilterResult

type FilterResult int

FilterResult describes the result of an operation filter.

const (
	// Accept means that the filter accepts the item.
	Accept FilterResult = iota

	// Reject means that the filter rejects the item
	Reject

	// Terminal means that the filter is rejected, and that no more items
	// should be sumbmitted to that filter. This is typically useful for
	// operations working on sorted sets of data, and for which the first
	// failure could also mean that no Accept may further occur.
	Terminal
)

type Operation

type Operation interface {
	// Accepts returns the combination of GitHub item types that the operation
	// can be applied to.
	Accepts() AcceptedType

	// Apply applies the operation to the GitHub item.
	Apply(*Context, gh.Item, interface{}) error

	// Describe returns a human-readable description of calling Apply on the
	// specified item with the specified context.
	Describe(*Context, gh.Item, interface{}) string

	// Filter returns whether that operation should apply to the specified
	// item, and an operation specific user data that is guaranteed to be
	// passed on Apply and Describe invocation.
	Filter(*Context, gh.Item) (FilterResult, interface{}, error)

	// IssueListOptions returns the global filtering options to apply when
	// listing issues for the specified context.
	IssueListOptions(*Context) *github.IssueListByRepoOptions

	// PullRequestListOptions returns the global filtering options to apply
	// when listing pull requests for the specified context.
	PullRequestListOptions(*Context) *github.PullRequestListOptions
}

Operation is the central interface: it encapsulates an action over GitHub items (either issues, pull requests, or both).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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