mailchimp

package
v0.0.0-...-16adccd Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package mailchimp has types for working with the Mailchimp API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(fs *flag.FlagSet) func(c *http.Client) V3

func ImportPage

func ImportPage(ctx context.Context, cl *http.Client, page string) (body string, err error)

func PageContent

func PageContent(doc *html.Node) (body string, err error)

Types

type AbSplitOpts

type AbSplitOpts struct {
	SplitTest      string    `json:"split_test,omitempty"`
	PickWinner     string    `json:"pick_winner,omitempty"`
	WaitUnits      string    `json:"wait_units,omitempty"`
	WaitTime       int       `json:"wait_time,omitempty"`
	SplitSize      int       `json:"split_size,omitempty"`
	FromNameA      string    `json:"from_name_a,omitempty"`
	FromNameB      string    `json:"from_name_b,omitempty"`
	ReplyEmailA    string    `json:"reply_email_a,omitempty"`
	ReplyEmailB    string    `json:"reply_email_b,omitempty"`
	SubjectA       string    `json:"subject_a,omitempty"`
	SubjectB       string    `json:"subject_b,omitempty"`
	SendTimeA      time.Time `json:"send_time_a,omitempty"`
	SendTimeB      time.Time `json:"send_time_b,omitempty"`
	SendTimeWinner string    `json:"send_time_winner,omitempty"`
}

type Archive

type Archive struct {
	ArchiveContent string `json:"archive_content,omitempty"`
	ArchiveType    string `json:"archive_type,omitempty"`
}

type Campaign

type Campaign struct {
	ArchiveURL string    `json:"archive_url"`
	SentAt     time.Time `json:"send_time"`
	Settings   struct {
		Subject     string `json:"subject_line"`
		Title       string `json:"title"`
		PreviewText string `json:"preview_text"`
	} `json:"settings"`
}

type Capsule

type Capsule struct {
	Notes bool `json:"notes,omitempty"`
}

type Combinations

type Combinations struct {
	ID                 string `json:"id,omitempty"`
	SubjectLine        int    `json:"subject_line,omitempty"`
	SendTime           int    `json:"send_time,omitempty"`
	FromName           int    `json:"from_name,omitempty"`
	ReplyTo            int    `json:"reply_to,omitempty"`
	ContentDescription int    `json:"content_description,omitempty"`
	Recipients         int    `json:"recipients,omitempty"`
}

type DailySend

type DailySend struct {
	Sunday    bool `json:"sunday,omitempty"`
	Monday    bool `json:"monday,omitempty"`
	Tuesday   bool `json:"tuesday,omitempty"`
	Wednesday bool `json:"wednesday,omitempty"`
	Thursday  bool `json:"thursday,omitempty"`
	Friday    bool `json:"friday,omitempty"`
	Saturday  bool `json:"saturday,omitempty"`
}

type DeliveryStatus

type DeliveryStatus struct {
	Enabled        bool   `json:"enabled,omitempty"`
	CanCancel      bool   `json:"can_cancel,omitempty"`
	Status         string `json:"status,omitempty"`
	EmailsSent     int    `json:"emails_sent,omitempty"`
	EmailsCanceled int    `json:"emails_canceled,omitempty"`
}

type Ecommerce

type Ecommerce struct {
	TotalOrders  int `json:"total_orders,omitempty"`
	TotalSpent   int `json:"total_spent,omitempty"`
	TotalRevenue int `json:"total_revenue,omitempty"`
}

type EmailService

type EmailService interface {
	SendEmail(ctx context.Context, subject, body string) error
}

func NewMailService

func NewMailService(apiKey, listID string, c *http.Client) EmailService

type ErrorResponse

type ErrorResponse struct {
	Type     string `json:"type"`
	Title    string `json:"title"`
	Status   int    `json:"status"`
	Detail   string `json:"detail"`
	Instance string `json:"instance"`
	Errors   []any  `json:"errors"`
}
type Links struct {
	Rel          string `json:"rel,omitempty"`
	Href         string `json:"href,omitempty"`
	Method       string `json:"method,omitempty"`
	TargetSchema string `json:"targetSchema,omitempty"`
	Schema       string `json:"schema,omitempty"`
}

type ListCampaignsResp

type ListCampaignsResp struct {
	Campaigns []Campaign `json:"campaigns"`
}

func (*ListCampaignsResp) ToNewsletters

func (resp *ListCampaignsResp) ToNewsletters(mcKind string) []Newsletter

type MockEmailService

type MockEmailService struct {
}

func (MockEmailService) SendEmail

func (mock MockEmailService) SendEmail(ctx context.Context, subject, body string) error

type Newsletter

type Newsletter struct {
	Subject     string    `json:"subject"`
	Blurb       string    `json:"blurb"`
	Description string    `json:"description"`
	ArchiveURL  string    `json:"archive_url"`
	PublishedAt time.Time `json:"published_at"`
}

type PostCampaignRequest

type PostCampaignRequest struct {
	Type            string           `json:"type"`
	Recipients      Recipients       `json:"recipients,omitempty"`
	Settings        Settings         `json:"settings,omitempty"`
	VariateSettings *VariateSettings `json:"variate_settings,omitempty"`
	Tracking        *Tracking        `json:"tracking,omitempty"`
	RssOpts         *RssOpts         `json:"rss_opts,omitempty"`
	SocialCard      *SocialCard      `json:"social_card,omitempty"`
	ContentType     string           `json:"content_type,omitempty"`
}

type PostCampaignResponse

type PostCampaignResponse struct {
	ID                string          `json:"id"`
	WebID             int             `json:"web_id"`
	ParentCampaignID  string          `json:"parent_campaign_id"`
	Type              string          `json:"type"`
	CreateTime        time.Time       `json:"create_time"`
	ArchiveURL        string          `json:"archive_url"`
	LongArchiveURL    string          `json:"long_archive_url"`
	Status            string          `json:"status"`
	EmailsSent        int             `json:"emails_sent"`
	SendTime          string          `json:"send_time"`
	ContentType       string          `json:"content_type"`
	NeedsBlockRefresh bool            `json:"needs_block_refresh"`
	Resendable        bool            `json:"resendable"`
	Recipients        Recipients      `json:"recipients"`
	Settings          Settings        `json:"settings"`
	VariateSettings   VariateSettings `json:"variate_settings"`
	Tracking          Tracking        `json:"tracking"`
	RssOpts           RssOpts         `json:"rss_opts"`
	AbSplitOpts       AbSplitOpts     `json:"ab_split_opts"`
	SocialCard        SocialCard      `json:"social_card"`
	ReportSummary     ReportSummary   `json:"report_summary"`
	DeliveryStatus    DeliveryStatus  `json:"delivery_status"`
	Links             []Links         `json:"_links"`
}

type PutCampaignRequest

type PutCampaignRequest struct {
	PlainText       string    `json:"plain_text,omitempty"`
	HTML            string    `json:"html,omitempty"`
	URL             string    `json:"url,omitempty"`
	Template        *Template `json:"template,omitempty"`
	Archive         *Archive  `json:"archive,omitempty"`
	VariateContents []any     `json:"variate_contents,omitempty"`
}

type PutCampaignResponse

type PutCampaignResponse struct {
	VariateContents []VariateContents `json:"variate_contents"`
	PlainText       string            `json:"plain_text"`
	HTML            string            `json:"html"`
	ArchiveHTML     string            `json:"archive_html"`
	Links           []Links           `json:"_links"`
}

type Recipients

type Recipients struct {
	ListID         string      `json:"list_id,omitempty"`
	ListIsActive   bool        `json:"list_is_active,omitempty"`
	ListName       string      `json:"list_name,omitempty"`
	SegmentText    string      `json:"segment_text,omitempty"`
	RecipientCount int         `json:"recipient_count,omitempty"`
	SegmentOpts    SegmentOpts `json:"segment_opts,omitempty"`
}

type ReportSummary

type ReportSummary struct {
	Opens            int       `json:"opens,omitempty"`
	UniqueOpens      int       `json:"unique_opens,omitempty"`
	OpenRate         int       `json:"open_rate,omitempty"`
	Clicks           int       `json:"clicks,omitempty"`
	SubscriberClicks int       `json:"subscriber_clicks,omitempty"`
	ClickRate        int       `json:"click_rate,omitempty"`
	Ecommerce        Ecommerce `json:"ecommerce,omitempty"`
}

type RssOpts

type RssOpts struct {
	FeedURL         string    `json:"feed_url,omitempty"`
	Frequency       string    `json:"frequency,omitempty"`
	Schedule        Schedule  `json:"schedule,omitempty"`
	LastSent        time.Time `json:"last_sent,omitempty"`
	ConstrainRssImg bool      `json:"constrain_rss_img,omitempty"`
}

type Salesforce

type Salesforce struct {
	Campaign bool `json:"campaign,omitempty"`
	Notes    bool `json:"notes,omitempty"`
}

type Schedule

type Schedule struct {
	Hour            int       `json:"hour,omitempty"`
	DailySend       DailySend `json:"daily_send,omitempty"`
	WeeklySendDay   string    `json:"weekly_send_day,omitempty"`
	MonthlySendDate int       `json:"monthly_send_date,omitempty"`
}

type SegmentOpts

type SegmentOpts struct {
	SavedSegmentID    int    `json:"saved_segment_id,omitempty"`
	PrebuiltSegmentID string `json:"prebuilt_segment_id,omitempty"`
	Match             string `json:"match,omitempty"`
	Conditions        []any  `json:"conditions,omitempty"`
}

type Settings

type Settings struct {
	SubjectLine     string   `json:"subject_line,omitempty"`
	PreviewText     string   `json:"preview_text,omitempty"`
	Title           string   `json:"title,omitempty"`
	FromName        string   `json:"from_name,omitempty"`
	ReplyTo         string   `json:"reply_to,omitempty"`
	UseConversation bool     `json:"use_conversation,omitempty"`
	ToName          string   `json:"to_name,omitempty"`
	FolderID        string   `json:"folder_id,omitempty"`
	Authenticate    bool     `json:"authenticate,omitempty"`
	AutoFooter      bool     `json:"auto_footer,omitempty"`
	InlineCSS       bool     `json:"inline_css,omitempty"`
	AutoTweet       bool     `json:"auto_tweet,omitempty"`
	AutoFbPost      []string `json:"auto_fb_post,omitempty"`
	FbComments      bool     `json:"fb_comments,omitempty"`
	Timewarp        bool     `json:"timewarp,omitempty"`
	TemplateID      int      `json:"template_id,omitempty"`
	DragAndDrop     bool     `json:"drag_and_drop,omitempty"`
}

type SocialCard

type SocialCard struct {
	ImageURL    string `json:"image_url,omitempty"`
	Description string `json:"description,omitempty"`
	Title       string `json:"title,omitempty"`
}

type Template

type Template struct {
	ID       int               `json:"id,omitempty"`
	Sections map[string]string `json:"sections,omitempty"`
}

type TestEmailRequest

type TestEmailRequest struct {
	TestEmails []string `json:"test_emails"`
	SendType   string   `json:"send_type"`
}

type Tracking

type Tracking struct {
	Opens           bool       `json:"opens,omitempty"`
	HTMLClicks      bool       `json:"html_clicks,omitempty"`
	TextClicks      bool       `json:"text_clicks,omitempty"`
	GoalTracking    bool       `json:"goal_tracking,omitempty"`
	Ecomm360        bool       `json:"ecomm360,omitempty"`
	GoogleAnalytics string     `json:"google_analytics,omitempty"`
	Clicktale       string     `json:"clicktale,omitempty"`
	Salesforce      Salesforce `json:"salesforce,omitempty"`
	Capsule         Capsule    `json:"capsule,omitempty"`
}

type V3

type V3 struct {
	// contains filtered or unexported fields
}

func NewV3

func NewV3(apiKey, listID string, cl *http.Client) V3

func (V3) ListCampaigns

func (v3 V3) ListCampaigns(ctx context.Context) (*ListCampaignsResp, error)

func (V3) SendEmail

func (v3 V3) SendEmail(ctx context.Context, subject, body string) (err error)

type VariateContents

type VariateContents struct {
	ContentLabel string `json:"content_label"`
	PlainText    string `json:"plain_text"`
	HTML         string `json:"html"`
}

type VariateSettings

type VariateSettings struct {
	WinningCombinationID string         `json:"winning_combination_id,omitempty"`
	WinningCampaignID    string         `json:"winning_campaign_id,omitempty"`
	WinnerCriteria       string         `json:"winner_criteria,omitempty"`
	WaitTime             int            `json:"wait_time,omitempty"`
	TestSize             int            `json:"test_size,omitempty"`
	SubjectLines         []string       `json:"subject_lines,omitempty"`
	SendTimes            []time.Time    `json:"send_times,omitempty"`
	FromNames            []string       `json:"from_names,omitempty"`
	ReplyToAddresses     []string       `json:"reply_to_addresses,omitempty"`
	Contents             []string       `json:"contents,omitempty"`
	Combinations         []Combinations `json:"combinations,omitempty"`
}

Jump to

Keyboard shortcuts

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