|
| 1 | +import Foundation |
| 2 | + |
| 3 | +public struct MailSettings: Encodable { |
| 4 | + /// This allows you to have a blind carbon copy automatically sent to the specified email address for every email that is sent. |
| 5 | + public var bcc: BCC? |
| 6 | + |
| 7 | + /// Allows you to bypass all unsubscribe groups and suppressions to ensure that the email is delivered to every single recipient. This should only be used in emergencies when it is absolutely necessary that every recipient receives your email. |
| 8 | + public var bypassListManagement: BypassListManagement? |
| 9 | + |
| 10 | + /// The default footer that you would like included on every email. |
| 11 | + public var footer: Footer? |
| 12 | + |
| 13 | + /// This allows you to send a test email to ensure that your request body is valid and formatted correctly. |
| 14 | + public var sandboxMode: SandboxMode? |
| 15 | + |
| 16 | + /// This allows you to test the content of your email for spam. |
| 17 | + public var spamCheck: SpamCheck? |
| 18 | + |
| 19 | + public init(bcc: BCC? = nil, |
| 20 | + bypassListManagement: BypassListManagement? = nil, |
| 21 | + footer: Footer? = nil, |
| 22 | + sandboxMode: SandboxMode? = nil, |
| 23 | + spamCheck: SpamCheck? = nil) { |
| 24 | + self.bcc = bcc |
| 25 | + self.bypassListManagement = bypassListManagement |
| 26 | + self.footer = footer |
| 27 | + self.sandboxMode = sandboxMode |
| 28 | + self.spamCheck = spamCheck |
| 29 | + } |
| 30 | + |
| 31 | + private enum CodingKeys: String, CodingKey { |
| 32 | + case bcc |
| 33 | + case bypassListManagement = "bypass_list_management" |
| 34 | + case footer |
| 35 | + case sandboxMode = "sandbox_mode" |
| 36 | + case spamCheck = "spam_check" |
| 37 | + } |
| 38 | + |
| 39 | + public func encode(to encoder: Encoder) throws { |
| 40 | + var container = encoder.container(keyedBy: CodingKeys.self) |
| 41 | + try container.encode(bcc, forKey: .bcc) |
| 42 | + try container.encode(bypassListManagement, forKey: .bypassListManagement) |
| 43 | + try container.encode(footer, forKey: .footer) |
| 44 | + try container.encode(sandboxMode, forKey: .sandboxMode) |
| 45 | + try container.encode(spamCheck, forKey: .spamCheck) |
| 46 | + } |
| 47 | +} |
| 48 | + |
| 49 | +public struct BCC: Encodable { |
| 50 | + /// Indicates if this setting is enabled. |
| 51 | + public var enable: Bool? |
| 52 | + public var email: String? |
| 53 | + |
| 54 | + public init(enable: Bool? = nil, |
| 55 | + email: String? = nil) { |
| 56 | + self.enable = enable |
| 57 | + self.email = email |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +public struct BypassListManagement: Encodable { |
| 62 | + /// Indicates if this setting is enabled. |
| 63 | + public var enable: Bool? |
| 64 | + |
| 65 | + public init(enable: Bool? = nil) { |
| 66 | + self.enable = enable |
| 67 | + } |
| 68 | +} |
| 69 | + |
| 70 | +public struct Footer: Encodable { |
| 71 | + /// Indicates if this setting is enabled. |
| 72 | + public var enable: Bool? |
| 73 | + |
| 74 | + /// The plain text content of your footer. |
| 75 | + public var text: String? |
| 76 | + |
| 77 | + /// The HTML content of your footer. |
| 78 | + public var html: String? |
| 79 | + |
| 80 | + public init(enable: Bool? = nil, |
| 81 | + text: String? = nil, |
| 82 | + html: String? = nil) { |
| 83 | + self.enable = enable |
| 84 | + self.text = text |
| 85 | + self.html = html |
| 86 | + } |
| 87 | +} |
| 88 | + |
| 89 | +public struct SandboxMode: Encodable { |
| 90 | + /// Indicates if this setting is enabled. |
| 91 | + public var enable: Bool? |
| 92 | + |
| 93 | + public init(enable: Bool? = nil) { |
| 94 | + self.enable = enable |
| 95 | + } |
| 96 | +} |
| 97 | + |
| 98 | +public struct SpamCheck: Encodable { |
| 99 | + /// Indicates if this setting is enabled. |
| 100 | + public var enable: Bool? |
| 101 | + |
| 102 | + /// The threshold used to determine if your content qualifies as spam on a scale from 1 to 10, with 10 being most strict, or most likely to be considered as spam. |
| 103 | + public var threshold: Int? |
| 104 | + |
| 105 | + /// An Inbound Parse URL that you would like a copy of your email along with the spam report to be sent to. |
| 106 | + public var postToUrl: String? |
| 107 | + |
| 108 | + public init(enable: Bool? = nil, |
| 109 | + threshold: Int? = nil, |
| 110 | + postToUrl: String? = nil) { |
| 111 | + self.enable = enable |
| 112 | + self.threshold = threshold |
| 113 | + self.postToUrl = postToUrl |
| 114 | + } |
| 115 | + |
| 116 | + private enum CodingKeys: String, CodingKey { |
| 117 | + case enable |
| 118 | + case threshold |
| 119 | + case postToUrl = "post_to_url" |
| 120 | + } |
| 121 | + |
| 122 | + public func encode(to encoder: Encoder) throws { |
| 123 | + var container = encoder.container(keyedBy: CodingKeys.self) |
| 124 | + try container.encode(enable, forKey: .enable) |
| 125 | + try container.encode(threshold, forKey: .threshold) |
| 126 | + try container.encode(postToUrl, forKey: .postToUrl) |
| 127 | + } |
| 128 | + |
| 129 | +} |
0 commit comments