Documentation
¶
Overview ¶
Package wazobiamail is the official Go SDK for the WazobiaMail API.
WazobiaMail is a Resend alternative for transactional email through an API or SMTP, with sending domains, hosted mailboxes and deliverability tools. Start free with 3,000 emails/month.
Index ¶
- Constants
- Variables
- type APIError
- type APIKey
- type APIKeyEnvelope
- type APIKeysService
- func (s *APIKeysService) Create(ctx context.Context, req CreateAPIKeyRequest) (*APIResponse[APIKeyEnvelope], error)
- func (s *APIKeysService) List(ctx context.Context) (*APIResponse[Items[APIKey]], error)
- func (s *APIKeysService) Regenerate(ctx context.Context, keyID string) (*APIResponse[APIKeyEnvelope], error)
- func (s *APIKeysService) Revoke(ctx context.Context, keyID string) (*APIResponse[map[string]string], error)
- type APIResponse
- type AccountStatus
- type BillingService
- func (s *BillingService) CurrentSubscription(ctx context.Context, product string) (*APIResponse[SubscriptionEnvelope], error)
- func (s *BillingService) DownloadInvoice(ctx context.Context, invoiceID string) ([]byte, http.Header, error)
- func (s *BillingService) ListInvoices(ctx context.Context) (*APIResponse[Page[Invoice]], error)
- type Client
- type CloudflareConnect
- type CloudflareStatus
- type CloudflareSyncRequest
- type CloudflareSyncResult
- type CreateAPIKeyRequest
- type CreateDomainRequest
- type CreateMailboxRequest
- type CreateSMTPRelayRequest
- type CreateSupportTicketRequest
- type CreateTemplateRequest
- type CreatedAPIKey
- type CreatedCredential
- type CreatedSupportTicket
- type CredentialEnvelope
- type DNSRecord
- type Domain
- type DomainDNS
- type DomainDNSEnvelope
- type DomainEnvelope
- type DomainVerification
- type DomainsService
- func (s *DomainsService) CloudflareConnect(ctx context.Context, domainID string) (*APIResponse[CloudflareConnect], error)
- func (s *DomainsService) CloudflareDisconnect(ctx context.Context, domainID string) (*APIResponse[map[string]any], error)
- func (s *DomainsService) CloudflareStatus(ctx context.Context, domainID string) (*APIResponse[CloudflareStatus], error)
- func (s *DomainsService) CloudflareSync(ctx context.Context, domainID string) (*APIResponse[CloudflareSyncResult], error)
- func (s *DomainsService) Create(ctx context.Context, req CreateDomainRequest) (*APIResponse[DomainEnvelope], error)
- func (s *DomainsService) DNSRecords(ctx context.Context, domainID string) (*APIResponse[DomainDNSEnvelope], error)
- func (s *DomainsService) Delete(ctx context.Context, domainID string) (*APIResponse[map[string]string], error)
- func (s *DomainsService) Get(ctx context.Context, domainID string) (*APIResponse[DomainEnvelope], error)
- func (s *DomainsService) List(ctx context.Context) (*APIResponse[Items[Domain]], error)
- func (s *DomainsService) RefreshDNS(ctx context.Context, domainID string) (*APIResponse[VerificationEnvelope], error)
- func (s *DomainsService) Update(ctx context.Context, domainID string, req UpdateDomainRequest) (*APIResponse[DomainEnvelope], error)
- func (s *DomainsService) Verify(ctx context.Context, domainID string, force bool) (*APIResponse[VerificationEnvelope], error)
- type EffectiveLimits
- type EmailAddress
- type EmailLog
- type EmailLogParams
- type EmailLogs
- type FileUpload
- type InboxAttachment
- type InboxMessage
- type InboxMessageDetail
- type Invoice
- type Items
- type LimitsEnvelope
- type ListMessagesParams
- type Mailbox
- type MailboxConnection
- type MailboxCredential
- type MailboxEnvelope
- type MailboxMessages
- type MailboxesService
- func (s *MailboxesService) Connection(ctx context.Context, mailboxID string) (*APIResponse[MailboxConnection], error)
- func (s *MailboxesService) Create(ctx context.Context, req CreateMailboxRequest) (*APIResponse[Mailbox], error)
- func (s *MailboxesService) CreateCredential(ctx context.Context, mailboxID string) (*APIResponse[CredentialEnvelope], error)
- func (s *MailboxesService) Delete(ctx context.Context, mailboxID string) (*APIResponse[map[string]string], error)
- func (s *MailboxesService) DeleteMessage(ctx context.Context, mailboxID, messageID string) (*APIResponse[map[string]any], error)
- func (s *MailboxesService) Get(ctx context.Context, mailboxID string) (*APIResponse[MailboxEnvelope], error)
- func (s *MailboxesService) GetMessage(ctx context.Context, mailboxID, messageID string) (*APIResponse[InboxMessageDetail], error)
- func (s *MailboxesService) List(ctx context.Context) (*APIResponse[[]Mailbox], error)
- func (s *MailboxesService) ListMessages(ctx context.Context, mailboxID string, params ListMessagesParams) (*APIResponse[MailboxMessages], error)
- func (s *MailboxesService) RevokeCredential(ctx context.Context, mailboxID, credentialID string) (*APIResponse[map[string]string], error)
- func (s *MailboxesService) RotateCredential(ctx context.Context, mailboxID string) (*APIResponse[CredentialEnvelope], error)
- func (s *MailboxesService) Storage(ctx context.Context) (*APIResponse[map[string]any], error)
- func (s *MailboxesService) Update(ctx context.Context, mailboxID string, req UpdateMailboxRequest) (*APIResponse[MailboxEnvelope], error)
- type MessagesService
- func (s *MessagesService) GetTracked(ctx context.Context, trackingID string) (*APIResponse[TrackingDetail], error)
- func (s *MessagesService) ListEmailLogs(ctx context.Context, params EmailLogParams) (*APIResponse[EmailLogs], error)
- func (s *MessagesService) ListTracked(ctx context.Context, params TrackingListParams) (*APIResponse[TrackingList], error)
- func (s *MessagesService) Send(ctx context.Context, req SendMessageRequest) (*APIResponse[SendEnvelope], error)
- func (s *MessagesService) SendWithAttachments(ctx context.Context, req SendMessageRequest, files []FileUpload) (*APIResponse[SendEnvelope], error)
- func (s *MessagesService) SpamCheck(ctx context.Context, req SpamCheckRequest) (*APIResponse[SpamCheckResult], error)
- func (s *MessagesService) UploadAttachment(ctx context.Context, file FileUpload) (*APIResponse[UploadedFileEnvelope], error)
- type Option
- func WithAccessToken(token string) Option
- func WithAllowUnauthenticated(allow bool) Option
- func WithBaseURL(baseURL string) Option
- func WithHTTPClient(client *http.Client) Option
- func WithHeader(name, value string) Option
- func WithTimeout(timeout time.Duration) Option
- func WithUserAgent(userAgent string) Option
- type Page
- type Pagination
- type Plan
- type PlansService
- type PreviewTemplateRequest
- type PurchaseUnitsRequest
- type ReplySupportTicketRequest
- type SMTPAccess
- type SMTPConnection
- type SMTPRelay
- type SMTPRelayEnvelope
- type SMTPRelaysEnvelope
- type SMTPService
- func (s *SMTPService) Access(ctx context.Context) (*APIResponse[SMTPAccess], error)
- func (s *SMTPService) ActivateRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)
- func (s *SMTPService) CreateRelay(ctx context.Context, req CreateSMTPRelayRequest) (*APIResponse[SMTPRelayEnvelope], error)
- func (s *SMTPService) DeactivateRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)
- func (s *SMTPService) DeleteRelay(ctx context.Context, relayID string) (*APIResponse[map[string]string], error)
- func (s *SMTPService) GetRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)
- func (s *SMTPService) ListRelays(ctx context.Context) (*APIResponse[SMTPRelaysEnvelope], error)
- func (s *SMTPService) UpdateAccess(ctx context.Context, enabled bool) (*APIResponse[map[string]bool], error)
- func (s *SMTPService) UpdateRelay(ctx context.Context, relayID string, req UpdateSMTPRelayRequest) (*APIResponse[SMTPRelayEnvelope], error)
- type SendEnvelope
- type SendMessageRequest
- type SendResult
- type SpamCheckRequest
- type SpamCheckResult
- type SpamRule
- type StatusService
- type Subscription
- type SubscriptionEnvelope
- type SuccessResponse
- type SupportAttachment
- type SupportListParams
- type SupportMessage
- type SupportService
- func (s *SupportService) Create(ctx context.Context, req CreateSupportTicketRequest) (*APIResponse[CreatedSupportTicket], error)
- func (s *SupportService) DownloadAttachment(ctx context.Context, attachmentID string) ([]byte, http.Header, error)
- func (s *SupportService) Get(ctx context.Context, ticketID string) (*APIResponse[SupportTicket], error)
- func (s *SupportService) List(ctx context.Context, params SupportListParams) (*APIResponse[SupportTicketList], error)
- func (s *SupportService) MarkRead(ctx context.Context, ticketID string) (*APIResponse[map[string]any], error)
- func (s *SupportService) Reply(ctx context.Context, ticketID string, req ReplySupportTicketRequest) (*APIResponse[SupportMessage], error)
- type SupportTicket
- type SupportTicketList
- type SupportUpload
- type Template
- type TemplateList
- type TemplateListParams
- type TemplatePreview
- type TemplatesService
- func (s *TemplatesService) Create(ctx context.Context, req CreateTemplateRequest) (*APIResponse[Template], error)
- func (s *TemplatesService) Delete(ctx context.Context, templateID string) (*APIResponse[map[string]string], error)
- func (s *TemplatesService) Get(ctx context.Context, templateID string) (*APIResponse[Template], error)
- func (s *TemplatesService) List(ctx context.Context, params TemplateListParams) (*APIResponse[TemplateList], error)
- func (s *TemplatesService) Preview(ctx context.Context, templateID string, req PreviewTemplateRequest) (*APIResponse[TemplatePreview], error)
- func (s *TemplatesService) SyncMeta(ctx context.Context, templateID string) (*APIResponse[Template], error)
- func (s *TemplatesService) Update(ctx context.Context, templateID string, req UpdateTemplateRequest) (*APIResponse[Template], error)
- type TrackingDetail
- type TrackingEvent
- type TrackingList
- type TrackingListParams
- type TrackingMessage
- type TrackingSummary
- type URLAttachment
- type UnitLedgerEntry
- type UnitPack
- type UnitsService
- func (s *UnitsService) Ledger(ctx context.Context, page, perPage int) (*APIResponse[Page[UnitLedgerEntry]], error)
- func (s *UnitsService) Packs(ctx context.Context) (*APIResponse[Items[UnitPack]], error)
- func (s *UnitsService) Purchase(ctx context.Context, req PurchaseUnitsRequest) (*APIResponse[map[string]any], error)
- func (s *UnitsService) Summary(ctx context.Context) (*APIResponse[UnitsSummary], error)
- type UnitsSummary
- type UpdateDomainRequest
- type UpdateMailboxRequest
- type UpdateSMTPRelayRequest
- type UpdateTemplateRequest
- type UploadedFile
- type UploadedFileEnvelope
- type VerificationCheck
- type VerificationEnvelope
- type WebhooksService
Constants ¶
const ( // Version is the SDK version. Version = "0.1.0" // DefaultBaseURL is the production WazobiaMail API root. DefaultBaseURL = "https://app.wazobiamail.com/api/v1" // DefaultTimeout is the default HTTP timeout. DefaultTimeout = 30 * time.Second // DefaultUserAgent identifies the SDK to the API. DefaultUserAgent = "wazobiamail-go/" + Version )
const ( // WebhookSignatureHeader is the header that carries the hex HMAC SHA-256 signature. WebhookSignatureHeader = "X-Wazobia-Signature" // WebhookSecretEnv is the conventional environment variable for the signing secret. WebhookSecretEnv = "WAZOBIA_WEBHOOK_SECRET" )
Variables ¶
var ErrInvalidWebhookSignature = errors.New("wazobiamail: invalid webhook signature")
ErrInvalidWebhookSignature is returned when a webhook signature does not match.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
StatusCode int
Message string
Code string
Errors map[string]any
Body []byte
RetryAfter time.Duration
}
APIError is returned for non-2xx API responses.
func (*APIError) IsForbidden ¶
IsForbidden reports whether the API returned 403.
func (*APIError) IsNotFound ¶
IsNotFound reports whether the API returned 404.
func (*APIError) IsRateLimited ¶
IsRateLimited reports whether the API returned 429.
func (*APIError) IsUnauthorized ¶
IsUnauthorized reports whether the API returned 401.
func (*APIError) IsValidation ¶
IsValidation reports whether the API returned 422 (or a 400 with field errors).
type APIKey ¶
type APIKey struct {
ID string `json:"id"`
Name string `json:"name"`
Scope string `json:"scope"`
DomainID *string `json:"domainId"`
Domain *string `json:"domain"`
KeyPrefix string `json:"keyPrefix"`
LastUsedAt *string `json:"lastUsedAt"`
ExpiresAt *string `json:"expiresAt"`
RevokedAt *string `json:"revokedAt"`
CreatedAt string `json:"createdAt"`
}
APIKey is a scoped sending API key.
type APIKeyEnvelope ¶
type APIKeyEnvelope struct {
APIKey CreatedAPIKey `json:"apiKey"`
}
APIKeyEnvelope is {"apiKey":{...}}.
type APIKeysService ¶
type APIKeysService struct {
// contains filtered or unexported fields
}
APIKeysService manages sending API keys.
func (*APIKeysService) Create ¶
func (s *APIKeysService) Create(ctx context.Context, req CreateAPIKeyRequest) (*APIResponse[APIKeyEnvelope], error)
func (*APIKeysService) List ¶
func (s *APIKeysService) List(ctx context.Context) (*APIResponse[Items[APIKey]], error)
func (*APIKeysService) Regenerate ¶
func (s *APIKeysService) Regenerate(ctx context.Context, keyID string) (*APIResponse[APIKeyEnvelope], error)
func (*APIKeysService) Revoke ¶
func (s *APIKeysService) Revoke(ctx context.Context, keyID string) (*APIResponse[map[string]string], error)
type APIResponse ¶
type APIResponse[T any] struct { Success bool `json:"success"` Message string `json:"message"` Data T `json:"data"` }
APIResponse is the standard WazobiaMail success envelope.
type AccountStatus ¶
AccountStatus is the /status response.
type BillingService ¶
type BillingService struct {
// contains filtered or unexported fields
}
BillingService reads invoices and subscriptions.
func (*BillingService) CurrentSubscription ¶
func (s *BillingService) CurrentSubscription(ctx context.Context, product string) (*APIResponse[SubscriptionEnvelope], error)
func (*BillingService) DownloadInvoice ¶
func (*BillingService) ListInvoices ¶
func (s *BillingService) ListInvoices(ctx context.Context) (*APIResponse[Page[Invoice]], error)
type Client ¶
type Client struct {
Messages *MessagesService
Domains *DomainsService
Mailboxes *MailboxesService
APIKeys *APIKeysService
SMTP *SMTPService
Billing *BillingService
Units *UnitsService
Plans *PlansService
Status *StatusService
Support *SupportService
Templates *TemplatesService
Webhooks *WebhooksService
// contains filtered or unexported fields
}
Client is a WazobiaMail API client. It is safe for concurrent use.
func NewClient ¶
NewClient creates a client. An empty apiKey falls back to WAZOBIA_API_KEY or WAZOBIAMAIL_API_KEY.
func NewClientFromEnv ¶
NewClientFromEnv creates a client from WAZOBIA_API_KEY or WAZOBIAMAIL_API_KEY.
type CloudflareConnect ¶
type CloudflareConnect struct {
AuthorizationURL string `json:"authorizationUrl"`
}
CloudflareConnect is {"authorizationUrl":"..."}.
type CloudflareStatus ¶
type CloudflareStatus struct {
Connected bool `json:"connected"`
ZoneID *string `json:"zoneId"`
Domain *string `json:"domain"`
}
CloudflareStatus describes the Cloudflare DNS connection.
type CloudflareSyncRequest ¶
type CloudflareSyncRequest struct {
DomainID string `json:"domainId"`
}
CloudflareSyncRequest asks Cloudflare to publish DNS records.
type CloudflareSyncResult ¶
type CloudflareSyncResult struct {
Zone string `json:"zone"`
Added int `json:"added"`
Updated int `json:"updated"`
Records int `json:"records"`
VerificationStatus string `json:"verificationStatus"`
}
CloudflareSyncResult is the sync response.
type CreateAPIKeyRequest ¶
type CreateAPIKeyRequest struct {
Name string `json:"name"`
Scope string `json:"scope,omitempty"`
DomainID string `json:"domainId,omitempty"`
ExpiresAt string `json:"expiresAt,omitempty"`
}
CreateAPIKeyRequest creates a sending key.
type CreateDomainRequest ¶
type CreateDomainRequest struct {
Domain string `json:"domain"`
IsDefault *bool `json:"isDefault,omitempty"`
UseRootDomain *bool `json:"useRootDomain,omitempty"`
HostInboxesOnMainDomain *bool `json:"hostInboxesOnMainDomain,omitempty"`
SendingSubdomain string `json:"sendingSubdomain,omitempty"`
MailMode string `json:"mailMode,omitempty"`
}
CreateDomainRequest describes a new sending domain.
type CreateMailboxRequest ¶
type CreateMailboxRequest struct {
DomainID string `json:"domainId"`
LocalPart string `json:"localPart"`
DisplayName string `json:"displayName,omitempty"`
Password string `json:"password,omitempty"`
QuotaMB int `json:"quotaMb,omitempty"`
Role string `json:"role,omitempty"`
Status string `json:"status,omitempty"`
}
CreateMailboxRequest provisions a mailbox.
type CreateSMTPRelayRequest ¶
type CreateSMTPRelayRequest struct {
Name string `json:"name"`
SMTPHost string `json:"smtp_host"`
SMTPPort int `json:"smtp_port"`
SMTPUsername string `json:"smtp_username"`
SMTPPassword string `json:"smtp_password"`
SMTPSecurity string `json:"smtp_security"`
IsDefault *bool `json:"is_default,omitempty"`
Status string `json:"status,omitempty"`
}
CreateSMTPRelayRequest creates a relay. The request DTO uses snake_case.
type CreateSupportTicketRequest ¶
type CreateSupportTicketRequest struct {
Name string `json:"name"`
Email string `json:"email"`
Subject string `json:"subject"`
Domain string `json:"domain,omitempty"`
Category string `json:"category"`
Priority string `json:"priority"`
Message string `json:"message"`
ContentType string `json:"contentType,omitempty"`
Attachments []SupportUpload `json:"attachments,omitempty"`
}
CreateSupportTicketRequest opens a ticket.
type CreateTemplateRequest ¶
type CreateTemplateRequest struct {
Name string `json:"name"`
Channel string `json:"channel,omitempty"`
Category string `json:"category,omitempty"`
Subject string `json:"subject,omitempty"`
Body string `json:"body"`
TextBody string `json:"textBody,omitempty"`
Language string `json:"language,omitempty"`
Components any `json:"components,omitempty"`
Variables any `json:"variables,omitempty"`
Design any `json:"design,omitempty"`
AutoSubmitMeta bool `json:"autoSubmitMeta,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
}
CreateTemplateRequest creates a template.
type CreatedAPIKey ¶
type CreatedAPIKey struct {
ID string `json:"id"`
Name string `json:"name"`
Scope string `json:"scope"`
DomainID *string `json:"domainId"`
KeyPrefix string `json:"keyPrefix"`
APIKey string `json:"apiKey"`
ExpiresAt *string `json:"expiresAt"`
}
CreatedAPIKey includes the one-time secret.
type CreatedCredential ¶
type CreatedCredential struct {
Credential MailboxCredential `json:"credential"`
Password string `json:"password"`
}
CreatedCredential is the inner credential + one-time password.
type CreatedSupportTicket ¶
CreatedSupportTicket is the ticket creation receipt.
type CredentialEnvelope ¶
type CredentialEnvelope struct {
Credential CreatedCredential `json:"credential"`
}
CredentialEnvelope is {"credential":{"credential":...,"password":"..."}}.
type DNSRecord ¶
type DNSRecord struct {
ID string `json:"id"`
RecordType string `json:"recordType"`
Host string `json:"host"`
Value string `json:"value"`
TTL int `json:"ttl"`
Status string `json:"status"`
LastCheckedAt *string `json:"lastCheckedAt"`
}
DNSRecord is one required DNS record.
type Domain ¶
type Domain struct {
ID string `json:"id"`
AccountID int64 `json:"accountId"`
Domain string `json:"domain"`
RequestedDomain *string `json:"requestedDomain"`
VerificationStatus string `json:"verificationStatus"`
IsDefault bool `json:"isDefault"`
DomainRole string `json:"domainRole"`
ParentDomainID *string `json:"parentDomainId"`
CreateDefaultInboxes bool `json:"createDefaultInboxes"`
MailMode string `json:"mailMode"`
CreatedAt string `json:"createdAt"`
}
Domain is a sending domain.
type DomainDNS ¶
type DomainDNS struct {
Provisioning bool `json:"provisioning"`
DomainID string `json:"domainId"`
Domain string `json:"domain"`
VerificationStatus string `json:"verificationStatus"`
Records []DNSRecord `json:"records"`
CopyBlock string `json:"copyBlock"`
}
DomainDNS is the DNS payload returned by /dns-records.
type DomainDNSEnvelope ¶
type DomainDNSEnvelope struct {
Domain DomainDNS `json:"domain"`
}
DomainDNSEnvelope is {"domain":{...}} for DNS records.
type DomainEnvelope ¶
type DomainEnvelope struct {
Domain Domain `json:"domain"`
}
DomainEnvelope is {"domain":{...}}.
type DomainVerification ¶
type DomainVerification struct {
DomainID string `json:"domainId"`
Domain string `json:"domain"`
VerificationStatus string `json:"verificationStatus"`
VerifiedCount int `json:"verifiedCount"`
PendingCount int `json:"pendingCount"`
Checks []VerificationCheck `json:"checks"`
}
DomainVerification is the /verify result.
type DomainsService ¶
type DomainsService struct {
// contains filtered or unexported fields
}
DomainsService manages sending domains.
func (*DomainsService) CloudflareConnect ¶
func (s *DomainsService) CloudflareConnect(ctx context.Context, domainID string) (*APIResponse[CloudflareConnect], error)
CloudflareConnect starts the Cloudflare OAuth connection.
func (*DomainsService) CloudflareDisconnect ¶
func (s *DomainsService) CloudflareDisconnect(ctx context.Context, domainID string) (*APIResponse[map[string]any], error)
CloudflareDisconnect removes the Cloudflare DNS connection.
func (*DomainsService) CloudflareStatus ¶
func (s *DomainsService) CloudflareStatus(ctx context.Context, domainID string) (*APIResponse[CloudflareStatus], error)
Cloudflare reads the Cloudflare DNS connection status.
func (*DomainsService) CloudflareSync ¶
func (s *DomainsService) CloudflareSync(ctx context.Context, domainID string) (*APIResponse[CloudflareSyncResult], error)
CloudflareSync publishes DNS records to the connected Cloudflare zone.
func (*DomainsService) Create ¶
func (s *DomainsService) Create(ctx context.Context, req CreateDomainRequest) (*APIResponse[DomainEnvelope], error)
func (*DomainsService) DNSRecords ¶
func (s *DomainsService) DNSRecords(ctx context.Context, domainID string) (*APIResponse[DomainDNSEnvelope], error)
func (*DomainsService) Delete ¶
func (s *DomainsService) Delete(ctx context.Context, domainID string) (*APIResponse[map[string]string], error)
func (*DomainsService) Get ¶
func (s *DomainsService) Get(ctx context.Context, domainID string) (*APIResponse[DomainEnvelope], error)
func (*DomainsService) List ¶
func (s *DomainsService) List(ctx context.Context) (*APIResponse[Items[Domain]], error)
func (*DomainsService) RefreshDNS ¶
func (s *DomainsService) RefreshDNS(ctx context.Context, domainID string) (*APIResponse[VerificationEnvelope], error)
func (*DomainsService) Update ¶
func (s *DomainsService) Update(ctx context.Context, domainID string, req UpdateDomainRequest) (*APIResponse[DomainEnvelope], error)
func (*DomainsService) Verify ¶
func (s *DomainsService) Verify(ctx context.Context, domainID string, force bool) (*APIResponse[VerificationEnvelope], error)
type EffectiveLimits ¶
type EffectiveLimits struct {
AccountID int64 `json:"accountId"`
PlanID string `json:"planId"`
SendRateLimitPerMinute int `json:"sendRateLimitPerMinute"`
MailboxOpsPerMinute int `json:"mailboxOpsPerMinute"`
MailboxLimit int `json:"mailboxLimit"`
BaseMailboxLimit int `json:"baseMailboxLimit"`
AdditionalMailboxLimit int `json:"additionalMailboxLimit"`
CustomDomainSendingEnabled bool `json:"customDomainSendingEnabled"`
DomainLimit int `json:"domainLimit"`
ReceivingEnabled bool `json:"receivingEnabled"`
MailboxStorageGB int `json:"mailboxStorageGb"`
}
EffectiveLimits is the resolved account limits.
type EmailAddress ¶
EmailAddress is a name/address pair.
type EmailLog ¶
type EmailLog struct {
ID string `json:"id"`
TrackingID string `json:"trackingId"`
Recipient *string `json:"recipient"`
Subject *string `json:"subject"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
}
EmailLog is a customer-visible delivery log row.
type EmailLogParams ¶
EmailLogParams filters account email logs.
type EmailLogs ¶
type EmailLogs struct {
Available bool `json:"available"`
Messages []EmailLog `json:"messages"`
HasMore bool `json:"hasMore"`
EventDetailsAvailable bool `json:"eventDetailsAvailable"`
}
EmailLogs is the email logs response.
type FileUpload ¶
FileUpload is a binary attachment for the multipart send endpoint.
type InboxAttachment ¶
type InboxAttachment struct {
BlobID string `json:"blobId"`
Name string `json:"name"`
Type string `json:"type"`
SizeBytes int64 `json:"sizeBytes"`
}
InboxAttachment is an attachment on an inbox message.
type InboxMessage ¶
type InboxMessage struct {
ID string `json:"id"`
ThreadID *string `json:"threadId"`
Subject *string `json:"subject"`
Preview *string `json:"preview"`
From []EmailAddress `json:"from"`
To []EmailAddress `json:"to"`
ReceivedAt *string `json:"receivedAt"`
IsUnread bool `json:"isUnread"`
HasAttachments bool `json:"hasAttachments"`
SizeBytes int64 `json:"sizeBytes"`
}
InboxMessage is a headless inbox message summary.
type InboxMessageDetail ¶
type InboxMessageDetail struct {
InboxMessage
CC []EmailAddress `json:"cc"`
BCC []EmailAddress `json:"bcc"`
ReplyTo []EmailAddress `json:"replyTo"`
HTMLBody *string `json:"htmlBody"`
TextBody *string `json:"textBody"`
Attachments []InboxAttachment `json:"attachments"`
}
InboxMessageDetail includes bodies and attachments.
type Invoice ¶
type Invoice struct {
ID string `json:"id"`
AccountID int64 `json:"accountId"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Status string `json:"status"`
Purpose string `json:"purpose"`
Metadata map[string]any `json:"metadata"`
DueDate *string `json:"dueDate"`
PaidAt *string `json:"paidAt"`
CreatedAt string `json:"createdAt"`
}
Invoice is a billing invoice.
type Items ¶
type Items[T any] struct { Items []T `json:"items"` }
Items is a collection envelope used by endpoints that return {"items":[...]}.
type LimitsEnvelope ¶
type LimitsEnvelope struct {
Limits EffectiveLimits `json:"limits"`
}
LimitsEnvelope is {"limits":{...}}.
type ListMessagesParams ¶
ListMessagesParams filters inbox messages.
type Mailbox ¶
type Mailbox struct {
ID string `json:"id"`
DomainID string `json:"domainId"`
Address string `json:"address"`
LocalPart string `json:"localPart"`
DisplayName *string `json:"displayName"`
Status string `json:"status"`
IsPlatformSubdomain bool `json:"isPlatformSubdomain"`
AutoProvisioned bool `json:"autoProvisioned"`
Role string `json:"role"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
Mailbox is a hosted mailbox.
type MailboxConnection ¶
type MailboxConnection struct {
MailboxID string `json:"mailboxId"`
DomainID string `json:"domainId"`
Username string `json:"username"`
Status string `json:"status"`
SMTP map[string]any `json:"smtp"`
IMAP map[string]any `json:"imap"`
POP3 map[string]any `json:"pop3"`
Authentication string `json:"authentication"`
PasswordHint string `json:"passwordHint"`
}
MailboxConnection contains client settings.
type MailboxCredential ¶
type MailboxCredential struct {
ID string `json:"id"`
MailboxID string `json:"mailboxId"`
Username string `json:"username"`
ExpiresAt *string `json:"expiresAt"`
RevokedAt *string `json:"revokedAt"`
CreatedAt string `json:"createdAt"`
}
MailboxCredential is an SMTP/IMAP credential.
type MailboxEnvelope ¶
type MailboxEnvelope struct {
Mailbox Mailbox `json:"mailbox"`
}
MailboxEnvelope is {"mailbox":{...}}.
type MailboxMessages ¶
type MailboxMessages struct {
Items []InboxMessage `json:"items"`
Total int `json:"total"`
Page int `json:"page"`
Limit int `json:"limit"`
}
MailboxMessages is the inbox list response.
type MailboxesService ¶
type MailboxesService struct {
// contains filtered or unexported fields
}
MailboxesService manages hosted mailboxes and enterprise inboxes.
func (*MailboxesService) Connection ¶
func (s *MailboxesService) Connection(ctx context.Context, mailboxID string) (*APIResponse[MailboxConnection], error)
func (*MailboxesService) Create ¶
func (s *MailboxesService) Create(ctx context.Context, req CreateMailboxRequest) (*APIResponse[Mailbox], error)
func (*MailboxesService) CreateCredential ¶
func (s *MailboxesService) CreateCredential(ctx context.Context, mailboxID string) (*APIResponse[CredentialEnvelope], error)
func (*MailboxesService) Delete ¶
func (s *MailboxesService) Delete(ctx context.Context, mailboxID string) (*APIResponse[map[string]string], error)
func (*MailboxesService) DeleteMessage ¶
func (s *MailboxesService) DeleteMessage(ctx context.Context, mailboxID, messageID string) (*APIResponse[map[string]any], error)
func (*MailboxesService) Get ¶
func (s *MailboxesService) Get(ctx context.Context, mailboxID string) (*APIResponse[MailboxEnvelope], error)
func (*MailboxesService) GetMessage ¶
func (s *MailboxesService) GetMessage(ctx context.Context, mailboxID, messageID string) (*APIResponse[InboxMessageDetail], error)
func (*MailboxesService) List ¶
func (s *MailboxesService) List(ctx context.Context) (*APIResponse[[]Mailbox], error)
func (*MailboxesService) ListMessages ¶
func (s *MailboxesService) ListMessages(ctx context.Context, mailboxID string, params ListMessagesParams) (*APIResponse[MailboxMessages], error)
func (*MailboxesService) RevokeCredential ¶
func (s *MailboxesService) RevokeCredential(ctx context.Context, mailboxID, credentialID string) (*APIResponse[map[string]string], error)
func (*MailboxesService) RotateCredential ¶
func (s *MailboxesService) RotateCredential(ctx context.Context, mailboxID string) (*APIResponse[CredentialEnvelope], error)
func (*MailboxesService) Storage ¶
func (s *MailboxesService) Storage(ctx context.Context) (*APIResponse[map[string]any], error)
func (*MailboxesService) Update ¶
func (s *MailboxesService) Update(ctx context.Context, mailboxID string, req UpdateMailboxRequest) (*APIResponse[MailboxEnvelope], error)
type MessagesService ¶
type MessagesService struct {
// contains filtered or unexported fields
}
MessagesService sends transactional email and reads tracking/log data.
func (*MessagesService) GetTracked ¶
func (s *MessagesService) GetTracked(ctx context.Context, trackingID string) (*APIResponse[TrackingDetail], error)
GetTracked reads a tracked message and its event timeline.
func (*MessagesService) ListEmailLogs ¶
func (s *MessagesService) ListEmailLogs(ctx context.Context, params EmailLogParams) (*APIResponse[EmailLogs], error)
ListEmailLogs reads customer-visible delivery logs.
func (*MessagesService) ListTracked ¶
func (s *MessagesService) ListTracked(ctx context.Context, params TrackingListParams) (*APIResponse[TrackingList], error)
ListTracked lists tracked outgoing messages.
func (*MessagesService) Send ¶
func (s *MessagesService) Send(ctx context.Context, req SendMessageRequest) (*APIResponse[SendEnvelope], error)
Send sends an email and returns its tracking receipt.
func (*MessagesService) SendWithAttachments ¶
func (s *MessagesService) SendWithAttachments(ctx context.Context, req SendMessageRequest, files []FileUpload) (*APIResponse[SendEnvelope], error)
SendWithAttachments sends a message with binary file parts.
func (*MessagesService) SpamCheck ¶
func (s *MessagesService) SpamCheck(ctx context.Context, req SpamCheckRequest) (*APIResponse[SpamCheckResult], error)
SpamCheck runs a pre-flight spam and deliverability analysis.
func (*MessagesService) UploadAttachment ¶
func (s *MessagesService) UploadAttachment(ctx context.Context, file FileUpload) (*APIResponse[UploadedFileEnvelope], error)
UploadAttachment uploads a file and returns its public URL.
type Option ¶
Option configures a Client.
func WithAccessToken ¶
WithAccessToken authenticates with an account Bearer token instead of an API key.
func WithAllowUnauthenticated ¶
WithAllowUnauthenticated permits construction without a key for public endpoints such as plans and status.
func WithHTTPClient ¶
WithHTTPClient uses a custom *http.Client (useful for proxies, tracing and tests).
func WithHeader ¶
WithHeader adds a header sent with every request.
func WithTimeout ¶
WithTimeout sets the request timeout.
func WithUserAgent ¶
WithUserAgent overrides the User-Agent header.
type Page ¶
type Page[T any] struct { Items []T `json:"items"` Pagination Pagination `json:"pagination"` }
Page is a paginated collection envelope.
type Pagination ¶
type Pagination struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
TotalItems int `json:"totalItems"`
TotalPages int `json:"totalPages"`
HasNext bool `json:"hasNext"`
HasPrev bool `json:"hasPrev"`
}
Pagination is the API pagination metadata.
type Plan ¶
type Plan struct {
ID string `json:"id"`
Name string `json:"name"`
USDPrice float64 `json:"usdPrice"`
NairaPrice float64 `json:"nairaPrice"`
YearlyUSDPrice *float64 `json:"yearlyUsdPrice"`
YearlyNairaPrice *float64 `json:"yearlyNairaPrice"`
HourlyQuota int `json:"hourlyQuota"`
DailyQuota int `json:"dailyQuota"`
MonthlyQuota int `json:"monthlyQuota"`
SendRateLimitPerMinute int `json:"sendRateLimitPerMinute"`
DataRetentionDays int `json:"dataRetentionDays"`
Features any `json:"features"`
Limits any `json:"limits"`
Status string `json:"status"`
}
Plan is a subscription plan.
type PlansService ¶
type PlansService struct {
// contains filtered or unexported fields
}
PlansService reads plans and limits.
func (*PlansService) EffectiveLimits ¶
func (s *PlansService) EffectiveLimits(ctx context.Context) (*APIResponse[LimitsEnvelope], error)
func (*PlansService) List ¶
func (s *PlansService) List(ctx context.Context) (*APIResponse[Page[Plan]], error)
type PreviewTemplateRequest ¶
type PreviewTemplateRequest struct {
SampleVariables map[string]any `json:"sampleVariables,omitempty"`
}
PreviewTemplateRequest renders with sample variables.
type PurchaseUnitsRequest ¶
type PurchaseUnitsRequest struct {
PackID string `json:"packId"`
Currency string `json:"currency"`
}
PurchaseUnitsRequest buys a credit pack.
type ReplySupportTicketRequest ¶
type ReplySupportTicketRequest struct {
Message string `json:"message"`
ContentType string `json:"contentType,omitempty"`
Attachments []SupportUpload `json:"attachments,omitempty"`
}
ReplySupportTicketRequest replies to a ticket.
type SMTPAccess ¶
type SMTPAccess struct {
Paid bool `json:"paid"`
Eligible bool `json:"eligible"`
Enabled bool `json:"enabled"`
Persona *string `json:"persona"`
Configured bool `json:"configured"`
Connection *SMTPConnection `json:"connection"`
}
SMTPAccess is the account SMTP access snapshot.
type SMTPConnection ¶
type SMTPConnection struct {
Host string `json:"host"`
Port int `json:"port"`
Security string `json:"security"`
Usernames []string `json:"usernames"`
}
SMTPConnection is the SMTP access connection block.
type SMTPRelay ¶
type SMTPRelay struct {
ID string `json:"id"`
AccountID int64 `json:"accountId"`
Name string `json:"name"`
SMTPHost string `json:"smtpHost"`
SMTPPort int `json:"smtpPort"`
SMTPUsername string `json:"smtpUsername"`
SMTPSecurity string `json:"smtpSecurity"`
Status string `json:"status"`
IsDefault bool `json:"isDefault"`
HasPassword bool `json:"hasPassword"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
SMTPRelay is a customer SMTP relay configuration.
type SMTPRelayEnvelope ¶
type SMTPRelayEnvelope struct {
SMTPRelay SMTPRelay `json:"smtpRelay"`
}
SMTPRelayEnvelope is {"smtpRelay":{...}}.
type SMTPRelaysEnvelope ¶
type SMTPRelaysEnvelope struct {
SMTPRelays []SMTPRelay `json:"smtpRelays"`
}
SMTPRelaysEnvelope is {"smtpRelays":[...]}.
type SMTPService ¶
type SMTPService struct {
// contains filtered or unexported fields
}
SMTPService groups relay and access management.
func (*SMTPService) Access ¶
func (s *SMTPService) Access(ctx context.Context) (*APIResponse[SMTPAccess], error)
func (*SMTPService) ActivateRelay ¶
func (s *SMTPService) ActivateRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)
func (*SMTPService) CreateRelay ¶
func (s *SMTPService) CreateRelay(ctx context.Context, req CreateSMTPRelayRequest) (*APIResponse[SMTPRelayEnvelope], error)
func (*SMTPService) DeactivateRelay ¶
func (s *SMTPService) DeactivateRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)
func (*SMTPService) DeleteRelay ¶
func (s *SMTPService) DeleteRelay(ctx context.Context, relayID string) (*APIResponse[map[string]string], error)
func (*SMTPService) GetRelay ¶
func (s *SMTPService) GetRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)
func (*SMTPService) ListRelays ¶
func (s *SMTPService) ListRelays(ctx context.Context) (*APIResponse[SMTPRelaysEnvelope], error)
func (*SMTPService) UpdateAccess ¶
func (s *SMTPService) UpdateAccess(ctx context.Context, enabled bool) (*APIResponse[map[string]bool], error)
func (*SMTPService) UpdateRelay ¶
func (s *SMTPService) UpdateRelay(ctx context.Context, relayID string, req UpdateSMTPRelayRequest) (*APIResponse[SMTPRelayEnvelope], error)
type SendEnvelope ¶
type SendEnvelope struct {
Result SendResult `json:"result"`
}
SendEnvelope is the data envelope for a send response: {"result": {...}}.
type SendMessageRequest ¶
type SendMessageRequest struct {
To []string `json:"-"`
Cc []string `json:"-"`
Bcc []string `json:"-"`
From string `json:"-"`
Subject string `json:"-"`
HTML string `json:"-"`
Text string `json:"-"`
ReplyTo string `json:"-"`
EnvelopeSender string `json:"-"`
Attachments []URLAttachment `json:"-"`
IdempotencyKey string `json:"-"`
}
SendMessageRequest is the ergonomic send payload. The SDK converts it to the canonical nested content contract.
type SendResult ¶
type SendResult struct {
Status string `json:"status"`
TrackingID string `json:"trackingId"`
Recipients int `json:"recipients"`
}
SendResult is the receipt returned by the send endpoint.
type SpamCheckRequest ¶
type SpamCheckRequest struct {
Subject string `json:"subject"`
HTML string `json:"html,omitempty"`
Text string `json:"text,omitempty"`
From string `json:"from,omitempty"`
ReplyTo string `json:"replyTo,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
SpamCheckRequest is a pre-flight spam/deliverability analysis request.
type SpamCheckResult ¶
type SpamCheckResult struct {
Score float64 `json:"score"`
Threshold float64 `json:"threshold"`
IsSpam bool `json:"isSpam"`
Rating string `json:"rating"`
BadgeColor string `json:"badgeColor"`
DeliverabilityScore int `json:"deliverabilityScore"`
Summary string `json:"summary"`
Rules []SpamRule `json:"rules"`
}
SpamCheckResult is a spam/deliverability report.
type SpamRule ¶
type SpamRule struct {
Code string `json:"code"`
Points float64 `json:"points"`
Title string `json:"title"`
Description string `json:"description"`
Recommendation string `json:"recommendation"`
}
SpamRule is a single finding from the spam scanner.
type StatusService ¶
type StatusService struct {
// contains filtered or unexported fields
}
StatusService reads account health.
func (*StatusService) Get ¶
func (s *StatusService) Get(ctx context.Context) (*APIResponse[AccountStatus], error)
type Subscription ¶
type Subscription struct {
ID string `json:"id"`
AccountID int64 `json:"accountId"`
PlanID string `json:"planId"`
Status string `json:"status"`
StartDate string `json:"startDate"`
EndDate *string `json:"endDate"`
AutoRenew bool `json:"autoRenew"`
BillingInterval string `json:"billingInterval"`
Plan map[string]any `json:"plan"`
}
Subscription is the current subscription.
type SubscriptionEnvelope ¶
type SubscriptionEnvelope struct {
Subscription *Subscription `json:"subscription"`
}
SubscriptionEnvelope is {"subscription":{...}|null}.
type SuccessResponse ¶
SuccessResponse is returned by endpoints that only acknowledge an action.
type SupportAttachment ¶
type SupportAttachment struct {
ID string `json:"id"`
Filename string `json:"filename"`
ContentType string `json:"contentType"`
SizeBytes int64 `json:"sizeBytes"`
URL string `json:"url"`
}
SupportAttachment is a ticket attachment reference.
type SupportListParams ¶
SupportListParams filters tickets.
type SupportMessage ¶
type SupportMessage struct {
ID string `json:"id"`
TicketID string `json:"ticketId"`
SenderName string `json:"senderName"`
SenderEmail string `json:"senderEmail"`
Message string `json:"message"`
IsFromStaff bool `json:"isFromStaff"`
ContentType string `json:"contentType"`
Attachments []SupportAttachment `json:"attachments"`
CreatedAt string `json:"createdAt"`
}
SupportMessage is one message in a ticket thread.
type SupportService ¶
type SupportService struct {
// contains filtered or unexported fields
}
SupportService manages support tickets.
func (*SupportService) Create ¶
func (s *SupportService) Create(ctx context.Context, req CreateSupportTicketRequest) (*APIResponse[CreatedSupportTicket], error)
func (*SupportService) DownloadAttachment ¶
func (*SupportService) Get ¶
func (s *SupportService) Get(ctx context.Context, ticketID string) (*APIResponse[SupportTicket], error)
func (*SupportService) List ¶
func (s *SupportService) List(ctx context.Context, params SupportListParams) (*APIResponse[SupportTicketList], error)
func (*SupportService) MarkRead ¶
func (s *SupportService) MarkRead(ctx context.Context, ticketID string) (*APIResponse[map[string]any], error)
func (*SupportService) Reply ¶
func (s *SupportService) Reply(ctx context.Context, ticketID string, req ReplySupportTicketRequest) (*APIResponse[SupportMessage], error)
type SupportTicket ¶
type SupportTicket struct {
ID string `json:"id"`
AccountID *int64 `json:"accountId"`
Name string `json:"name"`
Email string `json:"email"`
Subject string `json:"subject"`
Domain *string `json:"domain"`
Category string `json:"category"`
Priority string `json:"priority"`
Status string `json:"status"`
Messages []SupportMessage `json:"messages"`
CustomerReadAt *string `json:"customerReadAt"`
StaffReadAt *string `json:"staffReadAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
SupportTicket is a support ticket with its thread.
type SupportTicketList ¶
type SupportTicketList struct {
Items []SupportTicket `json:"items"`
Total int64 `json:"total"`
Page int `json:"page"`
Pages int `json:"pages"`
}
SupportTicketList is the paginated ticket list.
type SupportUpload ¶
SupportUpload is an inline base64 attachment (max 5 MiB per file).
type Template ¶
type Template struct {
ID string `json:"id"`
AccountID *int64 `json:"accountId"`
Name string `json:"name"`
Slug string `json:"slug"`
Channel string `json:"channel"`
Category string `json:"category"`
Status string `json:"status"`
RejectionReason *string `json:"rejectionReason"`
Subject string `json:"subject"`
Body string `json:"body"`
TextBody string `json:"textBody"`
MetaTemplateID *string `json:"metaTemplateId"`
MetaTemplateName *string `json:"metaTemplateName"`
Language string `json:"language"`
Components any `json:"components"`
Variables any `json:"variables"`
Design any `json:"design"`
PreviewImageURL *string `json:"previewImageUrl"`
IsSystem bool `json:"isSystem"`
Revision int `json:"revision"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
Template is an email/WhatsApp template.
type TemplateList ¶
type TemplateList struct {
Items []Template `json:"items"`
Total int64 `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
TemplateList is the template page.
type TemplateListParams ¶
type TemplateListParams struct {
Channel string
Category string
Status string
Search string
Limit int
Offset int
}
TemplateListParams filters templates.
type TemplatePreview ¶
type TemplatePreview struct {
Channel string `json:"channel"`
Subject string `json:"subject"`
RenderedBody string `json:"renderedBody"`
RenderedText string `json:"renderedText"`
Status string `json:"status"`
CanSend bool `json:"canSend"`
}
TemplatePreview is a rendered preview.
type TemplatesService ¶
type TemplatesService struct {
// contains filtered or unexported fields
}
TemplatesService manages templates (Enterprise/admin access).
func (*TemplatesService) Create ¶
func (s *TemplatesService) Create(ctx context.Context, req CreateTemplateRequest) (*APIResponse[Template], error)
func (*TemplatesService) Delete ¶
func (s *TemplatesService) Delete(ctx context.Context, templateID string) (*APIResponse[map[string]string], error)
func (*TemplatesService) Get ¶
func (s *TemplatesService) Get(ctx context.Context, templateID string) (*APIResponse[Template], error)
func (*TemplatesService) List ¶
func (s *TemplatesService) List(ctx context.Context, params TemplateListParams) (*APIResponse[TemplateList], error)
func (*TemplatesService) Preview ¶
func (s *TemplatesService) Preview(ctx context.Context, templateID string, req PreviewTemplateRequest) (*APIResponse[TemplatePreview], error)
func (*TemplatesService) SyncMeta ¶
func (s *TemplatesService) SyncMeta(ctx context.Context, templateID string) (*APIResponse[Template], error)
func (*TemplatesService) Update ¶
func (s *TemplatesService) Update(ctx context.Context, templateID string, req UpdateTemplateRequest) (*APIResponse[Template], error)
type TrackingDetail ¶
type TrackingDetail struct {
Message TrackingMessage `json:"message"`
Events []TrackingEvent `json:"events"`
}
TrackingDetail is a tracked message plus its event timeline.
type TrackingEvent ¶
type TrackingEvent struct {
ID string `json:"id"`
EventType string `json:"eventType"`
RecipientEmail *string `json:"recipientEmail"`
ClickURL *string `json:"clickUrl"`
OccurredAt string `json:"occurredAt"`
Engagement map[string]any `json:"engagement"`
}
TrackingEvent is a delivery/open/click event.
type TrackingList ¶
type TrackingList struct {
Messages []TrackingMessage `json:"messages"`
Summary TrackingSummary `json:"summary"`
}
TrackingList is the tracked messages response: {"messages":[],"summary":{}}.
type TrackingListParams ¶
TrackingListParams filters tracked messages.
type TrackingMessage ¶
type TrackingMessage struct {
TrackingID string `json:"trackingId"`
SenderDomain string `json:"senderDomain"`
Subject *string `json:"subject"`
RecipientsCount int `json:"recipientsCount"`
AcceptedCount int `json:"acceptedCount"`
DeliveredCount int `json:"deliveredCount"`
BouncedCount int `json:"bouncedCount"`
OpenCount int `json:"openCount"`
ClickCount int `json:"clickCount"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
LastOpenedAt *string `json:"lastOpenedAt"`
LastClickedAt *string `json:"lastClickedAt"`
LastDeliveryEventAt *string `json:"lastDeliveryEventAt"`
}
TrackingMessage is a tracked outbound message.
type TrackingSummary ¶
type TrackingSummary struct {
Messages int64 `json:"messages"`
Recipients int64 `json:"recipients"`
Accepted int64 `json:"accepted"`
Delivered int64 `json:"delivered"`
Bounced int64 `json:"bounced"`
Opens int64 `json:"opens"`
Clicks int64 `json:"clicks"`
}
TrackingSummary aggregates tracked message activity.
type URLAttachment ¶
URLAttachment is a publicly reachable attachment.
type UnitLedgerEntry ¶
type UnitLedgerEntry struct {
ID string `json:"id"`
Delta int64 `json:"delta"`
BalanceAfter int64 `json:"balanceAfter"`
Reason string `json:"reason"`
Reference *string `json:"reference"`
CreatedAt string `json:"createdAt"`
}
UnitLedgerEntry is a credit ledger row.
type UnitPack ¶
type UnitPack struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Units int64 `json:"units"`
PriceNGNMinor int64 `json:"priceNgnMinor"`
PriceUSDMinor int64 `json:"priceUsdMinor"`
IsActive bool `json:"isActive"`
SortOrder int `json:"sortOrder"`
}
UnitPack is a purchasable credit pack.
type UnitsService ¶
type UnitsService struct {
// contains filtered or unexported fields
}
UnitsService reads and purchases email credits.
func (*UnitsService) Ledger ¶
func (s *UnitsService) Ledger(ctx context.Context, page, perPage int) (*APIResponse[Page[UnitLedgerEntry]], error)
func (*UnitsService) Packs ¶
func (s *UnitsService) Packs(ctx context.Context) (*APIResponse[Items[UnitPack]], error)
func (*UnitsService) Purchase ¶
func (s *UnitsService) Purchase(ctx context.Context, req PurchaseUnitsRequest) (*APIResponse[map[string]any], error)
func (*UnitsService) Summary ¶
func (s *UnitsService) Summary(ctx context.Context) (*APIResponse[UnitsSummary], error)
type UnitsSummary ¶
type UnitsSummary struct {
IncludedAllowance int64 `json:"includedAllowance"`
IncludedUsed int64 `json:"includedUsed"`
IncludedRemaining int64 `json:"includedRemaining"`
PurchasedBalance int64 `json:"purchasedBalance"`
Unlimited bool `json:"unlimited"`
CanBuyCredits bool `json:"canBuyCredits"`
}
UnitsSummary is the email credit summary.
type UpdateDomainRequest ¶
type UpdateDomainRequest struct {
Domain string `json:"domain,omitempty"`
IsDefault *bool `json:"isDefault,omitempty"`
UseRootDomain *bool `json:"useRootDomain,omitempty"`
MailMode string `json:"mailMode,omitempty"`
}
UpdateDomainRequest updates a sending domain.
type UpdateMailboxRequest ¶
type UpdateMailboxRequest struct {
DisplayName string `json:"displayName,omitempty"`
Password string `json:"password,omitempty"`
}
UpdateMailboxRequest updates a mailbox.
type UpdateSMTPRelayRequest ¶
type UpdateSMTPRelayRequest struct {
Name string `json:"name,omitempty"`
SMTPHost string `json:"smtp_host,omitempty"`
SMTPPort int `json:"smtp_port,omitempty"`
SMTPUsername string `json:"smtp_username,omitempty"`
SMTPPassword string `json:"smtp_password,omitempty"`
SMTPSecurity string `json:"smtp_security,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
Status string `json:"status,omitempty"`
}
UpdateSMTPRelayRequest updates a relay.
type UpdateTemplateRequest ¶
type UpdateTemplateRequest struct {
Name string `json:"name,omitempty"`
Subject string `json:"subject,omitempty"`
Body string `json:"body,omitempty"`
TextBody string `json:"textBody,omitempty"`
Category string `json:"category,omitempty"`
Components any `json:"components,omitempty"`
Variables any `json:"variables,omitempty"`
Design any `json:"design,omitempty"`
}
UpdateTemplateRequest updates a template.
type UploadedFile ¶
type UploadedFile struct {
FileName string `json:"fileName"`
ContentType *string `json:"contentType"`
SizeBytes int64 `json:"sizeBytes"`
PublicURL *string `json:"publicUrl"`
}
UploadedFile is the attachment upload response.
type UploadedFileEnvelope ¶
type UploadedFileEnvelope struct {
File UploadedFile `json:"file"`
}
UploadedFileEnvelope is {"file":{...}}.
type VerificationCheck ¶
type VerificationCheck struct {
RecordType string `json:"recordType"`
Host string `json:"host"`
ExpectedValue string `json:"expectedValue"`
Matched bool `json:"matched"`
ObservedValues []string `json:"observedValues"`
}
VerificationCheck is one checked DNS record.
type VerificationEnvelope ¶
type VerificationEnvelope struct {
Verification DomainVerification `json:"verification"`
}
VerificationEnvelope is {"verification":{...}}.
type WebhooksService ¶
type WebhooksService struct{}
WebhooksService verifies incoming webhook signatures without a network call.
func (*WebhooksService) ConstructEvent ¶
func (s *WebhooksService) ConstructEvent(payload []byte, signature, secret string, out any) error
ConstructEvent verifies the signature and decodes the JSON payload into out.
func (*WebhooksService) Sign ¶
func (s *WebhooksService) Sign(payload []byte, secret string) string
Sign returns the hex HMAC SHA-256 signature for a payload. Useful in tests.
func (*WebhooksService) VerifySignature ¶
func (s *WebhooksService) VerifySignature(payload []byte, signature, secret string) bool
VerifySignature checks a hex HMAC SHA-256 signature. A "sha256=" prefix is accepted.