Documentation
¶
Overview ¶
Package connect implements "Connect a sending provider" (spec 5.7, 7.2): the provider catalog built from the adapter registry, and a six-step setup (provider, connection, domain verification, test send, streams, contacts) whose progress is kept in provider_setups so a reload resumes the same step. The connection step works for every adapter through the Provider contract and its optional interfaces (Verifier, WebhookRegistrar, DomainManager, Provisioner…); core code never imports an adapter.
It also serves Settings › Providers: a summary per provider and the workspace-wide sending defaults.
Index ¶
- func Register(h huma.API, s *Service)
- type ConnectAccess
- type ConnectAdapterInfo
- type ConnectAuthResult
- type ConnectCatalog
- type ConnectCatalogEntry
- type ConnectChip
- type ConnectCommunityEntry
- type ConnectConnection
- type ConnectContacts
- type ConnectDomainChoice
- type ConnectDomainInput
- type ConnectDone
- type ConnectDoneRow
- type ConnectError
- type ConnectField
- type ConnectFinishInput
- type ConnectImportSource
- type ConnectInput
- type ConnectMailboxInput
- type ConnectOpenSetup
- type ConnectOption
- type ConnectProbe
- type ConnectProductionAccessInput
- type ConnectProvisionRow
- type ConnectRegion
- type ConnectRegionInput
- type ConnectRegistration
- type ConnectSESInput
- type ConnectSMTPForm
- type ConnectSMTPInput
- type ConnectSandbox
- type ConnectSelfTest
- type ConnectSenderOption
- type ConnectSetup
- type ConnectSetupInput
- type ConnectSetupList
- type ConnectSetupSummary
- type ConnectStepInput
- type ConnectStreamChoiceInput
- type ConnectStreamView
- type ConnectStreams
- type ConnectStreamsInput
- type ConnectSummaries
- type ConnectSuppressions
- type ConnectTestInput
- type ConnectTestStatus
- type ConnectTimelineStep
- type ConnectWebhook
- type ConnectWebhookInput
- type ConnectWebhookSecret
- type Connection
- type ContactsStep
- type DomainStep
- type MailboxTried
- type PollArgs
- type PollWorker
- type ProbeState
- type ProductionAccess
- type ProvisionArgs
- type ProvisionState
- type ProvisionWorker
- type PullArgs
- type PullWorker
- type RegionState
- type Registration
- type ScanArgs
- type ScanWorker
- type SelfTestState
- type SendingDefaults
- type Service
- func (s *Service) Abandon(ctx context.Context, ws *store.Workspace, rawID string) error
- func (s *Service) Catalog(ctx context.Context, ws *store.Workspace) (ConnectCatalog, error)
- func (s *Service) ChooseDomain(ctx context.Context, ws *store.Workspace, rawID string, in ConnectDomainInput) (ConnectSetup, error)
- func (s *Service) Connect(ctx context.Context, ws *store.Workspace, rawID string, in ConnectInput) (ConnectSetup, error)
- func (s *Service) ConnectMailbox(ctx context.Context, ws *store.Workspace, rawID string, in ConnectMailboxInput) (ConnectSetup, error)
- func (s *Service) Contacts(ctx context.Context, ws *store.Workspace, rawID string) (ConnectContacts, error)
- func (s *Service) Create(ctx context.Context, ws *store.Workspace, in ConnectSetupInput) (ConnectSetup, error)
- func (s *Service) Finish(ctx context.Context, ws *store.Workspace, rawID string, in ConnectFinishInput) (ConnectSetup, error)
- func (s *Service) Get(ctx context.Context, ws *store.Workspace, rawID string) (ConnectSetup, error)
- func (s *Service) List(ctx context.Context, ws *store.Workspace, adapter, status string) (ConnectSetupList, error)
- func (s *Service) RequestProductionAccess(ctx context.Context, ws *store.Workspace, rawID string, ...) (ConnectSetup, error)
- func (s *Service) RetestWebhook(ctx context.Context, ws *store.Workspace, rawID string, in ConnectWebhookInput) (ConnectSetup, error)
- func (s *Service) RetryProvisioning(ctx context.Context, ws *store.Workspace, rawID string) (ConnectSetup, error)
- func (s *Service) RotateSecrets(ctx context.Context, ws *store.Workspace) (SettingsRotationResult, error)
- func (s *Service) RunProvisioning(ctx context.Context, setupID uuid.UUID) (bool, error)
- func (s *Service) SaveSettings(ctx context.Context, ws *store.Workspace, in SettingsProvidersInput) (SettingsProviders, error)
- func (s *Service) SaveStreams(ctx context.Context, ws *store.Workspace, rawID string, in ConnectStreamsInput) (ConnectSetup, error)
- func (s *Service) ScanRegions(ctx context.Context, setupID uuid.UUID) error
- func (s *Service) SendTest(ctx context.Context, ws *store.Workspace, rawID string, in ConnectTestInput) (ConnectTestStatus, error)
- func (s *Service) SetRegion(ctx context.Context, ws *store.Workspace, rawID string, in ConnectRegionInput) (ConnectSetup, error)
- func (s *Service) SetStep(ctx context.Context, ws *store.Workspace, rawID string, in ConnectStepInput) (ConnectSetup, error)
- func (s *Service) SettingsPage(ctx context.Context, ws *store.Workspace) (SettingsProviders, error)
- func (s *Service) TestStatus(ctx context.Context, ws *store.Workspace, rawID string) (ConnectTestStatus, error)
- func (s *Service) UsePolling(ctx context.Context, ws *store.Workspace, rawID string) (ConnectSetup, error)
- func (s *Service) View(ctx context.Context, ws *store.Workspace, st store.ProviderSetup) (ConnectSetup, error)
- func (s *Service) WebhookSecret(ctx context.Context, ws *store.Workspace, rawID string) (ConnectWebhookSecret, error)
- type SettingsProviderCard
- type SettingsProviderCost
- type SettingsProviders
- type SettingsProvidersInput
- type SettingsRotationResult
- type State
- type StepError
- type StreamChoice
- type StreamsStep
- type SuppressionPreview
- type TestEvent
- type TestStep
- type WebhookState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectAccess ¶
type ConnectAccess struct {
LaunchURL string `json:"launchUrl"`
Policy string `json:"policy"`
Principal string `json:"principal"`
RoleName string `json:"roleName"`
}
ConnectAccess is the CloudFormation path.
type ConnectAdapterInfo ¶
type ConnectAdapterInfo struct {
Adapter string `json:"adapter"`
Name string `json:"name"`
Short string `json:"short"`
Step1 string `json:"step1"`
Title string `json:"title"`
Heading string `json:"heading"`
Lead string `json:"lead"`
Section string `json:"section"`
Flow string `json:"flow" enum:"ses,smtp,api"`
ConnectionHint string `json:"connectionHint"`
DomainHint string `json:"domainHint"`
KeyHint string `json:"keyHint"`
KeysURL string `json:"keysUrl"`
VerifyCall string `json:"verifyCall"`
WebhookEvents string `json:"webhookEvents"`
// Webhooks is the adapter's event channel: SNS, Registered, Bounce mailbox or none.
Webhooks string `json:"webhooks"`
// CanRegister: ReputeCast registers the webhook itself.
CanRegister bool `json:"canRegister"`
// CanPoll: the provider has an events API ReputeCast can poll instead.
CanPoll bool `json:"canPoll"`
// BulkAllowed is false when the terms exclude bulk marketing.
BulkAllowed bool `json:"bulkAllowed"`
Fields []ConnectField `json:"fields"`
}
ConnectAdapterInfo is how the setup talks about its adapter.
type ConnectAuthResult ¶
type ConnectAuthResult struct {
Receiver string `json:"receiver"`
Header string `json:"header"`
DKIM string `json:"dkim" enum:"pass,fail,none"`
SPF string `json:"spf" enum:"pass,fail,none"`
DMARC string `json:"dmarc" enum:"pass,fail,none"`
SizeKB int `json:"sizeKb"`
Clipped bool `json:"clipped"`
}
ConnectAuthResult is what the receiving mailbox provider will see for the test's authentication, from the DNS records of the sender's domain.
type ConnectCatalog ¶
type ConnectCatalog struct {
Builtin []ConnectCatalogEntry `json:"builtin"`
Community []ConnectCommunityEntry `json:"community"`
// Open setups can be resumed.
Open []ConnectOpenSetup `json:"open"`
// CanConnect is false without providers:manage; Helpers then names who
// can connect providers.
CanConnect bool `json:"canConnect"`
Helpers []string `json:"helpers"`
}
ConnectCatalog is step 1 of the setup: every adapter the registry knows.
type ConnectCatalogEntry ¶
type ConnectCatalogEntry struct {
Adapter string `json:"adapter"`
Name string `json:"name"`
Short string `json:"short"`
Kind string `json:"kind" enum:"api,smtp,self_hosted,community"`
Recommended bool `json:"recommended"`
// Terms is the badge about bulk marketing ("Bulk marketing allowed").
Terms string `json:"terms"`
TermsTone string `json:"termsTone" enum:"ok,warn,neutral"`
Pricing string `json:"pricing"`
Chips []ConnectChip `json:"chips"`
// Filters of the catalog.
BulkAllowed bool `json:"bulkAllowed"`
Webhooks bool `json:"webhooks"`
DedicatedIPs bool `json:"dedicatedIps"`
// Connected counts this workspace's connections of the adapter.
Connected int `json:"connected"`
}
ConnectCatalogEntry is one provider card of the catalog.
type ConnectChip ¶
type ConnectChip struct {
Label string `json:"label"`
// Kind: yes (green), partial (amber), no (struck through).
Kind string `json:"kind" enum:"yes,partial,no"`
}
ConnectChip is one capability chip of a catalog card.
type ConnectCommunityEntry ¶
type ConnectCommunityEntry struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Maintainer string `json:"maintainer"`
// Summary is "webhooks, suppression pull".
Summary string `json:"summary"`
// Adapter is the registry key to connect it with; empty when this
// build can't run it.
Adapter string `json:"adapter"`
// Reason explains why it can't be connected here.
Reason string `json:"reason,omitempty"`
// Configure is true for the generic HTTP adapter (set up on the
// Adapters page, not connected directly).
Configure bool `json:"configure"`
}
ConnectCommunityEntry is an installed community adapter.
type ConnectConnection ¶
type ConnectConnection struct {
Status string `json:"status" enum:"none,connected,failed"`
At *time.Time `json:"at,omitempty"`
Account string `json:"account"`
AccountID string `json:"accountId"`
Summary string `json:"summary"`
Error *ConnectError `json:"error,omitempty"`
// Fields are the generic form (api flow).
Fields []ConnectField `json:"fields"`
// SES
Access string `json:"access" enum:"role,keys"`
ExternalID string `json:"externalId"`
RoleARN string `json:"roleArn"`
Region string `json:"region"`
Regions []ConnectRegion `json:"regions"`
Template *ConnectAccess `json:"template,omitempty"`
Provisioning []ConnectProvisionRow `json:"provisioning"`
ProvisionDone int `json:"provisionDone"`
ProvisionTotal int `json:"provisionTotal"`
// Working is true while provisioning runs (poll for progress).
Working bool `json:"working"`
Sandbox *ConnectSandbox `json:"sandbox,omitempty"`
// SMTP
SMTPForm *ConnectSMTPForm `json:"smtpForm,omitempty"`
SMTP *ConnectProbe `json:"smtp,omitempty"`
Mailbox *ConnectProbe `json:"mailbox,omitempty"`
// Events
Webhook *ConnectWebhook `json:"webhook,omitempty"`
// CanContinue: the provider is connected and its events can come back.
CanContinue bool `json:"canContinue"`
}
ConnectConnection is step 2.
type ConnectContacts ¶
type ConnectContacts struct {
Sources []ConnectImportSource `json:"sources"`
Suppressions ConnectSuppressions `json:"suppressions"`
// Lists are the workspace's lists; Suggested the ones "Start empty"
// creates when there are none.
Lists []string `json:"lists"`
Suggested []string `json:"suggested"`
Pull bool `json:"pull"`
}
ConnectContacts is step 6.
type ConnectDomainChoice ¶
type ConnectDomainChoice struct {
DomainID string `json:"domainId"`
Name string `json:"name"`
Skipped bool `json:"skipped"`
// Suggested is the domain to propose when none is chosen yet.
Suggested string `json:"suggested"`
}
ConnectDomainChoice is the domain of step 3.
type ConnectDomainInput ¶
type ConnectDomainInput struct {
Domain string `json:"domain,omitempty" maxLength:"253"`
// Skip moves on without a verified domain (the test send still works
// from an address the provider already verified).
Skip bool `json:"skip,omitempty"`
}
ConnectDomainInput picks the sending domain of step 3.
type ConnectDone ¶
type ConnectDone struct {
Title string `json:"title"`
// Minutes the setup took.
Minutes int `json:"minutes"`
Domain string `json:"domain"`
Rows []ConnectDoneRow `json:"rows"`
// HostRepute is connected already (the recommendation becomes "Open").
HostRepute bool `json:"hostRepute"`
}
ConnectDone is the summary.
type ConnectDoneRow ¶
type ConnectDoneRow struct {
Status string `json:"status" enum:"done,skipped,failed,pending"`
Lead string `json:"lead"`
// Text follows the bold lead; `backticks` mark code.
Text string `json:"text"`
// ImportLink ends the line with "Import now".
ImportLink bool `json:"importLink"`
}
ConnectDoneRow is one line of "What was configured".
type ConnectError ¶
type ConnectError struct {
Field string `json:"field,omitempty"`
Code string `json:"code,omitempty"`
Message string `json:"message"`
Detail string `json:"detail,omitempty"`
}
ConnectError is why the connection failed.
type ConnectField ¶
type ConnectField struct {
Key string `json:"key"`
Label string `json:"label"`
Secret bool `json:"secret"`
Required bool `json:"required"`
Options []ConnectOption `json:"options"`
Help string `json:"help,omitempty"`
// Type is "number" for a whole number (sent as text, stored as a JSON
// number), else "text".
Type string `json:"type" enum:"text,number"`
// Value is the current value of a non-secret field.
Value string `json:"value"`
// Set is true when a secret is stored (shown masked with Replace).
Set bool `json:"set"`
}
ConnectField is one input of the generic connection form, from the adapter's Descriptor.
type ConnectFinishInput ¶
type ConnectFinishInput struct {
// PullSuppressions imports the provider's own suppression list into the
// shared one.
PullSuppressions bool `json:"pullSuppressions"`
// StartEmpty creates the suggested lists when the workspace has none.
StartEmpty bool `json:"startEmpty"`
// Source is the importer source the person opened, if any.
Source string `json:"source,omitempty" enum:"brevo,mailchimp,mailerlite,listmonk,keila,csv"`
}
ConnectFinishInput ends the setup.
type ConnectImportSource ¶
type ConnectImportSource struct {
Key string `json:"key"`
Name string `json:"name"`
Detail string `json:"detail"`
Badge string `json:"badge"`
Tone string `json:"tone" enum:"ok,neutral"`
}
ConnectImportSource is one importer source of step 6.
type ConnectInput ¶
type ConnectInput struct {
// Values are the generic form's fields by key (settings and credentials).
Values map[string]string `json:"values,omitempty"`
// PublicURL is a tunnel address the provider calls instead of the
// instance's public URL (testing on a laptop or a staging box).
PublicURL string `json:"publicUrl,omitempty" maxLength:"2048"`
SES *ConnectSESInput `json:"ses,omitempty"`
SMTP *ConnectSMTPInput `json:"smtp,omitempty"`
}
ConnectInput is the connection step's form.
type ConnectMailboxInput ¶
type ConnectMailboxInput struct {
Address string `json:"address" maxLength:"254" doc:"The return-path address bounces go to"`
Protocol string `json:"protocol" enum:"imap,pop3"`
Host string `json:"host" minLength:"1" maxLength:"253"`
Port int `json:"port" minimum:"1" maximum:"65535"`
TLS string `json:"tls" enum:"tls,starttls,none"`
Username string `json:"username" maxLength:"254"`
// Password is kept as stored when empty.
Password string `json:"password,omitempty" maxLength:"1024"`
Folder string `json:"folder,omitempty" maxLength:"200"`
PollEvery string `json:"pollEvery,omitempty" enum:"1m,5m,15m"`
AfterProcessing string `json:"afterProcessing,omitempty" enum:"move,delete,leave"`
}
ConnectMailboxInput is the bounce mailbox of the SMTP path.
type ConnectOpenSetup ¶
type ConnectOpenSetup struct {
ID string `json:"id"`
Adapter string `json:"adapter"`
Name string `json:"name"`
Step string `json:"step"`
UpdatedAt time.Time `json:"updatedAt"`
}
ConnectOpenSetup is a setup that wasn't finished.
type ConnectOption ¶
ConnectOption is one choice of a select.
type ConnectProbe ¶
type ConnectProbe struct {
OK bool `json:"ok"`
At time.Time `json:"at"`
Summary string `json:"summary"`
// Transcript is the protocol exchange joined with " · ".
Transcript string `json:"transcript"`
Error string `json:"error,omitempty"`
}
ConnectProbe is a connection or mailbox test result.
type ConnectProductionAccessInput ¶
type ConnectProductionAccessInput struct {
Region string `json:"region" minLength:"6" maxLength:"32"`
Website string `json:"website" format:"uri" maxLength:"500"`
MailType string `json:"mailType" enum:"marketing,transactional"`
UseCase string `json:"useCase" minLength:"20" maxLength:"5000"`
DailyVolume int64 `json:"dailyVolume" minimum:"1" maximum:"100000000"`
Language string `json:"language" enum:"en,ja"`
}
ConnectProductionAccessInput files a production-access request.
type ConnectProvisionRow ¶
type ConnectProvisionRow struct {
Key string `json:"key"`
// Text is the label or, once done, what was done; `backticks` mark code.
Text string `json:"text"`
Status string `json:"status" enum:"waiting,running,done,failed"`
At *time.Time `json:"at,omitempty"`
Error string `json:"error,omitempty"`
Hint string `json:"hint,omitempty"`
}
ConnectProvisionRow is one provisioning row.
type ConnectRegion ¶
type ConnectRegion struct {
Region string `json:"region"`
Name string `json:"name"`
Production bool `json:"production"`
Max24h int64 `json:"max24h"`
MaxRate float64 `json:"maxRate"`
// Label is the option text ("us-east-1 · N. Virginia · production access, quota 50,000 per day").
Label string `json:"label"`
Err string `json:"err,omitempty"`
}
ConnectRegion is a region of the region select.
type ConnectRegionInput ¶
type ConnectRegionInput struct {
Region string `json:"region" minLength:"6" maxLength:"32"`
}
ConnectRegionInput picks the SES region.
type ConnectRegistration ¶
type ConnectRegistration struct {
Status string `json:"status" enum:"done,skipped,failed,manual"`
Detail string `json:"detail,omitempty"`
At time.Time `json:"at"`
}
ConnectRegistration is the webhook registration at the provider.
type ConnectSESInput ¶
type ConnectSESInput struct {
Access string `json:"access" enum:"role,keys"`
// RoleARN is the stack's RoleArn output (CloudFormation path).
RoleARN string `json:"roleArn,omitempty" maxLength:"2048"`
AccessKeyID string `json:"accessKeyId,omitempty" maxLength:"128"`
SecretAccessKey string `json:"secretAccessKey,omitempty" maxLength:"256"`
Region string `json:"region,omitempty" maxLength:"32"`
}
ConnectSESInput is the AWS access of the SES path.
type ConnectSMTPForm ¶
type ConnectSMTPForm struct {
Host string `json:"host"`
Port int `json:"port"`
TLS string `json:"tls" enum:"starttls,tls,none"`
Username string `json:"username"`
PasswordSet bool `json:"passwordSet"`
MaxRate string `json:"maxRate"`
DailyCap string `json:"dailyCap"`
ReturnPath string `json:"returnPath"`
Protocol string `json:"protocol" enum:"imap,pop3"`
MailboxHost string `json:"mailboxHost"`
MailboxPort int `json:"mailboxPort"`
MailboxTLS string `json:"mailboxTls" enum:"tls,starttls,none"`
MailboxUser string `json:"mailboxUser"`
MailboxPassSet bool `json:"mailboxPasswordSet"`
Folder string `json:"folder"`
PollEvery string `json:"pollEvery" enum:"1m,5m,15m"`
AfterProcessing string `json:"afterProcessing" enum:"move,delete,leave"`
}
ConnectSMTPForm is the SMTP form's current values (never the passwords).
type ConnectSMTPInput ¶
type ConnectSMTPInput struct {
Host string `json:"host" minLength:"1" maxLength:"253"`
Port int `json:"port" minimum:"1" maximum:"65535"`
TLS string `json:"tls" enum:"starttls,tls,none"`
Username string `json:"username,omitempty" maxLength:"254"`
// Password is kept as stored when empty.
Password string `json:"password,omitempty" maxLength:"1024"`
MaxRate string `json:"maxRate,omitempty" maxLength:"40" doc:"Messages per second the server allows, e.g. 5 per second"`
DailyCap string `json:"dailyCap,omitempty" maxLength:"40" doc:"Messages per day, e.g. 20,000"`
}
ConnectSMTPInput is the outgoing server of the SMTP path.
type ConnectSandbox ¶
type ConnectSandbox struct {
Region string `json:"region"`
Name string `json:"name"`
// Selected is true when the selected region itself is in the sandbox.
Selected bool `json:"selected"`
Website string `json:"website"`
MailType string `json:"mailType" enum:"marketing,transactional"`
UseCase string `json:"useCase"`
DailyVolume int64 `json:"dailyVolume"`
Language string `json:"language" enum:"en,ja"`
RequestedAt *time.Time `json:"requestedAt,omitempty"`
}
ConnectSandbox is the sandbox card and its production-access request.
type ConnectSelfTest ¶
type ConnectSelfTest struct {
OK bool `json:"ok"`
At time.Time `json:"at"`
Code string `json:"code,omitempty"`
Reason string `json:"reason,omitempty"`
Private bool `json:"private"`
}
ConnectSelfTest is the webhook endpoint self-test.
type ConnectSenderOption ¶
type ConnectSenderOption struct {
ID string `json:"id"`
Label string `json:"label"`
// Verified is true when the new provider can sign for its domain.
Verified bool `json:"verified"`
}
ConnectSenderOption is a sender the test can come from.
type ConnectSetup ¶
type ConnectSetup struct {
ID string `json:"id"`
Adapter string `json:"adapter"`
Info ConnectAdapterInfo `json:"info"`
Step string `json:"step" enum:"connection,domain,test,streams,contacts,done"`
Status string `json:"status" enum:"open,finished,abandoned"`
ProviderID string `json:"providerId"`
Provider string `json:"provider"`
Summaries ConnectSummaries `json:"summaries"`
Connection ConnectConnection `json:"connection"`
Domain ConnectDomainChoice `json:"domain"`
Streams ConnectStreams `json:"streams"`
Done *ConnectDone `json:"done,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
CanManage bool `json:"canManage"`
// Helpers names who can manage providers when the caller can't.
Helpers []string `json:"helpers"`
}
ConnectSetup is a setup with everything its steps show.
type ConnectSetupInput ¶
type ConnectSetupInput struct {
Adapter string `json:"adapter" minLength:"2" maxLength:"120"`
}
ConnectSetupInput starts a setup.
type ConnectSetupList ¶
type ConnectSetupList struct {
Items []ConnectSetupSummary `json:"items"`
}
ConnectSetupList is a workspace's setups, newest first.
type ConnectSetupSummary ¶
type ConnectSetupSummary struct {
ID string `json:"id"`
Adapter string `json:"adapter"`
// Name is the adapter's display name ("Amazon SES").
Name string `json:"name"`
Step string `json:"step"`
Status string `json:"status" enum:"open,finished,abandoned"`
Provider string `json:"provider"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
}
ConnectSetupSummary is one setup of the list.
type ConnectStepInput ¶
type ConnectStepInput struct {
Step string `json:"step" enum:"connection,domain,test,streams,contacts"`
}
ConnectStepInput moves a setup to a step (Back, Continue, Save and finish later).
type ConnectStreamChoiceInput ¶
type ConnectStreamChoiceInput struct {
Stream string `json:"stream" enum:"broadcast,automation,system,transactional"`
Enabled bool `json:"enabled"`
Role string `json:"role,omitempty" enum:"primary,split,fallback"`
Weight int `json:"weight,omitempty" minimum:"1" maximum:"99"`
}
ConnectStreamChoiceInput is one stream of step 5.
type ConnectStreamView ¶
type ConnectStreamView struct {
Stream string `json:"stream" enum:"broadcast,automation,system,transactional"`
Name string `json:"name"`
Description string `json:"description"`
Enabled bool `json:"enabled"`
// Allowed is false when the provider's terms exclude the stream
// (bulk marketing); Reason says why.
Allowed bool `json:"allowed"`
Reason string `json:"reason,omitempty"`
// HasRoute: another provider already carries the stream, so the role
// can be chosen (primary, split, fallback).
HasRoute bool `json:"hasRoute"`
Current []string `json:"current"`
Role string `json:"role" enum:"primary,split,fallback"`
Weight int `json:"weight"`
// RoleLabel is the badge ("Primary · 100%").
RoleLabel string `json:"roleLabel"`
ConfigurationSet string `json:"configurationSet"`
Failover string `json:"failover"`
// Tracking is shown for Broadcasts ("ReputeCast only; SES tracking off").
Tracking string `json:"tracking"`
}
ConnectStreamView is one stream card of step 5.
type ConnectStreams ¶
type ConnectStreams struct {
Streams []ConnectStreamView `json:"streams"`
Saved bool `json:"saved"`
// Tips are the "Suggested next steps"; Defaults the line about
// throttles and thresholds.
Tips []string `json:"tips"`
Defaults string `json:"defaults"`
}
ConnectStreams is step 5.
type ConnectStreamsInput ¶
type ConnectStreamsInput struct {
Streams []ConnectStreamChoiceInput `json:"streams" maxItems:"4"`
}
ConnectStreamsInput assigns the provider to streams.
type ConnectSummaries ¶
type ConnectSummaries struct {
Provider string `json:"provider"`
Connection string `json:"connection"`
Domain string `json:"domain"`
DomainShort string `json:"domainShort"`
Test string `json:"test"`
Streams string `json:"streams"`
}
ConnectSummaries are the stepper's lines.
type ConnectSuppressions ¶
type ConnectSuppressions struct {
Available bool `json:"available"`
Provider string `json:"provider"`
Short string `json:"short"`
Total int `json:"total"`
Bounces int `json:"bounces"`
Complaints int `json:"complaints"`
Error string `json:"error,omitempty"`
}
ConnectSuppressions is the provider's own suppression list.
type ConnectTestInput ¶
type ConnectTestInput struct {
SenderID string `json:"senderId" format:"uuid"`
To string `json:"to,omitempty" maxLength:"254"`
Subject string `json:"subject" minLength:"1" maxLength:"200"`
// Seeds sends the test to a seed list instead (one address per mailbox
// provider: gmail, outlook, yahoo, icloud); they are saved for next time.
Seeds map[string]string `json:"seeds,omitempty"`
}
ConnectTestInput sends a test through the new provider.
type ConnectTestStatus ¶
type ConnectTestStatus struct {
MessageID string `json:"messageId"`
SenderID string `json:"senderId"`
To string `json:"to"`
Subject string `json:"subject"`
Senders []ConnectSenderOption `json:"senders"`
// Listening is true while events may still arrive.
Listening bool `json:"listening"`
Timeline []ConnectTimelineStep `json:"timeline"`
// RoundTrip is the closing line once delivered ("Round trip 2.4 s …").
RoundTrip string `json:"roundTrip"`
Auth *ConnectAuthResult `json:"auth,omitempty"`
Seeds []string `json:"seeds"`
// SeedList is the workspace's saved seed addresses by mailbox provider.
SeedList map[string]string `json:"seedList"`
}
ConnectTestStatus is step 4.
type ConnectTimelineStep ¶
type ConnectTimelineStep struct {
Key string `json:"key" enum:"queued,accepted,sent,delivered,opened"`
Title string `json:"title"`
Detail string `json:"detail"`
Status string `json:"status" enum:"done,waiting,failed"`
At *time.Time `json:"at,omitempty"`
}
ConnectTimelineStep is one line of the delivery timeline.
type ConnectWebhook ¶
type ConnectWebhook struct {
Mode string `json:"mode" enum:"webhook,polling,mailbox,none"`
URL string `json:"url"`
PublicURL string `json:"publicUrl"`
// NeedsSecret: the webhook is set up by hand with the secret ReputeCast
// generated (shown on request), sent in SecretHeader or used to sign.
NeedsSecret bool `json:"needsSecret"`
SecretHeader string `json:"secretHeader,omitempty"`
SelfTest *ConnectSelfTest `json:"selfTest,omitempty"`
Registration *ConnectRegistration `json:"registration,omitempty"`
}
ConnectWebhook is how events come back from the provider.
type ConnectWebhookInput ¶
type ConnectWebhookInput struct {
// PublicURL replaces the instance's public URL for this provider's
// webhooks (a Cloudflare Tunnel or ngrok address while testing).
PublicURL string `json:"publicUrl,omitempty" maxLength:"2048"`
}
ConnectWebhookInput re-tests the webhook endpoint, optionally through a tunnel URL.
type ConnectWebhookSecret ¶
type ConnectWebhookSecret struct {
URL string `json:"url"`
Secret string `json:"secret"`
// Header carries the secret as it is ("X-ReputeCast-Secret"); empty when
// the provider signs its requests with it instead.
Header string `json:"header,omitempty"`
}
ConnectWebhookSecret is the secret a provider set up by hand sends with its webhooks, shown to the person who configures it.
type Connection ¶
type Connection struct {
// Status: "" (nothing yet), connected, failed.
Status string `json:"status,omitempty"`
At *time.Time `json:"at,omitempty"`
// Settings are the non-secret values entered (to refill the form).
Settings map[string]string `json:"settings,omitempty"`
// Account is the provider's account standing ("Production · no enforcement").
Account string `json:"account,omitempty"`
AccountText i18n.Text `json:"account_text,omitzero"`
AccountID string `json:"account_id,omitempty"`
// Summary is the stepper's line once connected ("us-east-1 · production").
Summary string `json:"summary,omitempty"`
Error *StepError `json:"error,omitempty"`
// Amazon SES
Access string `json:"access,omitempty"` // role, keys
ExternalID string `json:"external_id,omitempty"`
RoleARN string `json:"role_arn,omitempty"`
Region string `json:"region,omitempty"`
Regions []RegionState `json:"regions,omitempty"`
Provisioning []ProvisionState `json:"provisioning,omitempty"`
ProvisionSuffix string `json:"provision_suffix,omitempty"`
ProductionAccess *ProductionAccess `json:"production_access,omitempty"`
// SMTP
SMTP *ProbeState `json:"smtp,omitempty"`
Mailbox *ProbeState `json:"mailbox,omitempty"`
// MailboxTried is the bounce mailbox last tested (no password), so a
// reload after a failed test keeps the form; the provider keeps it
// only once the test passes.
MailboxTried *MailboxTried `json:"mailbox_tried,omitempty"`
// Events
Webhook *WebhookState `json:"webhook,omitempty"`
}
Connection is step 2.
type ContactsStep ¶
type ContactsStep struct {
Suppressions *SuppressionPreview `json:"suppressions,omitempty"`
// Choice: import (an importer source), empty (start empty).
Choice string `json:"choice,omitempty"`
Source string `json:"source,omitempty"`
Pull bool `json:"pull"`
// ListsCreated are lists created by "Start empty".
ListsCreated []string `json:"lists_created,omitempty"`
// Imported is how many suppressions the pull added.
Imported *int64 `json:"imported,omitempty"`
At *time.Time `json:"at,omitempty"`
}
ContactsStep is step 6.
type DomainStep ¶
type DomainStep struct {
DomainID string `json:"domain_id,omitempty"`
Name string `json:"name"`
Skipped bool `json:"skipped,omitempty"`
Verified int `json:"verified"`
Total int `json:"total"`
At *time.Time `json:"at,omitempty"`
}
DomainStep is step 3.
type MailboxTried ¶
type MailboxTried struct {
Address string `json:"address,omitempty"`
Protocol string `json:"protocol"`
Host string `json:"host"`
Port int `json:"port"`
TLS string `json:"tls"`
Username string `json:"username,omitempty"`
Folder string `json:"folder,omitempty"`
PollEvery string `json:"poll_every,omitempty"`
AfterProcessing string `json:"after_processing,omitempty"`
}
MailboxTried is a bounce mailbox's settings as they were tested.
type PollArgs ¶
type PollArgs struct{}
PollArgs polls the events API of providers whose events can't come by webhook ("Use polling for now").
func (PollArgs) InsertOpts ¶
func (PollArgs) InsertOpts() river.InsertOpts
InsertOpts runs one poll a minute.
type PollWorker ¶
type PollWorker struct {
river.WorkerDefaults[PollArgs]
S *Service
// Backfill records the status of a provider's recent messages from its
// events API (ingest.Normalizer.Backfill).
Backfill func(ctx context.Context, providerID uuid.UUID) (int, error)
}
PollWorker runs PollArgs through the ingest backfill.
type ProbeState ¶
type ProbeState struct {
OK bool `json:"ok"`
At time.Time `json:"at"`
Summary string `json:"summary,omitempty"`
Transcript []string `json:"transcript,omitempty"`
Error string `json:"error,omitempty"`
// SummaryText and ErrorText are the messages of Summary and Error.
SummaryText i18n.Text `json:"summary_text,omitzero"`
ErrorText i18n.Text `json:"error_text,omitzero"`
}
ProbeState is the result of a connection or mailbox test.
type ProductionAccess ¶
type ProductionAccess struct {
Region string `json:"region"`
RequestedAt time.Time `json:"requested_at"`
Website string `json:"website"`
MailType string `json:"mail_type"`
UseCase string `json:"use_case"`
Language string `json:"language"`
DailyVolume int64 `json:"daily_volume"`
}
ProductionAccess is a filed request to leave the sandbox.
type ProvisionArgs ¶
ProvisionArgs runs a setup's provisioning steps (SES: SNS topic, subscription handshake, configuration sets) one after another, saving progress after each so the connection step shows it live.
func (ProvisionArgs) InsertOpts ¶
func (ProvisionArgs) InsertOpts() river.InsertOpts
InsertOpts keeps one run per setup at a time; a finished run doesn't block the next one (retry, region change).
type ProvisionState ¶
type ProvisionState struct {
Key string `json:"key"`
// Label is what the step does; Text what was done (`backticks` = code).
Label string `json:"label"`
Text string `json:"text,omitempty"`
Status string `json:"status"` // waiting, running, done, failed
At *time.Time `json:"at,omitempty"`
// Error is the provider's error ("AccessDenied: ses:CreateConfigurationSet"),
// Hint the likely cause.
Error string `json:"error,omitempty"`
Hint string `json:"hint,omitempty"`
// Attempts counts runs of a step that waits (SNS confirmation).
Attempts int `json:"attempts,omitempty"`
// Texts are the messages of Label, Text, Error and Hint, by those names
// in lower case; "reason" is the message of an Error that is a code and
// a reason ("ECONNREFUSED: localhost only works on this machine").
Texts map[string]i18n.Text `json:"texts,omitempty"`
}
ProvisionState is one provisioning row.
type ProvisionWorker ¶
type ProvisionWorker struct {
river.WorkerDefaults[ProvisionArgs]
S *Service
}
ProvisionWorker runs ProvisionArgs.
func (*ProvisionWorker) Timeout ¶
func (w *ProvisionWorker) Timeout(*river.Job[ProvisionArgs]) time.Duration
Timeout bounds one run.
func (*ProvisionWorker) Work ¶
func (w *ProvisionWorker) Work(ctx context.Context, job *river.Job[ProvisionArgs]) error
Work implements river.Worker.
type PullArgs ¶
PullArgs imports a provider's suppression list after the setup.
func (PullArgs) InsertOpts ¶
func (PullArgs) InsertOpts() river.InsertOpts
InsertOpts implements river.JobArgsWithInsertOpts.
type PullWorker ¶
type PullWorker struct {
river.WorkerDefaults[PullArgs]
S *Service
}
PullWorker runs PullArgs through the suppression sync (internal/suppressions).
type RegionState ¶
type RegionState struct {
Region string `json:"region"`
Name string `json:"name"`
Production bool `json:"production"`
Max24h int64 `json:"max_24h,omitempty"`
MaxRate float64 `json:"max_rate,omitempty"`
Err string `json:"err,omitempty"`
}
RegionState is the account in one region.
type Registration ¶
type Registration struct {
// Status: done, skipped, failed, manual (set up in the provider's dashboard).
Status string `json:"status"`
At time.Time `json:"at"`
Detail string `json:"detail,omitempty"`
DetailText i18n.Text `json:"detail_text,omitzero"`
}
Registration is the webhook registration at the provider.
type ScanArgs ¶
ScanArgs reads an SES account in every region for the region select.
func (ScanArgs) InsertOpts ¶
func (ScanArgs) InsertOpts() river.InsertOpts
InsertOpts implements river.JobArgsWithInsertOpts.
type ScanWorker ¶
type ScanWorker struct {
river.WorkerDefaults[ScanArgs]
S *Service
}
ScanWorker runs ScanArgs.
type SelfTestState ¶
type SelfTestState struct {
OK bool `json:"ok"`
At time.Time `json:"at"`
// Code is the error class ("ECONNREFUSED", "HTTP 404"); Reason explains
// it ("DNS resolves to 10.0.4.18, a private address").
Code string `json:"code,omitempty"`
Reason string `json:"reason,omitempty"`
ReasonText i18n.Text `json:"reason_text,omitzero"`
// Private is true when the public URL can't be reached from the
// internet at all (localhost, a private address).
Private bool `json:"private,omitempty"`
}
SelfTestState is the endpoint self-test.
func Preflight ¶
Preflight checks, before anything is connected, whether providers could reach a webhook URL at all: localhost, private addresses and names that don't resolve fail up front. It returns nil when the URL may be reachable (the self-test proper needs the connected provider).
func SelfTest ¶
func SelfTest(ctx context.Context, rawURL, token string, now time.Time, allowPrivate bool) SelfTestState
SelfTest checks that a webhook URL can be reached from the internet: localhost and private addresses fail up front (no provider can reach them), then the endpoint must answer a signed self-test with 200.
type SendingDefaults ¶
type SendingDefaults struct {
Bounce float64 `json:"bounce" doc:"Auto-pause at this hard-bounce rate, percent"`
Complaint float64 `json:"complaint" doc:"Auto-pause at this complaint rate, percent"`
MailboxComplaint float64 `json:"mailboxComplaint" doc:"Auto-pause one mailbox provider at this complaint rate, percent"`
ProviderError float64 `json:"providerError" doc:"Treat a provider as failing at this API error rate over 3 minutes, percent"`
PauseScope string `json:"pauseScope" enum:"route,campaign"`
ConfirmOver int64 `json:"confirmOver" doc:"Sends to more recipients need the count typed to confirm"`
Throttles map[string]float64 `json:"throttles" doc:"Messages per second per mailbox provider (gmail, outlook, yahoo, icloud); 0 = no limit"`
SuppressionSync string `json:"suppressionSync" enum:"15m,1h"`
// SecretsRotatedAt is when the webhook signing secrets were last rotated.
SecretsRotatedAt *time.Time `json:"secretsRotatedAt,omitempty"`
}
SendingDefaults is what the defaults cards show and edit.
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Q *store.Queries
Audit *audit.Logger
Box *secrets.Box
Factory *manage.Factory
Domains *domains.Service
Routing *routing.Service
Suppressions *suppressions.Service
Providers *manage.Service
Deliver *systemmail.Deliverer
Links *linktoken.Signer
Jobs func() *jobs.Client
// URLs is the instance's public URL (App.URLs): provider webhooks and
// the test message's open pixel point at it.
URLs publicurl.Builder
// TemplateURL is the published CloudFormation template (SES).
TemplateURL string
// Reachable tests a webhook URL from outside; nil uses the HTTP
// self-test (tests replace it).
Reachable func(ctx context.Context, url string, p store.Provider) SelfTestState
// AllowPrivateURL lets the webhook self-test reach a private or
// loopback public URL (integration tests only).
AllowPrivateURL bool
// AllowPrivateNetworks lets SMTP and bounce-mailbox servers be on
// loopback and private addresses (providers.allow_private_networks).
AllowPrivateNetworks bool
// OnRoutingChange is called after the streams step saved routing (the
// system mailer forgets its cached availability).
OnRoutingChange func()
Log *slog.Logger
Now func() time.Time
}
Service is the connect flow and Settings › Providers.
func (*Service) Abandon ¶
Abandon cancels an open setup. A provider it connected that no route uses yet is disconnected again.
func (*Service) Catalog ¶
Catalog lists every registered adapter (built-in and community) with its capability chips, pricing and bulk-marketing terms. Adapters that aren't in this build don't appear; installed community adapters do, with the reason when this build can't run them.
func (*Service) ChooseDomain ¶
func (s *Service) ChooseDomain(ctx context.Context, ws *store.Workspace, rawID string, in ConnectDomainInput) (ConnectSetup, error)
ChooseDomain sets up the provider for a sending domain: the domain is added when it's new, the provider's records are fetched (through its domain API when it has one) and checked live.
func (*Service) Connect ¶
func (s *Service) Connect(ctx context.Context, ws *store.Workspace, rawID string, in ConnectInput) (ConnectSetup, error)
Connect checks the credentials with the provider, then creates (or updates) the provider, sealed credentials included, and sets up how its events come back: SES provisioning, webhook registration behind a reachability test of the public URL, or the SMTP bounce mailbox. A rejected key is recorded on the setup (the error state), not saved.
func (*Service) ConnectMailbox ¶
func (s *Service) ConnectMailbox(ctx context.Context, ws *store.Workspace, rawID string, in ConnectMailboxInput) (ConnectSetup, error)
ConnectMailbox sets up and tests the SMTP bounce mailbox.
func (*Service) Contacts ¶
func (s *Service) Contacts(ctx context.Context, ws *store.Workspace, rawID string) (ConnectContacts, error)
Contacts returns step 6: importer sources, the provider's suppression list (read once and kept on the setup) and the workspace's lists.
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, ws *store.Workspace, in ConnectSetupInput) (ConnectSetup, error)
Create starts a setup for an adapter, or returns the open one to resume.
func (*Service) Finish ¶
func (s *Service) Finish(ctx context.Context, ws *store.Workspace, rawID string, in ConnectFinishInput) (ConnectSetup, error)
Finish ends the setup: the suppression pull is queued, the suggested lists are created when asked and the summary becomes available.
func (*Service) List ¶
func (s *Service) List(ctx context.Context, ws *store.Workspace, adapter, status string) (ConnectSetupList, error)
List returns the workspace's latest setups, optionally of one adapter or status.
func (*Service) RequestProductionAccess ¶
func (s *Service) RequestProductionAccess(ctx context.Context, ws *store.Workspace, rawID string, in ConnectProductionAccessInput) (ConnectSetup, error)
RequestProductionAccess asks the provider to lift its sandbox in a region.
func (*Service) RetestWebhook ¶
func (s *Service) RetestWebhook(ctx context.Context, ws *store.Workspace, rawID string, in ConnectWebhookInput) (ConnectSetup, error)
RetestWebhook tests the endpoint again and registers it when reachable.
func (*Service) RetryProvisioning ¶
func (s *Service) RetryProvisioning(ctx context.Context, ws *store.Workspace, rawID string) (ConnectSetup, error)
RetryProvisioning sets failed steps back to waiting and runs them again.
func (*Service) RotateSecrets ¶
func (s *Service) RotateSecrets(ctx context.Context, ws *store.Workspace) (SettingsRotationResult, error)
RotateSecrets gives every provider a new webhook signing secret and registers the webhooks again where the provider holds the secret, so events keep verifying.
func (*Service) RunProvisioning ¶
RunProvisioning runs the pending provisioning steps of a setup. It returns true when a step waits for something (the SNS handshake) and the job should run again in a few seconds.
func (*Service) SaveSettings ¶
func (s *Service) SaveSettings(ctx context.Context, ws *store.Workspace, in SettingsProvidersInput) (SettingsProviders, error)
SaveSettings saves the workspace-wide sending defaults.
func (*Service) SaveStreams ¶
func (s *Service) SaveStreams(ctx context.Context, ws *store.Workspace, rawID string, in ConnectStreamsInput) (ConnectSetup, error)
SaveStreams assigns the provider to the chosen streams through the routing rules (primary, a weighted split or the fallback) and records the choice on the setup.
func (*Service) ScanRegions ¶
ScanRegions records the account's standing in every region.
func (*Service) SendTest ¶
func (s *Service) SendTest(ctx context.Context, ws *store.Workspace, rawID string, in ConnectTestInput) (ConnectTestStatus, error)
SendTest sends a test message through the setup's provider (never through routing) and records it like any send, so the timeline can watch its events arrive.
func (*Service) SetRegion ¶
func (s *Service) SetRegion(ctx context.Context, ws *store.Workspace, rawID string, in ConnectRegionInput) (ConnectSetup, error)
SetRegion moves an SES connection to another region: the account is read there and provisioning runs again in it.
func (*Service) SetStep ¶
func (s *Service) SetStep(ctx context.Context, ws *store.Workspace, rawID string, in ConnectStepInput) (ConnectSetup, error)
SetStep records the step the person is on, so a reload resumes there.
func (*Service) SettingsPage ¶
SettingsPage returns Settings › Providers.
func (*Service) TestStatus ¶
func (s *Service) TestStatus(ctx context.Context, ws *store.Workspace, rawID string) (ConnectTestStatus, error)
TestStatus is the test form and the latest test's delivery timeline.
func (*Service) UsePolling ¶
func (s *Service) UsePolling(ctx context.Context, ws *store.Workspace, rawID string) (ConnectSetup, error)
UsePolling switches the provider to polling its events API instead of webhooks.
func (*Service) View ¶
func (s *Service) View(ctx context.Context, ws *store.Workspace, st store.ProviderSetup) (ConnectSetup, error)
View builds the setup for its screens.
func (*Service) WebhookSecret ¶
func (s *Service) WebhookSecret(ctx context.Context, ws *store.Workspace, rawID string) (ConnectWebhookSecret, error)
WebhookSecret issues a new webhook secret for a provider whose webhook is set up by hand, and returns it this once: like API keys, a stored secret is never read back. The new secret replaces the previous one, in the audit log.
type SettingsProviderCard ¶
type SettingsProviderCard struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status" enum:"healthy,degraded,down,sandbox,warming_up,paused"`
StatusLabel string `json:"statusLabel"`
StatusTone string `json:"statusTone" enum:"ok,info,warn,bad,neutral"`
// Streams says what it carries ("Broadcasts 90% · Automations").
Streams string `json:"streams"`
// IdentityLabel and Identity name the account or server
// ("Region · account", "us-east-1 · 123456789012").
IdentityLabel string `json:"identityLabel"`
Identity string `json:"identity"`
ConnectedAt time.Time `json:"connectedAt"`
ConnectedVia string `json:"connectedVia"`
Cost SettingsProviderCost `json:"cost"`
}
SettingsProviderCard is one provider of Settings › Providers.
type SettingsProviderCost ¶
type SettingsProviderCost struct {
Basis string `json:"basis" enum:"metered,plan,self_hosted"`
ToDate float64 `json:"toDate"`
Monthly float64 `json:"monthly"`
}
SettingsProviderCost is a provider's cost this month.
type SettingsProviders ¶
type SettingsProviders struct {
Providers []SettingsProviderCard `json:"providers"`
Defaults SendingDefaults `json:"defaults"`
// MonthStart is the first day of this month (the cost period).
MonthStart time.Time `json:"monthStart"`
CanManage bool `json:"canManage"`
// Helpers names who can manage providers when the caller can't.
Helpers []string `json:"helpers"`
}
SettingsProviders is Settings › Providers.
type SettingsProvidersInput ¶
type SettingsProvidersInput struct {
Bounce float64 `json:"bounce" minimum:"0.1" maximum:"50"`
Complaint float64 `json:"complaint" minimum:"0.01" maximum:"5"`
MailboxComplaint float64 `json:"mailboxComplaint" minimum:"0.01" maximum:"5"`
ProviderError float64 `json:"providerError" minimum:"0.5" maximum:"100"`
PauseScope string `json:"pauseScope" enum:"route,campaign"`
ConfirmOver int64 `json:"confirmOver" minimum:"1" maximum:"100000000"`
Throttles map[string]float64 `json:"throttles"`
SuppressionSync string `json:"suppressionSync" enum:"15m,1h"`
}
SettingsProvidersInput saves the defaults cards.
type SettingsRotationResult ¶
type SettingsRotationResult struct {
Rotated int `json:"rotated"`
Skipped []string `json:"skipped"`
Page SettingsProviders `json:"page"`
}
SettingsRotationResult says what a rotation changed.
type State ¶
type State struct {
Connection Connection `json:"connection"`
Domain *DomainStep `json:"domain,omitempty"`
Test *TestStep `json:"test,omitempty"`
Streams *StreamsStep `json:"streams,omitempty"`
Contacts *ContactsStep `json:"contacts,omitempty"`
}
State is provider_setups.state: what each step of the setup found and chose, so a reload (or a teammate) resumes exactly where it was. Secrets never go here; they are sealed on the provider row once accepted. Text for people keeps its English and, beside it, its message for readers in other languages (the *Text fields, lang.go).
type StepError ¶
type StepError struct {
// Field is the form field to mark ("api_key"), empty for the step.
Field string `json:"field,omitempty"`
Code string `json:"code,omitempty"`
Message string `json:"message"`
// Texts are Message's sentences as messages, in order.
Texts []i18n.Text `json:"texts,omitempty"`
// Detail is the provider's own answer ("401 Unauthorized · Forbidden").
Detail string `json:"detail,omitempty"`
}
StepError is why a step failed, for the person.
type StreamChoice ¶
type StreamChoice struct {
Enabled bool `json:"enabled"`
Role string `json:"role,omitempty"` // primary, split, fallback
Weight int `json:"weight,omitempty"`
}
StreamChoice is one stream of step 5.
type StreamsStep ¶
type StreamsStep struct {
Saved bool `json:"saved"`
At *time.Time `json:"at,omitempty"`
Streams map[string]StreamChoice `json:"streams"`
}
StreamsStep is step 5.
type SuppressionPreview ¶
type SuppressionPreview struct {
Available bool `json:"available"`
Total int `json:"total"`
Bounces int `json:"bounces"`
Complaints int `json:"complaints"`
Error string `json:"error,omitempty"`
ErrorText i18n.Text `json:"error_text,omitzero"`
At time.Time `json:"at"`
}
SuppressionPreview is the provider's own suppression list.
type TestEvent ¶
type TestEvent struct {
At time.Time `json:"at"`
// Name is the provider's event name ("Send"), Via how it came ("SNS").
Name string `json:"name,omitempty"`
Via string `json:"via"`
}
TestEvent is a provider event the test timeline shows.
type TestStep ¶
type TestStep struct {
MessageID string `json:"message_id"`
SenderID string `json:"sender_id"`
From string `json:"from"`
To string `json:"to"`
Subject string `json:"subject"`
QueuedAt time.Time `json:"queued_at"`
// RoundTripMs is queue to delivery event, once delivered.
RoundTripMs int64 `json:"round_trip_ms,omitempty"`
// SizeBytes is the message's approximate size (Gmail clips at 102 KB).
SizeBytes int `json:"size_bytes,omitempty"`
// Seeds are the seed-list addresses of the last seed test.
Seeds []string `json:"seeds,omitempty"`
// FirstEvent is the provider's first webhook about the message, kept
// once seen: raw webhook payloads are swept after 90 days.
FirstEvent *TestEvent `json:"first_event,omitempty"`
}
TestStep is step 4.
type WebhookState ¶
type WebhookState struct {
// Mode: webhook, polling (the provider's events API), mailbox (SMTP
// bounce mailbox), none.
Mode string `json:"mode"`
URL string `json:"url,omitempty"`
// Token is the webhook token reserved for the provider the setup
// connects, so the URL is known before the key works.
Token string `json:"token,omitempty"`
// NeedsSecret: the webhook is set up by hand in the provider and
// authenticated with the secret ReputeCast generated at connect time,
// sent in SecretHeader (or used to sign when that is empty).
NeedsSecret bool `json:"needs_secret,omitempty"`
SecretHeader string `json:"secret_header,omitempty"`
// PublicURL overrides the instance's public URL for this provider (a
// tunnel while testing).
PublicURL string `json:"public_url,omitempty"`
SelfTest *SelfTestState `json:"self_test,omitempty"`
Registration *Registration `json:"registration,omitempty"`
}
WebhookState is how events come back.