label

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equivalent

func Equivalent(upstream, local Label) bool

Equivalent returns true if two labels can be considered equal, despite a different ID.

Unspecified color is also ignored.

func Validate

func Validate(d LabelsDiff, filters filter.Filters) error

Validate makes sure that a diff is valid and safe to apply.

Types

type Color

type Color struct {
	Background string
	Text       string
}

Color is the color of a label.

See https://developers.google.com/gmail/api/v1/reference/users/labels for the list of possible colors.

type Label

type Label struct {
	ID    string
	Name  string
	Color *Color
}

Label contains information about a Gmail label.

func (Label) String

func (l Label) String() string

type Labels

type Labels []Label

Labels is a list of labels.

func FromConfig

func FromConfig(ls []v1alpha3.Label) Labels

FromConfig creates labels from the config format.

func (Labels) String

func (ls Labels) String() string

func (Labels) Validate

func (ls Labels) Validate() error

Validate checks the given labels for possible issues.

type LabelsDiff

type LabelsDiff struct {
	Modified []ModifiedLabel
	Added    Labels
	Removed  Labels
}

LabelsDiff contains the diff of two lists of labels.

func Diff

func Diff(upstream, local Labels) (LabelsDiff, error)

Diff computes the diff between two lists of labels.

To compute the diff, IDs are ignored, only the properties of the labels are actually considered.

func (LabelsDiff) Empty

func (d LabelsDiff) Empty() bool

Empty returns true if the diff is empty.

func (LabelsDiff) String

func (d LabelsDiff) String() string

type ModifiedLabel

type ModifiedLabel struct {
	Old Label
	New Label
}

ModifiedLabel is a label in two versions, the old and the new.

Jump to

Keyboard shortcuts

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