api

package
v0.0.0-...-d18f405 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidOldEmailsModifyAction = fmt.Errorf("Invalid old email modification criteria")
)

API Errors

Functions

This section is empty.

Types

type Client

type Client struct {
	GmailClient GmailClient
	Labels      *label.LabelMap
}

Client is an api client

func GetClient

func GetClient(ctx context.Context, auth *auth.Authenticator, dryrun bool) (Client, error)

func (Client) CreateFilter

func (c Client) CreateFilter(f filter.Filter, applyLabelsToOldEmails bool) error

func (Client) CreateLabelIfDoesNotExist

func (c Client) CreateLabelIfDoesNotExist(name string, m *label.LabelMap) (string, error)

func (Client) DeleteExistingFilters

func (c Client) DeleteExistingFilters() error

func (Client) ExportExistingFilters

func (c Client) ExportExistingFilters(file string) error

func (Client) GetExistingFilters

func (c Client) GetExistingFilters() ([]filter.Filter, error)

func (Client) GetLabels

func (c Client) GetLabels() (*label.LabelMap, error)

type DryrunClient

type DryrunClient struct {
	Inner gmailClient
}

DryrunClient is a read-only client and an implementationof GmailClient

func (DryrunClient) ApplyLabelsToOldEmails

func (d DryrunClient) ApplyLabelsToOldEmails(f gmail.Filter) error

func (DryrunClient) CreateFilter

func (d DryrunClient) CreateFilter(fltr *gmail.Filter) error

CreateFilter pretends to create a filter

func (DryrunClient) CreateLabel

func (d DryrunClient) CreateLabel(l *gmail.Label) (string, error)

CreateLabel pretends to create a label

func (DryrunClient) DeleteFilter

func (d DryrunClient) DeleteFilter(f string) error

DeleteFilter pretends to delete a filter

func (DryrunClient) ListFilters

func (d DryrunClient) ListFilters() (*gmail.ListFiltersResponse, error)

ListFilters fetches a list of filters

func (DryrunClient) ListLabels

func (d DryrunClient) ListLabels() (*gmail.ListLabelsResponse, error)

ListLabels fetches a list of labels

type GmailClient

type GmailClient interface {
	ApplyLabelsToOldEmails(f gmail.Filter) error
	CreateFilter(*gmail.Filter) error
	CreateLabel(*gmail.Label) (string, error)
	DeleteFilter(string) error
	ListFilters() (*gmail.ListFiltersResponse, error)
	ListLabels() (*gmail.ListLabelsResponse, error)
}

GmailClient is a client of the filters gmail API

Jump to

Keyboard shortcuts

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