concourse

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

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

func NewCheck

func NewCheck(gh CommentSelector) *Check

func (*Check) Run

func (c *Check) Run(ctx context.Context, request Request) ([]Version, error)

type CommentFetcher

type CommentFetcher interface {
	GetComment(ctx context.Context, commentID uint) (github.Comment, error)
}

type CommentPusher

type CommentPusher interface {
	PutComment(ctx context.Context, body string, prNumber int) (github.Comment, error)
}

type CommentSelector

type CommentSelector interface {
	SelectComments(context.Context, ...github.Filter) ([]github.Comment, error)
}

type In

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

func NewIn

func NewIn(gh CommentFetcher) *In

func (*In) Run

func (i *In) Run(ctx context.Context, req Request, writer io.Writer) (Response, error)

type Metadata

type Metadata struct {
	Key   string `json:"name"`
	Value string `json:"value"`
}

type Out

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

func NewOut

func NewOut(gh CommentPusher) *Out

func (*Out) Run

func (o *Out) Run(ctx context.Context, req Request, reader io.Reader) (Response, error)

type Request

type Request struct {
	Source  Source            `json:"source"`
	Version Version           `json:"version"`
	Params  map[string]string `json:"params"`
}

Request is a generic resource request for check, in and out tasks. Fields are populated per task: check: Source and Version in: Source, Version and Params out: Source and Params

type Response

type Response struct {
	Version  Version    `json:"version"`
	Metadata []Metadata `json:"metadata"`
}

Response is a generic resource response for in and out tasks.

func (*Response) GetMetadataField

func (r *Response) GetMetadataField(name string) string

type Source

type Source struct {
	AccessToken string   `json:"access_token"`
	Repository  string   `json:"repository"`
	Comments    string   `json:"comments"`
	Labels      []string `json:"labels"`
	LatestPerPR bool     `json:"latest_per_pr"`
}

func (*Source) OwnerAndName

func (s *Source) OwnerAndName() (string, string, error)

type Version

type Version struct {
	// CommentID is a unique identifier to a GitHub comment on a pull request.
	CommentID string `json:"comment_id"`
}

Version represents a single version of a resource.

func VersionFromNumber

func VersionFromNumber(commentID uint) Version

VersionFromNumber creates a Version from a uint instead of a string.

func (*Version) IDNumber

func (v *Version) IDNumber() uint

IDNumber returns the version identifier in a numeric value.

Jump to

Keyboard shortcuts

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