gmail

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileGenerator

func FileGenerator(filename string) (io.Writer, error)

FileGenerator returns a system file

Types

type ProcessedAttachment

type ProcessedAttachment struct {
	Body     io.Reader
	Filename string
	// Original filename
	OriginalName string
	Headers      []*gmail.MessagePartHeader
}

ProcessedAttachment file contents read from the emails fetched

type ProcessedAttachments

type ProcessedAttachments []*ProcessedAttachment

ProcessedAttachments a slice of ProcessAttachment

func (ProcessedAttachments) Close

func (at ProcessedAttachments) Close() error

Close closes readers which also implement Closer interface

type Service

type Service struct {
	UserID string

	// DefaultQ  is provided when filtering messages Gmail search box style
	DefaultQ        string
	WriterGenerator WriterGenerator
	// contains filtered or unexported fields
}

Service encapsulates the needed configuration settings to make successful Gmail api calls The struct methods have not been optimized for concurrent use, create new instances for different goroutines

func NewService

func NewService(config io.Reader, userID string) (*Service, error)

NewService instantiates a new service struct for API calls

func (*Service) GmailService added in v0.0.3

func (srv *Service) GmailService() *gmail.Service

GmailService returns the underlying gmail service

func (*Service) ListMessages

func (srv *Service) ListMessages() ([]*gmail.Message, error)

ListMessages fetches messages from the specified userID

func (*Service) ProcessPDFAttachments

func (srv *Service) ProcessPDFAttachments(markRead bool) (ProcessedAttachments, error)

ProcessPDFAttachments reads pdf attachments from the emails fetched

type WriterGenerator

type WriterGenerator func(filename string) (io.Writer, error)

WriterGenerator defines a function that defines where the attachment contents will be written to.

This could be a byte.Buffer, os.File or any other interface that implements the writer interface

Jump to

Keyboard shortcuts

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