gmailservice

package
v0.0.0-...-f02d9f3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const RetryWaitInterval = 60

number of seconds to wait before retrying (multiplied by number of retries)

 10s was too short for API rate limiting to recover,
60s may be longer than needed

Variables

This section is empty.

Functions

func BodyText

func BodyText(msg gmail.Message, mimeType string) string

func Download

func Download(d Downloader) []*store.Label

Download everything that is requested in calliope generic Message format

func DownloadFullMessage

func DownloadFullMessage(d Downloader, id string)

func DownloadFullMessages

func DownloadFullMessages(d Downloader)

func DownloadLabels

func DownloadLabels(d Downloader) []*store.Label

func ExtractHeader

func ExtractHeader(gmail gmail.Message, field string) string

func GetBodyPartByMimeType

func GetBodyPartByMimeType(msg gmail.Message, mimeType string) string

func GetPartByMimeType

func GetPartByMimeType(parts []*gmail.MessagePart, mimeType string) string

func GmailToMessage

func GmailToMessage(gmail gmail.Message, inboxUrl string, downloaded time.Time) (store.Message, error)

func HasMatchingHeader

func HasMatchingHeader(excludeHeaders map[string][]string, message gmail.Message) (string, string)

func SearchMessages

func SearchMessages(d Downloader)

SearchMessages gets list of message and thread IDs (not full message content)

Types

type Downloader

type Downloader struct {
	SearchChan   chan *gmail.Message
	MessageChan  chan *store.Message
	M2           chan *store.Message
	WorkersQueue chan bool
	MaxWorkers   int
	Svc          *gmail.Service
	Options      Options

	DoListLabels   func(*gmail.UsersLabelsListCall)
	GmailToMessage func(gmail.Message, string, time.Time) (store.Message, error)
	StartedAt      time.Time
	// contains filtered or unexported fields
}

func New

func New(svc *gmail.Service, options Options, maxWorkers int) Downloader

func (*Downloader) DoGetWrapper

func (d *Downloader) DoGetWrapper(id string) (*gmail.Message, error)

func (Downloader) NoNewWorkers

func (d Downloader) NoNewWorkers()

type Options

type Options struct {
	Query          string
	Limit          int64
	InboxUrl       string
	ExcludeHeaders map[string][]string
}

Jump to

Keyboard shortcuts

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