issues

package
v0.0.0-...-3f7b053 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package issues defines a client interface wrapping the Github API for creating, listing, and closing issues on a single repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// githubClient is an authenticated client for accessing the github API.
	GithubClient *github.Client
	// contains filtered or unexported fields
}

A Client manages communication with the Github API.

func NewClient

func NewClient(org, authToken, alertLabel string) *Client

NewClient creates an Client authenticated using the Github authToken. Future operations are only performed on the given github "org/repo".

func NewEnterpriseClient

func NewEnterpriseClient(baseURL, uploadURL, org, authToken, alertLabel string) (*Client, error)

NewEnterpriseClient creates an Enterprise Client authenticated using the Github authToken. Future operations are only performed on the given github enterprise "org/repo". If uploadURL is empty it will be set to baseURL

func (*Client) CloseIssue

func (c *Client) CloseIssue(issue *github.Issue) (*github.Issue, error)

CloseIssue changes the issue state to "closed" unconditionally. If the issue is already close, then this should have no effect.

func (*Client) CreateIssue

func (c *Client) CreateIssue(repo, title, body string, extra []string) (*github.Issue, error)

CreateIssue creates a new Github issue. New issues are unassigned. Issues are labeled with with an alert named alertLabel. Labels are created automatically if they do not already exist in a repo.

func (*Client) LabelIssue

func (c *Client) LabelIssue(issue *github.Issue, label string, add bool) error

LabelIssue adds or removes a label from an issue. This call is idempotent; it returns errors if there's a network error, but no error is returned if trying to add a label that's already present or remove one that's absent.

func (*Client) ListOpenIssues

func (c *Client) ListOpenIssues() ([]*github.Issue, error)

ListOpenIssues returns open issues created by past alerts within the client organization. Because ListOpenIssues uses the Github Search API, the *github.Issue instances returned will contain partial information. See also: https://developer.github.com/v3/search/#search-issues

type ListClient

type ListClient interface {
	ListOpenIssues() ([]*github.Issue, error)
}

ListClient defines an interface for listing issues.

type ListHandler

type ListHandler struct {
	ListClient
}

ListHandler contains data needed for HTTP handlers.

func (*ListHandler) ServeHTTP

func (lh *ListHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP lists open issues from github for view in a browser.

Directories

Path Synopsis
Package local provides in memory operations on GitHub issues.
Package local provides in memory operations on GitHub issues.

Jump to

Keyboard shortcuts

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