diff --git a/helpers/mail/mail_v3.go b/helpers/mail/mail_v3.go index 59df3b46..9d80164b 100644 --- a/helpers/mail/mail_v3.go +++ b/helpers/mail/mail_v3.go @@ -52,6 +52,7 @@ type Personalization struct { DynamicTemplateData map[string]interface{} `json:"dynamic_template_data,omitempty"` Categories []string `json:"categories,omitempty"` SendAt int `json:"send_at,omitempty"` + SendEachAt []int `json:"send_each_at,omitempty"` } // Email holds email name and address info @@ -369,6 +370,11 @@ func (p *Personalization) SetSendAt(sendAt int) { p.SendAt = sendAt } +// SetSendEachAt ... +func (p *Personalization) SetSendEachAt(sendEachAt []int) { + p.SendEachAt = sendEachAt +} + // NewAttachment ... func NewAttachment() *Attachment { return &Attachment{} diff --git a/helpers/mail/mail_v3_test.go b/helpers/mail/mail_v3_test.go index 28af9192..920689b1 100644 --- a/helpers/mail/mail_v3_test.go +++ b/helpers/mail/mail_v3_test.go @@ -380,6 +380,18 @@ func TestV3PersonalizationSetSendAt(t *testing.T) { assert.Equal(t, sendAt, p.SendAt, fmt.Sprintf("sendat should be %d, got %d", sendAt, p.SendAt)) } +func TestV3PersonalizationSetSendEachAt(t *testing.T) { + sendAts := []int{ + time.Now().Second(), + time.Now().AddDate(0, 0, 1).Second(), + } + + p := NewPersonalization() + p.SetSendEachAt(sendAts) + + assert.Equal(t, len(sendAts), len(p.SendEachAt), fmt.Sprintf("length of SendEachAt should be %d, got %d", len(sendAts), len(p.SendEachAt))) +} + func TestV3NewAttachment(t *testing.T) { assert.NotNil(t, NewAttachment(), "NewAttachment() shouldn't return nil") }