service

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayConfig

type GatewayConfig interface {
	DefaultEmailProvider() string
	DefaultSMSProvider() string
	DefaultPushProvider() string
	DefaultChatProvider() string
}

GatewayConfig holds the configuration needed by the service.

type GatewayService

type GatewayService struct {
	// contains filtered or unexported fields
}

GatewayService handles provider registration and message dispatching.

func NewGatewayService

func NewGatewayService(cfg GatewayConfig, registry *Registry) *GatewayService

NewGatewayService creates a new GatewayService.

func (*GatewayService) Chat

func (s *GatewayService) Chat() (port.ChatSender, error)

Chat returns the default chat provider.

func (*GatewayService) ChatProvider

func (s *GatewayService) ChatProvider(name string) (port.ChatSender, error)

ChatProvider returns a specific chat provider by name.

func (*GatewayService) Email

func (s *GatewayService) Email() (port.EmailSender, error)

Email returns the default email provider.

func (*GatewayService) EmailProvider

func (s *GatewayService) EmailProvider(name string) (port.EmailSender, error)

EmailProvider returns a specific email provider by name.

func (*GatewayService) Push

func (s *GatewayService) Push() (port.PushSender, error)

Push returns the default push provider.

func (*GatewayService) PushProvider

func (s *GatewayService) PushProvider(name string) (port.PushSender, error)

PushProvider returns a specific push provider by name.

func (*GatewayService) RegisterChatProvider

func (s *GatewayService) RegisterChatProvider(name string, provider port.ChatSender)

RegisterChatProvider registers a custom chat provider.

func (*GatewayService) RegisterEmailProvider

func (s *GatewayService) RegisterEmailProvider(name string, provider port.EmailSender)

RegisterEmailProvider registers a custom email provider.

func (*GatewayService) RegisterPushProvider

func (s *GatewayService) RegisterPushProvider(name string, provider port.PushSender)

RegisterPushProvider registers a custom push provider.

func (*GatewayService) RegisterSMSProvider

func (s *GatewayService) RegisterSMSProvider(name string, provider port.SMSSender)

RegisterSMSProvider registers a custom SMS provider.

func (*GatewayService) SMS

func (s *GatewayService) SMS() (port.SMSSender, error)

SMS returns the default SMS provider.

func (*GatewayService) SMSProvider

func (s *GatewayService) SMSProvider(name string) (port.SMSSender, error)

SMSProvider returns a specific SMS provider by name.

func (*GatewayService) SendChat

SendChat sends a chat message using the default provider.

func (*GatewayService) SendChatWith

func (s *GatewayService) SendChatWith(ctx context.Context, providerName string, message *contracts.ChatMessage) (*contracts.SendResult, error)

SendChatWith sends a chat message using a specific provider.

func (*GatewayService) SendEmail

func (s *GatewayService) SendEmail(ctx context.Context, email *contracts.Email) (*contracts.SendResult, error)

SendEmail sends an email using the default provider.

func (*GatewayService) SendEmailWith

func (s *GatewayService) SendEmailWith(ctx context.Context, providerName string, email *contracts.Email) (*contracts.SendResult, error)

SendEmailWith sends an email using a specific provider.

func (*GatewayService) SendPush

func (s *GatewayService) SendPush(ctx context.Context, notification *contracts.PushNotification) (*contracts.SendResult, error)

SendPush sends a push notification using the default provider.

func (*GatewayService) SendPushWith

func (s *GatewayService) SendPushWith(ctx context.Context, providerName string, notification *contracts.PushNotification) (*contracts.SendResult, error)

SendPushWith sends a push notification using a specific provider.

func (*GatewayService) SendSMS

SendSMS sends an SMS using the default provider.

func (*GatewayService) SendSMSWith

func (s *GatewayService) SendSMSWith(ctx context.Context, providerName string, sms *contracts.SMS) (*contracts.SendResult, error)

SendSMSWith sends an SMS using a specific provider.

type ProviderNotFoundError

type ProviderNotFoundError struct {
	ProviderType string
	ProviderName string
}

func NewProviderNotFoundError

func NewProviderNotFoundError(providerType, providerName string) *ProviderNotFoundError

func (*ProviderNotFoundError) Error

func (e *ProviderNotFoundError) Error() string

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages provider instances in a thread-safe manner.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new Registry.

func (*Registry) GetChatProvider

func (r *Registry) GetChatProvider(name string) (port.ChatSender, bool)

GetChatProvider returns a chat provider by name.

func (*Registry) GetEmailProvider

func (r *Registry) GetEmailProvider(name string) (port.EmailSender, bool)

GetEmailProvider returns an email provider by name.

func (*Registry) GetPushProvider

func (r *Registry) GetPushProvider(name string) (port.PushSender, bool)

GetPushProvider returns a push provider by name.

func (*Registry) GetSMSProvider

func (r *Registry) GetSMSProvider(name string) (port.SMSSender, bool)

GetSMSProvider returns an SMS provider by name.

func (*Registry) RegisterChatProvider

func (r *Registry) RegisterChatProvider(name string, provider port.ChatSender)

RegisterChatProvider registers a chat provider with the given name.

func (*Registry) RegisterEmailProvider

func (r *Registry) RegisterEmailProvider(name string, provider port.EmailSender)

RegisterEmailProvider registers an email provider with the given name.

func (*Registry) RegisterPushProvider

func (r *Registry) RegisterPushProvider(name string, provider port.PushSender)

RegisterPushProvider registers a push provider with the given name.

func (*Registry) RegisterSMSProvider

func (r *Registry) RegisterSMSProvider(name string, provider port.SMSSender)

RegisterSMSProvider registers an SMS provider with the given name.

Jump to

Keyboard shortcuts

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