Documentation
¶
Overview ¶
Package campaigns implements campaigns: the list and summary, drafts and the composer's storage, versions, scheduling and sending state.
Index ¶
- Constants
- func ContentHash(subject, preheader, mjmlSrc, html string, ab json.RawMessage) string
- func Register(h huma.API, s *Service)
- func RegisterComposer(h huma.API, s *Service)
- func ShortName(name, adapter string) string
- type CampaignList
- type CampaignListItem
- type CampaignPath
- type CampaignStatusCounts
- type CampaignSummary
- type ChangeHook
- type ComposerABTest
- type ComposerABVariant
- type ComposerAccess
- type ComposerAudience
- type ComposerAudienceCount
- type ComposerAudienceInput
- type ComposerAudienceOption
- type ComposerCampaign
- type ComposerChecks
- type ComposerChecksRequest
- type ComposerCompileRequest
- type ComposerCompiled
- type ComposerContentSettings
- type ComposerContext
- type ComposerCreateCampaign
- type ComposerPreview
- type ComposerPreviewContact
- type ComposerPreviewContactList
- type ComposerPreviewRequest
- type ComposerRestoreVersion
- type ComposerRoute
- type ComposerSaveContent
- type ComposerSavedContent
- type ComposerSenderOption
- type ComposerSenderRef
- type ComposerTestRecipient
- type ComposerTestSend
- type ComposerTestSendResult
- type ComposerTokenValue
- type ComposerUpdateCampaign
- type ComposerVersion
- type ComposerVersionDetail
- type ComposerVersionList
- type ListParams
- type ProviderCost
- type ReadinessSummary
- type RouteShare
- type Service
- func (s *Service) Checks(ctx context.Context, ws *store.Workspace, id uuid.UUID, ...) (ComposerChecks, error)
- func (s *Service) Context(ctx context.Context, ws *store.Workspace, p *authz.Principal) (ComposerContext, error)
- func (s *Service) CountAudience(ctx context.Context, ws *store.Workspace, p *authz.Principal, ...) (ComposerAudienceCount, error)
- func (s *Service) Create(ctx context.Context, ws *store.Workspace, p *authz.Principal, ...) (ComposerCampaign, error)
- func (s *Service) Detail(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) (ComposerCampaign, error)
- func (s *Service) Duplicate(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) (ComposerCampaign, error)
- func (s *Service) List(ctx context.Context, ws *store.Workspace, p ListParams) (CampaignList, error)
- func (s *Service) Preview(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (ComposerPreview, error)
- func (s *Service) PreviewContacts(ctx context.Context, ws *store.Workspace, id uuid.UUID, query string) (ComposerPreviewContactList, error)
- func (s *Service) Restore(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (ComposerSavedContent, error)
- func (s *Service) Save(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (ComposerSavedContent, error)
- func (s *Service) SendTest(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (ComposerTestSendResult, error)
- func (s *Service) Summary(ctx context.Context, ws *store.Workspace, days int) (CampaignSummary, error)
- func (s *Service) Update(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (ComposerCampaign, error)
- func (s *Service) Version(ctx context.Context, ws *store.Workspace, id uuid.UUID, version int) (ComposerVersionDetail, error)
- func (s *Service) Versions(ctx context.Context, ws *store.Workspace, id uuid.UUID, limit int) (ComposerVersionList, error)
- type VersionPath
Constants ¶
const CodeVersionConflict = "version_conflict"
CodeVersionConflict is the problem code of an autosave based on an old version.
const KeepVersions = 300
KeepVersions is how many autosaved versions a campaign keeps; the first version and named saves (⌘S, restores, imports) are always kept.
Variables ¶
This section is empty.
Functions ¶
func ContentHash ¶
func ContentHash(subject, preheader, mjmlSrc, html string, ab json.RawMessage) string
ContentHash fingerprints what an approval covers in the content: subject, preheader, MJML, HTML and A/B variants.
func RegisterComposer ¶
RegisterComposer adds the composer operations.
Types ¶
type CampaignList ¶
type CampaignList struct {
Items []CampaignListItem `json:"items"`
Total int64 `json:"total" doc:"Campaigns matching the filter"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
Counts CampaignStatusCounts `json:"counts"`
}
CampaignList is one page of campaigns.
type CampaignListItem ¶
type CampaignListItem struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status" enum:"draft,approval,approved,scheduled,sending,paused,sent,cancelled,failed"`
// Blocked is true for drafts whose latest Send Readiness run is Blocked.
Blocked bool `json:"blocked"`
// Audience is a readable label ("Weekly Digest", "All subscribers"); empty when not set.
Audience string `json:"audience"`
Recipients *int64 `json:"recipients,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy"`
ScheduledAt *time.Time `json:"scheduledAt,omitempty"`
Timezone string `json:"timezone,omitempty"`
StartedAt *time.Time `json:"startedAt,omitempty"`
// Rates in percent, set once the campaign has sent anything.
Delivered *float64 `json:"delivered,omitempty"`
HumanOpens *float64 `json:"humanOpens,omitempty"`
Clicks *float64 `json:"clicks,omitempty"`
// Routes lists the sending providers; empty for a draft without an
// audience (it will use the Broadcasts route).
Routes []RouteShare `json:"routes"`
// Origin is the importer source for history pulled in by migration ("brevo").
Origin string `json:"origin,omitempty"`
// Notes are short annotations: "A/B subject, winner B", "auto-paused once, Yahoo deferrals".
Notes []string `json:"notes"`
// Readiness of unsent campaigns: verdict and number of warnings or blocks.
Readiness *ReadinessSummary `json:"readiness,omitempty"`
}
CampaignListItem is one row of the campaigns list.
type CampaignPath ¶
type CampaignPath struct {
api.WorkspaceInput
CampaignID string `path:"campaignId" format:"uuid"`
}
CampaignPath is the {workspace}/{campaignId} part of composer operations.
type CampaignStatusCounts ¶
type CampaignStatusCounts struct {
All int64 `json:"all"`
Drafts int64 `json:"drafts"`
Scheduled int64 `json:"scheduled"`
Sending int64 `json:"sending"`
Sent int64 `json:"sent"`
}
CampaignStatusCounts feeds the All / Drafts / Scheduled / Sending / Sent tabs.
type CampaignSummary ¶
type CampaignSummary struct {
Days int `json:"days"`
Campaigns int64 `json:"campaigns"`
Sent int64 `json:"sent"`
Delivered *float64 `json:"delivered,omitempty"`
Bounces *float64 `json:"bounces,omitempty"`
Complaints *float64 `json:"complaints,omitempty"`
HumanOpens *float64 `json:"humanOpens,omitempty"`
Clicks *float64 `json:"clicks,omitempty"`
ClickToOpen *float64 `json:"clickToOpen,omitempty"`
Cost float64 `json:"cost" doc:"Dollars"`
CostBy []ProviderCost `json:"costBy"`
}
CampaignSummary is the KPI row above the list (last 30 days).
type ChangeHook ¶
ChangeHook is told which campaign changed. The save already committed, so a hook handles its own errors.
type ComposerABTest ¶
type ComposerABTest struct {
Kind string `json:"kind" enum:"subject,content,send_time"`
Variants []ComposerABVariant `json:"variants" minItems:"2" maxItems:"3"`
TestPercent int `json:"testPercent" minimum:"5" maximum:"50" doc:"Share of the audience in the test"`
Metric string `json:"metric" enum:"human_opens,clicks,manual"`
// DurationHours is how long the test runs before the winner is sent.
DurationHours int `json:"durationHours" minimum:"1" maximum:"72"`
// BestTime sends each recipient at their usual open time (send-time tests).
BestTime bool `json:"bestTime,omitempty"`
Winner string `json:"winner,omitempty"`
}
ComposerABTest compares variants on a sample, then sends the winner to the rest.
type ComposerABVariant ¶
type ComposerABVariant struct {
Key string `json:"key" enum:"A,B,C" doc:"Variant A is the campaign itself"`
Subject string `json:"subject,omitempty" maxLength:"998"`
Preheader string `json:"preheader,omitempty" maxLength:"500"`
// MJML and HTML are set for content tests (variants B and C).
MJML string `json:"mjml,omitempty" maxLength:"2000000"`
HTML string `json:"html,omitempty" maxLength:"2000000"`
// SendTime is the local send time for send-time tests ("14:00").
SendTime string `json:"sendTime,omitempty" pattern:"^([01]\\d|2[0-3]):[0-5]\\d$"`
}
ComposerABVariant is one variant of an A/B test.
type ComposerAccess ¶
type ComposerAccess struct {
// Editable is false once a campaign started sending.
Editable bool `json:"editable"`
ReadOnlyReason string `json:"readOnlyReason,omitempty"`
CanEdit bool `json:"canEdit"`
// CanSend is campaigns:send. Without it "Review & send" becomes "Request approval".
CanSend bool `json:"canSend"`
SendHelpers []string `json:"sendHelpers" doc:"Members who hold campaigns:send"`
// CanManageRouting is providers:manage; others see the route read-only.
CanManageRouting bool `json:"canManageRouting"`
// CanSendTestToOthers lets test emails go to other addresses (campaigns:send).
CanSendTestToOthers bool `json:"canSendTestToOthers"`
CanEditTemplates bool `json:"canEditTemplates"`
CanViewContacts bool `json:"canViewContacts"`
}
ComposerAccess tells the composer what the caller may do.
type ComposerAudience ¶
type ComposerAudience struct {
Lists []string `json:"lists"`
Segments []string `json:"segments"`
ExcludeLists []string `json:"excludeLists"`
ExcludeSegments []string `json:"excludeSegments"`
}
ComposerAudience says who receives a campaign: lists and segments, minus excluded lists and segments.
type ComposerAudienceCount ¶
type ComposerAudienceCount struct {
Count int64 `json:"count"`
// Approximate is true when segments are involved: their last cached
// count is used, so overlaps may be counted twice until Send Readiness
// computes the final number.
Approximate bool `json:"approximate"`
}
ComposerAudienceCount is the live count of an audience definition.
type ComposerAudienceInput ¶
type ComposerAudienceInput struct {
Lists []string `json:"lists,omitempty" maxItems:"100"`
Segments []string `json:"segments,omitempty" maxItems:"100"`
ExcludeLists []string `json:"excludeLists,omitempty" maxItems:"100"`
ExcludeSegments []string `json:"excludeSegments,omitempty" maxItems:"100"`
}
ComposerAudienceInput is an audience in requests (every part optional).
type ComposerAudienceOption ¶
type ComposerAudienceOption struct {
ID string `json:"id"`
Name string `json:"name"`
Count *int64 `json:"count,omitempty"`
}
ComposerAudienceOption is a list or segment with its size.
type ComposerCampaign ¶
type ComposerCampaign struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status" enum:"draft,approval,approved,scheduled,sending,paused,sent,cancelled,failed"`
Subject string `json:"subject"`
Preheader string `json:"preheader"`
Sender *ComposerSenderRef `json:"sender,omitempty"`
ReplyTo string `json:"replyTo"`
Audience ComposerAudience `json:"audience"`
AudienceLabel string `json:"audienceLabel"`
AudienceCount *int64 `json:"audienceCount,omitempty"`
EditorMode string `json:"editorMode" enum:"visual,mjml,html"`
MJML string `json:"mjml"`
HTML string `json:"html"`
PlainText string `json:"plainText"`
Version int `json:"version"`
VersionCount int `json:"versionCount"`
ContentHash string `json:"contentHash"`
ABTest *ComposerABTest `json:"abTest,omitempty"`
Settings ComposerContentSettings `json:"settings"`
ScheduledAt *time.Time `json:"scheduledAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy"`
AutosavedAt *time.Time `json:"autosavedAt,omitempty"`
Route ComposerRoute `json:"route"`
Readiness *ReadinessSummary `json:"readiness,omitempty"`
Access ComposerAccess `json:"access"`
}
ComposerCampaign is everything the composer loads.
type ComposerChecks ¶
type ComposerChecks struct {
contentcheck.ContentCheckReport
// footer existed in an earlier version.
FooterRemovedAt *time.Time `json:"footerRemovedAt,omitempty"`
// Lint lists MJML layout warnings (image wider than its column…).
Lint []mjml.MJMLProblem `json:"lint"`
}
ComposerChecks is a content report plus what the composer shows around it.
type ComposerChecksRequest ¶
type ComposerChecksRequest struct {
Subject string `json:"subject,omitempty" maxLength:"998"`
Preheader string `json:"preheader,omitempty" maxLength:"500"`
MJML string `json:"mjml,omitempty" maxLength:"2000000"`
HTML string `json:"html,omitempty" maxLength:"2500000"`
ProbeLinks bool `json:"probeLinks,omitempty" doc:"Also request every link (slower; Send Readiness does it)"`
}
ComposerChecksRequest is content to check (unsaved edits included).
type ComposerCompileRequest ¶
type ComposerCompileRequest struct {
MJML string `json:"mjml" minLength:"1" maxLength:"2000000"`
}
ComposerCompileRequest is MJML to compile on the server.
type ComposerCompiled ¶
type ComposerCompiled struct {
HTML string `json:"html"`
Errors []mjml.MJMLProblem `json:"errors"`
Warnings []mjml.MJMLProblem `json:"warnings"`
SizeBytes int `json:"sizeBytes"`
DurationMs int64 `json:"durationMs"`
}
ComposerCompiled is the server-side compile result (gomjml, MJML 4.15).
type ComposerContentSettings ¶
type ComposerContentSettings struct {
// Minify shrinks the HTML (whitespace, inline CSS) to stay under Gmail's clipping limit.
Minify bool `json:"minify"`
}
ComposerContentSettings are composer options applied to the stored HTML.
type ComposerContext ¶
type ComposerContext struct {
Senders []ComposerSenderOption `json:"senders"`
DefaultSenderID string `json:"defaultSenderId,omitempty"`
Lists []ComposerAudienceOption `json:"lists"`
Segments []ComposerAudienceOption `json:"segments"`
Tokens []liquid.PersonalizationToken `json:"tokens"`
Members []ComposerTestRecipient `json:"members"`
BroadcastRoute ComposerRoute `json:"broadcastRoute"`
// PostalAddress is the workspace's address for footers, if set.
PostalAddress string `json:"postalAddress"`
// PublicURL is where images and links point once an email leaves ReputeCast.
PublicURL string `json:"publicUrl"`
SenderDomains []string `json:"senderDomains"`
}
ComposerContext is the workspace data the composer needs once.
type ComposerCreateCampaign ¶
type ComposerCreateCampaign struct {
Name string `json:"name,omitempty" maxLength:"200"`
TemplateID string `json:"templateId,omitempty" maxLength:"64" doc:"Start from a template (starter:<key> or a saved template id)"`
FromCampaignID string `json:"fromCampaignId,omitempty" format:"uuid" doc:"Start from a copy of another campaign's content"`
}
ComposerCreateCampaign starts a draft, blank or from a template or another campaign.
type ComposerPreview ¶
type ComposerPreview struct {
Subject string `json:"subject"`
Preheader string `json:"preheader"`
HTML string `json:"html"`
Text string `json:"text"`
FromName string `json:"fromName"`
FromEmail string `json:"fromEmail"`
Contact *ComposerPreviewContact `json:"contact,omitempty"`
Tokens []ComposerTokenValue `json:"tokens"`
// MissingFirstName counts audience contacts with no first name (they see the fallback).
MissingFirstName *int64 `json:"missingFirstName,omitempty"`
Problems []liquid.LiquidProblem `json:"problems"`
RenderedAt time.Time `json:"renderedAt"`
}
ComposerPreview is the rendered email for one recipient.
type ComposerPreviewContact ¶
type ComposerPreviewContact struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Email string `json:"email"`
// Label describes the choice ("first_name set", "fallback "there"").
Label string `json:"label"`
}
ComposerPreviewContact is who the preview is personalized for.
type ComposerPreviewContactList ¶
type ComposerPreviewContactList struct {
Items []ComposerPreviewContact `json:"items"`
}
ComposerPreviewContactList is who the preview can be personalized for.
type ComposerPreviewRequest ¶
type ComposerPreviewRequest struct {
ContactID string `json:"contactId,omitempty" format:"uuid"`
Sample string `json:"sample,omitempty" enum:"contact,no_first_name,random" default:"contact"`
Variant string `json:"variant,omitempty" enum:"A,B,C"`
Subject *string `json:"subject,omitempty" maxLength:"998"`
Preheader *string `json:"preheader,omitempty" maxLength:"500"`
HTML *string `json:"html,omitempty" maxLength:"2500000"`
}
ComposerPreviewRequest asks for the email as one recipient sees it. Subject, preheader and HTML may carry unsaved edits.
type ComposerRestoreVersion ¶
type ComposerRestoreVersion struct {
BaseVersion int `json:"baseVersion" minimum:"1"`
}
ComposerRestoreVersion makes an old version current again, as a new version.
type ComposerRoute ¶
type ComposerRoute struct {
Source string `json:"source" enum:"campaign,rule,none"`
}
ComposerRoute is the sending route of a campaign: its planned split, or the Broadcasts rule when it has none yet.
type ComposerSaveContent ¶
type ComposerSaveContent struct {
// BaseVersion is the version the editor started from. Saving on top of
// someone else's newer version fails with 409 unless Force is set.
BaseVersion int `json:"baseVersion" minimum:"1"`
Subject string `json:"subject,omitempty" maxLength:"998"`
Preheader string `json:"preheader,omitempty" maxLength:"500"`
MJML string `json:"mjml,omitempty" maxLength:"2000000"`
// HTML compiled by the composer (mjml-browser). Empty: the server
// compiles the MJML with gomjml.
HTML string `json:"html,omitempty" maxLength:"2500000"`
ABTest *ComposerABTest `json:"abTest,omitempty"`
// Label says what changed ("2-column section padding").
Label string `json:"label,omitempty" maxLength:"200"`
Source string `json:"source,omitempty" enum:"autosave,manual,import,template" default:"autosave"`
// Force saves on top of a newer version ("Keep mine").
Force bool `json:"force,omitempty"`
}
ComposerSaveContent is one save of the composer: subject, preheader, MJML and the HTML the browser compiled from it, and the A/B variants.
type ComposerSavedContent ¶
type ComposerSavedContent struct {
Version int `json:"version"`
SavedAt time.Time `json:"savedAt"`
ContentHash string `json:"contentHash"`
SizeBytes int `json:"sizeBytes"`
PlainText string `json:"plainText"`
// HTML is what was stored (minified when the campaign asks for it).
HTML string `json:"html"`
}
ComposerSavedContent is the result of a save.
type ComposerSenderOption ¶
type ComposerSenderOption struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Domain string `json:"domain"`
Verified bool `json:"verified"`
}
ComposerSenderOption is a sender the campaign can come from.
type ComposerSenderRef ¶
type ComposerSenderRef struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
ComposerSenderRef is the "From" identity.
type ComposerTestRecipient ¶
ComposerTestRecipient is a workspace member offered for test emails.
type ComposerTestSend ¶
type ComposerTestSend struct {
To []string `json:"to" minItems:"1" maxItems:"10"`
Variant string `json:"variant,omitempty" enum:"A,B,C"`
ContactID string `json:"contactId,omitempty" format:"uuid" doc:"Personalize as this contact"`
}
ComposerTestSend sends the saved content to a few addresses.
type ComposerTestSendResult ¶
type ComposerTestSendResult struct {
Sent []string `json:"sent"`
Provider string `json:"provider"`
}
ComposerTestSendResult says where the test went.
type ComposerTokenValue ¶
type ComposerTokenValue struct {
Token string `json:"token" example:"{{ first_name | default: \"there\" }}"`
Key string `json:"key"`
Value string `json:"value"`
FallbackUsed bool `json:"fallbackUsed"`
PerRecipient bool `json:"perRecipient" doc:"A link filled in per recipient at send time"`
}
ComposerTokenValue is what one token printed.
type ComposerUpdateCampaign ¶
type ComposerUpdateCampaign struct {
Name *string `json:"name,omitempty" minLength:"1" maxLength:"200"`
SenderID *string `json:"senderId,omitempty" doc:"A sender id, or empty to clear"`
ReplyTo *string `json:"replyTo,omitempty" maxLength:"254"`
Audience *ComposerAudienceInput `json:"audience,omitempty"`
Settings *ComposerContentSettings `json:"settings,omitempty"`
}
ComposerUpdateCampaign changes what isn't versioned content: name, sender, reply-to, audience and content settings. Omitted fields stay.
type ComposerVersion ¶
type ComposerVersion struct {
Version int `json:"version"`
SavedAt time.Time `json:"savedAt"`
SavedBy string `json:"savedBy"`
Label string `json:"label"`
Source string `json:"source" enum:"create,autosave,manual,restore,template,import,duplicate,api"`
SizeBytes int `json:"sizeBytes"`
Current bool `json:"current"`
}
ComposerVersion is one entry of the version history.
type ComposerVersionDetail ¶
type ComposerVersionDetail struct {
ComposerVersion
Subject string `json:"subject"`
Preheader string `json:"preheader"`
MJML string `json:"mjml"`
HTML string `json:"html"`
ABTest *ComposerABTest `json:"abTest,omitempty"`
// Sections are the labels of the sections that differ from the version before.
Sections []string `json:"sections"`
}
ComposerVersionDetail is a version with its content (compare, restore).
type ComposerVersionList ¶
type ComposerVersionList struct {
Items []ComposerVersion `json:"items"`
Total int `json:"total"`
}
ComposerVersionList is the version history, newest first.
type ListParams ¶
ListParams filters the list.
type ProviderCost ¶
type ProviderCost struct {
Provider string `json:"provider"`
Short string `json:"short"`
Cost float64 `json:"cost"`
}
ProviderCost is one provider's cost in the period.
type ReadinessSummary ¶
type ReadinessSummary struct {
Verdict string `json:"verdict" enum:"ready,warnings,blocked"`
// Issues are the blocking issues of a blocked campaign, otherwise its
// warnings.
Issues int64 `json:"issues"`
}
ReadinessSummary is the latest Send Readiness verdict.
type RouteShare ¶
type RouteShare struct {
// Short is the label used in badges ("SES", "Postal").
Percent float64 `json:"percent"`
// Planned recipients and, once sending started, how many were sent.
}
RouteShare is one sending provider's part of a campaign.
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Q *store.Queries
Audit *audit.Logger
Now func() time.Time
// Templates resolves templates when a draft starts from one.
Templates *templates.Service
// Mail sends test emails through the System route (App.Mail, read at call time).
Mail func() mailer.Sender
// URLs builds public links (unsubscribe, preferences, view online).
URLs publicurl.Builder
// Checker runs the content checks (blocklist and link probing plug in here).
Checker *contentcheck.Checker
// AfterChange runs once a save of the content, audience, sender or
// settings committed (the approvals domain re-checks open approvals).
AfterChange ChangeHook
}
Service holds the campaigns domain dependencies.
func (*Service) Checks ¶
func (s *Service) Checks(ctx context.Context, ws *store.Workspace, id uuid.UUID, in ComposerChecksRequest) (ComposerChecks, error)
Checks runs the content checks on the composer's current content.
func (*Service) Context ¶
func (s *Service) Context(ctx context.Context, ws *store.Workspace, p *authz.Principal) (ComposerContext, error)
Context returns senders, lists, segments, tokens, team and the route.
func (*Service) CountAudience ¶
func (s *Service) CountAudience(ctx context.Context, ws *store.Workspace, p *authz.Principal, def ComposerAudience) (ComposerAudienceCount, error)
CountAudience counts the recipients of a definition.
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, ws *store.Workspace, p *authz.Principal, in ComposerCreateCampaign) (ComposerCampaign, error)
Create makes a draft and returns it.
func (*Service) Detail ¶
func (s *Service) Detail(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) (ComposerCampaign, error)
Detail loads a campaign for the composer.
func (*Service) Duplicate ¶
func (s *Service) Duplicate(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) (ComposerCampaign, error)
Duplicate copies a campaign (any status) into a new draft.
func (*Service) List ¶
func (s *Service) List(ctx context.Context, ws *store.Workspace, p ListParams) (CampaignList, error)
List returns one page of campaigns with their route and readiness.
func (*Service) Preview ¶
func (s *Service) Preview(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ComposerPreviewRequest) (ComposerPreview, error)
Preview renders the campaign for a contact (or a sample).
func (*Service) PreviewContacts ¶
func (s *Service) PreviewContacts(ctx context.Context, ws *store.Workspace, id uuid.UUID, query string) (ComposerPreviewContactList, error)
PreviewContacts searches contacts of the audience.
func (*Service) Restore ¶
func (s *Service) Restore(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, version int, in ComposerRestoreVersion) (ComposerSavedContent, error)
Restore copies a version on top of the history.
func (*Service) Save ¶
func (s *Service) Save(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ComposerSaveContent) (ComposerSavedContent, error)
Save stores a new version of the content.
func (*Service) SendTest ¶
func (s *Service) SendTest(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ComposerTestSend) (ComposerTestSendResult, error)
SendTest delivers test emails through the System route. Content Writers and other members without campaigns:send can only send to themselves.
func (*Service) Summary ¶
func (s *Service) Summary(ctx context.Context, ws *store.Workspace, days int) (CampaignSummary, error)
Summary returns the last-N-days totals across campaigns.
func (*Service) Update ¶
func (s *Service) Update(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ComposerUpdateCampaign) (ComposerCampaign, error)
Update applies an UpdateCampaign.
type VersionPath ¶
type VersionPath struct {
CampaignPath
Version int `path:"version" minimum:"1"`
}
VersionPath adds a {version}.