Documentation ¶
Overview ¶
Package specifies a common interface for all email clients, e.g. amazon sns,
Package emailclient is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmazonClient ¶
type AmazonClient struct {
// contains filtered or unexported fields
}
AmazonClient holds a state of a client
func NewAmazonClient ¶
func NewAmazonClient(logger *zap.Logger, keyID, secretKey string) (*AmazonClient, error)
NewAmazonClient returns a new amazon SNS client for given credentials
func (*AmazonClient) ProviderName ¶
func (ac *AmazonClient) ProviderName() string
ProviderName returns "aws"
func (*AmazonClient) Send ¶
func (ac *AmazonClient) Send(ctx context.Context, sender string, recipients []string, subject string, opts ...EmailOption) error
Send sends an email using Amazon SNS
type EmailClient ¶
type EmailClient interface { Send(context.Context, string, []string, string, ...EmailOption) error ProviderName() string }
EmailClient is an common interface used by all email clients
type EmailOption ¶
type EmailOption func(*emailOptions)
EmailOption...
func WithBCCRecipient ¶
func WithBCCRecipient(recipient string) EmailOption
WithBCCRecipient adds a bcc recipient to the list of options
func WithBCCRecipients ¶
func WithBCCRecipients(recipients []string) EmailOption
WithBCCRecipients sets cc recipients
func WithCCRecipient ¶
func WithCCRecipient(recipient string) EmailOption
WithCCRecipient adds a cc recipient to the list of options
func WithCCRecipients ¶
func WithCCRecipients(recipients []string) EmailOption
WithCCRecipients sets cc recipients
type MockEmailClient ¶
type MockEmailClient struct {
// contains filtered or unexported fields
}
MockEmailClient is a mock of EmailClient interface
func NewMockEmailClient ¶
func NewMockEmailClient(ctrl *gomock.Controller) *MockEmailClient
NewMockEmailClient creates a new mock instance
func (*MockEmailClient) EXPECT ¶
func (m *MockEmailClient) EXPECT() *MockEmailClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockEmailClient) ProviderName ¶
func (m *MockEmailClient) ProviderName() string
ProviderName mocks base method
func (*MockEmailClient) Send ¶
func (m *MockEmailClient) Send(arg0 context.Context, arg1 string, arg2 []string, arg3 string, arg4 ...EmailOption) error
Send mocks base method
type MockEmailClientMockRecorder ¶
type MockEmailClientMockRecorder struct {
// contains filtered or unexported fields
}
MockEmailClientMockRecorder is the mock recorder for MockEmailClient
func (*MockEmailClientMockRecorder) ProviderName ¶
func (mr *MockEmailClientMockRecorder) ProviderName() *gomock.Call
ProviderName indicates an expected call of ProviderName
func (*MockEmailClientMockRecorder) Send ¶
func (mr *MockEmailClientMockRecorder) Send(arg0, arg1, arg2, arg3 interface{}, arg4 ...interface{}) *gomock.Call
Send indicates an expected call of Send
type NopClient ¶
type NopClient struct {
// contains filtered or unexported fields
}
NopClient holds a state of a client
func NewNopClient ¶
NewNopClient returns a new NOP client It is useful for tests
func (*NopClient) ProviderName ¶
ProviderName returns "nop"
type SendgridClient ¶
type SendgridClient struct {
// contains filtered or unexported fields
}
SendgridClient holds a state of a client
func NewSendgridClient ¶
func NewSendgridClient(logger *zap.Logger, key string) (*SendgridClient, error)
NewSendgridClient creates a new SendgridClient
func (*SendgridClient) ProviderName ¶
func (sc *SendgridClient) ProviderName() string
ProviderName returns "sendgrid"
func (*SendgridClient) Send ¶
func (sc *SendgridClient) Send(ctx context.Context, sender string, recipients []string, subject string, opts ...EmailOption) error
Send sends an email using SendGrid service