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 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"` Labels []Label `json:"labels,omitempty"` Rules []Rule `json:"rules"` Tests []Test `json:"tests,omitempty"` }
Config contains the Jsonnet configuration of the Gmail filters.
type FilterNode ¶
type FilterNode struct { 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"` Bcc string `json:"bcc,omitempty"` ReplyTo string `json:"replyto,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) NonEmptyFields ¶
func (f FilterNode) NonEmptyFields() []string
NonEmptyFields returns the names of the fields with a value.
type Label ¶
type Label struct { Name string `json:"name"` Color *LabelColor `json:"color,omitempty"` }
Label represents a Gmail label.
type LabelColor ¶
LabelColor is the color of a label.
See https://developers.google.com/gmail/api/v1/reference/users/labels for the list of possible colors.
type Message ¶
type Message struct { From string `json:"from,omitempty"` To []string `json:"to,omitempty"` Cc []string `json:"cc,omitempty"` Bcc []string `json:"bcc,omitempty"` ReplyTo []string `json:"replyto,omitempty"` Lists []string `json:"lists,omitempty"` Subject string `json:"subject,omitempty"` Body string `json:"body,omitempty"` }
Message represents the contents and metadata of an email.
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.