gateway

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 7 Imported by: 0

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

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 New

func New(cfg Config) (*Gateway, error)

New creates a new Gateway instance.

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

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.

func (*Gateway) SendSMS

func (g *Gateway) SendSMS(ctx context.Context, sms *contracts.SMS) (*contracts.SendResult, error)

SendSMS sends an SMS using the default provider.

func (*Gateway) SendSMSWith

func (g *Gateway) SendSMSWith(ctx context.Context, provider string, sms *contracts.SMS) (*contracts.SendResult, error)

SendSMSWith sends an SMS 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.

Jump to

Keyboard shortcuts

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