Documentation
¶
Index ¶
- Variables
- func SetWebhookClient(client WebhookClient)
- type AttachedFile
- type EmailSender
- type FakeDisconnectedMailer
- type FakeMailer
- type GetUserByLoginFunc
- type Mailer
- type Message
- type NotificationService
- func (ns *NotificationService) GetMailer() Mailer
- func (ns *NotificationService) Run(ctx context.Context) error
- func (ns *NotificationService) Send(msg *Message) (int, error)
- func (ns *NotificationService) SendEmailCommandHandler(ctx context.Context, cmd *models.SendEmailCommand) error
- func (ns *NotificationService) SendEmailCommandHandlerSync(ctx context.Context, cmd *models.SendEmailCommandSync) error
- func (ns *NotificationService) SendResetPasswordEmail(ctx context.Context, cmd *models.SendResetPasswordEmailCommand) error
- func (ns *NotificationService) SendWebhookSync(ctx context.Context, cmd *models.SendWebhookSync) error
- func (ns *NotificationService) ValidateResetPasswordCode(ctx context.Context, query *models.ValidateResetPasswordCodeQuery, ...) error
- type NotificationServiceMock
- func (ns *NotificationServiceMock) SendEmailCommandHandler(ctx context.Context, cmd *models.SendEmailCommand) error
- func (ns *NotificationServiceMock) SendEmailCommandHandlerSync(ctx context.Context, cmd *models.SendEmailCommandSync) error
- func (ns *NotificationServiceMock) SendWebhookSync(ctx context.Context, cmd *models.SendWebhookSync) error
- type Service
- type SmtpClient
- type TempUserStore
- type Webhook
- type WebhookClient
- type WebhookSender
Constants ¶
This section is empty.
Variables ¶
View Source
var NetClient = &netClient
NetClient is used to export original in test.
Functions ¶
func SetWebhookClient ¶
func SetWebhookClient(client WebhookClient)
SetWebhookClient is used to mock in test.
Types ¶
type AttachedFile ¶
AttachedFile struct represents email attached files.
type EmailSender ¶
type EmailSender interface { SendEmailCommandHandlerSync(ctx context.Context, cmd *models.SendEmailCommandSync) error SendEmailCommandHandler(ctx context.Context, cmd *models.SendEmailCommand) error }
type FakeDisconnectedMailer ¶
type FakeDisconnectedMailer struct{}
func NewFakeDisconnectedMailer ¶
func NewFakeDisconnectedMailer() *FakeDisconnectedMailer
type FakeMailer ¶
type FakeMailer struct {
Sent []*Message
}
func NewFakeMailer ¶
func NewFakeMailer() *FakeMailer
type GetUserByLoginFunc ¶
type Message ¶
type Message struct { To []string SingleEmail bool From string Subject string Body map[string]string Info string ReplyTo []string EmbeddedFiles []string AttachedFiles []*AttachedFile }
Message is representation of the email message.
type NotificationService ¶
type NotificationService struct { Bus bus.Bus Cfg *setting.Cfg // contains filtered or unexported fields }
func ProvideService ¶
func ProvideService(bus bus.Bus, cfg *setting.Cfg, mailer Mailer, store TempUserStore) (*NotificationService, error)
func (*NotificationService) GetMailer ¶
func (ns *NotificationService) GetMailer() Mailer
func (*NotificationService) SendEmailCommandHandler ¶
func (ns *NotificationService) SendEmailCommandHandler(ctx context.Context, cmd *models.SendEmailCommand) error
func (*NotificationService) SendEmailCommandHandlerSync ¶
func (ns *NotificationService) SendEmailCommandHandlerSync(ctx context.Context, cmd *models.SendEmailCommandSync) error
func (*NotificationService) SendResetPasswordEmail ¶
func (ns *NotificationService) SendResetPasswordEmail(ctx context.Context, cmd *models.SendResetPasswordEmailCommand) error
func (*NotificationService) SendWebhookSync ¶
func (ns *NotificationService) SendWebhookSync(ctx context.Context, cmd *models.SendWebhookSync) error
func (*NotificationService) ValidateResetPasswordCode ¶
func (ns *NotificationService) ValidateResetPasswordCode(ctx context.Context, query *models.ValidateResetPasswordCodeQuery, userByLogin GetUserByLoginFunc) error
type NotificationServiceMock ¶
type NotificationServiceMock struct { Webhook models.SendWebhookSync EmailSync models.SendEmailCommandSync Email models.SendEmailCommand ShouldError error WebhookHandler func(context.Context, *models.SendWebhookSync) error EmailHandlerSync func(context.Context, *models.SendEmailCommandSync) error EmailHandler func(context.Context, *models.SendEmailCommand) error }
func MockNotificationService ¶
func MockNotificationService() *NotificationServiceMock
func (*NotificationServiceMock) SendEmailCommandHandler ¶
func (ns *NotificationServiceMock) SendEmailCommandHandler(ctx context.Context, cmd *models.SendEmailCommand) error
func (*NotificationServiceMock) SendEmailCommandHandlerSync ¶
func (ns *NotificationServiceMock) SendEmailCommandHandlerSync(ctx context.Context, cmd *models.SendEmailCommandSync) error
func (*NotificationServiceMock) SendWebhookSync ¶
func (ns *NotificationServiceMock) SendWebhookSync(ctx context.Context, cmd *models.SendWebhookSync) error
type Service ¶
type Service interface { WebhookSender EmailSender }
type SmtpClient ¶
type SmtpClient struct {
// contains filtered or unexported fields
}
func NewSmtpClient ¶
func NewSmtpClient(cfg setting.SmtpSettings) (*SmtpClient, error)
type TempUserStore ¶
type TempUserStore interface {
UpdateTempUserWithEmailSent(ctx context.Context, cmd *models.UpdateTempUserWithEmailSentCommand) error
}
type Webhook ¶
type Webhook struct { Url string User string Password string Body string HttpMethod string HttpHeader map[string]string ContentType string // Validation is a function that will validate the response body and statusCode of the webhook. Any returned error will cause the webhook request to be considered failed. // This can be useful when a webhook service communicates failures in creative ways, such as using the response body instead of the status code. Validation func(body []byte, statusCode int) error }
type WebhookClient ¶
WebhookClient exists to mock the client in tests.
type WebhookSender ¶
type WebhookSender interface {
SendWebhookSync(ctx context.Context, cmd *models.SendWebhookSync) error
}
Click to show internal directories.
Click to hide internal directories.