mailchimp

package
v0.0.0-...-1aaf8f9 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EndpointListsStaticSegments       string = "/lists/%s/segments"
	EndpointListsStaticSegment        string = "/lists/%s/segments/%d"
	EndpointListsStaticSegmentMembers string = "/lists/%s/segments/%d/members"
)
View Source
const (
	ChimpURI       = "%s.api.mailchimp.com"
	ChimpVersion   = "3.0"
	ChimpDCPattern = "[c-z]+[0-9]+$"
	DefaultTimeout = 0
	DefaultDebug   = false
)

Variables

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 ChimpClient

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

func NewClient

func NewClient(apiKey string, options ...ChimpOptionFunc) *ChimpClient

func (*ChimpClient) CreateSegment

func (c *ChimpClient) CreateSegment(listID string, payload *SegmentPayload) (*SegmentResponse, error)

func (*ChimpClient) DeleteStaticSegment

func (c *ChimpClient) DeleteStaticSegment(listID string, segmentId int) error

func (*ChimpClient) GetSegmentMembers

func (c *ChimpClient) GetSegmentMembers(listID string, segmentId int) (*SegmentMembersResponse, error)

func (*ChimpClient) GetSegments

func (c *ChimpClient) GetSegments(listID string) (*SegmentsResponse, error)

func (*ChimpClient) UpdateStaticSegment

func (c *ChimpClient) UpdateStaticSegment(listID string, segmentId int, payload *SegmentPayload) (*SegmentResponse, error)

type ChimpOptionFunc

type ChimpOptionFunc func(*ChimpClient)

func SetDebug

func SetDebug(debug bool) ChimpOptionFunc

func SetTimeout

func SetTimeout(t time.Duration) ChimpOptionFunc

type ErrorResponse

type ErrorResponse struct {
	Type     string `json:"type"`
	Title    string `json:"title"`
	Status   int    `json:"status"`
	Detail   string `json:"detail"`
	Instance string `json:"instance"`
}

type LinkResponse

type LinkResponse struct {
	Rel          string
	Href         string
	Method       string
	TargetSchema string
	Schema       string
}

type SegmentMemberResponse

type SegmentMemberResponse struct {
	ID    string `json:"id"`
	Email string `json:"email_address"`
}

type SegmentMembersResponse

type SegmentMembersResponse struct {
	Members []SegmentMemberResponse `json:"members"`
	Total   int                     `json:"total_items"`
	Links   []LinkResponse          `json:"_links"`
}

type SegmentOptions

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

type SegmentPayload

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

type SegmentResponse

type SegmentResponse struct {
	ID           int            `json:"id"`
	Name         string         `json:"name"`
	MembersCount int            `json:"member_count"`
	Type         string         `json:"type"`
	CreatedAt    string         `json:"created_at"`
	UpdatedAt    string         `json:"updated_at"`
	ListID       string         `json:"list_id"`
	Links        []LinkResponse `json:"_links"`
}

type SegmentsResponse

type SegmentsResponse struct {
	Segments []SegmentResponse `json:"segments"`
	ListID   string            `json:"list_id"`
	Total    int               `json:"total_items"`
	Links    []LinkResponse    `json:"_links"`
}

Jump to

Keyboard shortcuts

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