From bb79302b8add1410656ac20ecf2693ff1aeaf1ea Mon Sep 17 00:00:00 2001 From: Michael Claes Date: Wed, 12 Oct 2022 17:05:39 +0200 Subject: [PATCH 1/7] member has memberactivity, not activity --- members.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 { From 656878dbad1c81252b58cc4e46e5726f204fe28a Mon Sep 17 00:00:00 2001 From: Michael Claes Date: Wed, 12 Oct 2022 17:23:09 +0200 Subject: [PATCH 2/7] forked mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From b1a620dfbd7d38703587e4c810c36e6a76f7d665 Mon Sep 17 00:00:00 2001 From: Michael Claes Date: Wed, 12 Oct 2022 17:24:16 +0200 Subject: [PATCH 3/7] hanzoai => Elandiro --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ( From 1b907792959c47a064db6c34f0dc185903afd19d Mon Sep 17 00:00:00 2001 From: Michael Claes Date: Wed, 19 Oct 2022 10:47:02 +0200 Subject: [PATCH 4/7] segments use integer id, not string --- segments.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"` From dde487e0df522d8724460523beb08972e2f754e4 Mon Sep 17 00:00:00 2001 From: Michael Claes Date: Wed, 19 Oct 2022 15:22:05 +0200 Subject: [PATCH 5/7] lists queryparams support --- lists.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lists.go b/lists.go index e13e140..8b1f829 100644 --- a/lists.go +++ b/lists.go @@ -499,6 +499,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"] = fmt.Sprintf("%s", b.SkipMergeValidation) + params["skip_duplicate_check"] = fmt.Sprintf("%s", b.SkipDuplicateCheck) + return params +} + type BatchSubscribeMembersError struct { EmailAddress string `json:"email_address"` ErrorMessage string `json:"error"` @@ -523,7 +535,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 +543,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) } // ------------------------------------------------------------------------------------------------ From 2e943cd8225364ef1c32afec5d8c33fed4628d45 Mon Sep 17 00:00:00 2001 From: Michael Claes Date: Wed, 19 Oct 2022 15:29:32 +0200 Subject: [PATCH 6/7] format bool params --- lists.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lists.go b/lists.go index 8b1f829..ba0b720 100644 --- a/lists.go +++ b/lists.go @@ -3,6 +3,7 @@ package gochimp3 import ( "errors" "fmt" + "strconv" ) const ( @@ -506,8 +507,8 @@ type BatchSubscribeMembersParams struct { func (b *BatchSubscribeMembersParams) Params() map[string]string { params := make(map[string]string) - params["skip_merge_validation"] = fmt.Sprintf("%s", b.SkipMergeValidation) - params["skip_duplicate_check"] = fmt.Sprintf("%s", b.SkipDuplicateCheck) + params["skip_merge_validation"] = strconv.FormatBool(b.SkipDuplicateCheck) + params["skip_duplicate_check"] = strconv.FormatBool(b.SkipDuplicateCheck) return params } From ef9a4a6585f252bb43d3df23c637b4fa2da06354 Mon Sep 17 00:00:00 2001 From: Michael Claes Date: Wed, 19 Oct 2022 15:52:07 +0200 Subject: [PATCH 7/7] wrong boolean for skip_merge_validation --- lists.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lists.go b/lists.go index ba0b720..2bd2aa7 100644 --- a/lists.go +++ b/lists.go @@ -507,7 +507,7 @@ type BatchSubscribeMembersParams struct { func (b *BatchSubscribeMembersParams) Params() map[string]string { params := make(map[string]string) - params["skip_merge_validation"] = strconv.FormatBool(b.SkipDuplicateCheck) + params["skip_merge_validation"] = strconv.FormatBool(b.SkipMergeValidation) params["skip_duplicate_check"] = strconv.FormatBool(b.SkipDuplicateCheck) return params }