Documentation
¶
Index ¶
Constants ¶
const Version = "v1alpha3"
Version is the latest supported version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actions ¶
type Actions struct {
Archive bool `json:"archive,omitempty"`
Delete bool `json:"delete,omitempty"`
MarkRead bool `json:"markRead,omitempty"`
Star bool `json:"star,omitempty"`
// MarkSpam can be used to disallow mails to be marked as spam.
// This however is not allowed to be set to true by Gmail.
MarkSpam *bool `json:"markSpam,omitempty"`
MarkImportant *bool `json:"markImportant,omitempty"`
Category gmail.Category `json:"category,omitempty"`
Labels []string `json:"labels,omitempty"`
// Forward actions
// TODO(#56) Unused for now.
Forward string `json:"forward,omitempty"`
}
Actions contains the actions to be applied to a set of emails.
type Config ¶
type Config struct {
Version string `json:"version"`
Author Author `json:"author,omitempty"`
Rules []Rule `json:"rules"`
}
Config contains the yaml configuration of the Gmail filters.
type FilterNode ¶
type FilterNode struct {
RefName string `json:"name,omitempty"`
And []FilterNode `json:"and,omitempty"`
Or []FilterNode `json:"or,omitempty"`
Not *FilterNode `json:"not,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Cc string `json:"cc,omitempty"`
Subject string `json:"subject,omitempty"`
List string `json:"list,omitempty"`
Has string `json:"has,omitempty"`
Query string `json:"query,omitempty"`
// IsEscaped specifies that the given parameters don't need any
// further escaping.
//
// Only allowed in combination with 'From', 'To' or 'Subject'.
IsEscaped bool `json:"isEscaped,omitempty"`
}
FilterNode represents a piece of a Gmail filter.
The definition is recursive, as filters can be composed together with the use of logical operators. For every filter node, only one operator can be specified. If you need to combine multiple queries together, combine the nodes with 'And', 'Or' and 'Not'.
func (FilterNode) Empty ¶
func (f FilterNode) Empty() bool
Empty returns true if all the fields are empty.
func (FilterNode) NonEmptyFields ¶
func (f FilterNode) NonEmptyFields() []string
NonEmptyFields returns the names of the fields with a value.
type Rule ¶
type Rule struct {
Filter FilterNode `json:"filter"`
Actions Actions `json:"actions"`
}
Rule is the actual complete Gmail filter.
For every email, if the filter applies correctly, then the specified actions will be applied to it.