Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNilConfig indicates a nil config was provided. ErrNilConfig = platformerrors.New("SendGrid config is nil") // ErrEmptyAPIToken indicates an empty API token was provided. ErrEmptyAPIToken = platformerrors.New("empty Sendgrid API token") // ErrNilHTTPClient indicates a nil HTTP client was provided. ErrNilHTTPClient = platformerrors.New("nil HTTP client") )
View Source
var ErrSendgridAPIResponse = platformerrors.New("sendgrid request error")
ErrSendgridAPIResponse indicates an error occurred in SendGrid.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
APIToken string `env:"API_TOKEN" json:"apiToken" yaml:"apiToken"`
}
Config configures SendGrid to send email.
type Emailer ¶
type Emailer struct {
// contains filtered or unexported fields
}
Emailer uses SendGrid to send email.
func NewSendGridEmailer ¶
func NewSendGridEmailer(cfg *Config, client *http.Client, circuitBreaker circuitbreaking.CircuitBreaker, opts ...Option) (*Emailer, error)
NewSendGridEmailer returns a new SendGrid-backed Emailer.
type Option ¶
type Option func(*options)
Option configures the Emailer this package constructs. The zero configuration works: an absent logger logs nowhere, an absent tracer provider traces nowhere, and an absent metrics provider records nothing.
func WithMetricsProvider ¶
WithMetricsProvider attaches a metrics provider.
func WithTracerProvider ¶
func WithTracerProvider(tracerProvider tracing.TracerProvider) Option
WithTracerProvider attaches a tracer provider, enabling spans on every send.
Click to show internal directories.
Click to hide internal directories.