gochimp

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

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 13 Imported by: 24

README

gochimp

GoDoc

Go based API for Mailchimp, starting with Mandrill.

To run tests, set a couple env variables. (replacing values with your own mandrill credentials):

$ export MANDRILL_KEY=111111111-1111-1111-1111-111111111
$ export MANDRILL_USER=user@domain.com

Mandrill Status

  • API Feature complete on Oct 26/2012
  • Adding tests, making naming conventions consistent, and refactoring error handling

Chimp Status

  • Not started

Getting Started

Below is an example approach to rendering custom content into a Mandrill template called "welcome email" and sending the rendered email.

package main

import (
	"fmt"
	"github.com/mattbaird/gochimp"
	"os"
)

func main() {
	apiKey := os.Getenv("MANDRILL_KEY")
	mandrillApi, err := gochimp.NewMandrill(apiKey)

	if err != nil {
		fmt.Println("Error instantiating client")
	}

	templateName := "welcome email"
	contentVar := gochimp.Var{"main", "<h1>Welcome aboard!</h1>"}
	content := []gochimp.Var{contentVar}

	_, err = mandrillApi.TemplateAdd(templateName, fmt.Sprintf("%s", contentVar.Content), true)
	if err != nil {
		fmt.Println("Error adding template: %v", err)
		return
	}
	defer mandrillApi.TemplateDelete(templateName)
	renderedTemplate, err := mandrillApi.TemplateRender(templateName, content, nil)

	if err != nil {
		fmt.Println("Error rendering template: %v", err)
		return
	}

	recipients := []gochimp.Recipient{
		gochimp.Recipient{Email: "person@place.com"},
	}

	message := gochimp.Message{
		Html:      renderedTemplate,
		Subject:   "Welcome aboard!",
		FromEmail: "person@place.com",
		FromName:  "Boss Man",
		To:        recipients,
	}

	_, err = mandrillApi.MessageSend(message, false)

	if err != nil {
		fmt.Println("Error sending message")
	}
}

Documentation

Overview

The API package provides the basic support for using HTTP to talk to the Mandrill and Mailchimp API's. Each Struct contains a Key, Transport and endpoint property

Index

Constants

View Source
const APITimeFormat = "2006-01-02 15:04:05"

format string for time.Format

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status string `json:"status"`
	Code   int    `json:"code"`
	Name   string `json:"name"`
	Err    string `json:"error"`
}

func (APIError) Error

func (e APIError) Error() string

type APITime

type APITime struct {
	time.Time
}

Mailchimp does not conform to RFC3339 format, so we need custom UnmarshalJSON

func (*APITime) UnmarshalJSON

func (t *APITime) UnmarshalJSON(data []byte) (err error)

type ActivityDetail

type ActivityDetail struct {
	Timestamp time.Duration `json:"ts"`
	IP        string        `json:"ip"`
	Url       string        `json:"url"`
	Location  string        `json:"location"`
	UserAgent string        `json:"ua"`
}

type Attachment

type Attachment struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Content string `json:"content"`
}

type BatchError

type BatchError struct {
	Emails Email  `json:"email"`
	Code   int    `json:"code"`
	Error  string `json:"error"`
}

type BatchResponse

type BatchResponse struct {
	Success     int          `json:"success_count"`
	ErrorCount  int          `json:"error_count"`
	BatchErrors []BatchError `json:"errors"`
}

type BatchSubscribe

type BatchSubscribe struct {
	ApiKey           string        `json:"apikey"`
	ListId           string        `json:"id"`
	Batch            []ListsMember `json:"batch"`
	DoubleOptin      bool          `json:"double_optin"`
	UpdateExisting   bool          `json:"update_existing"`
	ReplaceInterests bool          `json:"replace_interests"`
}

type BatchSubscribeResponse

type BatchSubscribeResponse struct {
	AddCount    int                    `json:"add_count"`
	Adds        []Email                `json:"adds"`
	UpdateCount int                    `json:"update_count"`
	Updates     []Email                `json:"updates"`
	ErrorCount  int                    `json:"error_count"`
	Error       []BatchSubscriberError `json:"errors"`
}

type BatchSubscriberError

type BatchSubscriberError struct {
	Emails Email       `json:"email"`
	Code   int         `json:"code"`
	Error  string      `json:"error"`
	Row    interface{} `json:"row"`
}

type BatchUnsubscribe

type BatchUnsubscribe struct {
	ApiKey       string  `json:"apikey"`
	ListId       string  `json:"id"`
	Batch        []Email `json:"batch"`
	DeleteMember bool    `json:"delete_member"`
	SendGoodbye  bool    `json:"send_goodbye"`
	SendNotify   bool    `json:"send_notify"`
}

type CampaignCreate

type CampaignCreate struct {
	ApiKey  string                `json:"apikey"`
	Type    string                `json:"type"`
	Options CampaignCreateOptions `json:"options"`
	Content CampaignCreateContent `json:"content"`
}

type CampaignCreateContent

type CampaignCreateContent struct {
	// HTML is the raw/pasted HTML content for the campaign
	HTML string `json:"html"`

	// When using a template instead of raw HTML, each key
	// in the map should be the unique mc:edit area name from
	// the template.
	Sections map[string]string `json:"sections,omitempty"`

	// Text is the plain-text version of the body
	Text string `json:"text"`

	// MailChimp will pull in content from this URL. Note,
	// this will override any other content options - for lists
	// with Email Format options, you'll need to turn on
	// generate_text as well
	URL string `json:"url,omitempty"`

	// A Base64 encoded archive file for MailChimp to import all
	// media from. Note, this will override any other content
	// options - for lists with Email Format options, you'll
	// need to turn on generate_text as well
	Archive string `json:"archive,omitempty"`

	// ArchiveType only applies to the Archive field. Supported
	// formats are: zip, tar.gz, tar.bz2, tar, tgz, tbz.
	// If not included, we will default to zip
	ArchiveType string `json:"archive_options,omitempty"`
}

type CampaignCreateOptions

type CampaignCreateOptions struct {
	// ListID is the list to send this campaign to
	ListID string `json:"list_id"`

	// Title is the title for new campaign
	Title string `json:"title"`
	// TemplateID is the user-created template from which the HTML
	// content of the campaign should be created
	TemplateID string `json:"template_id"`

	// Subject is the subject line for your campaign message
	Subject string `json:"subject"`

	// FromEmail is the From: email address for your campaign message
	FromEmail string `json:"from_email"`

	// FromName is the From: name for your campaign message (not an email address)
	FromName string `json:"from_name"`

	// ToName is the To: name recipients will see (not email address)
	ToName string `json:"to_name"`
}

type CampaignList

type CampaignList struct {
	// A valid API Key for your user account. Get by visiting your API dashboard
	ApiKey string `json:"apikey"`

	// Filters to apply to this query - all are optional:
	Filter CampaignListFilter `json:"filters,omitempty"`

	// Control paging of campaigns, start results at this campaign #,
	// defaults to 1st page of data (page 0)
	Start int `json:"start,omitempty"`

	// Control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)
	Limit int `json:"limit,omitempty"`

	// One of "create_time", "send_time", "title", "subject". Invalid values
	// will fall back on "create_time" - case insensitive.
	SortField string `json:"sort_field,omitempty"`

	// "DESC" for descending (default), "ASC" for Ascending. Invalid values
	// will fall back on "DESC" - case insensitive.
	OrderOrder string `json:"sort_dir,omitempty"`
}

type CampaignListFilter

type CampaignListFilter struct {
	// Return the campaign using a know campaign_id. Accepts
	// multiples separated by commas when not using exact matching.
	CampaignID string `json:"campaign_id,omitempty"`

	// Return the child campaigns using a known parent campaign_id.
	// Accepts multiples separated by commas when not using exact matching.
	ParentID string `json:"parent_id,omitempty"`

	// The list to send this campaign to - Get lists using ListList.
	// Accepts multiples separated by commas when not using exact matching.
	ListID string `json:"list_id,omitempty"`

	// Only show campaigns from this folder id - get folders using FoldersList.
	// Accepts multiples separated by commas when not using exact matching.
	FolderID int `json:"folder_id,omitempty"`

	// Only show campaigns using this template id - get templates using TemplatesList.
	// Accepts multiples separated by commas when not using exact matching.
	TemplateID int `json:"template_id,omitempty"`

	// Return campaigns of a specific status - one of "sent", "save", "paused", "schedule", "sending".
	// Accepts multiples separated by commas when not using exact matching.
	Status string `json:"status,omitempty"`

	// Return campaigns of a specific type - one of "regular", "plaintext", "absplit", "rss", "auto".
	// Accepts multiples separated by commas when not using exact matching.
	Type string `json:"type,omitempty"`

	// Only show campaigns that have this "From Name"
	FromName string `json:"from_name,omitempty"`

	// Only show campaigns that have this "Reply-to Email"
	FromEmail string `json:"from_email,omitempty"`

	// Only show campaigns that have this title
	Title string `json:"title"`

	// Only show campaigns that have this subject
	Subject string `json:"subject"`

	// Only show campaigns that have been sent since this date/time (in GMT) - -
	// 24 hour format in GMT, eg "2013-12-30 20:30:00" - if this is invalid the whole call fails
	SendTimeStart string `json:"sendtime_start,omitempty"`

	// Only show campaigns that have been sent before this date/time (in GMT) - -
	// 24 hour format in GMT, eg "2013-12-30 20:30:00" - if this is invalid the whole call fails
	SendTimeEnd string `json:"sendtime_end,omitempty"`

	// Whether to return just campaigns with or without segments
	UsesSegment bool `json:"uses_segment,omitempty"`

	// Flag for whether to filter on exact values when filtering, or search within content for
	// filter values - defaults to true. Using this disables the use of any filters that accept multiples.
	Exact bool `json:"exact,omitempty"`
}

type CampaignListResponse

type CampaignListResponse struct {
	Total     int                `json:"total"`
	Campaigns []CampaignResponse `json:"data"`
}

type CampaignResponse

type CampaignResponse struct {
	Id                 string           `json:"id"`
	WebId              int              `json:"web_id"`
	ListId             string           `json:"list_id"`
	FolderId           int              `json:"folder_id"`
	TemplateId         int              `json:"template_id"`
	ContentType        string           `json:"content_type"`
	ContentEditedBy    string           `json:"content_edited_by"`
	Title              string           `json:"title"`
	Type               string           `json:"type"`
	CreateTime         string           `json:"create_time"`
	SendTime           string           `json:"send_time"`
	ContentUpdatedTime string           `json:"content_updated_time"`
	Status             string           `json:"status"`
	FromName           string           `json:"from_name"`
	FromEmail          string           `json:"from_email"`
	Subject            string           `json:"subject"`
	ToName             string           `json:"to_name"`
	ArchiveURL         string           `json:"archive_url"`
	ArchiveURLLong     string           `json:"archive_url_long"`
	EmailsSent         int              `json:"emails_sent"`
	Analytics          string           `json:"analytics"`
	AnalyticsTag       string           `json:"analytics_tag"`
	InlineCSS          bool             `json:"inline_css"`
	Authenticate       bool             `json:"authenticate"`
	Ecommm360          bool             `json:"ecomm360"`
	AutoTweet          bool             `json:"auto_tweet"`
	AutoFacebookPort   string           `json:"auto_fb_post"`
	AutoFooter         bool             `json:"auto_footer"`
	Timewarp           bool             `json:"timewarp"`
	TimewarpSchedule   string           `json:"timewarp_schedule,omitempty"`
	Tracking           CampaignTracking `json:"tracking"`
	ParentId           string           `json:"parent_id"`
	IsChild            bool             `json:"is_child"`
	TestsRemaining     int              `json:"tests_remain"`
	SegmentText        string           `json:"segment_text"`
}

type CampaignSendResponse

type CampaignSendResponse struct {
	Complete bool `json:"complete"`
}

type CampaignTracking

type CampaignTracking struct {
	HTMLClicks bool `json:"html_clicks"`
	TextClicks bool `json:"text_clicks"`
	Opens      bool `json:"opens"`
}

type ChimpAPI

type ChimpAPI struct {
	Key       string
	Transport http.RoundTripper
	Timeout   time.Duration
	// contains filtered or unexported fields
}

func NewChimp

func NewChimp(apiKey string, https bool) *ChimpAPI

func (*ChimpAPI) BatchSubscribe

func (a *ChimpAPI) BatchSubscribe(req BatchSubscribe) (BatchSubscribeResponse, error)

func (*ChimpAPI) BatchUnsubscribe

func (a *ChimpAPI) BatchUnsubscribe(req BatchUnsubscribe) (BatchResponse, error)

func (*ChimpAPI) CampaignCreate

func (a *ChimpAPI) CampaignCreate(req CampaignCreate) (CampaignResponse, error)

func (*ChimpAPI) CampaignList

func (a *ChimpAPI) CampaignList(req CampaignList) (CampaignListResponse, error)

func (*ChimpAPI) CampaignSend

func (a *ChimpAPI) CampaignSend(cid string) (CampaignSendResponse, error)

func (*ChimpAPI) GetClicks

func (a *ChimpAPI) GetClicks(req ReportsClicks) (ReportClicksResponse, error)

func (*ChimpAPI) GetContent

func (a *ChimpAPI) GetContent(cid string, options map[string]interface{}, contentFormat string) (ContentResponse, error)

func (*ChimpAPI) GetContentAsJson

func (a *ChimpAPI) GetContentAsJson(cid string, options map[string]interface{}) (ContentResponse, error)

func (*ChimpAPI) GetContentAsXML

func (a *ChimpAPI) GetContentAsXML(cid string, options map[string]interface{}) (ContentResponse, error)

func (*ChimpAPI) GetSummary

func (a *ChimpAPI) GetSummary(req ReportsSummary) (ReportSummaryResponse, error)

func (*ChimpAPI) InlineCSS

func (a *ChimpAPI) InlineCSS(req InlineCSSRequest) (InlineCSSResponse, error)

func (*ChimpAPI) InterestGroupAdd

func (a *ChimpAPI) InterestGroupAdd(req InterestGroupAdd) (InterestGroupAddResponse, error)

func (*ChimpAPI) InterestGroupingsList

func (a *ChimpAPI) InterestGroupingsList(req InterestGroupingsList) ([]InterestGroupingsListResponse, error)

func (*ChimpAPI) ListsList

func (a *ChimpAPI) ListsList(req ListsList) (ListsListResponse, error)

func (*ChimpAPI) ListsSubscribe

func (a *ChimpAPI) ListsSubscribe(req ListsSubscribe) (Email, error)

func (*ChimpAPI) ListsUnsubscribe

func (a *ChimpAPI) ListsUnsubscribe(req ListsUnsubscribe) error

func (*ChimpAPI) MemberInfo

func (a *ChimpAPI) MemberInfo(req ListsMemberInfo) (ListsMemberInfoResponse, error)

func (*ChimpAPI) Members

func (a *ChimpAPI) Members(req ListsMembers) (ListsMembersResponse, error)

func (*ChimpAPI) StaticSegmentAdd

func (*ChimpAPI) StaticSegmentDel

func (*ChimpAPI) StaticSegmentMembersAdd

func (*ChimpAPI) StaticSegmentMembersDel

func (*ChimpAPI) StaticSegmentReset

func (a *ChimpAPI) StaticSegmentReset(req ListsStaticSegment) (ListsStaticSegmentUpdateResponse, error)

func (*ChimpAPI) StaticSegments

func (a *ChimpAPI) StaticSegments(req ListsStaticSegments) ([]ListsStaticSegmentResponse, error)

func (*ChimpAPI) TemplatesAdd

func (a *ChimpAPI) TemplatesAdd(req TemplatesAdd) (TemplatesAddResponse, error)

func (*ChimpAPI) TemplatesInfo

func (a *ChimpAPI) TemplatesInfo(req TemplateInfo) (TemplateInfoResponse, error)

func (*ChimpAPI) TemplatesList

func (a *ChimpAPI) TemplatesList(req TemplatesList) (TemplatesListResponse, error)

func (*ChimpAPI) TemplatesUpdate

func (a *ChimpAPI) TemplatesUpdate(req TemplatesUpdate) (TemplatesUpdateResponse, error)

func (*ChimpAPI) UpdateMember

func (a *ChimpAPI) UpdateMember(req UpdateMember) error

func (*ChimpAPI) WebhookAdd

func (*ChimpAPI) WebhookDel

func (*ChimpAPI) Webhooks

func (a *ChimpAPI) Webhooks(req ChimpWebhooksRequest) ([]ChimpWebhook, error)

type ChimpGroup

type ChimpGroup struct {
	Bit          string `json:"bit"`
	Name         string `json:"name"`
	DisplayOrder string `json:"display_order"`
	Subscribers  int    `json:"subscribers"`
}

type ChimpWebhook

type ChimpWebhook struct {
	Url     string              `json:"url"`
	Actions ChimpWebhookActions `json:"actions"`
	Sources ChimpWebhookSources `json:"sources"`
}

type ChimpWebhookActions

type ChimpWebhookActions 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 ChimpWebhookAddRequest

type ChimpWebhookAddRequest struct {
	ChimpWebhook
	ApiKey string `json:"apikey"`
	ListId string `json:"id"`
}

type ChimpWebhookAddResponse

type ChimpWebhookAddResponse struct {
	Id int `json:"id,string"`
}

type ChimpWebhookDelRequest

type ChimpWebhookDelRequest struct {
	ApiKey string `json:"apikey"`
	ListId string `json:"id"`
	Url    string `json:"url"`
}

type ChimpWebhookDelResponse

type ChimpWebhookDelResponse struct {
	Complete bool `json:"complete"`
}

type ChimpWebhookSources

type ChimpWebhookSources struct {
	User  bool `json:"user"`
	Admin bool `json:"admin"`
	Api   bool `json:"api"`
}

type ChimpWebhooksRequest

type ChimpWebhooksRequest struct {
	ApiKey string `json:"apikey"`
	ListId string `json:"id"`
}

type ContentResponse

type ContentResponse struct {
	Html string `json:"html"`
	Text string `json:"text"`
}

type Domain

type Domain struct {
	Domain    string    `json:"domain"`
	CreatedAt time.Time `json:"created_at"`
}

type Email

type Email struct {
	Email string `json:"email"`
	Euid  string `json:"euid"`
	Leid  string `json:"leid"`
}

type GalleryTemplate

type GalleryTemplate struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	Layout       string `json:"layout"`
	Category     string `json:"category"`
	PreviewImage string `json:"preview_image"`
	DateCreated  string `json:"date_created"`
	Active       bool   `json:"active"`
	EditSource   bool   `json:"edit_source"`
}

type InboundDomain

type InboundDomain struct {
	Domain    string  `json:"domain"`
	CreatedAt APITime `json:"created_at"`
	ValidMx   bool    `json:"valid_mx"`
}

type InboundRecipient

type InboundRecipient struct {
	Email   string `json:"email"`
	Pattern string `json:"pattern"`
	Url     string `json:"url"`
}

type Info

type Info struct {
	Username    string          `json:"username"`
	CreatedAt   APITime         `json:"created_at"`
	PublicId    string          `json:"public_id"`
	Reputation  int             `json:"reputation"`
	HourlyQuota int             `json:"hourly_quota"`
	Backlog     int             `json:"backlog"`
	Stats       map[string]Stat `json:"stats"`
}

type InlineCSSRequest

type InlineCSSRequest struct {
	ApiKey   string `json:"apikey"`
	HTML     string `json:"html"`
	StripCSS bool   `json:"strip_html"`
}

type InlineCSSResponse

type InlineCSSResponse struct {
	HTML string `json:"html"`
}

type InterestGroupAdd

type InterestGroupAdd struct {
	ApiKey     string `json:"apikey"`
	ListId     string `json:"id"`
	GroupName  string `json:"group_name"`
	GroupingId int    `json:"grouping_id,omitempty"`
}

type InterestGroupAddResponse

type InterestGroupAddResponse struct {
	Complete bool `json:"complete"`
}

type InterestGroupingsList

type InterestGroupingsList struct {
	ApiKey string `json:"apikey"`
	ListId string `json:"id"`
	Counts bool   `json:"counts"`
}

type InterestGroupingsListResponse

type InterestGroupingsListResponse struct {
	Id        int          `json:"id"`
	Name      string       `json:"name"`
	FormField string       `json:"form_field"`
	Groups    []ChimpGroup `json:"groups"`
}

type JsonAlterer

type JsonAlterer interface {
	// contains filtered or unexported methods
}

type ListData

type ListData struct {
	Id                string   `json:"id"`
	WebId             int      `json:"web_id"`
	Name              string   `json:"name"`
	DateCreated       string   `json:"date_created"`
	EmailTypeOption   bool     `json:"email_type_option"`
	UseAwesomeBar     bool     `json:"use_awesomebar"`
	DefaultFromName   string   `json:"default_from_name"`
	DefaultFromEmail  string   `json:"default_from_email"`
	DefaultSubject    string   `json:"default_subject"`
	DefaultLanguage   string   `json:"default_language"`
	ListRating        float64  `json:"list_rating"`
	SubscribeShortUrl string   `json:"subscribe_url_short"`
	SubscribeLongUrl  string   `json:"subscribe_url_long"`
	BeamerAddress     string   `json:"beamer_address"`
	Visibility        string   `json:"visibility"`
	Stats             ListStat `json:"stats"`
	Modules           []string `json:"modules"`
}

type ListError

type ListError struct {
	Param string `json:"param"`
	Code  int    `json:"code"`
	Error string `json:"error"`
}

type ListFilter

type ListFilter struct {
	ListId        string `json:"list_id"`
	ListName      string `json:"list_name"`
	FromName      string `json:"from_name"`
	FromEmail     string `json:"from_email"`
	FromSubject   string `json:"from_subject"`
	CreatedBefore string `json:"created_before"`
	CreatedAfter  string `json:"created_after"`
	Exact         bool   `json:"exact"`
}

type ListResponse

type ListResponse struct {
	Tag         string `json:"tag"`
	Sent        int32  `json:"sent"`
	HardBounces int32  `json:"hard_bounces"`
	SoftBounces int32  `json:"soft_bounces"`
	Rejects     int32  `json:"rejects"`
	Complaints  int32  `json:"complaints"`
	Unsubs      int32  `json:"unsubs"`
	Opens       int32  `json:"opens"`
	Clicks      int32  `json:"clicks"`
}

type ListStat

type ListStat struct {
	MemberCount               float64 `json:"member_count"`
	UnsubscribeCount          float64 `json:"unsubscribe_count"`
	CleanedCount              float64 `json:"cleaned_count"`
	MemberCountSinceSend      float64 `json:"member_count_since_send"`
	UnsubscribeCountSinceSend float64 `json:"unsubscribe_count_since_send"`
	CleanedCountSinceSend     float64 `json:"cleaned_count_since_send"`
	CampaignCount             float64 `json:"campaign_count"`
	GroupingCount             float64 `json:"grouping_count"`
	GroupCount                float64 `json:"group_count"`
	MergeVarCount             float64 `json:"merge_var_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"`
}

type ListsList

type ListsList struct {
	ApiKey        string     `json:"apikey"`
	Filters       ListFilter `json:"filters,omitempty"`
	Start         int        `json:"start,omitempty"`
	Limit         int        `json:"limit,omitempty"`
	SortField     string     `json:"sort_field,omitempty"`
	SortDirection string     `json:"sort_dir,omitempty"`
}

type ListsListResponse

type ListsListResponse struct {
	Total  int         `json:"total"`
	Data   []ListData  `json:"data"`
	Errors []ListError `json:"errors"`
}

type ListsMember

type ListsMember struct {
	Email     Email                  `json:"email"`
	EmailType string                 `json:"emailtype"`
	MergeVars map[string]interface{} `json:"merge_vars,omitempty"`
}

type ListsMemberInfo

type ListsMemberInfo struct {
	ApiKey string  `json:"apikey"`
	ListId string  `json:"id"`
	Emails []Email `json:"emails"`
}

type ListsMemberInfoResponse

type ListsMemberInfoResponse struct {
	SuccessCount      int          `json:"success_count"`
	ErrorCount        int          `json:"error_count"`
	Errors            []ListError  `json:"errors"`
	MemberInfoRecords []MemberInfo `json:"data"`
}

type ListsMembers

type ListsMembers struct {
	ApiKey  string          `json:"apikey"`
	ListId  string          `json:"id"`
	Status  string          `json:"status"`
	Options ListsMembersOpt `json:"opts,omitempty"`
}

type ListsMembersOpt

type ListsMembersOpt struct {
	Start         int    `json:"start,omitempty"`
	Limit         int    `json:"limit,omitempty"`
	SortField     string `json:"sort_field,omitempty"`
	SortDirection string `json:"sort_dir,omitempty"`
}

type ListsMembersResponse

type ListsMembersResponse struct {
	Total int          `json:"total"`
	Data  []MemberInfo `json:"data"`
}

type ListsStaticSegment

type ListsStaticSegment struct {
	ApiKey string `json:"apikey"`
	ListId string `json:"id"`
	SegId  int    `json:"seg_id"`
}

type ListsStaticSegmentAdd

type ListsStaticSegmentAdd struct {
	ApiKey string `json:"apikey"`
	ListId string `json:"id"`
	Name   string `json:"name"`
}

type ListsStaticSegmentAddResponse

type ListsStaticSegmentAddResponse struct {
	Id int `json:"id"`
}

type ListsStaticSegmentMembers

type ListsStaticSegmentMembers struct {
	ApiKey string  `json:"apikey"`
	ListId string  `json:"id"`
	SegId  int     `json:"seg_id"`
	Batch  []Email `json:"batch"`
}

type ListsStaticSegmentMembersResponse

type ListsStaticSegmentMembersResponse struct {
	SuccessCount int          `json:"success_count"`
	ErrorCount   int          `json:"error_count"`
	Errors       []BatchError `json:"errors"`
}

type ListsStaticSegmentResponse

type ListsStaticSegmentResponse struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	MemberCount int    `json:"member_count"`
	CreatedDate string `json:"created_date"`
	LastUpdate  string `json:"last_update"`
	LastReset   string `json:"last_reset"`
}

type ListsStaticSegmentUpdateResponse

type ListsStaticSegmentUpdateResponse struct {
	Complete bool `json:"complete"`
}

type ListsStaticSegments

type ListsStaticSegments struct {
	ApiKey    string `json:"apikey"`
	ListId    string `json:"id"`
	GetCounts bool   `json:"get_counts,omitempty"`
	Start     int    `json:"start,omitempty"`
	Limit     int    `json:"limit,omitempty"`
}

type ListsSubscribe

type ListsSubscribe struct {
	ApiKey           string                 `json:"apikey"`
	ListId           string                 `json:"id"`
	Email            Email                  `json:"email"`
	MergeVars        map[string]interface{} `json:"merge_vars,omitempty"`
	EmailType        string                 `json:"email_type,omitempty"`
	DoubleOptIn      bool                   `json:"double_optin"`
	UpdateExisting   bool                   `json:"update_existing"`
	ReplaceInterests bool                   `json:"replace_interests"`
	SendWelcome      bool                   `json:"send_welcome"`
}

type ListsUnsubscribe

type ListsUnsubscribe struct {
	ApiKey       string `json:"apikey"`
	ListId       string `json:"id"`
	Email        Email  `json:"email"`
	DeleteMember bool   `json:"delete_member"`
	SendGoodbye  bool   `json:"send_goodbye"`
	SendNotify   bool   `json:"send_notify"`
}

type MandrillAPI

type MandrillAPI struct {
	Key       string
	Transport http.RoundTripper
	Timeout   time.Duration
	// contains filtered or unexported fields
}

func NewMandrill

func NewMandrill(apiKey string) (*MandrillAPI, error)

see https://mandrillapp.com/api/docs/ currently supporting json output formats

func (*MandrillAPI) InboundDomainAdd

func (a *MandrillAPI) InboundDomainAdd(domain string) (InboundDomain, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) InboundDomainCheck

func (a *MandrillAPI) InboundDomainCheck(domain string) (InboundDomain, error)

can error with one of the following: Invalid_Key, Unknown_InboundDomain, ValidationError, GeneralError

func (*MandrillAPI) InboundDomainDelete

func (a *MandrillAPI) InboundDomainDelete(domain string) (InboundDomain, error)

can error with one of the following: Invalid_Key, Unknown_InboundDomain, ValidationError, GeneralError

func (*MandrillAPI) InboundDomainList

func (a *MandrillAPI) InboundDomainList() ([]InboundDomain, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) MessageContent

func (a *MandrillAPI) MessageContent(id string) (*MessageContent, error)

func (*MandrillAPI) MessageInfo

func (a *MandrillAPI) MessageInfo(id string) (map[string]interface{}, error)

func (*MandrillAPI) MessageParse

func (a *MandrillAPI) MessageParse(rawMessage string, async bool) (Message, error)

func (*MandrillAPI) MessageSearch

func (a *MandrillAPI) MessageSearch(searchRequest SearchRequest) ([]SearchResponse, error)

func (*MandrillAPI) MessageSend

func (a *MandrillAPI) MessageSend(message Message, async bool) ([]SendResponse, error)

func (*MandrillAPI) MessageSendRaw

func (a *MandrillAPI) MessageSendRaw(rawMessage string, to []string, from Recipient, async bool) ([]SendResponse, error)

Can return oneof Invalid_Key, ValidationError or GeneralError

func (*MandrillAPI) MessageSendTemplate

func (a *MandrillAPI) MessageSendTemplate(templateName string, templateContent []Var, message Message, async bool) ([]SendResponse, error)

func (*MandrillAPI) MessageSendWithOptions

func (a *MandrillAPI) MessageSendWithOptions(message Message, opts MessageSendOptions) ([]SendResponse, error)

MessageSendWithOptions sends messages, allowing for a few configuration options todo: add ip_pool and key to MessageSendOptions

func (*MandrillAPI) Ping

func (a *MandrillAPI) Ping() (string, error)

func (*MandrillAPI) RejectsDelete

func (a *MandrillAPI) RejectsDelete(email string) (bool, error)

can error with one of the following: Invalid_Reject, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) RejectsList

func (a *MandrillAPI) RejectsList(email string, includeExpired bool) ([]Reject, error)

RejectsList retrieves your email rejection blacklist. You can provide an email address to limit the results. Returns up to 1000 results. By default, entries that have expired are excluded from the results; set include_expired to true to include them.

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) RouteAdd

func (a *MandrillAPI) RouteAdd(domain string, pattern string, url string) (Route, error)

can error with one of the following: Invalid_Key, Unknown_InboundDomain, ValidationError, GeneralError

func (*MandrillAPI) RouteDelete

func (a *MandrillAPI) RouteDelete(id string) (Route, error)

can error with one of the following: Invalid_Key, Unknown_InboundDomain, ValidationError, GeneralError

func (*MandrillAPI) RouteList

func (a *MandrillAPI) RouteList(domain string) ([]Route, error)

can error with one of the following: Invalid_Key, Unknown_InboundDomain, ValidationError, GeneralError

func (*MandrillAPI) RouteUpdate

func (a *MandrillAPI) RouteUpdate(id string, domain string, pattern string, url string) (Route, error)

can error with one of the following: Invalid_Key, Unknown_InboundDomain, ValidationError, GeneralError

func (*MandrillAPI) SendRawMIME

func (a *MandrillAPI) SendRawMIME(raw_message string, to []string, mail_from string, helo string, client_address string) ([]InboundRecipient, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) SenderDomains

func (a *MandrillAPI) SenderDomains() ([]Domain, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) SenderInfo

func (a *MandrillAPI) SenderInfo(address string) (SenderInfo, error)

can error with one of the following: Unknown_Sender, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) SenderList

func (a *MandrillAPI) SenderList() ([]Sender, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) SenderTimeSeries

func (a *MandrillAPI) SenderTimeSeries(address string) ([]TimeSeries, error)

can error with one of the following: Unknown_Sender, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) SubaccountAdd

func (a *MandrillAPI) SubaccountAdd(id string, name string, notes string, custom_quota int32) (response SubaccountInfo, err error)

func (*MandrillAPI) SubaccountDelete

func (a *MandrillAPI) SubaccountDelete(id string) (response SubaccountInfo, err error)

func (*MandrillAPI) SubaccountInfo

func (a *MandrillAPI) SubaccountInfo(id string) (response SubaccountInfo, err error)

func (*MandrillAPI) SubaccountList

func (a *MandrillAPI) SubaccountList() (response []SubaccountInfo, err error)

func (*MandrillAPI) SubaccountPause

func (a *MandrillAPI) SubaccountPause(id string) (response SubaccountInfo, err error)

func (*MandrillAPI) SubaccountResume

func (a *MandrillAPI) SubaccountResume(id string) (response SubaccountInfo, err error)

func (*MandrillAPI) SubaccountUpdate

func (a *MandrillAPI) SubaccountUpdate(id string, name string, notes string, custom_quota int32) (response SubaccountInfo, err error)

func (*MandrillAPI) TagAllTimeSeries

func (a *MandrillAPI) TagAllTimeSeries() ([]TimeSeries, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TagInfo

func (a *MandrillAPI) TagInfo(tag string) (TagInfo, error)

can error with one of the following: Invalid_Tag_Name, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TagList

func (a *MandrillAPI) TagList() ([]ListResponse, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TagTimeSeries

func (a *MandrillAPI) TagTimeSeries(tag string) ([]TimeSeries, error)

can error with one of the following: Invalid_Tag_Name, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplateAdd

func (a *MandrillAPI) TemplateAdd(name string, code string, publish bool) (Template, error)

can error with one of the following: Unknown_Template, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplateDelete

func (a *MandrillAPI) TemplateDelete(name string) (Template, error)

can error with one of the following: Unknown_Template, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplateInfo

func (a *MandrillAPI) TemplateInfo(name string) (Template, error)

can error with one of the following: Unknown_Template, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplateList

func (a *MandrillAPI) TemplateList() ([]Template, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplatePublish

func (a *MandrillAPI) TemplatePublish(name string) (Template, error)

can error with one of the following: Unknown_Template, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplateRender

func (a *MandrillAPI) TemplateRender(templateName string, templateContent []Var, mergeVars []Var) (string, error)

can error with one of the following: Unknown_Template, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplateTimeSeries

func (a *MandrillAPI) TemplateTimeSeries(name string) ([]Template, error)

can error with one of the following: Unknown_Template, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) TemplateUpdate

func (a *MandrillAPI) TemplateUpdate(name string, code string, publish bool) (Template, error)

can error with one of the following: Unknown_Template, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) UrlList

func (a *MandrillAPI) UrlList() ([]UrlInfo, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) UrlSearch

func (a *MandrillAPI) UrlSearch(q string) ([]UrlInfo, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) UrlTimeSeries

func (a *MandrillAPI) UrlTimeSeries(url string) ([]UrlInfo, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) UserInfo

func (a *MandrillAPI) UserInfo() (Info, error)

func (*MandrillAPI) UserSenders

func (a *MandrillAPI) UserSenders() ([]Sender, error)

func (*MandrillAPI) WebhookAdd

func (a *MandrillAPI) WebhookAdd(url string, events []string) (Webhook, error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) WebhookDelete

func (a *MandrillAPI) WebhookDelete(id int) (Webhook, error)

can error with one of the following: Unknown_Webhook, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) WebhookInfo

func (a *MandrillAPI) WebhookInfo(id int) (Webhook, error)

can error with one of the following: Unknown_Webhook, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) WebhookUpdate

func (a *MandrillAPI) WebhookUpdate(url string, events []string) (Webhook, error)

can error with one of the following: Unknown_Webhook, Invalid_Key, ValidationError, GeneralError

func (*MandrillAPI) WebhooksList

func (a *MandrillAPI) WebhooksList() (response []Webhook, err error)

can error with one of the following: Invalid_Key, ValidationError, GeneralError

type MandrillError

type MandrillError struct {
	Status  string `json:"status"`
	Code    int    `json:"code"`
	Name    string `json:"name"`
	Message string `json:"message"`
}

four types of error Invalid_Key - The provided API key is not a valid Mandrill API key ValidationError - The parameters passed to the API call are invalid or not provided when required GeneralError - An unexpected error occurred processing the request. Mandrill developers will be notified. Unknown_Template - The requested template does not exist

func (MandrillError) Error

func (e MandrillError) Error() string

type MemberInfo

type MemberInfo struct {
	Email           string                 `json:"email"`
	Euid            string                 `json:"euid"`
	EmailType       string                 `json:"email_type"`
	IpSignup        string                 `json:"ip_signup,omitempty"`
	TimestampSignup string                 `json:"timestamp_signup,omitempty"`
	IpOpt           string                 `json:"ip_opt"`
	TimestampOpt    string                 `json:"timestamp_opt"`
	MemberRating    int                    `json:"member_rating"`
	InfoChanged     string                 `json:"info_changed"`
	Leid            int                    `json:"leid"`
	Language        string                 `json:"language,omitempty"`
	ListId          string                 `json:"list_id"`
	ListName        string                 `json:"list_name"`
	Merges          map[string]interface{} `json:"merges"`
	Status          string                 `json:"status"`
	Timestamp       string                 `json:"timestamp"`
}

type MergeVars

type MergeVars struct {
	Recipient string `json:"rcpt"`
	Vars      []Var  `json:"vars"`
}

type Message

type Message struct {
	Html                    string              `json:"html,omitempty"`
	Text                    string              `json:"text,omitempty"`
	Subject                 string              `json:"subject"`
	FromEmail               string              `json:"from_email"`
	FromName                string              `json:"from_name"`
	To                      []Recipient         `json:"to"`
	Headers                 map[string]string   `json:"headers,omitempty"`
	Important               bool                `json:"important,omitempty"`
	TrackOpens              bool                `json:"track_opens"`
	TrackClicks             bool                `json:"track_clicks"`
	ViewContentLink         bool                `json:"view_content_link,omitempty"`
	AutoText                bool                `json:"auto_text,omitempty"`
	AutoHtml                bool                `json:"auto_html,omitempty"`
	UrlStripQS              bool                `json:"url_strip_qs,omitempty"`
	InlineCss               bool                `json:"inline_css,omitempty"`
	PreserveRecipients      bool                `json:"preserve_recipients,omitempty"`
	BCCAddress              string              `json:"bcc_address,omitempty"`
	TrackingDomain          string              `json:"tracking_domain,omitempty"`
	SigningDomain           string              `json:"signing_domain,omitempty"`
	ReturnPathDomain        string              `json:"return_path_domain,omitempty"`
	Merge                   bool                `json:"merge,omitempty"`
	GlobalMergeVars         []Var               `json:"global_merge_vars,omitempty"`
	MergeVars               []MergeVars         `json:"merge_vars,omitempty"`
	Tags                    []string            `json:"tags,omitempty"`
	Subaccount              string              `json:"subaccount,omitempty"`
	GoogleAnalyticsDomains  []string            `json:"google_analytics_domains,omitempty"`
	GoogleAnalyticsCampaign []string            `json:"google_analytics_campaign,omitempty"`
	Metadata                map[string]string   `json:"metadata,omitempty"`
	RecipientMetadata       []RecipientMetaData `json:"recipient_metadata,omitempty"`
	Attachments             []Attachment        `json:"attachments,omitempty"`
	MergeLanguage           string              `json:"merge_language,omitempty"`
	Images                  []Attachment        `json:"images,omitempty"`
}

func (*Message) AddAttachments

func (m *Message) AddAttachments(attachement ...Attachment)

func (*Message) AddGlobalMergeVar

func (m *Message) AddGlobalMergeVar(globalvars ...Var)

func (*Message) AddGoogleAnalyticsCampaign

func (m *Message) AddGoogleAnalyticsCampaign(campaigns ...string)

func (*Message) AddGoogleAnalyticsDomains

func (m *Message) AddGoogleAnalyticsDomains(domains ...string)

func (*Message) AddHeader

func (m *Message) AddHeader(key, value string)

func (*Message) AddImages

func (m *Message) AddImages(image ...Attachment)

func (*Message) AddMergeVar

func (m *Message) AddMergeVar(vars ...MergeVars)

func (*Message) AddMetadata

func (m *Message) AddMetadata(key, value string)

func (*Message) AddRecipientMetadata

func (m *Message) AddRecipientMetadata(metadata ...RecipientMetaData)

func (*Message) AddRecipients

func (m *Message) AddRecipients(r ...Recipient)

func (*Message) AddTag

func (m *Message) AddTag(tags ...string)

func (*Message) String

func (m *Message) String() string

type MessageContent

type MessageContent struct {
	Timestamp TS        `json:"ts"`
	Id        string    `json:"_id"`
	FromEmail string    `json:"from_email"`
	FromName  string    `json:"from_name"`
	Subject   string    `json:"subject"`
	To        Recipient `json:"to"`
	Text      string    `json:"text"`
	Html      string    `json:"html"`
}

type MessageSendOptions

type MessageSendOptions struct {
	Async  bool
	SendAt *time.Time
}

MessageSendOptions wraps options for MessageSend API call

type Recipient

type Recipient struct {
	Email string `json:"email"`
	Name  string `json:"name"`
	Type  string `json:"type"`
}

type RecipientMetaData

type RecipientMetaData struct {
	Recipient string            `json:"rcpt"`
	Vars      map[string]string `json:"values"`
}

type Reject

type Reject struct {
	Email       string  `json:"email"`
	Reason      string  `json:"reason"`
	Detail      string  `json:"detail"`
	CreatedAt   APITime `json:"created_at"`
	LastEventAt APITime `json:"last_event_at"`
	ExpiresAt   APITime `json:"expires_at"`
	Expired     bool    `json:"expired"`
	Sender      Sender  `json:"sender"`
}

type ReportClicksResponse

type ReportClicksResponse struct {
	Total []TrackedUrl `json:"total"`
}

type ReportSummaryResponse

type ReportSummaryResponse struct {
	HardBounce   int         `json:"hard_bounces"`
	SoftBounce   int         `json:"soft_bounces"`
	Unsubscribes int         `json:"unsubscribes"`
	AbuseReports int         `json:"abuse_reports"`
	Opens        int         `json:"opens"`
	UniqueOpens  int         `json:"unique_opens"`
	Clicks       int         `json:"clicks"`
	UniqueClicks int         `json:"unique_clicks"`
	EmailsSent   int         `json:"emails_sent"`
	TimeSeries   []TimeSerie `json:"timeseries"`
}

type ReportsClicks

type ReportsClicks struct {
	ApiKey     string `json:"apikey"`
	CampaignId string `json:"cid"`
}

type ReportsSummary

type ReportsSummary struct {
	ApiKey     string `json:"apikey"`
	CampaignId string `json:"cid"`
}

type Resend

type Resend struct {
	Timestamp time.Duration `json:"ts"`
}

type Route

type Route struct {
	Id      string `json:"id"`
	Pattern string `json:"pattern"`
	Url     string `json:"url"`
}

type SMTPEvent

type SMTPEvent struct {
	Timestamp     time.Duration `json:"ts"`
	Type          string        `json:"type"`
	Diagnostics   string        `json:"diag"`
	SourceIP      string        `json:"source_ip"`
	DestinationIP string        `json:"destination_ip"`
	Size          int           `json:"size"`
}

type SearchRequest

type SearchRequest struct {
	Query    string   `json:"query"`
	DateFrom APITime  `json:"date_from"`
	DateTo   APITime  `json:"date_to"`
	Tags     []string `json:"tags"`
	Senders  []string `json:"senders"`
	APIKeys  []string `json:"api_keys"`
	Limit    int      `json:"limit"`
}

type SearchResponse

type SearchResponse struct {
	Timestamp    time.Duration     `json:"ts"`
	Id           string            `json:"_id"`
	Sender       string            `json:"sender"`
	Subject      string            `json:"subject"`
	Email        string            `json:"email"`
	Tags         []string          `json:"tags"`
	Opens        int               `json:"opens"`
	Clicks       int               `json:"clicks"`
	State        string            `json:"state"`
	Diag         string            `json:"diag"`
	Metadata     map[string]string `json:"metadata"`
	Template     interface{}       `json:"template"`
	Resends      []Resend          `json:"resends"`
	SMTPEvents   []SMTPEvent       `json:"smtp_events"`
	OpensDetail  []ActivityDetail  `json:"opens_detail"`
	ClicksDetail []ActivityDetail  `json:"clicks_detail"`
}

type SendResponse

type SendResponse struct {
	Email          string `json:"email"`
	Status         string `json:"status"`
	Id             string `json:"_id"`
	RejectedReason string `json:"reject_reason"`
}

type Sender

type Sender struct {
	Sent         int     `json:"sent"`
	HardBounces  int     `json:"hard_bounces"`
	SoftBounces  int     `json:"soft_bounces"`
	Rejects      int     `json:"rejects"`
	Complaints   int     `json:"complaints"`
	Unsubs       int     `json:"unsubs"`
	Opens        int     `json:"opens"`
	Clicks       int     `json:"clicks"`
	UniqueOpens  int     `json:"unique_opens"`
	UniqueClicks int     `json:"unique_clicks"`
	Reputation   int     `json:"reputation"`
	Address      string  `json:"address"`
	CreatedAt    APITime `json:"created_at"`
}

func (*Sender) String

func (s *Sender) String() string

type SenderInfo

type SenderInfo struct {
	Address     string    `json:"address"`
	CreatedAt   time.Time `json:"created_at"`
	Sent        int32     `json:"sent"`
	HardBounces int32     `json:"hard_bounces"`
	SoftBounces int32     `json:"soft_bounces"`
	Rejects     int32     `json:"rejects"`
	Complaints  int32     `json:"complaints"`
	Unsubs      int32     `json:"unsubs"`
	Opens       int32     `json:"opens"`
	Clicks      int32     `json:"clicks"`
	Stats       []Stat    `json:"stats"`
}

type Stat

type Stat struct {
	Sent         int `json:"sent"`
	HardBounces  int `json:"hard_bounces"`
	SoftBounces  int `json:"soft_bounces"`
	Rejects      int `json:"rejects"`
	Complaints   int `json:"complaints"`
	Unsubs       int `json:"unsubs"`
	Opens        int `json:"opens"`
	UniqueOpens  int `json:"unique_opens"`
	Clicks       int `json:"clicks"`
	UniqueClicks int `json:"unique_clicks"`
}

type SubaccountInfo

type SubaccountInfo struct {
	Id          string               `json:"id"`
	Name        string               `json:"name"`
	Notes       string               `json:"notes"`
	CustomQuota int32                `json:"custom_quota"`
	Status      string               `json:"status"`
	Reputation  int32                `json:"reputation"`
	CreatedAt   APITime              `json:"created_at"`
	FirstSentAt APITime              `json:"first_sent_at"`
	SentWeekly  int32                `json:"sent_weekly"`
	SentMonthly int32                `json:"sent_monthly"`
	SentTotal   int32                `json:"sent_total"`
	SentHourly  int32                `json:"sent_hourly"`
	HourlyQuota int32                `json:"hourly_quota"`
	Last30Days  SubaccountTimeSeries `json:"last_30_days"`
}

type SubaccountTimeSeries

type SubaccountTimeSeries struct {
	Sent         int32 `json:"sent"`
	HardBounces  int32 `json:"hard_bounces"`
	SoftBounces  int32 `json:"soft_bounces"`
	Rejects      int32 `json:"rejects"`
	Complaints   int32 `json:"complaints"`
	Unsubs       int32 `json:"unsubs"`
	Opens        int32 `json:"opens"`
	UniqueOpens  int32 `json:"unique_opens"`
	Clicks       int32 `json:"clicks"`
	UniqueClicks int32 `json:"unique_clicks"`
}

type TS

type TS struct {
	time.Time
}

func (*TS) UnmarshalJSON

func (t *TS) UnmarshalJSON(data []byte) error

type TagInfo

type TagInfo struct {
	Tag          string `json:"tag"`
	Reputation   int32  `json:"reputation,omitempty"`
	Sent         int32  `json:"sent"`
	HardBounces  int32  `json:"hard_bounces"`
	SoftBounces  int32  `json:"soft_bounces"`
	Rejects      int32  `json:"rejects"`
	Complaints   int32  `json:"complaints"`
	Unsubs       int32  `json:"unsubs"`
	Opens        int32  `json:"opens"`
	Clicks       int32  `json:"clicks"`
	UniqueOpens  int32  `json:"unique_opens"`
	UniqueClicks int32  `json:"unique_clicks"`
	Stats        []Stat `json:"stats,omitempty"`
}

type Template

type Template struct {
	Name             string  `json:"name"`
	Code             string  `json:"code"`
	PublishName      string  `json:"publish_name"`
	PublishCode      string  `json:"publish_code"`
	Slug             string  `json:"slug"`
	Subject          string  `json:"subject"`
	CreatedAt        APITime `json:"published_at"`
	UpdateAt         APITime `json:"updated_at"`
	FromEmail        string  `json:"from_email"`
	FromName         string  `json:"from_name"`
	Text             string  `json:"text"`
	PublishFromEmail string  `json:"publish_from_email"`
	PublishFromName  string  `json:"publish_from_name"`
	PublishText      string  `json:"publish_text"`
	PublishSubject   string  `json:"publish_subject"`
	PublishAt        APITime `json:"published_at"`
}

type TemplateInfo

type TemplateInfo struct {
	ApiKey     string `json:"apikey"`
	TemplateID int    `json:"template_id"`
	Type       string `json:"type"`
}

type TemplateInfoResponse

type TemplateInfoResponse struct {
	DefaultContent interface{}
	Sections       interface{}
	Source         string
	Preview        string
}

type TemplateListFilter

type TemplateListFilter struct {
	Category           string `json:"category"`
	FolderId           string `json:"folder_id"`
	IncludeInactive    bool   `json:"include_inactive"`
	InactiveOnly       bool   `json:"inactive_only"`
	IncludeDragAndDrop bool   `json:"include_drag_and_drop"`
}

type TemplateListType

type TemplateListType struct {
	User    bool `json:"user"`
	Gallery bool `json:"gallery"`
	Base    bool `json:"base"`
}

type TemplatesAdd

type TemplatesAdd struct {
	ApiKey   string `json:"apikey"`
	Name     string `json:"name"`
	HTML     string `json:"html"`
	FolderID int    `json:"folder_id,omitempty"`
}

type TemplatesAddResponse

type TemplatesAddResponse struct {
	TemplateID int `json:"template_id"`
}

type TemplatesList

type TemplatesList struct {
	ApiKey  string             `json:"apikey"`
	Types   TemplateListType   `json:"types"`
	Filters TemplateListFilter `json:"filters"`
}

type TemplatesListResponse

type TemplatesListResponse struct {
	User    []UserTemplate    `json:"user"`
	Gallery []GalleryTemplate `json:"gallery"`
}

type TemplatesUpdate

type TemplatesUpdate struct {
	ApiKey     string                `json:"apikey"`
	TemplateID int                   `json:"template_id"`
	Values     TemplatesUpdateValues `json:"values"`
}

type TemplatesUpdateResponse

type TemplatesUpdateResponse struct {
	Complete bool `json:"complete"`
}

type TemplatesUpdateValues

type TemplatesUpdateValues struct {
	Name     string `json:"name"`
	HTML     string `json:"html"`
	FolderID int    `json:"folder_id,omitempty"`
}

type TimeSerie

type TimeSerie struct {
	TimeStamp       string `json:"timestamp"`
	EmailsSent      int    `json:"emails_sent"`
	UniqueOpens     int    `json:"unique_opens"`
	RecipientsClick int    `json:"recipients_click"`
}

type TimeSeries

type TimeSeries struct {
	Time         APITime `json:"time"`
	Sent         int32   `json:"sent"`
	HardBounces  int32   `json:"hard_bounces"`
	SoftBounces  int32   `json:"soft_bounces"`
	Rejects      int32   `json:"rejects"`
	Complaints   int32   `json:"complaints"`
	Unsubs       int32   `json:"unsubs"`
	Opens        int32   `json:"opens"`
	UniqueOpens  int32   `json:"unique_opens"`
	Clicks       int32   `json:"clicks"`
	UniqueClicks int32   `json:"unique_clicks"`
}

type TrackedUrl

type TrackedUrl struct {
	Url           string  `json:"url"`
	Clicks        int     `json:"clicks"`
	ClicksPercent float32 `json:"clicks_percent"`
	Unique        int     `json:"unique"`
	UniquePercent float32 `json:"unique_percent"`
}

type UpdateMember

type UpdateMember struct {
	ApiKey           string                 `json:"apikey"`
	ListId           string                 `json:"id"`
	Email            Email                  `json:"email"`
	MergeVars        map[string]interface{} `json:"merge_vars,omitempty"`
	EmailType        string                 `json:"email_type,omitempty"`
	ReplaceInterests bool                   `json:"replace_interests"`
}

type UrlInfo

type UrlInfo struct {
	Url          string `json:"url"`
	Sent         int    `json:"sent"`
	Clicks       int    `json:"clicks"`
	UniqueClicks int    `json:"unique_clicks"`
}

type UrlTimeSeriesInfo

type UrlTimeSeriesInfo struct {
	Time         APITime `json:"time"`
	Sent         int     `json:"sent"`
	Clicks       int     `json:"clicks"`
	UniqueClicks int     `json:"unique_clicks"`
}

type UserTemplate

type UserTemplate struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	Layout       string `json:"layout"`
	Category     string `json:"category"`
	PreviewImage string `json:"preview_image"`
	DateCreated  string `json:"date_created"`
	Active       bool   `json:"active"`
	EditSource   bool   `json:"edit_source"`
	FolderId     bool   `json:"folder_id"`
}

type Var

type Var struct {
	Name    string      `json:"name"`
	Content interface{} `json:"content"`
}

func NewVar

func NewVar(name string, content interface{}) *Var

type Webhook

type Webhook struct {
	Id          int      `json:"id"`
	Url         string   `json:"url"`
	AuthKey     string   `json:"auth_key"`
	Events      []string `json:"events"`
	CreatedAt   APITime  `json:"created_at"`
	LastSentAt  APITime  `json:"last_sent_at"`
	BatchesSent int      `json:"batches_sent"`
	EventsSent  int      `json:"events_sent"`
	LastError   string   `json:"last_error"`
}

func (Webhook) HasAllEvents

func (w Webhook) HasAllEvents(events []string) (found bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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