gochimp3

package module
v0.0.0-...-da66ea7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: MIT Imports: 15 Imported by: 5

README

gochimp3

GoDoc Build Status Gitter chat

Introduction

Golang client for MailChimp API 3.0.

Install

Install with go get:

$ go get github.com/hanzoai/gochimp3

Usage

package main

import (
	"fmt"
	"os"

	"github.com/hanzoai/gochimp3"
)

const (
	apiKey = "YOUR_API_KEY_HERE"
)

func main() {
	client := gochimp3.New(apiKey)

	// Audience ID
	// https://mailchimp.com/help/find-audience-id/
	listID := "7f12f9b3fz"

	// Fetch list
	list, err := client.GetList(listID, nil)
	if err != nil {
		fmt.Printf("Failed to get list %s", listID)
		os.Exit(1)
	}

	// Add subscriber
	req := &gochimp3.MemberRequest{
		EmailAddress: "test@mail.com",
		Status:       "subscribed",
	}

	if _, err := list.CreateMember(req); err != nil {
		fmt.Printf("Failed to subscribe %s", req.EmailAddress)
		os.Exit(1)
	}
}
Set Timeout
client := gochimp3.New(apiKey)
client.Timeout = (5 * time.Second)

Documentation

Index

Constants

View Source
const (
	CAMPAIGN_TYPE_REGULAR   = "regular"
	CAMPAIGN_TYPE_PLAINTEXT = "plaintext"
	CAMPAIGN_TYPE_ABSPLIT   = "absplit" // deprecated by mailchimp
	CAMPAIGN_TYPE_RSS       = "rss"
	CAMPAIGN_TYPE_VARIATE   = "variate"

	CAMPAIGN_SEND_TYPE_HTML      = "html"
	CAMPAIGN_SEND_TYPE_PLAINTEXT = "plaintext"

	CONDITION_MATCH_ANY = "any"
	CONDITION_MATCH_ALL = "all"

	CONDITION_TYPE_INTERESTS = "Interests"

	CONDITION_OP_CONTAINS = "interestcontains"
)
View Source
const URIFormat string = "%s.api.mailchimp.com"

URIFormat defines the endpoint for a single app

View Source
const Version string = "/3.0"

Version the latest API version

Variables

View Source
var DatacenterRegex = regexp.MustCompile("[^-]\\w+$")

DatacenterRegex defines which datacenter to hit

Functions

This section is empty.

Types

type API

type API struct {
	Key       string
	Timeout   time.Duration
	Transport http.RoundTripper

	User  string
	Debug bool
	// contains filtered or unexported fields
}

API represents the origin of the API

func New

func New(apiKey string) *API

New creates a API

func (*API) CreateAuthorizedApp

func (api *API) CreateAuthorizedApp(body *AuthorizedAppRequest) (*AuthorizedAppCreateResponse, error)

func (*API) CreateAutomationEmailQueue

func (api *API) CreateAutomationEmailQueue(workflowID, emailID, emailAddress string) (*AutomationQueue, error)

func (*API) CreateAutomationRemovedSubscribers

func (api *API) CreateAutomationRemovedSubscribers(workflowID, emailAddress string) (*RemovedSubscriber, error)

func (*API) CreateBatchOperation

func (api *API) CreateBatchOperation(body *BatchOperationCreationRequest) (*BatchOperationResponse, error)

func (*API) CreateCampaign

func (api *API) CreateCampaign(body *CampaignCreationRequest) (*CampaignResponse, error)

func (*API) CreateCampaignFolder

func (api *API) CreateCampaignFolder(body *CampaignFolderCreationRequest) (*CampaignFolder, error)

func (*API) CreateList

func (api *API) CreateList(body *ListCreationRequest) (*ListResponse, error)

func (*API) CreateStore

func (api *API) CreateStore(req *Store) (*Store, error)

func (*API) CreateTemplate

func (api *API) CreateTemplate(body *TemplateCreationRequest) (*TemplateResponse, error)

func (*API) CreateTemplateFolder

func (api *API) CreateTemplateFolder(body *TemplateFolderCreationRequest) (*TemplateFolder, error)

func (*API) DeleteCampaign

func (api *API) DeleteCampaign(id string) (bool, error)

func (*API) DeleteList

func (api *API) DeleteList(id string) (bool, error)

func (*API) DeleteStore

func (api *API) DeleteStore(id string) (bool, error)

func (*API) DeleteTemplate

func (api *API) DeleteTemplate(id string) (bool, error)

func (*API) GetAuthorizedApps

func (api *API) GetAuthorizedApps(params *ExtendedQueryParams) (*ListOfAuthorizedApps, error)

func (*API) GetAuthroizedApp

func (api *API) GetAuthroizedApp(id string, params *BasicQueryParams) (*AuthorizedApp, error)

func (*API) GetAutomation

func (api *API) GetAutomation(id string) (*Automation, error)

TODO query params?

func (*API) GetAutomationEmail

func (api *API) GetAutomationEmail(automationID, emailID string) (*AutomationEmail, error)

func (*API) GetAutomationEmails

func (api *API) GetAutomationEmails(automationID string) (*ListOfEmails, error)

func (*API) GetAutomationQueue

func (api *API) GetAutomationQueue(workflowID, emailID, subsID string) (*AutomationQueue, error)

func (*API) GetAutomationQueues

func (api *API) GetAutomationQueues(workflowID, emailID string) (*ListOfAutomationQueues, error)

func (*API) GetAutomationRemovedSubscribers

func (api *API) GetAutomationRemovedSubscribers(workflowID string) (*ListOfRemovedSubscribers, error)

func (*API) GetAutomations

func (api *API) GetAutomations(params *BasicQueryParams) (*ListOfAutomations, error)

func (*API) GetBatchOperation

func (api *API) GetBatchOperation(id string, params *BasicQueryParams) (*BatchOperationResponse, error)

func (*API) GetBatchOperations

func (api *API) GetBatchOperations(params *ListQueryParams) (*ListOfBatchOperations, error)

func (*API) GetCampaign

func (api *API) GetCampaign(id string, params *BasicQueryParams) (*CampaignResponse, error)

func (*API) GetCampaignContent

func (api *API) GetCampaignContent(id string, params *BasicQueryParams) (*CampaignContentResponse, error)

func (*API) GetCampaignFolders

func (api *API) GetCampaignFolders(params *CampaignFolderQueryParams) (*ListOfCampaignFolders, error)

func (*API) GetCampaigns

func (api *API) GetCampaigns(params *CampaignQueryParams) (*ListOfCampaigns, error)

func (*API) GetList

func (api *API) GetList(id string, params *BasicQueryParams) (*ListResponse, error)

func (*API) GetLists

func (api *API) GetLists(params *ListQueryParams) (*ListOfLists, error)

func (*API) GetRoot

func (api *API) GetRoot(params *BasicQueryParams) (*RootResponse, error)

GetRoot queries the root of the API for stats

func (*API) GetStore

func (api *API) GetStore(id string, params QueryParams) (*Store, error)

func (*API) GetStores

func (api *API) GetStores(params *ExtendedQueryParams) (*StoreList, error)

func (*API) GetTemplate

func (api *API) GetTemplate(id string, params *BasicQueryParams) (*TemplateResponse, error)

func (*API) GetTemplateDefaultContent

func (api *API) GetTemplateDefaultContent(id string, params *BasicQueryParams) (*TemplateDefaultContentResponse, error)

func (*API) GetTemplateFolders

func (api *API) GetTemplateFolders(params *TemplateFolderQueryParams) (*ListOfTemplateFolders, error)

func (*API) GetTemplates

func (api *API) GetTemplates(params *TemplateQueryParams) (*ListOfTemplates, error)

func (*API) MemberForApiCalls

func (api *API) MemberForApiCalls(listId, email string) *Member

The Member struct returned by this should be all you need to start calling APIs for this member, meaning it should pass CanMakeRequest.

func (*API) NewListResponse

func (api *API) NewListResponse(id string) *ListResponse

NewListResponse returns a *ListResponse that is minimally viable for making API requests. This is useful for such API requests that depend on a ListResponse for its ID (e.g. CreateMember) without having to make a second network request to get the list itself.

func (*API) PauseSending

func (api *API) PauseSending(workflowID, emailID string) (bool, error)

func (*API) PauseSendingAll

func (api *API) PauseSendingAll(id string) (bool, error)

func (*API) Request

func (api *API) Request(method, path string, params QueryParams, body, response interface{}) error

Request will make a call to the actual API.

func (*API) RequestOk

func (api *API) RequestOk(method, path string) (bool, error)

RequestOk Make Request ignoring body and return true if HTTP status code is 2xx.

func (*API) SendCampaign

func (api *API) SendCampaign(id string, body *SendCampaignRequest) (bool, error)

func (*API) SendTestEmail

func (api *API) SendTestEmail(id string, body *TestEmailRequest) (bool, error)

func (*API) StartSending

func (api *API) StartSending(workflowID, emailID string) (bool, error)

func (*API) StartSendingAll

func (api *API) StartSendingAll(id string) (bool, error)

func (*API) UpdateCampaign

func (api *API) UpdateCampaign(id string, body *CampaignCreationRequest) (*CampaignResponse, error)

func (*API) UpdateCampaignContent

func (api *API) UpdateCampaignContent(id string, body *CampaignContentUpdateRequest) (*CampaignContentResponse, error)

func (*API) UpdateList

func (api *API) UpdateList(id string, body *ListCreationRequest) (*ListResponse, error)

func (*API) UpdateStore

func (api *API) UpdateStore(req *Store) (*Store, error)

func (*API) UpdateTemplate

func (api *API) UpdateTemplate(id string, body *TemplateCreationRequest) (*TemplateResponse, error)

type APIError

type APIError struct {
	Type            string `json:"type,omitempty"`
	Title           string `json:"title,omitempty"`
	Status          int    `json:"status,omitempty"`
	Detail          string `json:"detail,omitempty"`
	Instance        string `json:"instance,omitempty"`
	ReferenceNumber string `json:"ref_no,omitempty"`
	Errors          []struct {
		Field   string `json:"field"`
		Message string `json:"message"`
	} `json:"errors,omitempty"`
}

APIError is what the what the api returns on error

func (*APIError) Error

func (err *APIError) Error() string

func (*APIError) HasError

func (err *APIError) HasError() bool

HasError checks if this call had an error

func (*APIError) String

func (err *APIError) String() string

type AbuseReport

type AbuseReport struct {
	ID           string `json:"id"`
	CampaignID   string `json:"campaign_id"`
	ListID       string `json:"list_id"`
	EmailID      string `json:"email_id"`
	EmailAddress string `json:"email_address"`
	Date         string `json:"date"`
	// contains filtered or unexported fields
}

type AccountContact

type AccountContact struct {
	Company string `json:"company"`
	Addr1   string `json:"addr1"`
	Addr2   string `json:"addr2"`
	City    string `json:"city"`
	State   string `json:"state"`
	Zip     string `json:"zip"`
	Country string `json:"country"`
}

type Activity

type Activity struct {
	Day             string `json:"day"`
	EmailsSent      int    `json:"emails_sent"`
	UniqueOpens     int    `json:"unique_opens"`
	RecipientClicks int    `json:"recipient_clicks"`
	HardBounce      int    `json:"hard_bounce"`
	SoftBounce      int    `json:"soft_bounce"`
	Subs            int    `json:"subs"`
	Unsubs          int    `json:"unsubs"`
	OtherAdds       int    `json:"other_adds"`
	OtherRemoves    int    `json:"other_removes"`
	// contains filtered or unexported fields
}

type Address

type Address struct {
	Address1     string  `json:"address1"`
	Address2     string  `json:"address2"`
	City         string  `json:"city"`
	Province     string  `json:"province"`
	ProvinceCode string  `json:"province_code"`
	PostalCode   string  `json:"postal_code"`
	Country      string  `json:"country"`
	CountryCode  string  `json:"country_code"`
	Longitude    float64 `json:"longitude"`
	Latitude     float64 `json:"latitude"`
}

Address represents what it says

func (*Address) MarshalJSON

func (address *Address) MarshalJSON() ([]byte, error)

type AuthorizedApp

type AuthorizedApp struct {
	ID          int      `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Users       []string `json:"users "`
	// contains filtered or unexported fields
}

type AuthorizedAppCreateResponse

type AuthorizedAppCreateResponse struct {
	AccessToken string `json:"access_token"`
	ViewerToken string `json:"viewer_token"`
}

type AuthorizedAppRequest

type AuthorizedAppRequest struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

type Automation

type Automation struct {
	ID              string                  `json:"id"`
	CreateTime      string                  `json:"create_time"`
	StartTime       string                  `json:"start_time"`
	Status          string                  `json:"status"`
	EmailsSent      int                     `json:"emails_sent"`
	Recipients      AutomationRecipient     `json:"recipients"`
	Settings        AutomationSettingsShort `json:"settings"`
	Tracking        AutomationTracking      `json:"tracking"`
	TriggerSettings WorkflowType            `json:"trigger_settings"`
	ReportSummary   ReportSummary           `json:"report_summary"`
	// contains filtered or unexported fields
}

func (*Automation) CanMakeRequest

func (auto *Automation) CanMakeRequest() error

func (*Automation) CreateRemovedSubscribers

func (auto *Automation) CreateRemovedSubscribers(emailAddress string) (*RemovedSubscriber, error)

func (*Automation) GetEmail

func (auto *Automation) GetEmail(id string) (*AutomationEmail, error)

func (*Automation) GetEmails

func (auto *Automation) GetEmails() (*ListOfEmails, error)

func (*Automation) GetRemovedSubscribers

func (auto *Automation) GetRemovedSubscribers() (*ListOfRemovedSubscribers, error)

func (*Automation) PauseSendingAll

func (auto *Automation) PauseSendingAll() (bool, error)

func (*Automation) StartSendingAll

func (auto *Automation) StartSendingAll() (bool, error)

type AutomationDelay

type AutomationDelay struct {
	Amount    int    `json:"amount"`
	Type      string `json:"type"`
	Direction string `json:"direction"`
	Action    string `json:"action"`
}

type AutomationEmail

type AutomationEmail struct {
	ID              string                 `json:"id"`
	WorkflowID      string                 `json:"workflow_id"`
	Position        int                    `json:"position"`
	Delay           AutomationDelay        `json:"delay"`
	CreateTime      string                 `json:"create_time"`
	StartTime       string                 `json:"start_time"`
	ArchiveURL      string                 `json:"archive_url"`
	Status          string                 `json:"status"`
	EmailsSent      int                    `json:"emails_sent"`
	SendTime        string                 `json:"send_time"`
	ContentType     string                 `json:"content_type"`
	Recipients      AutomationRecipient    `json:"recipients"`
	Settings        AutomationSettingsLong `json:"settings"`
	Tracking        AutomationTracking     `json:"tracking"`
	SocialCard      SocialCard             `json:"social_card"`
	TriggerSettings WorkflowType           `json:"trigger_settings"`
	ReportSummary   ReportSummary          `json:"report_summary"`
	// contains filtered or unexported fields
}

func (*AutomationEmail) CanMakeRequest

func (email *AutomationEmail) CanMakeRequest() error

func (*AutomationEmail) CreateQueue

func (email *AutomationEmail) CreateQueue(emailAddress string) (*AutomationQueue, error)

func (*AutomationEmail) GetQueue

func (email *AutomationEmail) GetQueue(id string) (*AutomationQueue, error)

func (*AutomationEmail) GetQueues

func (email *AutomationEmail) GetQueues() (*ListOfAutomationQueues, error)

func (*AutomationEmail) PauseSending

func (email *AutomationEmail) PauseSending() (bool, error)

func (*AutomationEmail) StartSending

func (email *AutomationEmail) StartSending() (bool, error)

type AutomationOptions

type AutomationOptions struct {
	SavedSegmentID int                  `json:"saved_segment_id"`
	Match          string               `json:"match"`
	Conditions     []SegmentConditional `json:"conditions"`
}

type AutomationQueue

type AutomationQueue struct {
	ID           string `json:"id"`
	WorkflowID   string `json:"workflow_id"`
	EmailID      string `json:"email_id"`
	ListID       string `json:"list_id"`
	EmailAddress string `json:"email_address"`
	NextSend     string `json:"next_send"`
	// contains filtered or unexported fields
}

type AutomationQueueRequest

type AutomationQueueRequest struct {
	EmailAddress string `json:"email_address"`
}

type AutomationRecipient

type AutomationRecipient struct {
	ListID         string            `json:"list_id"`
	SegmentOptions AutomationOptions `json:"segment_options"`
}

type AutomationSettingsLong

type AutomationSettingsLong struct {
	Title        string   `json:"title"`
	FromName     string   `json:"from_name"`
	ReplyTo      string   `json:"reply_to"`
	Authenticate bool     `json:"authenticate"`
	AutoFooter   bool     `json:"auto_footer"`
	InlineCSS    bool     `json:"inline_css"`
	SubjectLine  string   `json:"subject_line"`
	AutoTweet    bool     `json:"auto_tweet"`
	AutoFBPost   []string `json:"auto_fb_post"`
	FBComments   bool     `json:"fb_comments"`
	TemplateID   int      `json:"template_id"`
	DragAndDrop  bool     `json:"drag_and_drop"`
}

type AutomationSettingsShort

type AutomationSettingsShort struct {
	UseConversation bool   `json:"use_conversation"`
	ToName          string `json:"to_name"`
	Title           string `json:"title"`
	FromName        string `json:"from_name"`
	ReplyTo         string `json:"reply_to"`
	Authenticate    bool   `json:"authenticate"`
	AutoFooter      bool   `json:"auto_footer"`
	InlineCSS       bool   `json:"inline_css"`
}

type AutomationTracking

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

type BasicQueryParams

type BasicQueryParams struct {
	Status        string
	SortField     string
	SortDirection string
	Fields        []string
	ExcludeFields []string
}

BasicQueryParams basic filter queries

func (*BasicQueryParams) Params

func (q *BasicQueryParams) Params() map[string]string

type BatchOperation

type BatchOperation struct {
	Method      string     `json:"method"`
	Path        string     `json:"path"`
	Params      url.Values `json:"params,omitempty"`
	Body        string     `json:"body"`
	OperationID string     `json:"operation_id,omitempty"`
	// contains filtered or unexported fields
}

type BatchOperationCreationRequest

type BatchOperationCreationRequest struct {
	Operations []BatchOperation `json:"operations"`
}

type BatchOperationResponse

type BatchOperationResponse struct {
	Links []Link `json:"_links,omitempty"`

	ID                 string `json:"id"`
	Status             string `json:"status"`
	TotalOperations    int    `json:"total_operations"`
	FinishedOperations int    `json:"finished_operations"`
	ErroredOperations  int    `json:"errored_operations"`
	SubmittedAt        string `json:"submitted_at,omitempty"`
	CompletedAt        string `json:"completed_at,omitempty"`
	ResponseBodyUrl    string `json:"response_body_url"`
	// contains filtered or unexported fields
}

type BatchSubscribeMembersError

type BatchSubscribeMembersError struct {
	EmailAddress string `json:"email_address"`
	ErrorMessage string `json:"error"`
	ErrorCode    string `json:"error_code"`
}

------------------------------------------------------------------------------------------------ Batch subscribe list members ------------------------------------------------------------------------------------------------

type BatchSubscribeMembersRequest

type BatchSubscribeMembersRequest struct {
	Members        []MemberRequest `json:"members"`
	UpdateExisting bool            `json:"update_existing"`
}

type BatchSubscribeMembersResponse

type BatchSubscribeMembersResponse struct {
	NewMembers     []Member                     `json:"new_members"`
	UpdatedMembers []Member                     `json:"updated_members"`
	ErrorMessages  []BatchSubscribeMembersError `json:"errors"`
	TotalCreated   int                          `json:"total_created"`
	TotalUpdated   int                          `json:"total_updated"`
	ErrorCount     int                          `json:"error_count"`
	// contains filtered or unexported fields
}

type CampaignContentResponse

type CampaignContentResponse struct {
	PlainText   string `json:"plain_text"`
	Html        string `json:"html"`
	ArchiveHtml string `json:"archive_html"`
	// contains filtered or unexported fields
}

type CampaignContentTemplateRequest

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

type CampaignContentUpdateRequest

type CampaignContentUpdateRequest struct {
	PlainText string                          `json:"plain_text"`
	Html      string                          `json:"html"`
	Url       string                          `json:"url"`
	Template  *CampaignContentTemplateRequest `json:"template,omitempty"`
}

type CampaignCreationRecipients

type CampaignCreationRecipients struct {
	ListId         string                         `json:"list_id"`
	SegmentOptions CampaignCreationSegmentOptions `json:"segment_opts"`
}

type CampaignCreationRequest

type CampaignCreationRequest struct {
	Type       string                     `json:"type"` // must be one of the CAMPAIGN_TYPE_* consts
	Recipients CampaignCreationRecipients `json:"recipients"`
	Settings   CampaignCreationSettings   `json:"settings"`
	// variate_settings not implemented
	Tracking CampaignTracking `json:"tracking"`
}

type CampaignCreationSegmentOptions

type CampaignCreationSegmentOptions struct {
	SavedSegmentId int    `json:"saved_segment_id"`
	Match          string `json:"match"` // one of CONDITION_MATCH_*

	// this accepts various payloads. See http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/#create-post_campaigns
	Conditions interface{} `json:"conditions"`
}

type CampaignCreationSettings

type CampaignCreationSettings struct {
	SubjectLine     string `json:"subject_line"`
	PreviewText     string `json:"preview_text"`
	Title           string `json:"title"`
	FromName        string `json:"from_name"`
	ReplyTo         string `json:"reply_to"`
	UseConversation bool   `json:"use_conversation"`
	ToName          string `json:"to_name"`
	FolderId        string `json:"folder_id"`
	Authenticate    bool   `json:"authenticate"`
	AutoFooter      bool   `json:"auto_footer"`
	InlineCss       bool   `json:"inline_css"`
	AutoTweet       bool   `json:"auto_tweet"`
	FbComments      bool   `json:"fb_comments"`
	TemplateId      uint   `json:"template_id"`
}

type CampaignDefaults

type CampaignDefaults struct {
	FromName  string `json:"from_name"`
	FromEmail string `json:"from_email"`
	Subject   string `json:"subject"`
	Language  string `json:"language"`
}

type CampaignDeliveryStatus

type CampaignDeliveryStatus struct {
	Enabled bool `json:"enabled"`
}

type CampaignEcommerce

type CampaignEcommerce struct {
	TotalOrders  int `json:"total_orders"`
	TotalSpent   int `json:"total_spent"`
	TotalRevenue int `json:"total_revenue"`
}

type CampaignFolder

type CampaignFolder struct {
	Name  string `json:"name"`
	ID    string `json:"id"`
	Count uint   `json:"count"`
	// contains filtered or unexported fields
}

type CampaignFolderCreationRequest

type CampaignFolderCreationRequest struct {
	Name string `json:"name"`
}

type CampaignFolderQueryParams

type CampaignFolderQueryParams struct {
	ExtendedQueryParams
}

type CampaignQueryParams

type CampaignQueryParams struct {
	ExtendedQueryParams

	Type             string
	Status           string
	BeforeSendTime   string
	SinceSendTime    string
	BeforeCreateTime string
	SinceCreateTime  string
	ListId           string
	FolderId         string
	SortField        string
	SortDir          string
}

func (CampaignQueryParams) Params

func (q CampaignQueryParams) Params() map[string]string

type CampaignReportSummary

type CampaignReportSummary struct {
	Opens            int               `json:"opens"`
	UniqueOpens      int               `json:"unique_opens"`
	OpenRate         float32           `json:"open_rate"`
	Clicks           int               `json:"clicks"`
	SubscriberClicks int               `json:"subscriber_clicks"`
	ClickRate        float32           `json:"click_rate"`
	Ecommerce        CampaignEcommerce `json:"ecommerce"`
}

type CampaignResponse

type CampaignResponse struct {
	ID                string                     `json:"id"`
	WebID             uint                       `json:"web_id"`
	Type              string                     `json:"type"`
	CreateTime        string                     `json:"create_time"`
	ArchiveUrl        string                     `json:"archive_url"`
	LongArchiveUrl    string                     `json:"long_archive_url"`
	Status            string                     `json:"status"`
	EmailsSent        uint                       `json:"emails_sent"`
	SendTime          string                     `json:"send_time"`
	ContentType       string                     `json:"content_type"`
	NeedsBlockRefresh bool                       `json:"needs_block_refresh"`
	Recipients        CampaignResponseRecipients `json:"recipients"`
	Settings          CampaignResponseSettings   `json:"settings"`
	Tracking          CampaignTracking           `json:"tracking"`
	ReportSummary     CampaignReportSummary      `json:"report_summary"`
	DeliveryStatus    CampaignDeliveryStatus     `json:"delivery_status"`
	// contains filtered or unexported fields
}

func (CampaignResponse) CanMakeRequest

func (campaign CampaignResponse) CanMakeRequest() error

type CampaignResponseRecipients

type CampaignResponseRecipients struct {
	ListId         string `json:"list_id"`
	ListName       string `json:"list_name"`
	SegmentText    string `json:"segment_text"`
	RecipientCount int    `json:"recipient_count"`
}

type CampaignResponseSettings

type CampaignResponseSettings struct {
	SubjectLine     string `json:"subject_line"`
	PreviewText     string `json:"preview_text"`
	Title           string `json:"title"`
	FromName        string `json:"from_name"`
	ReplyTo         string `json:"reply_to"`
	UseConversation bool   `json:"use_conversation"`
	ToName          string `json:"to_name"`
	FolderId        string `json:"folder_id"`
	Authenticate    bool   `json:"authenticate"`
	AutoFooter      bool   `json:"auto_footer"`
	InlineCss       bool   `json:"inline_css"`
	AutoTweet       bool   `json:"auto_tweet"`
	FbComments      bool   `json:"fb_comments"`
	Timewarp        bool   `json:"timewarp"`
	TemplateId      uint   `json:"template_id"`
	DragAndDrop     bool   `json:"drag_and_drop"`
}

type CampaignTracking

type CampaignTracking struct {
	Opens           bool   `json:"opens"`
	HtmlClicks      bool   `json:"html_clicks"`
	TextClicks      bool   `json:"text_clicks"`
	GoalTracking    bool   `json:"goal_tracking"`
	Ecomm360        bool   `json:"ecomm360"`
	GoogleAnalytics string `json:"google_analytics"`
	Clicktale       string `json:"clicktale"`
}

type Capsule

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

type Cart

type Cart struct {
	APIError

	// Required
	Customer     Customer   `json:"customer"`
	CurrencyCode string     `json:"currency_code"`
	OrderTotal   float64    `json:"order_total"`
	Lines        []LineItem `json:"lines"`

	// Optional
	ID          string  `json:"id,omitempty"`
	CampaignID  string  `json:"campaign_id,omitempty"`
	CheckoutURL string  `json:"checkout_url,omitempty"`
	TaxTotal    float64 `json:"tax_total,omitempty"`

	// Response only
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	Links     []Link    `json:"_links,omitempty"`
}

func (*Cart) MarshalJSON

func (cart *Cart) MarshalJSON() ([]byte, error)

type CartList

type CartList struct {
	APIError

	Carts      []Cart `json:"cart"`
	TotalItems int    `json:"total_items"`
	Links      []Link `json:"_links"`
}

type Client

type Client struct {
	Client  string `json:"client"`
	Members int    `json:"members"`
	ListID  string `json:"list_id"`
	// contains filtered or unexported fields
}

type Contact

type Contact struct {
	Company     string `json:"company"`
	Address1    string `json:"address1"`
	Address2    string `json:"address2"`
	City        string `json:"city"`
	State       string `json:"state"`
	Zip         string `json:"zip"`
	Country     string `json:"country"`
	PhoneNumber string `json:"phone"`
}

Contact defines a single contact

type Customer

type Customer struct {
	// Required
	ID string `json:"id"`

	// Optional
	EmailAddress string   `json:"email_address,omitempty"`
	OptInStatus  bool     `json:"opt_in_status,omitempty"`
	Company      string   `json:"company,omitempty"`
	FirstName    string   `json:"first_name,omitempty"`
	LastName     string   `json:"last_name,omitempty"`
	OrdersCount  int      `json:"orders_count,omitempty"`
	TotalSpent   float64  `json:"total_spent,omitempty"`
	Address      *Address `json:"address,omitempty"`

	// Response
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
	Links     []Link `json:"_links,omitempty"`
}

Customer defines a mailchimp customer

type CustomerList

type CustomerList struct {
	APIError

	Customers  []Customer `json:"customer"`
	TotalItems int        `json:"total_items"`
	Links      []Link     `json:"_links"`
}

type EventRequest

type EventRequest struct {
	Name       string            `json:"name"`
	Properties map[string]string `json:"properties,omitempty"`
	IsSyncing  bool              `json:"is_syncing,omitempty"`
	OccurredAt *time.Time        `json:"occurred_at,omitempty"`
}

type ExtendedQueryParams

type ExtendedQueryParams struct {
	BasicQueryParams

	Count  int
	Offset int
}

ExtendedQueryParams includes a count and offset

func (*ExtendedQueryParams) Params

func (q *ExtendedQueryParams) Params() map[string]string

type GrowthHistory

type GrowthHistory struct {
	ListID   string `json:"list_id"`
	Month    string `json:"month"`
	Existing int    `json:"existing"`
	Imports  int    `json:"imports"`
	OptIns   int    `json:"optins"`
	// contains filtered or unexported fields
}

type Highrise

type Highrise struct {
	Campaign bool `json:"campaign"`
	Notes    bool `json:"notes"`
}

type HookEvents

type HookEvents struct {
	Subscribe   bool `json:"subscribe"`
	Unsubscribe bool `json:"unsubscribe"`
	Profile     bool `json:"profile"`
	Cleaned     bool `json:"cleaned"`
	Upemail     bool `json:"upemail"`
	Campaign    bool `json:"campaign"`
}

type HookSources

type HookSources struct {
	User  bool `json:"user"`
	Admin bool `json:"admin"`
	API   bool `json:"api"`
}

type IndustryStats

type IndustryStats struct {
	OpenRate   float64 `json:"open_rate"`
	BounceRate float64 `json:"bounce_rate"`
	ClickRate  float64 `json:"click_rate"`
}

type Interest

type Interest struct {
	CategoryID   string `json:"category_id"`
	ListID       string `json:"list_id"`
	ID           string `json:"id"`
	Name         string `json:"name"`
	DisplayOrder int    `json:"display_order"`
	// contains filtered or unexported fields
}

type InterestCategoriesQueryParams

type InterestCategoriesQueryParams struct {
	ExtendedQueryParams

	Type string `json:"type"`
}

func (*InterestCategoriesQueryParams) Params

type InterestCategory

type InterestCategory struct {
	InterestCategoryRequest

	ListID string `json:"list_id"`
	ID     string `json:"id"`
	// contains filtered or unexported fields
}

func (*InterestCategory) CanMakeRequest

func (interestCatgory *InterestCategory) CanMakeRequest() error

func (*InterestCategory) CreateInterest

func (interestCategory *InterestCategory) CreateInterest(body *InterestRequest) (*Interest, error)

type InterestCategoryRequest

type InterestCategoryRequest struct {
	Title        string `json:"title"`
	DisplayOrder int    `json:"display_order"`
	Type         string `json:"type"`
}

type InterestRequest

type InterestRequest struct {
	Name         string `json:"name"`
	DisplayOrder int    `json:"display_order"`
}

type InterestsCondition

type InterestsCondition struct {
	ConditionType string   `json:"condition_type"`
	Field         string   `json:"field"`
	Op            string   `json:"op"`
	Value         []string `json:"value"`
}

type LineItem

type LineItem struct {
	// Required
	ID               string  `json:"id"`
	ProductID        string  `json:"product_id"`
	ProductVariantID string  `json:"product_variant_id"`
	Quantity         int     `json:"quantity"`
	Price            float64 `json:"price"`

	// Optional
	ProductTitle        string `json:"product_title,omitempty"`
	ProductVariantTitle string `json:"product_variant_title,omitempty"`
}

LineItem defines a mailchimp cart or order line item

type Link struct {
	Rel          string `json:"re"`
	Href         string `json:"href"`
	Method       string `json:"method"`
	TargetSchema string `json:"targetSchema"`
	Schema       string `json:"schema"`
}

Link refereneces another object

type ListCreationRequest

type ListCreationRequest struct {
	Name                string           `json:"name"`
	Contact             Contact          `json:"contact"`
	PermissionReminder  string           `json:"permission_reminder"`
	UseArchiveBar       bool             `json:"use_archive_bar"`
	CampaignDefaults    CampaignDefaults `json:"campaign_defaults"`
	NotifyOnSubscribe   string           `json:"notify_on_subscribe"`
	NotifyOnUnsubscribe string           `json:"notify_on_unsubscribe"`
	EmailTypeOption     bool             `json:"email_type_option"`
	Visibility          string           `json:"visibility"`
}

type ListOfAbuseReports

type ListOfAbuseReports struct {
	ListID  string        `json:"list_id"`
	Reports []AbuseReport `json:"abuse_reports"`
	// contains filtered or unexported fields
}

type ListOfActivity

type ListOfActivity struct {
	ListID     string     `json:"list_id"`
	Activities []Activity `json:"activity"`
	// contains filtered or unexported fields
}

type ListOfAuthorizedApps

type ListOfAuthorizedApps struct {
	Apps []AuthorizedApp `json:""`
	// contains filtered or unexported fields
}

type ListOfAutomationQueues

type ListOfAutomationQueues struct {
	WorkflowID string            `json:"workflow_id"`
	EmailID    string            `json:"email_id"`
	Queues     []AutomationQueue `json:"queue"`
	// contains filtered or unexported fields
}

type ListOfAutomations

type ListOfAutomations struct {
	Automations []Automation `json:"automations"`
	// contains filtered or unexported fields
}

type ListOfBatchOperations

type ListOfBatchOperations struct {
	BatchOperations []BatchOperationResponse `json:"batches"`
	// contains filtered or unexported fields
}

type ListOfCampaignFolders

type ListOfCampaignFolders struct {
	Folders []CampaignFolder `json:"folders"`
	// contains filtered or unexported fields
}

type ListOfCampaigns

type ListOfCampaigns struct {
	Campaigns []CampaignResponse `json:"campaigns"`
	// contains filtered or unexported fields
}

type ListOfClients

type ListOfClients struct {
	ListID  string   `json:"list_id"`
	Clients []Client `json:"clients"`
	// contains filtered or unexported fields
}

type ListOfEmails

type ListOfEmails struct {
	Emails []AutomationEmail `json:"emails"`
	// contains filtered or unexported fields
}

type ListOfGrownHistory

type ListOfGrownHistory struct {
	ListID  string          `json:"list_id"`
	History []GrowthHistory `json:"history"`
	// contains filtered or unexported fields
}

type ListOfInterestCategories

type ListOfInterestCategories struct {
	ListID     string             `json:"list_id"`
	Categories []InterestCategory `json:"categories"`
	// contains filtered or unexported fields
}

type ListOfInterests

type ListOfInterests struct {
	Interests  []Interest `json:"interests"`
	CategoryID string     `json:"category_id"`
	ListID     string     `json:"list_id"`
	TotalItems int        `json:"total_items"`
	// contains filtered or unexported fields
}

type ListOfLists

type ListOfLists struct {
	Lists []ListResponse `json:"lists"`
	// contains filtered or unexported fields
}

type ListOfMemberActivity

type ListOfMemberActivity struct {
	EmailID  string     `json:"email_id"`
	ListID   string     `json:"list_id"`
	Activity []Activity `json:"activity"`
	// contains filtered or unexported fields
}

type ListOfMemberGoals

type ListOfMemberGoals struct {
	EmailID string       `json:"email_id"`
	ListID  string       `json:"list_id"`
	Goals   []MemberGoal `json:"goals"`
	// contains filtered or unexported fields
}

type ListOfMemberNotes

type ListOfMemberNotes struct {
	EmailID string           `json:"email_id"`
	ListID  string           `json:"list_id"`
	Notes   []MemberNoteLong `json:"notes"`
	// contains filtered or unexported fields
}

type ListOfMemberTags

type ListOfMemberTags struct {
	Tags []MemberTagLong `json:"tags"`
	// contains filtered or unexported fields
}

type ListOfMembers

type ListOfMembers struct {
	ListID  string   `json:"list_id"`
	Members []Member `json:"members"`
	// contains filtered or unexported fields
}

type ListOfMergeFields

type ListOfMergeFields struct {
	ListID      string       `json:"list_id"`
	MergeFields []MergeField `json:"merge_fields"`
	// contains filtered or unexported fields
}

type ListOfRemovedSubscribers

type ListOfRemovedSubscribers struct {
	WorkflowID  string              `json:"workflow_id"`
	Subscribers []RemovedSubscriber `json:"subscribers"`
	// contains filtered or unexported fields
}

type ListOfSegments

type ListOfSegments struct {
	Segments []Segment `json:"segments"`
	ListID   string    `json:"list_id"`
	// contains filtered or unexported fields
}

type ListOfTemplateFolders

type ListOfTemplateFolders struct {
	Folders []TemplateFolder `json:"folders"`
	// contains filtered or unexported fields
}

type ListOfTemplates

type ListOfTemplates struct {
	Templates []TemplateResponse `json:"templates"`
	// contains filtered or unexported fields
}

type ListOfWebHooks

type ListOfWebHooks struct {
	ListID   string    `json:"list_id"`
	WebHooks []WebHook `json:"webhooks"`
	// contains filtered or unexported fields
}

type ListQueryParams

type ListQueryParams struct {
	ExtendedQueryParams

	BeforeDateCreated      string
	SinceDateCreated       string
	BeforeCampaignLastSent string
	SinceCampaignLastSent  string
	Email                  string
}

func (ListQueryParams) Params

func (q ListQueryParams) Params() map[string]string

type ListResponse

type ListResponse struct {
	ListCreationRequest

	ID                string   `json:"id"`
	DateCreated       string   `json:"date_created"`
	ListRating        int      `json:"list_rating"`
	SubscribeURLShort string   `json:"subscribe_url_short"`
	SubscribeURLLong  string   `json:"subscribe_url_long"`
	BeamerAddress     string   `json:"beamer_address"`
	Modules           []string `json:"modules"`
	Stats             Stats    `json:"stats"`
	// contains filtered or unexported fields
}

func (*ListResponse) AddOrUpdateMember

func (list *ListResponse) AddOrUpdateMember(id string, body *MemberRequest) (*Member, error)

func (*ListResponse) BatchModifySegment

func (list *ListResponse) BatchModifySegment(id string, body *SegmentBatchRequest) (*SegmentBatchResponse, error)

BatchModifySegment adds and/or removes one or more emails from a static segment using POST /lists/{list_id}/segments/{segment_id}. NOTE: You MUST check SegmentBatchResponse for errors, as there may be multiple errors (i.e. multiple failures to add/remove), and err may still be nil.

func (*ListResponse) BatchSubscribeMembers

func (list *ListResponse) BatchSubscribeMembers(body *BatchSubscribeMembersRequest) (*BatchSubscribeMembersResponse, error)

func (*ListResponse) CanMakeRequest

func (list *ListResponse) CanMakeRequest() error

func (*ListResponse) CreateInterestCategory

func (list *ListResponse) CreateInterestCategory(body *InterestCategoryRequest) (*InterestCategory, error)

func (*ListResponse) CreateMember

func (list *ListResponse) CreateMember(body *MemberRequest) (*Member, error)

func (*ListResponse) CreateMergeField

func (list *ListResponse) CreateMergeField(body *MergeFieldRequest) (*MergeField, error)

func (*ListResponse) CreateSegment

func (list *ListResponse) CreateSegment(body *SegmentRequest) (*Segment, error)

func (*ListResponse) CreateWebHooks

func (list *ListResponse) CreateWebHooks(body *WebHookRequest) (*WebHook, error)

func (*ListResponse) DeleteInterestCategory

func (list *ListResponse) DeleteInterestCategory(id string) (bool, error)

func (*ListResponse) DeleteMember

func (list *ListResponse) DeleteMember(id string) (bool, error)

func (*ListResponse) DeleteMemberPermanent

func (list *ListResponse) DeleteMemberPermanent(id string) (bool, error)

func (*ListResponse) DeleteSegment

func (list *ListResponse) DeleteSegment(id string) (bool, error)

func (*ListResponse) DeleteWebHook

func (list *ListResponse) DeleteWebHook(id string) (bool, error)

func (*ListResponse) GetAbuseReport

func (list *ListResponse) GetAbuseReport(id string, params *ExtendedQueryParams) (*AbuseReport, error)

func (*ListResponse) GetAbuseReports

func (list *ListResponse) GetAbuseReports(params *ExtendedQueryParams) (*ListOfAbuseReports, error)

func (*ListResponse) GetActivity

func (list *ListResponse) GetActivity(params *BasicQueryParams) (*ListOfActivity, error)

func (*ListResponse) GetClients

func (list *ListResponse) GetClients(params *BasicQueryParams) (*ListOfClients, error)

func (*ListResponse) GetGrowthHistory

func (list *ListResponse) GetGrowthHistory(params *ExtendedQueryParams) (*ListOfGrownHistory, error)

func (*ListResponse) GetGrowthHistoryForMonth

func (list *ListResponse) GetGrowthHistoryForMonth(month string, params *BasicQueryParams) (*GrowthHistory, error)

func (*ListResponse) GetInterest

func (list *ListResponse) GetInterest(interestCategoryID, interestID string, params *BasicQueryParams) (*Interest, error)

func (*ListResponse) GetInterestCategories

func (list *ListResponse) GetInterestCategories(params *InterestCategoriesQueryParams) (*ListOfInterestCategories, error)

func (*ListResponse) GetInterestCategory

func (list *ListResponse) GetInterestCategory(id string, params *BasicQueryParams) (*InterestCategory, error)

func (*ListResponse) GetInterests

func (list *ListResponse) GetInterests(interestCategoryID string, params *ExtendedQueryParams) (*ListOfInterests, error)

func (*ListResponse) GetMember

func (list *ListResponse) GetMember(id string, params *BasicQueryParams) (*Member, error)

func (*ListResponse) GetMembers

func (list *ListResponse) GetMembers(params *InterestCategoriesQueryParams) (*ListOfMembers, error)

func (*ListResponse) GetMergeField

func (list *ListResponse) GetMergeField(params *MergeFieldParams) (*MergeField, error)

func (*ListResponse) GetMergeFields

func (list *ListResponse) GetMergeFields(params *MergeFieldsParams) (*ListOfMergeFields, error)

func (*ListResponse) GetSegment

func (list *ListResponse) GetSegment(id string, params *BasicQueryParams) (*Segment, error)

func (*ListResponse) GetSegments

func (list *ListResponse) GetSegments(params *SegmentQueryParams) (*ListOfSegments, error)

func (*ListResponse) GetWebHook

func (list *ListResponse) GetWebHook(id string) (*WebHook, error)

func (*ListResponse) GetWebHooks

func (list *ListResponse) GetWebHooks() (*ListOfWebHooks, error)

func (*ListResponse) SearchMembers

func (list *ListResponse) SearchMembers(params *SearchMembersQueryParams) (*SearchMembersResponse, error)

func (*ListResponse) UpdateInterestCategory

func (list *ListResponse) UpdateInterestCategory(id string, body *InterestCategoryRequest) (*InterestCategory, error)

func (*ListResponse) UpdateMember

func (list *ListResponse) UpdateMember(id string, body *MemberRequest) (*Member, error)

func (*ListResponse) UpdateSegment

func (list *ListResponse) UpdateSegment(id string, body *SegmentRequest) (*Segment, error)

func (*ListResponse) UpdateWebHook

func (list *ListResponse) UpdateWebHook(id string, body *WebHookRequest) (*WebHook, error)

type MarketingPermission

type MarketingPermission struct {
	MarketingPermissionID string `json:"marketing_permission_id"`
	Text                  string `json:"text"`
	Enabled               bool   `json:"enabled"`
}

type MarketingPermissions

type MarketingPermissions []MarketingPermission

type Matches

type Matches struct {
	Members    []Member `json:"members"`
	TotalItems int64    `json:"total_items"`
}

type Member

type Member struct {
	MemberResponse

	ID            string          `json:"id"`
	ListID        string          `json:"list_id"`
	UniqueEmailID string          `json:"unique_email_id"`
	EmailType     string          `json:"email_type"`
	Stats         MemberStats     `json:"stats"`
	MemberRating  int             `json:"member_rating"`
	LastChanged   string          `json:"last_changed"`
	EmailClient   string          `json:"email_client"`
	LastNote      MemberNoteShort `json:"last_note"`
	// contains filtered or unexported fields
}

func (*Member) AddEvent

func (m *Member) AddEvent(e *EventRequest) error

func (*Member) AddSimpleEvent

func (m *Member) AddSimpleEvent(name string) error

func (*Member) CanMakeRequest

func (mem *Member) CanMakeRequest() error

func (*Member) CreateNote

func (mem *Member) CreateNote(msg string) (*MemberNoteLong, error)

func (*Member) DeleteNote

func (mem *Member) DeleteNote(id string) (bool, error)

func (*Member) GetActivity

func (mem *Member) GetActivity(params *BasicQueryParams) (*ListOfMemberActivity, error)

func (*Member) GetGoals

func (mem *Member) GetGoals(params *BasicQueryParams) (*ListOfMemberGoals, error)

func (*Member) GetNote

func (mem *Member) GetNote(id string, params *BasicQueryParams) (*MemberNoteLong, error)

func (*Member) GetNotes

func (mem *Member) GetNotes(params *ExtendedQueryParams) (*ListOfMemberNotes, error)

func (*Member) GetTags

func (mem *Member) GetTags(params *ExtendedQueryParams) (*ListOfMemberTags, error)

func (*Member) SetIdByMail

func (mem *Member) SetIdByMail(email string) *Member

func (*Member) UpdateNote

func (mem *Member) UpdateNote(id, msg string) (*MemberNoteLong, error)

func (*Member) UpdateTags

func (mem *Member) UpdateTags(tags []UpdateMemberTag) (*ListOfMemberTags, error)

func (*Member) WithApi

func (mem *Member) WithApi(api *API) *Member

type MemberActivity

type MemberActivity struct {
	Action         string `json:"action"`
	Timestamp      string `json:"timestamp"`
	URL            string `json:"url"`
	Type           string `json:"type"`
	CampaignID     string `json:"campaign_id"`
	Title          string `json:"title"`
	ParentCampaign string `json:"parent_campaign"`
}

type MemberGoal

type MemberGoal struct {
	ID            int    `json:"goal_id"`
	Event         string `json:"event"`
	LastVisitedAt string `json:"last_visited_at"`
	Data          string `json:"data"`
}

type MemberLocation

type MemberLocation struct {
	Latitude    float64 `json:"latitude"`
	Longitude   float64 `json:"longitude"`
	GMTOffset   int     `json:"gmtoff"`
	DSTOffset   int     `json:"dstoff"`
	CountryCode string  `json:"country_code"`
	Timezone    string  `json:"timezone"`
}

func (*MemberLocation) MarshalJSON

func (loc *MemberLocation) MarshalJSON() ([]byte, error)

type MemberNoteLong

type MemberNoteLong struct {
	ID        int    `json:"id"`
	CreatedAt string `json:"created_at"`
	CreatedBy string `json:"created_by"`
	UpdatedAt string `json:"updated_at"`
	Note      string `json:"note"`
	ListID    string `json:"list_id"`
	EmailID   string `json:"email_id"`
	// contains filtered or unexported fields
}

type MemberNoteShort

type MemberNoteShort struct {
	ID        int    `json:"note_id"`
	CreatedAt string `json:"created_at"`
	CreatedBy string `json:"created_by"`
	Note      string `json:"note"`
}

type MemberRequest

type MemberRequest struct {
	EmailAddress         string                 `json:"email_address"`
	EmailType            string                 `json:"email_type,omitempty"`
	Status               string                 `json:"status"`
	StatusIfNew          string                 `json:"status_if_new,omitempty"`
	MergeFields          map[string]interface{} `json:"merge_fields,omitempty"`
	Interests            map[string]bool        `json:"interests,omitempty"`
	Language             string                 `json:"language"`
	VIP                  bool                   `json:"vip"`
	Location             *MemberLocation        `json:"location,omitempty"`
	MarketingPermissions *MarketingPermissions  `json:"marketing_permissions,omitempty"`
	IPOpt                string                 `json:"ip_opt,omitempty"`
	IPSignup             string                 `json:"ip_signup,omitempty"`
	Tags                 []string               `json:"tags,omitempty"`
	TimestampSignup      string                 `json:"timestamp_signup,omitempty"`
	TimestampOpt         string                 `json:"timestamp_opt,omitempty"`
}

type MemberResponse

type MemberResponse struct {
	EmailAddress    string                 `json:"email_address"`
	EmailType       string                 `json:"email_type,omitempty"`
	Status          string                 `json:"status"`
	StatusIfNew     string                 `json:"status_if_new,omitempty"`
	MergeFields     map[string]interface{} `json:"merge_fields,omitempty"`
	Interests       map[string]bool        `json:"interests,omitempty"`
	Language        string                 `json:"language"`
	VIP             bool                   `json:"vip"`
	Location        *MemberLocation        `json:"location,omitempty"`
	IPOpt           string                 `json:"ip_opt,omitempty"`
	IPSignup        string                 `json:"ip_signup,omitempty"`
	Tags            []MemberTag            `json:"tags,omitempty"`
	TimestampSignup string                 `json:"timestamp_signup,omitempty"`
	TimestampOpt    string                 `json:"timestamp_opt,omitempty"`
}

type MemberStats

type MemberStats struct {
	AvgOpenRate  float64 `json:"avg_open_rate"`
	AvgClickRate float64 `json:"avg_click_rate"`
}

type MemberTag

type MemberTag struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type MemberTagLong

type MemberTagLong struct {
	ID        int     `json:"id"`
	Name      string  `json:"name"`
	DataAdded *string `json:"date_added,omitempty"`
	Status    string  `json:"status,omitempty"`
	// contains filtered or unexported fields
}

type MergeField

type MergeField struct {
	MergeID      int               `json:"merge_id"`
	Tag          string            `json:"tag"`
	Name         string            `json:"name"`
	Type         string            `json:"type"`
	Required     bool              `json:"required"`
	DefaultValue string            `json:"default_value"`
	Public       bool              `json:"public"`
	DisplayOrder int               `json:"display_order"`
	Options      MergeFieldOptions `json:"options"`
	HelpText     string            `json:"help_text"`
	ListID       string            `json:"list_id"`
	// contains filtered or unexported fields
}

type MergeFieldOptions

type MergeFieldOptions struct {
	DefaultCountry int      `json:"default_Country"`
	PhoneFormat    string   `json:"phone_format"`
	DateFormat     string   `json:"date_format"`
	Choices        []string `json:"choices,omitempty"`
	Size           int      `json:"size"`
}

type MergeFieldParams

type MergeFieldParams struct {
	BasicQueryParams

	MergeID string `json:"_"`
}

type MergeFieldRequest

type MergeFieldRequest struct {
	// The tag used in MailChimp campaigns and for the /members endpoint.
	Tag string `json:"tag"`

	// The name of the merge field.
	Name string `json:"name"`

	// The type for the merge field.
	// Possible Values: text, number, address, phone, date, url, image, url, radio, dropdown, birthday, zip
	Type string `json:"type"`

	// The boolean value if the merge field is required.
	Required bool `json:"required"`

	// The default value for the merge field if null.
	DefaultValue string `json:"default_value"`

	// Whether the merge field is displayed on the signup form.
	Public bool `json:"public"`

	// The order that the merge field displays on the list signup form.
	DisplayOrder int `json:"display_order"`

	// The order that the merge field displays on the list signup form.
	Options MergeFieldOptions `json:"options"`

	// Extra text to help the subscriber fill out the form.
	HelpText string `json:"help_text"`
}

type MergeFieldsParams

type MergeFieldsParams struct {
	ExtendedQueryParams

	Type     string `json:"type"`
	Required bool   `json:"required"`
}

type Order

type Order struct {
	APIError

	// Required
	ID           string     `json:"id"`
	Customer     Customer   `json:"customer"`
	Lines        []LineItem `json:"lines"`
	CurrencyCode string     `json:"currency_code"`
	OrderTotal   float64    `json:"order_total"`

	// Optional
	TaxTotal           float64   `json:"tax_total,omitempty"`
	ShippingTotal      float64   `json:"shipping_total,omitempty"`
	TrackingCode       string    `json:"tracking_code,omitempty"`
	ProcessedAtForeign time.Time `json:"processed_at_foreign"`
	CancelledAtForeign time.Time `json:"cancelled_at_foreign"`
	UpdatedAtForeign   time.Time `json:"updated_at_foreign"`
	CampaignID         string    `json:"campaign_id,omitempty"`
	FinancialStatus    string    `json:"financial_status,omitempty"`
	FulfillmentStatus  string    `json:"fulfillment_status,omitempty"`

	BillingAddress  *Address `json:"billing_address,omitempty"`
	ShippingAddress *Address `json:"shipping_address,omitempty"`

	// Response only
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	Links     []Link    `json:"_links,omitempty"`
}

func (*Order) MarshalJSON

func (order *Order) MarshalJSON() ([]byte, error)

type OrderList

type OrderList struct {
	APIError

	Orders     []Order `json:"cart"`
	TotalItems int     `json:"total_items"`
	Links      []Link  `json:"_links,omitempty"`
}

type Product

type Product struct {
	APIError

	StoreID string `json:"-"`

	// Required
	ID       string    `json:"id"`
	Title    string    `json:"title"`
	Variants []Variant `json:"variants"`

	// Optional
	Handle             string    `json:"handle,omitempty"`
	URL                string    `json:"url,omitempty"`
	Description        string    `json:"description,omitempty"`
	Type               string    `json:"type,omitempty"`
	Vendor             string    `json:"vendor,omitempty"`
	ImageURL           string    `json:"image_url,omitempty"`
	PublishedAtForeign time.Time `json:"published_at_foreign,omitempty"`

	// Response only
	Links []Link `json:"_links,omitempty"`
	// contains filtered or unexported fields
}

------------------------------------------------------------------------------------------------ Products ------------------------------------------------------------------------------------------------

func (*Product) CreateVariant

func (product *Product) CreateVariant(req *Variant) (*Variant, error)

func (*Product) DeleteVariant

func (product *Product) DeleteVariant(id string) (bool, error)

func (*Product) HasID

func (product *Product) HasID() error

func (*Product) MarshalJSON

func (product *Product) MarshalJSON() ([]byte, error)

func (*Product) UpdateVariant

func (product *Product) UpdateVariant(req *Variant) (*Variant, error)

type ProductList

type ProductList struct {
	APIError

	StoreID    string    `json:"store_id"`
	Products   []Product `json:"products"`
	TotalItems int       `json:"total_items"`
	Links      []Link    `json:"_links"`
}

type QueryParams

type QueryParams interface {
	Params() map[string]string
}

QueryParams defines the different params

type RemovedSubscriber

type RemovedSubscriber struct {
	ID           string `json:"id"`
	WorkflowID   string `json:"workflow_id"`
	ListID       string `json:"list_id"`
	EmailAddress string `json:"email_address"`
	// contains filtered or unexported fields
}

type RemovedSubscriberRequest

type RemovedSubscriberRequest struct {
	EmailAddress string `json:"email_address"`
}

type ReportSummary

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

type RootResponse

type RootResponse struct {
	AccountID        string         `json:"account_id"`
	AccountName      string         `json:"account_name"`
	Email            string         `json:"email"`
	Role             string         `json:"role"`
	Contact          AccountContact `json:"contact"`
	ProEnabled       bool           `json:"pro_enabled"`
	LastLogin        string         `json:"last_login"`
	TotalSubscribers int            `json:"total_subscribers"`
	IndustyStats     IndustryStats  `json:"industry_stats"`
	Links            []Link         `json:"_links"`
}

RootResponse - https://developer.mailchimp.com/documentation/mailchimp/reference/root/#read-get_root

type Salesforce

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

type SearchMembersQueryParams

type SearchMembersQueryParams struct {
	BasicQueryParams

	Query string
	// contains filtered or unexported fields
}

func (*SearchMembersQueryParams) Params

func (q *SearchMembersQueryParams) Params() map[string]string

type SearchMembersResponse

type SearchMembersResponse struct {
	ExactMatches Matches `json:"exact_matches"`
	FullSearch   Matches `json:"full_search"`
	Links        []Link  `json:"_links"`
}

type Segment

type Segment struct {
	SegmentRequest

	ID          string `json:"id"`
	MemberCount int    `json:"member_count"`
	Type        string `json:"type"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ListID      string `json:"list_id"`
	// contains filtered or unexported fields
}

type SegmentBatchError

type SegmentBatchError struct {
	EmailAddresses []string `json:"email_addresses"`
	Error          string   `json:"error"`
}

SegmentBatchError contains errors returned from batch modifying a static segment

type SegmentBatchRequest

type SegmentBatchRequest struct {
	MembersToAdd    []string `json:"members_to_add"`
	MembersToRemove []string `json:"members_to_remove"`
}

SegmentBatchRequest represents arguments for bach modifying a static segment. Note that both options must be provided, even if empty slice, and cannot be nil, or mailchimp will return a 400.

type SegmentBatchResponse

type SegmentBatchResponse struct {
	MembersAdded   []Member `json:"members_added"`
	MembersRemoved []Member `json:"members_removed"`

	Errors []SegmentBatchError `json:"errors"`

	TotalAdded   int `json:"total_added"`
	TotalRemoved int `json:"total_removed"`
	ErrorCount   int `json:"error_count"`
	// contains filtered or unexported fields
}

SegmentBatchResponse is the object returned by MailChimp from a request to batch modify a static segment

type SegmentConditional

type SegmentConditional struct {
	Field string      `json:"field"`
	OP    string      `json:"op"`
	Value interface{} `json:"value"`
}

SegmentConditional represents parameters to filter by

type SegmentOptions

type SegmentOptions struct {
	Match      string               `json:"match"`
	Conditions []SegmentConditional `json:"conditions"`
}

type SegmentQueryParams

type SegmentQueryParams struct {
	ExtendedQueryParams

	Type            string
	SinceCreatedAt  string
	BeforeCreatedAt string
	SinceUpdatedAt  string
	BeforeUpdatedAt string
}

func (*SegmentQueryParams) Params

func (q *SegmentQueryParams) Params() map[string]string

type SegmentRequest

type SegmentRequest struct {
	Name          string          `json:"name"`
	StaticSegment []string        `json:"static_segment"`
	Options       *SegmentOptions `json:"options,omitempty"`
}

type SendCampaignRequest

type SendCampaignRequest struct {
	CampaignId string `json:"campaign_id"`
}

type SocialCard

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

type Stats

type Stats struct {
	MemberCount               int     `json:"member_count"`
	UnsubscribeCount          int     `json:"unsubscribe_count"`
	CleanedCount              int     `json:"cleaned_count"`
	MemberCountSinceSend      int     `json:"member_count_since_send"`
	UnsubscribeCountSinceSend int     `json:"unsubscribe_count_since_send"`
	CleanedCountSinceSend     int     `json:"cleaned_count_since_send"`
	CampaignCount             int     `json:"campaign_count"`
	CampaignLastSent          string  `json:"campaign_last_sent"`
	MergeFieldCount           int     `json:"merge_field_count"`
	AvgSubRate                float64 `json:"avg_sub_rate"`
	AvgUnsubRate              float64 `json:"avg_unsub_rate"`
	TargetSubRate             float64 `json:"target_sub_rate"`
	OpenRate                  float64 `json:"open_rate"`
	ClickRate                 float64 `json:"click_rate"`
	LastSubDate               string  `json:"last_sub_date"`
	LastUnsubDate             string  `json:"last_unsub_date"`
}

type Store

type Store struct {
	APIError

	// Required
	ID           string `json:"id"`
	ListID       string `json:"list_id"`
	CurrencyCode string `json:"currency_code"`
	Name         string `json:"name"`

	// Optional
	Platform      string   `json:"platform,omitempty"`
	Domain        string   `json:"domain,omitempty"`
	EmailAddress  string   `json:"email_address,omitempty"`
	MoneyFormat   string   `json:"money_format,omitempty"`
	PrimaryLocale string   `json:"primary_locale,omitempty"`
	Timezone      string   `json:"timezone,omitempty"`
	Phone         string   `json:"phone,omitempty"`
	Address       *Address `json:"address,omitempty"`

	// Response
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	Links     []Link    `json:"_links,omitempty"`
	// contains filtered or unexported fields
}

func (*Store) CreateCart

func (store *Store) CreateCart(req *Cart) (*Cart, error)

func (*Store) CreateCustomer

func (store *Store) CreateCustomer(req *Customer) (*Customer, error)

func (*Store) CreateOrder

func (store *Store) CreateOrder(req *Order) (*Order, error)

func (*Store) CreateProduct

func (store *Store) CreateProduct(req *Product) (*Product, error)

func (*Store) DeleteCart

func (store *Store) DeleteCart(id string) (bool, error)

func (*Store) DeleteCustomer

func (store *Store) DeleteCustomer(id string) (bool, error)

func (*Store) DeleteOrder

func (store *Store) DeleteOrder(id string) (bool, error)

func (*Store) DeleteProduct

func (store *Store) DeleteProduct(id string) (bool, error)

func (*Store) GetCart

func (store *Store) GetCart(id string, params *BasicQueryParams) (*Cart, error)

func (*Store) GetCarts

func (store *Store) GetCarts(params *ExtendedQueryParams) (*CartList, error)

func (*Store) GetCustomer

func (store *Store) GetCustomer(id string, params *BasicQueryParams) (*Customer, error)

func (*Store) GetCustomers

func (store *Store) GetCustomers(params *ExtendedQueryParams) (*CustomerList, error)

func (*Store) GetOrder

func (store *Store) GetOrder(id string, params *BasicQueryParams) (*Order, error)

func (*Store) GetOrders

func (store *Store) GetOrders(params *ExtendedQueryParams) (*OrderList, error)

func (*Store) GetProduct

func (store *Store) GetProduct(id string, params *BasicQueryParams) (*Product, error)

func (*Store) GetProducts

func (store *Store) GetProducts(params *ExtendedQueryParams) (*ProductList, error)

func (*Store) HasID

func (store *Store) HasID() error

func (*Store) MarshalJSON

func (store *Store) MarshalJSON() ([]byte, error)

func (*Store) UpdateCart

func (store *Store) UpdateCart(req *Cart) (*Cart, error)

func (*Store) UpdateCustomer

func (store *Store) UpdateCustomer(req *Customer) (*Customer, error)

func (*Store) UpdateOrder

func (store *Store) UpdateOrder(req *Order) (*Order, error)

func (*Store) UpdateProduct

func (store *Store) UpdateProduct(req *Product) (*Product, error)

type StoreList

type StoreList struct {
	APIError

	Stores     []Store `json:"stores"`
	TotalItems int     `json:"total_items"`
	Links      []Link  `json:"_links"`
}

type TemplateCreationRequest

type TemplateCreationRequest struct {
	Name     string `json:"name"`
	Html     string `json:"html"`
	FolderId string `json:"folder_id"`
}

type TemplateDefaultContentResponse

type TemplateDefaultContentResponse struct {
	Sections map[string]string `json:"sections"`
	// contains filtered or unexported fields
}

type TemplateFolder

type TemplateFolder struct {
	Name  string `json:"name"`
	ID    string `json:"id"`
	Count uint   `json:"count"`
	// contains filtered or unexported fields
}

type TemplateFolderCreationRequest

type TemplateFolderCreationRequest struct {
	Name string `json:"name"`
}

type TemplateFolderQueryParams

type TemplateFolderQueryParams struct {
	ExtendedQueryParams
}

type TemplateQueryParams

type TemplateQueryParams struct {
	ExtendedQueryParams

	CreatedBy       string
	SinceCreatedAt  string
	BeforeCreatedAt string
	Type            string
	FolderId        string
}

func (*TemplateQueryParams) Params

func (q *TemplateQueryParams) Params() map[string]string

type TemplateResponse

type TemplateResponse struct {
	ID          uint   `json:"id"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	DragAndDrop bool   `json:"drag_and_drop"`
	Responsive  bool   `json:"responsive"`
	Category    string `json:"category"`
	DateCreated string `json:"date_created"`
	CreatedBy   string `json:"created_by"`
	Active      bool   `json:"activer"`
	FolderId    string `json:"folder_id"`
	Thumbnail   string `json:"thumbnail"`
	ShareUrl    string `json:"share_url"`
	// contains filtered or unexported fields
}

func (*TemplateResponse) CanMakeRequest

func (template *TemplateResponse) CanMakeRequest() error

type TestEmailRequest

type TestEmailRequest struct {
	TestEmails []string `json:"test_emails"`
	SendType   string   `json:"send_type"` // one of the CAMPAIGN_SEND_TYPE_* constants
}

type TimeToRun

type TimeToRun map[string]interface{}

func SendAsap

func SendAsap(days []string, sendAsap bool) *TimeToRun

func SendAt

func SendAt(days []string, sendAt string) *TimeToRun

func SendBetween

func SendBetween(days []string, start string, end string) *TimeToRun

type UpdateMemberTag

type UpdateMemberTag struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

type Variant

type Variant struct {
	APIError

	StoreID   string `json:"-"`
	ProductID string `json:"-"`

	// Required
	ID    string `json:"id"`
	Title string `json:"title"`

	// Optional
	URL               string  `json:"url,omitempty"`
	SKU               string  `json:"sku,omitempty"`
	Price             float64 `json:"price,omitempty"`
	InventoryQuantity int     `json:"inventory_quantity,omitempty"`
	ImageURL          string  `json:"image_url,omitempty"`
	Backorders        string  `json:"backorders,omitempty"`
	Visibility        string  `json:"visibility,omitempty"`
	// contains filtered or unexported fields
}

------------------------------------------------------------------------------------------------ Variants ------------------------------------------------------------------------------------------------

type VariantList

type VariantList struct {
	APIError

	StoreID    string    `json:"store_id"`
	Variants   []Variant `json:"variants"`
	TotalItems int       `json:"total_items"`
	Links      []Link    `json:"_links,omitempty"`
}

type WebHook

type WebHook struct {
	WebHookRequest
	ID     string `json:"id"`
	ListID string `json:"list_id"`
	// contains filtered or unexported fields
}

type WebHookRequest

type WebHookRequest struct {
	URL     string      `json:"url"`
	Events  HookEvents  `json:"events"`
	Sources HookSources `json:"sources"`
}

type WorkflowType

type WorkflowType map[string]interface{}

func WorkflowAPI

func WorkflowAPI(emailCount int, runtime TimeToRun) *WorkflowType

func WorkflowBestCustomer

func WorkflowBestCustomer(emailCount int, sendImmediately bool, lifetimePurchaseValue float64, purchaseOrders int, runtime TimeToRun) *WorkflowType

func WorkflowCategoryFollowup

func WorkflowCategoryFollowup(emailCount int, sendImmediately bool, categoryName string, runtime TimeToRun) *WorkflowType

func WorkflowDateAdded

func WorkflowDateAdded(emailCount int, runtime TimeToRun) *WorkflowType

func WorkflowEmailFollowup

func WorkflowEmailFollowup(emailCount int, triggerOnImport, sendImmediately bool, runtime TimeToRun) *WorkflowType

func WorkflowEmailSeries

func WorkflowEmailSeries(emailCount int, triggerOnImport, sendImmediately bool, runtime TimeToRun) *WorkflowType

func WorkflowGroupAdd

func WorkflowGroupAdd(emailCount int, sendImmediately bool, groupID int, runtime TimeToRun) *WorkflowType

func WorkflowGroupRemove

func WorkflowGroupRemove(emailCount int, sendImmediately bool, groupID int, runtime TimeToRun) *WorkflowType

func WorkflowMandrill

func WorkflowMandrill(emailCount int, sendImmediately bool, mandrillTags []string, runtime TimeToRun) *WorkflowType

func WorkflowProductFollowup

func WorkflowProductFollowup(emailCount int, sendImmediately bool, productName string, runtime TimeToRun) *WorkflowType

func WorkflowPurchaseFollowup

func WorkflowPurchaseFollowup(emailCount int, sendImmediately bool, runtime TimeToRun) *WorkflowType

func WorkflowRecurringEvent

func WorkflowRecurringEvent(emailCount int, mergeFieldTrigger string, runtime TimeToRun) *WorkflowType

func WorkflowSpecialEvent

func WorkflowSpecialEvent(emailCount int, mergeFieldTrigger string, runtime TimeToRun) *WorkflowType

func WorkflowVisitURL

func WorkflowVisitURL(emailCount int, sendImmediately bool, goalURL string, runtime TimeToRun) *WorkflowType

func WorkflowWelcomeSeries

func WorkflowWelcomeSeries(emailCount int, triggerOnImport, sendImmediately bool, runtime TimeToRun) *WorkflowType

Jump to

Keyboard shortcuts

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