/
Personalization.swift
63 lines (51 loc) · 2.54 KB
/
Personalization.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import Vapor
public struct Personalization: Content {
/// An array of recipients. Each object within this array may contain the name, but must always contain the email, of a recipient.
public var to: [EmailAddress]?
/// An array of recipients who will receive a copy of your email. Each object within this array may contain the name, but must always contain the email, of a recipient.
public var cc: [EmailAddress]?
/// An array of recipients who will receive a blind carbon copy of your email. Each object within this array may contain the name, but must always contain the email, of a recipient.
public var bcc: [EmailAddress]?
/// The subject of your email.
public var subject: String?
/// A collection of JSON key/value pairs allowing you to specify specific handling instructions for your email.
public var headers: [String: String]?
/// A collection of key/value pairs following the pattern "substitution_tag":"value to substitute".
public var substitutions: [String: String]?
/// A collection of key/value pairs following the pattern "key":"value" to substitute handlebar template data
public var dynamicTemplateData: [String: String]?
/// Values that are specific to this personalization that will be carried along with the email and its activity data.
public var customArgs: [String: String]?
/// A unix timestamp allowing you to specify when you want your email to be delivered. Scheduling more than 72 hours in advance is forbidden.
public var sendAt: Date?
public init(to: [EmailAddress]? = nil,
cc: [EmailAddress]? = nil,
bcc: [EmailAddress]? = nil,
subject: String? = nil,
headers: [String: String]? = nil,
substitutions: [String: String]? = nil,
dynamicTemplateData: [String: String]? = nil,
customArgs: [String: String]? = nil,
sendAt: Date? = nil) {
self.to = to
self.cc = cc
self.bcc = bcc
self.subject = subject
self.headers = headers
self.substitutions = substitutions
self.dynamicTemplateData = dynamicTemplateData
self.customArgs = customArgs
self.sendAt = sendAt
}
public enum CodingKeys: String, CodingKey {
case to
case cc
case bcc
case subject
case headers
case substitutions
case customArgs = "custom_args"
case dynamicTemplateData = "dynamic_template_data"
case sendAt = "send_at"
}
}