mail

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CredentialsFileName = "client_secret.json"
	TokenFileName       = "request.token"
)

Variables

View Source
var GMailDomainNames = []string{"googlemail.com", "gmail.com"}

Functions

func GetGmailConfig

func GetGmailConfig(credentialsPath string, scope ...string) (*oauth2.Config, error)

Types

type GmailService

type GmailService struct {
	// contains filtered or unexported fields
}

func NewGmailService

func NewGmailService(credentialsPath string) *GmailService

func (*GmailService) GetAllUnreadMail

func (service *GmailService) GetAllUnreadMail(context context.Context) ([]Mail, error)

func (*GmailService) MarkMailAsRead

func (service *GmailService) MarkMailAsRead(context context.Context, mail Mail) error

type Mail

type Mail struct {
	Id      string
	Subject string
	Body    string
}

type MailClientService

type MailClientService interface {
	GetAllUnreadMail(context context.Context) ([]Mail, error)
	MarkMailAsRead(context context.Context, mail Mail) error
}

func NewMailClientService

func NewMailClientService(mailClientConfig *config.MailClientConfig) (MailClientService, error)

type MailClientServiceMock

type MailClientServiceMock struct {
	ReturnErrorsOnly bool
	Mails            []Mail
}

func (MailClientServiceMock) GetAllUnreadMail

func (service MailClientServiceMock) GetAllUnreadMail(context context.Context) ([]Mail, error)

func (MailClientServiceMock) MarkMailAsRead

func (service MailClientServiceMock) MarkMailAsRead(context context.Context, mail Mail) error

Jump to

Keyboard shortcuts

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