github

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 Client

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

func NewClient

func NewClient(ctx context.Context, accessToken, owner, repositoryName string) *Client

func (*Client) GetComment

func (c *Client) GetComment(ctx context.Context, commentID uint) (Comment, error)

func (*Client) GetComments

func (c *Client) GetComments(ctx context.Context) ([]Comment, error)

func (*Client) PutComment

func (c *Client) PutComment(ctx context.Context, body string, prNumber int) (Comment, error)

func (*Client) SelectComments

func (c *Client) SelectComments(ctx context.Context, filters ...Filter) ([]Comment, error)

type Comment

type Comment struct {
	// ID refers to the database ID for a particular GitHub comment.
	ID uint
	// Body holds the contents of the comment.
	Body string
	// Labels is a map of label names where the key is the name and the value is empty. It serves the purpose
	// for fast querying if a comment contains a particular label.
	Labels map[string]struct{}
	// PullRequestNumber is the reference to the pull request where this comment was made.
	PullRequestNumber uint
}

Comment contains a representation of GitHub comment.

func (*Comment) HasLabel

func (c *Comment) HasLabel(label string) bool

HasLabel checks if the PR where the comment was posted contains a given label.

type Filter

type Filter func([]Comment) []Comment

func FilterCommentRegex

func FilterCommentRegex(regex string) Filter

FilterCommentRegex returns comments that match a given regex.

func FilterLabels

func FilterLabels(labels []string) Filter

FilterLabels returns comment that match at least one of the given labels.

func FilterLatestPerPR

func FilterLatestPerPR() Filter

FilterLatestPerPR returns the latest comment per PR that matches previous criteria if any.

func FilterSince

func FilterSince(commentID uint) Filter

FilterSince returns comments newer than the one given.

Jump to

Keyboard shortcuts

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