github

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OutputFormats added in v0.4.0

func OutputFormats() []string

func SupportedOutputFormat added in v0.4.0

func SupportedOutputFormat(format string) (string, error)

Types

type Cli

type Cli struct {
	Owner string
	Repo  string
}

func (*Cli) CreateLabel

func (cli *Cli) CreateLabel(label Label) (bytes.Buffer, error)

func (*Cli) DeleteLabel

func (cli *Cli) DeleteLabel(name string) error

func (*Cli) ListLabels

func (cli *Cli) ListLabels(substr string) (bytes.Buffer, error)

func (*Cli) UpdateLabel

func (cli *Cli) UpdateLabel(label EditLabel) (bytes.Buffer, error)

type Client

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

func New

func New(labels LabelsService) *Client

func (*Client) CreateLabel

func (c *Client) CreateLabel(label Label) (Label, error)

func (*Client) CreateOrUpdateLabel added in v0.4.0

func (c *Client) CreateOrUpdateLabel(label Label) (Label, error)

func (*Client) DeleteLabel

func (c *Client) DeleteLabel(name string) error

func (*Client) ListLabels

func (c *Client) ListLabels(substr string) (Labels, error)

func (*Client) UpdateLabel

func (c *Client) UpdateLabel(label EditLabel) (Label, error)

type EditLabel

type EditLabel struct {
	Label
	NewName string `json:"new_name,omitempty"`
}

type Label

type Label struct {
	Name        string `json:"name"`
	Color       string `json:"color"`
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
}

type Labels

type Labels []Label

func ReadLabels added in v0.4.0

func ReadLabels(format OutputFormat, r io.Reader) (Labels, error)

func (*Labels) Write added in v0.4.0

func (labels *Labels) Write(format OutputFormat, w io.Writer) error

type LabelsService

type LabelsService interface {
	CreateLabel(label Label) (bytes.Buffer, error)
	DeleteLabel(name string) error
	ListLabels(substr string) (bytes.Buffer, error)
	UpdateLabel(label EditLabel) (bytes.Buffer, error)
}

type Mock

type Mock struct {
	Stdout bytes.Buffer
	Err    error
}

func (*Mock) CreateLabel

func (m *Mock) CreateLabel(label Label) (bytes.Buffer, error)

func (*Mock) DeleteLabel

func (m *Mock) DeleteLabel(name string) error

func (*Mock) ListLabels

func (m *Mock) ListLabels(substr string) (bytes.Buffer, error)

func (*Mock) UpdateLabel

func (m *Mock) UpdateLabel(label EditLabel) (bytes.Buffer, error)

type OutputFormat added in v0.4.0

type OutputFormat string
const (
	CSV  OutputFormat = "csv"
	JSON OutputFormat = "json"
)

Jump to

Keyboard shortcuts

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