Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions helpers/mail/mail_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{}
Expand Down
12 changes: 12 additions & 0 deletions helpers/mail/mail_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down