messaging

package
v0.0.0-...-09efcc3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MessagingEmailPerIP     ratelimit.BucketName = "MessagingEmailPerIP"
	MessagingEmailPerTarget ratelimit.BucketName = "MessagingEmailPerTarget"
	MessagingEmail          ratelimit.BucketName = "MessagingEmail"
	MessagingSMSPerIP       ratelimit.BucketName = "MessagingSMSPerIP"
	MessagingSMSPerTarget   ratelimit.BucketName = "MessagingSMSPerTarget"
	MessagingSMS            ratelimit.BucketName = "MessagingSMS"
)

Variables

View Source
var DependencySet = wire.NewSet(
	NewLogger,
	wire.Struct(new(Limits), "*"),
	wire.Struct(new(Sender), "*"),
)

Functions

This section is empty.

Types

type EventService

type EventService interface {
	DispatchEventImmediately(ctx context.Context, payload event.NonBlockingPayload) error
}

type Limits

type Limits struct {
	Logger       Logger
	RateLimiter  RateLimiter
	UsageLimiter UsageLimiter
	RemoteIP     httputil.RemoteIP

	Config        *config.MessagingRateLimitsConfig
	FeatureConfig *config.MessagingFeatureConfig
	EnvConfig     *config.RateLimitsEnvironmentConfig
}

type Logger

type Logger struct{ *log.Logger }

func NewLogger

func NewLogger(lf *log.Factory) Logger

type MailSender

type MailSender interface {
	Send(opts mail.SendOptions) error
}

type RateLimiter

type RateLimiter interface {
	Reserve(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.Reservation, *ratelimit.FailedReservation, error)
	Cancel(ctx context.Context, r *ratelimit.Reservation)
}

type Reservation

type Reservation struct {
	UsageReservation      *usage.Reservation
	RateLimitReservations []*ratelimit.Reservation
}

type SMSSender

type SMSSender interface {
	Send(ctx context.Context, opts sms.SendOptions) error
}

type Sender

type Sender struct {
	Logger         Logger
	Limits         Limits
	Events         EventService
	MailSender     MailSender
	SMSSender      SMSSender
	WhatsappSender WhatsappSender
	Database       *appdb.Handle

	DevMode config.DevMode

	MessagingFeatureConfig *config.MessagingFeatureConfig

	FeatureTestModeEmailSuppressed config.FeatureTestModeEmailSuppressed
	TestModeEmailConfig            *config.TestModeEmailConfig

	FeatureTestModeSMSSuppressed config.FeatureTestModeSMSSuppressed
	TestModeSMSConfig            *config.TestModeSMSConfig

	FeatureTestModeWhatsappSuppressed config.FeatureTestModeWhatsappSuppressed
	TestModeWhatsappConfig            *config.TestModeWhatsappConfig
}

func (*Sender) SendEmailInNewGoroutine

func (s *Sender) SendEmailInNewGoroutine(ctx context.Context, msgType translation.MessageType, opts *mail.SendOptions) error

func (*Sender) SendSMSInNewGoroutine

func (s *Sender) SendSMSInNewGoroutine(ctx context.Context, msgType translation.MessageType, opts *sms.SendOptions) error

func (*Sender) SendWhatsappImmediately

func (s *Sender) SendWhatsappImmediately(ctx context.Context, msgType translation.MessageType, opts *whatsapp.SendAuthenticationOTPOptions) error

type UsageLimiter

type UsageLimiter interface {
	Reserve(ctx context.Context, name usage.LimitName, config *config.UsageLimitConfig) (*usage.Reservation, error)
	Cancel(ctx context.Context, r *usage.Reservation)
}

type WhatsappSender

type WhatsappSender interface {
	ResolveSendAuthenticationOTPOptions(ctx context.Context, opts *whatsapp.SendAuthenticationOTPOptions) (*whatsapp.ResolvedSendAuthenticationOTPOptions, error)
	SendAuthenticationOTP(ctx context.Context, opts *whatsapp.ResolvedSendAuthenticationOTPOptions) error
}

Jump to

Keyboard shortcuts

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