gmail

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceTypeFilter = "Filter"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a gmail configuration client with label id <=> name map cache.

func New

func New(ctx context.Context, oauthConfig *oauth2.Config, token *oauth2.Token) (*Client, error)

func (*Client) ApplyLabelToExistingEmail added in v0.0.4

func (c *Client) ApplyLabelToExistingEmail(ctx context.Context, filter Filter) error

func (*Client) CreateFilter

func (c *Client) CreateFilter(ctx context.Context, filter Filter) error

func (*Client) CreateLabel

func (c *Client) CreateLabel(ctx context.Context, label string) error

func (*Client) DeleteAllFilter

func (c *Client) DeleteAllFilter(ctx context.Context) error

func (*Client) DeleteFilterByID

func (c *Client) DeleteFilterByID(ctx context.Context, id string) error

func (*Client) ListFilters

func (c *Client) ListFilters(ctx context.Context) ([]Filter, error)

type Filter

type Filter struct {
	Criteria FilterCriteria `yaml:"criteria"`
	Action   FilterAction   `yaml:"action"`
	// contains filtered or unexported fields
}

func (Filter) String

func (f Filter) String() string

type FilterAction

type FilterAction struct {
	Archive         bool                  `yaml:"archive,omitempty"`
	MarkAsRead      bool                  `yaml:"mark_as_read,omitempty"`
	Star            bool                  `yaml:"star,omitempty"`
	AddLabel        string                `yaml:"add_label,omitempty"`
	ForwardTo       string                `yaml:"forward_to,omitempty"`
	Delete          bool                  `yaml:"delete,omitempty"`
	NeverMarkAsSpam bool                  `yaml:"never_mark_as_spam,omitempty"`
	Important       FilterActionImportant `yaml:"important,omitempty"`
	Category        string                `yaml:"category,omitempty"`
}

func (FilterAction) String

func (action FilterAction) String() string

type FilterActionImportant

type FilterActionImportant string
const (
	FilterActionImportantAlways FilterActionImportant = "always"
	FilterActionImportantNever  FilterActionImportant = "never"
)

type FilterCriteria

type FilterCriteria struct {
	From          string `yaml:"from,omitempty"`
	To            string `yaml:"to,omitempty"`
	Subject       string `yaml:"subject,omitempty"`
	Query         string `yaml:"query,omitempty"`
	NegatedQuery  string `yaml:"negated_query,omitempty"`
	LargerThan    int64  `yaml:"larger_than,omitempty"`
	SmallerThan   int64  `yaml:"smaller_than,omitempty"`
	HasAttachment bool   `yaml:"has_attachment,omitempty"`
	ExcludeChats  bool   `yaml:"exclude_chats,omitempty"`
}

func (FilterCriteria) String

func (criteria FilterCriteria) String() string

type FilterResource

type FilterResource struct {
	Filters []Filter `yaml:"filters"`
}

Jump to

Keyboard shortcuts

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