api

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLabelMap

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

DefaultLabelMap implements the LabelMap interface with a regular map of strings

func NewDefaultLabelMap

func NewDefaultLabelMap(idNameMap map[string]string) DefaultLabelMap

NewDefaultLabelMap creates a new DefaultLabelMap, given mapping between IDs to label names.

func (DefaultLabelMap) AddLabel

func (m DefaultLabelMap) AddLabel(id, name string)

AddLabel adds a label to the mapping

func (DefaultLabelMap) IDToName

func (m DefaultLabelMap) IDToName(id string) (string, bool)

IDToName maps the id of a string to its name.

func (DefaultLabelMap) NameToID

func (m DefaultLabelMap) NameToID(name string) (string, bool)

NameToID maps the name of a label to its ID.

type Exporter

type Exporter interface {
	// Export exports Gmail filters into Gmail API objects
	Export(filters filter.Filters, lmap LabelMap) ([]*gmailv1.Filter, error)
}

Exporter exports Gmail filters into Gmail API objects

func DefaulExporter

func DefaulExporter() Exporter

DefaulExporter returns a default implementation of a Gmail API filter exporter.

type Importer

type Importer interface {
	// Import exports Gmail filters into Gmail API objects.
	//
	// If some filter is invalid, the import skips it and returns only the
	// valid ones, but records and returns the error in the end.
	Import(filters []*gmailv1.Filter, lmap LabelMap) (filter.Filters, error)
}

Importer imports Gmail API objects into filters

func DefaulImporter

func DefaulImporter() Importer

DefaulImporter returns a default implementation of a Gmail API filter exporter.

type LabelMap

type LabelMap interface {
	// NameToID maps the name of a label to its ID.
	NameToID(name string) (string, bool)
	// IDToName maps the id of a string to its name.
	IDToName(id string) (string, bool)
}

LabelMap maps label names and IDs together.

Jump to

Keyboard shortcuts

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