resource

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        string     `json:"id"`
	Owner     string     `json:"owner"`
	Repo      string     `json:"repo"`
	PR        string     `json:"pr_number"`
	Branch    string     `json:"branch"`
	Body      string     `json:"body"`
	CreatedAt string     `json:"created_at"`
	Matches   [][]string `json:"matches"`
	User      string     `json:"user"`
}

Comment is the actual resource

func GithubComment

func GithubComment(input Input) (Comment, error)

GithubComment retrieves a specific comment

func (*Comment) Metadata

func (c *Comment) Metadata() []Metadata

Metadata returns the comment metadata

type Input

type Input struct {
	Source  *Source  `json:"source"`
	Version *Version `json:"version"`
}

Input is provided to this resource via STDIN

func GetInput

func GetInput(reader io.Reader, requireVersion bool) (Input, error)

GetInput takes a reader and constructs an Input

func (*Input) Validate

func (i *Input) Validate(requireVersion bool) error

Validate checks if the input is sound

type Metadata

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

Metadata is a key-value type

type Output

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

Output is written by in script

type Source

type Source struct {
	RepositoryString string `json:"repository"`
	AccessToken      string `json:"access_token"`
	V3Endpoint       string `json:"v3_endpoint"`
	Regex            string `json:"regex"`
}

Source is the configurable settings a user provides to this resource

func (*Source) Owner

func (s *Source) Owner() string

Owner returns the repo owner

func (*Source) Repo

func (s *Source) Repo() string

Repo returns the repo name

type Version

type Version struct {
	PrNumber  string `json:"pr"`
	CommentID string `json:"comment"`
}

Version represents a single version of the resource

func GithubVersions

func GithubVersions(input Input) ([]Version, error)

GithubVersions retrieves all matching versions for the given input

Jump to

Keyboard shortcuts

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