gmail

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gmail is used for sending emails via gmail

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFailedToSendEmail is returned when an email fails to send
	ErrFailedToSendEmail = errors.New("failed to send email")
	// ErrNoUsersMessagesService is returned when no UsersMessagesService is initiated
	ErrNoUsersMessagesService = errors.New("no UsersMessagesService initiated")
	// ErrUnableToBuildMIMEMessage is returned when a MIME message fails to be built
	ErrUnableToBuildMIMEMessage = errors.New("unable to build MIME message")
	// ErrUnableToStartGmailService is returned when a Gmail service fails to start
	ErrUnableToStartGmailService = errors.New("unable to start Gmail service")
	// ErrUnableToParseServiceAccount is returned when a service account fails to be parsed
	ErrUnableToParseServiceAccount = errors.New("unable to parse service account")
	// ErrUnableToParseJWTCredentials is returned when JWT credentials fail to be parsed
	ErrUnableToParseJWTCredentials = errors.New("unable to parse JWT credentials")
	// ErrInvalidToken is returned when a token is invalid
	ErrInvalidToken = errors.New("invalid token")
	// ErrMockServiceError is returned when a mock service encounters an error
	ErrMockServiceError = errors.New("mock service error")
)

Functions

func NewWithAPIKey added in v0.1.1

func NewWithAPIKey(ctx context.Context, apiKey, user string) (newman.EmailSender, error)

NewWithAPIKey initializes a new gmailEmailSenderAPIKey instance using an API key

func NewWithJWTAccess added in v0.1.1

func NewWithJWTAccess(ctx context.Context, jsonCredentials []byte, user string) (newman.EmailSender, error)

NewWithJWTAccess initializes a new gmailEmailSenderJWTAccess instance using a JWT access token

func NewWithJWTConfig added in v0.1.1

func NewWithJWTConfig(ctx context.Context, configJSON []byte, user string) (newman.EmailSender, error)

NewWithJWTConfig initializes a new gmailEmailSenderJWT instance using JWT configuration

func NewWithOauth2 added in v0.1.1

func NewWithOauth2(ctx context.Context, configJSON []byte, tokenManager TokenManager, user string) (newman.EmailSender, error)

NewWithOauth2 initializes a new gmailEmailSenderOauth2 instance using OAuth2 credentials

func NewWithServiceAccount added in v0.1.1

func NewWithServiceAccount(ctx context.Context, jsonCredentials []byte, user string) (newman.EmailSender, error)

NewWithServiceAccount initializes a new gmailEmailSenderServiceAccount instance using service account JSON credentials

Types

type TokenManager added in v0.1.1

type TokenManager interface {
	GetToken() ([]byte, error)
}

TokenManager defines an interface for obtaining OAuth2 tokens

Jump to

Keyboard shortcuts

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