v1alpha3

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: 3 Imported by: 0

Documentation

Index

Constants

View Source
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.

func (Actions) Empty

func (a Actions) Empty() bool

Empty returns true if no actions are specified.

type Author

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

Author represents the owner of the gmail account.

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

type LabelColor struct {
	Background string `json:"background"`
	Text       string `json:"text"`
}

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.

type Test

type Test struct {
	// Name is an optional name used for error reporting.
	Name     string    `json:"name,omitempty"`
	Messages []Message `json:"messages"`
	Actions  Actions   `json:"actions"`
}

Test represents the intended actions applied to a set of emails.

Jump to

Keyboard shortcuts

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