Documentation
¶
Index ¶
- Constants
- Variables
- type APIError
- type ChimpClient
- func (c *ChimpClient) CreateSegment(listID string, payload *SegmentPayload) (*SegmentResponse, error)
- func (c *ChimpClient) DeleteStaticSegment(listID string, segmentId int) error
- func (c *ChimpClient) GetSegmentMembers(listID string, segmentId int) (*SegmentMembersResponse, error)
- func (c *ChimpClient) GetSegments(listID string) (*SegmentsResponse, error)
- func (c *ChimpClient) UpdateStaticSegment(listID string, segmentId int, payload *SegmentPayload) (*SegmentResponse, error)
- type ChimpOptionFunc
- type ErrorResponse
- type LinkResponse
- type SegmentMemberResponse
- type SegmentMembersResponse
- type SegmentOptions
- type SegmentPayload
- type SegmentResponse
- type SegmentsResponse
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 ¶
View Source
var ChimpDC = regexp.MustCompile(ChimpDCPattern)
Functions ¶
This section is empty.
Types ¶
type APIError ¶
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 LinkResponse ¶
type SegmentMemberResponse ¶
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 SegmentsResponse ¶
type SegmentsResponse struct {
Segments []SegmentResponse `json:"segments"`
ListID string `json:"list_id"`
Total int `json:"total_items"`
Links []LinkResponse `json:"_links"`
}
Click to show internal directories.
Click to hide internal directories.