Documentation
¶
Overview ¶
Package gateway provides an embedded SDK for the message gateway.
Usage:
gw, err := gateway.New(gateway.Config{
DefaultEmailProvider: "memory",
})
result, err := gw.SendEmail(ctx, &contracts.Email{
To: []string{"user@example.com"},
Subject: "Hello",
HTML: "<p>World</p>",
})
Index ¶
- type Config
- type Gateway
- func (g *Gateway) SendChat(ctx context.Context, chat *contracts.ChatMessage) (*contracts.SendResult, error)
- func (g *Gateway) SendChatWith(ctx context.Context, provider string, chat *contracts.ChatMessage) (*contracts.SendResult, error)
- func (g *Gateway) SendEmail(ctx context.Context, email *contracts.Email) (*contracts.SendResult, error)
- func (g *Gateway) SendEmailWith(ctx context.Context, provider string, email *contracts.Email) (*contracts.SendResult, error)
- func (g *Gateway) SendPush(ctx context.Context, push *contracts.PushNotification) (*contracts.SendResult, error)
- func (g *Gateway) SendPushWith(ctx context.Context, provider string, push *contracts.PushNotification) (*contracts.SendResult, error)
- func (g *Gateway) SendSMS(ctx context.Context, sms *contracts.SMS) (*contracts.SendResult, error)
- func (g *Gateway) SendSMSWith(ctx context.Context, provider string, sms *contracts.SMS) (*contracts.SendResult, error)
- type MailgunConfig
- type MemoryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DefaultEmailProvider string
DefaultSMSProvider string
DefaultPushProvider string
DefaultChatProvider string
Mailgun MailgunConfig
Memory MemoryConfig
}
Config holds the gateway configuration.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway is the main entry point for sending messages.
func (*Gateway) SendChat ¶
func (g *Gateway) SendChat(ctx context.Context, chat *contracts.ChatMessage) (*contracts.SendResult, error)
SendChat sends a chat message using the default provider.
func (*Gateway) SendChatWith ¶
func (g *Gateway) SendChatWith(ctx context.Context, provider string, chat *contracts.ChatMessage) (*contracts.SendResult, error)
SendChatWith sends a chat message using a specific provider.
func (*Gateway) SendEmail ¶
func (g *Gateway) SendEmail(ctx context.Context, email *contracts.Email) (*contracts.SendResult, error)
SendEmail sends an email using the default provider.
func (*Gateway) SendEmailWith ¶
func (g *Gateway) SendEmailWith(ctx context.Context, provider string, email *contracts.Email) (*contracts.SendResult, error)
SendEmailWith sends an email using a specific provider.
func (*Gateway) SendPush ¶
func (g *Gateway) SendPush(ctx context.Context, push *contracts.PushNotification) (*contracts.SendResult, error)
SendPush sends a push notification using the default provider.
func (*Gateway) SendPushWith ¶
func (g *Gateway) SendPushWith(ctx context.Context, provider string, push *contracts.PushNotification) (*contracts.SendResult, error)
SendPushWith sends a push notification using a specific provider.
type MailgunConfig ¶
type MailgunConfig struct {
APIKey string
Domain string
BaseURL string
FromEmail string
FromName string
}
MailgunConfig holds Mailgun provider configuration.
type MemoryConfig ¶
type MemoryConfig struct {
MailpitEnabled bool
}
MemoryConfig holds memory provider configuration.
Click to show internal directories.
Click to hide internal directories.