v1alpha1

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: 2 Imported by: 2

Documentation

Index

Constants

View Source
const Version = "v1alpha1"

Version is the config format version supported by this package.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions struct {
	Archive       bool           `yaml:"archive,omitempty"`
	Delete        bool           `yaml:"delete,omitempty"`
	MarkImportant bool           `yaml:"markImportant,omitempty"`
	MarkRead      bool           `yaml:"markRead,omitempty"`
	Category      gmail.Category `yaml:"category,omitempty"`
	Labels        []string       `yaml:"labels,omitempty"`
}

Actions contains the actions to be applied to a set of emails.

type Author

type Author struct {
	Name  string `yaml:"name" json:"name"`
	Email string `yaml:"email" json:"email"`
}

Author represents the owner of the gmail account.

type CompositeFilters

type CompositeFilters struct {
	MatchFilters `yaml:",inline"`
	Not          MatchFilters `yaml:"not"`
}

CompositeFilters contains alternatively match or negation of matches.

All the conditions are put in AND together.

type Config

type Config struct {
	Version string `yaml:"version"`
	Author  Author `yaml:"author"`
	Consts  Consts `yaml:"consts,omitempty"`
	Rules   []Rule `yaml:"rules"`
}

Config contains the yaml configuration of the Gmail filters.

func ResolveConsts

func ResolveConsts(c Config) (Config, error)

ResolveConsts returns a copy of the config with all the constants replaced in the filters.

type ConstValue

type ConstValue struct {
	Values []string `yaml:"values"`
}

ConstValue is a container for an array of string values.

type Consts

type Consts map[string]ConstValue

Consts maps names to a list of string values

type Filters

type Filters struct {
	CompositeFilters `yaml:",inline"`
	Consts           CompositeFilters `yaml:"consts"`
	Query            string           `yaml:"query"`
}

Filters determine how to select emails.

Two ways are possible: by directly specifying the constants in the match filters or by referring to constants specified by the global `consts` section on top of the config.

type MatchFilters

type MatchFilters struct {
	From    []string `yaml:"from,omitempty"`
	To      []string `yaml:"to,omitempty"`
	Cc      []string `yaml:"cc,omitempty"`
	Subject []string `yaml:"subject,omitempty"`
	Has     []string `yaml:"has,omitempty"`
	List    []string `yaml:"list,omitempty"`
}

MatchFilters contains a list of filters interpreted at a higher level.

Every type of filter (e.g. Subject) is an array or requirements. They will be OR-ed together. If multiple types of filters are specified, they will be put in AND together.

type Rule

type Rule struct {
	Filters Filters `yaml:"filters"`
	Actions Actions `yaml:"actions"`
}

Rule is a filter with an associated action.

Jump to

Keyboard shortcuts

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