Documentation
¶
Overview ¶
Package provider defines the email-transport boundary used by application services.
Index ¶
- type Client
- type Error
- type OutboundAttachment
- type ReceivedAttachment
- type ReceivedEmail
- type Resend
- func (r *Resend) Download(ctx context.Context, rawURL string) (io.ReadCloser, int64, error)
- func (r *Resend) GetReceived(ctx context.Context, id string) (ReceivedEmail, error)
- func (r *Resend) GetReceivedAttachment(ctx context.Context, emailID, attachmentID string) (ReceivedAttachment, error)
- func (r *Resend) Send(ctx context.Context, request SendRequest) (string, error)
- func (r *Resend) UpdateCredentials(apiKey, webhookSecret string)
- func (r *Resend) VerifyWebhook(raw []byte, headers WebhookHeaders) error
- type SendRequest
- type WebhookHeaders
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
VerifyWebhook([]byte, WebhookHeaders) error
GetReceived(context.Context, string) (ReceivedEmail, error)
GetReceivedAttachment(context.Context, string, string) (ReceivedAttachment, error)
Download(context.Context, string) (io.ReadCloser, int64, error)
Send(context.Context, SendRequest) (string, error)
}
Client isolates Resend SDK models from the mailbox domain.
type OutboundAttachment ¶
type OutboundAttachment struct {
Filename string
ContentType string
ContentID string
Content []byte
}
OutboundAttachment is bounded content prepared for a provider SDK.
type ReceivedAttachment ¶
type ReceivedAttachment struct {
ID string
Filename string
ContentType string
ContentDisposition string
ContentID string
DownloadURL string
Size int64
}
ReceivedAttachment is inbound attachment metadata plus a temporary URL.
type ReceivedEmail ¶
type ReceivedEmail struct {
ID string
To []string
From string
CreatedAt time.Time
Subject string
HTML string
Text string
BCC []string
CC []string
ReplyTo []string
Headers map[string]string
MessageID string
RawURL string
Attachments []ReceivedAttachment
}
ReceivedEmail is a provider-neutral retrieved inbound message.
type Resend ¶
type Resend struct {
// contains filtered or unexported fields
}
Resend implements Client using the official Go SDK and bounded HTTP downloads.
func NewResendForTest ¶
func NewResendForTest(apiKey, webhookSecret string, httpClient *http.Client, baseURL *url.URL) *Resend
NewResendForTest creates an adapter with an injectable API endpoint and HTTP client.
func (*Resend) Download ¶
Download opens a temporary provider URL for streaming into private storage.
func (*Resend) GetReceived ¶
GetReceived retrieves normalized content and attachment metadata.
func (*Resend) GetReceivedAttachment ¶
func (r *Resend) GetReceivedAttachment(ctx context.Context, emailID, attachmentID string) (ReceivedAttachment, error)
GetReceivedAttachment refreshes the provider's temporary attachment URL.
func (*Resend) UpdateCredentials ¶ added in v0.3.1
UpdateCredentials replaces provider credentials for subsequent requests.
func (*Resend) VerifyWebhook ¶
func (r *Resend) VerifyWebhook(raw []byte, headers WebhookHeaders) error
VerifyWebhook delegates raw-body signature verification to the official SDK.
type SendRequest ¶
type SendRequest struct {
From model.Address
To []model.Address
CC []model.Address
BCC []model.Address
Subject string
Text string
Headers map[string]string
Attachments []OutboundAttachment
IdempotencyKey string
}
SendRequest is one logical provider submission.
type WebhookHeaders ¶
WebhookHeaders contains the three Svix signature headers.