diff --git a/README.md b/README.md index eee20aa..e4c6466 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Golang client for [MailChimp API 3.0](http://developer.mailchimp.com/documentati Install with `go get`: ```bash -$ go get github.com/hanzoai/gochimp3 +$ go get github.com/Elandiro/gochimp3 ``` ## Usage @@ -19,7 +19,7 @@ import ( "fmt" "os" - "github.com/hanzoai/gochimp3" + "github.com/Elandiro/gochimp3" ) const ( diff --git a/go.mod b/go.mod index 8dbbe9b..4daeb3b 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/hanzoai/gochimp3 +module github.com/Elandiro/gochimp3 go 1.13 diff --git a/lists.go b/lists.go index e13e140..2bd2aa7 100644 --- a/lists.go +++ b/lists.go @@ -3,6 +3,7 @@ package gochimp3 import ( "errors" "fmt" + "strconv" ) const ( @@ -499,6 +500,18 @@ func (interestCategory *InterestCategory) CreateInterest(body *InterestRequest) // ------------------------------------------------------------------------------------------------ // Batch subscribe list members // ------------------------------------------------------------------------------------------------ +type BatchSubscribeMembersParams struct { + SkipMergeValidation bool `json:"skip_merge_validation"` + SkipDuplicateCheck bool `json:"skip_duplicate_check"` +} + +func (b *BatchSubscribeMembersParams) Params() map[string]string { + params := make(map[string]string) + params["skip_merge_validation"] = strconv.FormatBool(b.SkipMergeValidation) + params["skip_duplicate_check"] = strconv.FormatBool(b.SkipDuplicateCheck) + return params +} + type BatchSubscribeMembersError struct { EmailAddress string `json:"email_address"` ErrorMessage string `json:"error"` @@ -523,7 +536,7 @@ type BatchSubscribeMembersRequest struct { UpdateExisting bool `json:"update_existing"` } -func (list *ListResponse) BatchSubscribeMembers(body *BatchSubscribeMembersRequest) (*BatchSubscribeMembersResponse, error) { +func (list *ListResponse) BatchSubscribeMembers(body *BatchSubscribeMembersRequest, params *BatchSubscribeMembersParams) (*BatchSubscribeMembersResponse, error) { if err := list.CanMakeRequest(); err != nil { return nil, err } @@ -531,7 +544,7 @@ func (list *ListResponse) BatchSubscribeMembers(body *BatchSubscribeMembersReque endpoint := fmt.Sprintf(lists_batch_subscribe_members, list.ID) response := new(BatchSubscribeMembersResponse) - return response, list.api.Request("POST", endpoint, nil, body, response) + return response, list.api.Request("POST", endpoint, params, body, response) } // ------------------------------------------------------------------------------------------------ diff --git a/members.go b/members.go index d9d0bd8..da4d170 100644 --- a/members.go +++ b/members.go @@ -241,9 +241,9 @@ func (list *ListResponse) DeleteMemberPermanent(id string) (bool, error) { type ListOfMemberActivity struct { baseList - EmailID string `json:"email_id"` - ListID string `json:"list_id"` - Activity []Activity `json:"activity"` + EmailID string `json:"email_id"` + ListID string `json:"list_id"` + Activity []MemberActivity `json:"activity"` } type MemberActivity struct { diff --git a/segments.go b/segments.go index 5ce9cda..7dd373c 100644 --- a/segments.go +++ b/segments.go @@ -23,7 +23,7 @@ type SegmentRequest struct { type Segment struct { SegmentRequest - ID string `json:"id"` + ID int `json:"id"` MemberCount int `json:"member_count"` Type string `json:"type"` CreatedAt string `json:"created_at"`