members

package
v0.0.0-...-7c5f827 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2016 License: BSD-3-Clause, MIT Imports: 6 Imported by: 1

Documentation

Overview

Package members implements the Members resource of the MailChimp API v3.

Reference: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/

Index

Constants

View Source
const (
	StatusSubscribed   Status = "subscribed"
	StatusUnsubscribed        = "unsubscribed"
	StatusCleaned             = "cleaned"
	StatusPending             = "pending"
)

The subscription status definitions.

Variables

This section is empty.

Functions

func Delete

func Delete(listID, hash string) error

Delete deletes a list member.

Types

type EmailType

type EmailType string

EmailType defines the type of email a member asked to get.

const (
	EmailTypeHTML EmailType = "html"
	EmailTypeText           = "text"
)

The email type definitions.

type GetMemberParams

type GetMemberParams struct {
	Fields        []string `url:"fields,omitempty"`
	ExcludeFields []string `url:"exclude_fields,omitempty"`
}

GetMemberParams defines the available parameters that can be used when getting information on a specific member via the GetMember function.

func (*GetMemberParams) EncodeQueryString

func (gmp *GetMemberParams) EncodeQueryString(v interface{}) (string, error)

EncodeQueryString handles custom query string encoding for the GetMemberParams object.

type GetParams

type GetParams struct {
	Fields             []string  `url:"fields,omitempty"`
	ExcludeFields      []string  `url:"exclude_fields,omitempty"`
	Count              int       `url:"count,omitempty"`
	Offset             int       `url:"offset,omitempty"`
	EmailType          EmailType `url:"email_type,omitempty"`
	Status             Status    `url:"status,omitempty"`
	SinceTimestampOpt  time.Time `url:"since_timestamp_opt,omitempty"`
	BeforeTimestampOpt time.Time `url:"before_timestamp_opt,omitempty"`
	SinceLastChanged   time.Time `url:"since_last_changed,omitempty"`
	BeforeLastChanged  time.Time `url:"before_last_changed,omitempty"`
	UniqueEmailID      string    `url:"unique_email_id,omitempty"`
	VIPOnly            bool      `url:"vip_only,omitempty"`
}

GetParams defines the available parameters that can be used when getting a list of members via the Get function.

func (*GetParams) EncodeQueryString

func (gp *GetParams) EncodeQueryString(v interface{}) (string, error)

EncodeQueryString handles custom query string encoding for the GetParams object.

type ListMembers

type ListMembers struct {
	Members    []Member `json:"members,omitempty"`
	ListID     string   `json:"list_id"`
	TotalItems int      `json:"total_items"`
}

ListMembers defines a list of members.

func Get

func Get(listID string, params *GetParams) (*ListMembers, error)

Get retrieves information about members in a list.

type Location

type Location struct {
	Latitude    float64 `json:"latitude,omitempty"`
	Longitude   float64 `json:"longitude,omitempty"`
	GMTOff      int     `json:"gmtoff,omitempty"`
	DSTOff      int     `json:"dstoff,omitempty"`
	CountryCode string  `json:"country_code,omitempty"`
	Timezone    string  `json:"timezone,omitempty"`
}

Location defines a member's location information.

type Member

type Member struct {
	ID              string                 `json:"id"`
	EmailAddress    string                 `json:"email_address"`
	UniqueEmailID   string                 `json:"unique_email_id"`
	EmailType       EmailType              `json:"email_type,omitempty"`
	Status          Status                 `json:"status"`
	MergeFields     map[string]interface{} `json:"merge_fields,omitempty"`
	Interests       map[string]bool        `json:"interests,omitempty"`
	Stats           *Stats                 `json:"stats,omitempty"`
	IPSignup        string                 `json:"ip_signup,omitempty"`
	TimestampSignup time.Time              `json:"timestamp_signup,omitempty"`
	IPOpt           string                 `json:"ip_opt,omitempty"`
	TimestampOpt    time.Time              `json:"timestamp_opt,omitempty"`
	MemberRating    uint8                  `json:"member_rating,omitempty"`
	LastChanged     time.Time              `json:"last_changed,omitempty"`
	Language        string                 `json:"language,omitempty"`
	VIP             bool                   `json:"vip,omitempty"`
	EmailClient     string                 `json:"email_client,omitempty"`
	Location        *Location              `json:"location,omitempty"`
	LastNote        *Note                  `json:"last_note,omitempty"`
	ListID          string                 `json:"list_id"`
}

Member defines a single member within a list.

func GetMember

func GetMember(listID, hash string, params *GetMemberParams) (*Member, error)

GetMember retrieves information about a specific member within a list.

func New

func New(listID string, params *NewParams) (*Member, error)

New adds a new list member.

func Update

func Update(listID, hash string, params *UpdateParams) (*Member, error)

Update updates a list member.

func (*Member) UnmarshalJSON

func (m *Member) UnmarshalJSON(data []byte) error

UnmarshalJSON handles custom JSON unmarshalling for the Member object. Credit to http://choly.ca/post/go-json-marshalling/

type NewParams

type NewParams struct {
	EmailType       EmailType              `json:"email_type,omitempty"`
	Status          Status                 `json:"status"`
	MergeFields     map[string]interface{} `json:"merge_fields,omitempty"`
	Interests       map[string]bool        `json:"interests,omitempty"`
	Language        string                 `json:"language,omitempty"`
	VIP             bool                   `json:"vip,omitempty"`
	Location        *Location              `json:"location,omitempty"`
	IPSignup        string                 `json:"ip_signup,omitempty"`
	TimestampSignup time.Time              `json:"timestamp_signup,omitempty"`
	IPOpt           string                 `json:"ip_opt,omitempty"`
	TimestampOpt    time.Time              `json:"timestamp_opt,omitempty"`
	EmailAddress    string                 `json:"email_address"`
}

NewParams defines the available parameters that can be used when adding a new list member via the New function.

func (*NewParams) MarshalJSON

func (np *NewParams) MarshalJSON() ([]byte, error)

MarshalJSON handles custom JSON marshalling for the NewParams object. Credit to http://choly.ca/post/go-json-marshalling/

type Note

type Note struct {
	NoteID    int       `json:"note_id"`
	CreatedAt time.Time `json:"created_at"`
	CreatedBy string    `json:"created_by"`
	Note      string    `json:"note"`
}

Note defines a note about a member.

func (*Note) UnmarshalJSON

func (n *Note) UnmarshalJSON(data []byte) error

UnmarshalJSON handles custom JSON unmarshalling for the Note object. Credit to http://choly.ca/post/go-json-marshalling/

type Stats

type Stats struct {
	AvgOpenRate  float32 `json:"avg_open_rate,omitempty"`
	AvgClickRate float32 `json:"avg_click_rate,omitempty"`
}

Stats defines the open and click rates for a member.

type Status

type Status string

Status defines the subscription status for a given member within a List.

type UpdateParams

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

UpdateParams defines the available parameters that can be used when updating a list member via the Update function.

func (*UpdateParams) MarshalJSON

func (up *UpdateParams) MarshalJSON() ([]byte, error)

MarshalJSON handles custom JSON marshalling for the UpdateParams object. Credit to http://choly.ca/post/go-json-marshalling/

Jump to

Keyboard shortcuts

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