1use serde::{Deserialize, Serialize};
9use serde_json::Value;
10use std::collections::HashMap;
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct Address {
17 pub email: String,
19 #[serde(skip_serializing_if = "Option::is_none")]
21 pub name: Option<String>,
22}
23
24impl Address {
25 pub fn new(email: impl Into<String>) -> Self {
27 Self {
28 email: email.into(),
29 name: None,
30 }
31 }
32
33 pub fn named(email: impl Into<String>, name: impl Into<String>) -> Self {
35 Self {
36 email: email.into(),
37 name: Some(name.into()),
38 }
39 }
40}
41
42impl From<&str> for Address {
43 fn from(s: &str) -> Self {
44 Address::new(s)
45 }
46}
47
48impl From<String> for Address {
49 fn from(s: String) -> Self {
50 Address::new(s)
51 }
52}
53
54impl From<(&str, &str)> for Address {
55 fn from((email, name): (&str, &str)) -> Self {
56 Address::named(email, name)
57 }
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62pub struct Attachment {
63 pub filename: String,
65 pub content_base64: String,
67 #[serde(skip_serializing_if = "Option::is_none")]
69 pub content_type: Option<String>,
70}
71
72#[derive(Debug, Clone, Deserialize)]
74pub struct Page<T> {
75 pub items: Vec<T>,
77 pub total: u64,
79 pub page: u64,
81 pub limit: u64,
83}
84
85#[derive(Debug, Clone, Serialize)]
91pub struct SendEmail {
92 #[serde(rename = "from_")]
94 pub from: Address,
95 pub to: Vec<Address>,
97 pub subject: String,
99 #[serde(skip_serializing_if = "Option::is_none")]
101 pub html: Option<String>,
102 #[serde(skip_serializing_if = "Option::is_none")]
104 pub text: Option<String>,
105 #[serde(skip_serializing_if = "Option::is_none")]
107 pub cc: Option<Vec<Address>>,
108 #[serde(skip_serializing_if = "Option::is_none")]
110 pub bcc: Option<Vec<Address>>,
111 #[serde(skip_serializing_if = "Option::is_none")]
113 pub reply_to: Option<Address>,
114 #[serde(skip_serializing_if = "Option::is_none")]
116 pub headers: Option<HashMap<String, String>>,
117 #[serde(skip_serializing_if = "Option::is_none")]
119 pub tags: Option<Vec<String>>,
120 #[serde(skip_serializing_if = "Option::is_none")]
122 pub send_at: Option<String>,
123 #[serde(skip_serializing_if = "Option::is_none")]
125 pub attachments: Option<Vec<Attachment>>,
126}
127
128impl SendEmail {
129 pub fn builder(
131 from: impl Into<Address>,
132 to: impl IntoAddressList,
133 subject: impl Into<String>,
134 ) -> SendEmailBuilder {
135 SendEmailBuilder {
136 inner: SendEmail {
137 from: from.into(),
138 to: to.into_address_list(),
139 subject: subject.into(),
140 html: None,
141 text: None,
142 cc: None,
143 bcc: None,
144 reply_to: None,
145 headers: None,
146 tags: None,
147 send_at: None,
148 attachments: None,
149 },
150 }
151 }
152}
153
154pub trait IntoAddressList {
156 fn into_address_list(self) -> Vec<Address>;
158}
159
160impl IntoAddressList for Address {
161 fn into_address_list(self) -> Vec<Address> {
162 vec![self]
163 }
164}
165
166impl IntoAddressList for &str {
167 fn into_address_list(self) -> Vec<Address> {
168 vec![Address::new(self)]
169 }
170}
171
172impl IntoAddressList for String {
173 fn into_address_list(self) -> Vec<Address> {
174 vec![Address::new(self)]
175 }
176}
177
178impl<T: Into<Address>> IntoAddressList for Vec<T> {
179 fn into_address_list(self) -> Vec<Address> {
180 self.into_iter().map(Into::into).collect()
181 }
182}
183
184#[derive(Debug, Clone)]
186pub struct SendEmailBuilder {
187 inner: SendEmail,
188}
189
190impl SendEmailBuilder {
191 pub fn html(mut self, html: impl Into<String>) -> Self {
193 self.inner.html = Some(html.into());
194 self
195 }
196
197 pub fn text(mut self, text: impl Into<String>) -> Self {
199 self.inner.text = Some(text.into());
200 self
201 }
202
203 pub fn cc(mut self, cc: impl IntoAddressList) -> Self {
205 self.inner.cc = Some(cc.into_address_list());
206 self
207 }
208
209 pub fn bcc(mut self, bcc: impl IntoAddressList) -> Self {
211 self.inner.bcc = Some(bcc.into_address_list());
212 self
213 }
214
215 pub fn reply_to(mut self, reply_to: impl Into<Address>) -> Self {
217 self.inner.reply_to = Some(reply_to.into());
218 self
219 }
220
221 pub fn headers(mut self, headers: HashMap<String, String>) -> Self {
223 self.inner.headers = Some(headers);
224 self
225 }
226
227 pub fn tags(mut self, tags: Vec<String>) -> Self {
229 self.inner.tags = Some(tags);
230 self
231 }
232
233 pub fn send_at(mut self, send_at: impl Into<String>) -> Self {
235 self.inner.send_at = Some(send_at.into());
236 self
237 }
238
239 pub fn attachments(mut self, attachments: Vec<Attachment>) -> Self {
241 self.inner.attachments = Some(attachments);
242 self
243 }
244
245 pub fn build(self) -> SendEmail {
247 self.inner
248 }
249}
250
251#[derive(Debug, Clone, Deserialize)]
255pub struct SendEmailResponse {
256 pub id: String,
258 pub status: String,
260 pub message_id: Option<String>,
262 pub rejection_reason: Option<String>,
264}
265
266#[derive(Debug, Clone, Deserialize)]
268pub struct BatchItemResult {
269 pub id: Option<String>,
271 pub status: String,
273 pub rejection_reason: Option<String>,
275}
276
277#[derive(Debug, Clone, Deserialize)]
279pub struct BatchResponse {
280 pub total: u64,
282 pub sent: u64,
284 pub failed: u64,
286 pub results: Vec<BatchItemResult>,
288}
289
290#[derive(Debug, Clone, Deserialize)]
292pub struct ValidationIssue {
293 pub field: String,
295 pub error: String,
297}
298
299#[derive(Debug, Clone, Deserialize)]
301pub struct ValidationUsage {
302 pub daily: u64,
304 pub daily_limit: u64,
306 pub monthly: u64,
308 pub monthly_limit: u64,
310}
311
312#[derive(Debug, Clone, Deserialize)]
314pub struct ValidationResult {
315 pub valid: bool,
317 pub can_send: bool,
319 pub issues: Vec<ValidationIssue>,
321 pub plan: String,
323 pub usage: ValidationUsage,
325}
326
327#[derive(Debug, Clone, Deserialize)]
329pub struct Email {
330 pub id: String,
332 pub from_address: String,
334 pub to_addresses: Vec<String>,
336 pub subject: Option<String>,
338 pub status: String,
340 #[serde(default)]
342 pub source: Option<String>,
343 #[serde(default)]
345 pub opened_count: Option<u64>,
346 #[serde(default)]
348 pub clicked_count: Option<u64>,
349 #[serde(default)]
351 pub tags: Option<Vec<String>>,
352 #[serde(default)]
354 pub scheduled_at: Option<String>,
355 pub created_at: Option<String>,
357 #[serde(default)]
359 pub sent_at: Option<String>,
360 #[serde(default)]
362 pub delivered_at: Option<String>,
363 #[serde(default)]
365 pub retry_of_id: Option<String>,
366}
367
368#[derive(Debug, Clone, Deserialize)]
370pub struct EmailEvent {
371 pub id: String,
373 pub event_type: String,
375 #[serde(default)]
377 pub metadata: Option<Value>,
378 pub created_at: String,
380}
381
382#[derive(Debug, Clone, Deserialize)]
384pub struct EmailDetail {
385 #[serde(flatten)]
387 pub email: Email,
388 #[serde(default)]
390 pub cc_addresses: Option<Vec<String>>,
391 #[serde(default)]
393 pub bcc_addresses: Option<Vec<String>>,
394 #[serde(default)]
396 pub text_body: Option<String>,
397 #[serde(default)]
399 pub html_body: Option<String>,
400 #[serde(default)]
402 pub headers: Option<Value>,
403 #[serde(default)]
405 pub message_id: Option<String>,
406 #[serde(default)]
408 pub events: Vec<EmailEvent>,
409}
410
411#[derive(Debug, Clone, Deserialize)]
413pub struct ScheduledEmail {
414 pub id: String,
416 pub from_address: String,
418 pub to_addresses: Vec<String>,
420 pub subject: Option<String>,
422 pub status: String,
424 #[serde(default)]
426 pub tags: Option<Vec<String>>,
427 #[serde(default)]
429 pub scheduled_at: Option<String>,
430 pub seconds_until_send: i64,
432 pub created_at: Option<String>,
434}
435
436#[derive(Debug, Clone, Deserialize)]
438pub struct EmailSearchHit {
439 pub id: String,
441 pub from_address: String,
443 pub to_addresses: Vec<String>,
445 pub subject: Option<String>,
447 pub status: String,
449 #[serde(default)]
451 pub tags: Option<Vec<String>>,
452 #[serde(default)]
454 pub source: Option<String>,
455 pub created_at: Option<String>,
457 #[serde(default)]
459 pub delivered_at: Option<String>,
460}
461
462#[derive(Debug, Clone, Deserialize)]
464pub struct IdStatus {
465 pub id: String,
467 pub status: String,
469}
470
471#[derive(Debug, Clone, Deserialize)]
475pub struct DomainListItem {
476 pub id: String,
478 pub name: String,
480 pub status: String,
482 pub created_at: Option<String>,
484 #[serde(default)]
486 pub platform_warning: Option<String>,
487}
488
489#[derive(Debug, Clone, Deserialize)]
491pub struct DnsRecord {
492 pub id: String,
494 pub record_type: String,
496 pub purpose: String,
498 pub host: String,
500 pub value: String,
502 pub is_verified: bool,
504 #[serde(default)]
506 pub last_checked_at: Option<String>,
507}
508
509#[derive(Debug, Clone, Deserialize)]
511pub struct Domain {
512 pub id: String,
514 pub name: String,
516 pub status: String,
518 pub dkim_selector: String,
520 #[serde(default)]
522 pub verified_at: Option<String>,
523 pub created_at: Option<String>,
525 pub dns_records: Vec<DnsRecord>,
527 #[serde(default)]
529 pub platform_warning: Option<String>,
530}
531
532#[derive(Debug, Clone, Deserialize)]
534pub struct DomainHealthCheck {
535 pub key: String,
537 pub label: String,
539 pub status: String,
541 pub detail: String,
543 #[serde(default)]
545 pub recommendation: Option<String>,
546 #[serde(default)]
548 pub record: Option<Value>,
549}
550
551#[derive(Debug, Clone, Deserialize)]
553pub struct DomainHealthSummary {
554 pub ok: u64,
556 pub warn: u64,
558 pub error: u64,
560 pub info: u64,
562}
563
564#[derive(Debug, Clone, Deserialize)]
566pub struct DomainHealth {
567 pub domain: String,
569 pub checks: Vec<DomainHealthCheck>,
571 pub summary: DomainHealthSummary,
573}
574
575#[derive(Debug, Clone, Deserialize)]
577pub struct DomainDiagnosis {
578 pub domain: String,
580 pub issues: Vec<Value>,
582 pub health_score: i64,
584}
585
586#[derive(Debug, Clone, Deserialize)]
588pub struct DkimRotation {
589 pub dkim_record_host: String,
591 pub dkim_record_value: String,
593 pub domain: Domain,
595}
596
597#[derive(Debug, Clone, Deserialize)]
599pub struct DomainTransfer {
600 pub id: String,
602 pub domain_id: String,
604 #[serde(default)]
606 pub domain_name: Option<String>,
607 #[serde(default)]
609 pub source_label: Option<String>,
610 pub target_email: String,
612 pub status: String,
614 #[serde(default)]
616 pub note: Option<String>,
617 #[serde(default)]
619 pub cooloff_until: Option<String>,
620 pub initiated_at: String,
622 #[serde(default)]
624 pub accepted_at: Option<String>,
625 #[serde(default)]
627 pub completed_at: Option<String>,
628 pub expires_at: String,
630}
631
632#[derive(Debug, Clone, Deserialize)]
634pub struct DomainAvailability {
635 pub available: bool,
637 pub reason: Option<String>,
639 pub detail: Option<String>,
641 pub stale_tokens: Option<i64>,
643}
644
645#[derive(Debug, Clone, Deserialize)]
647pub struct DomainCheck {
648 pub exists: bool,
650 pub verified: bool,
652 #[serde(default)]
654 pub status: Option<String>,
655 pub domain: String,
657 #[serde(default)]
659 pub id: Option<String>,
660}
661
662#[derive(Debug, Clone, Deserialize)]
666pub struct ContactList {
667 pub id: String,
669 pub name: String,
671 pub description: Option<String>,
673 pub icon_seed: Option<String>,
675 pub contact_count: u64,
677 pub created_at: String,
679}
680
681#[derive(Debug, Clone, Deserialize)]
683pub struct Contact {
684 pub id: String,
686 pub email: String,
688 pub name: Option<String>,
690 #[serde(default)]
692 pub metadata: Option<Value>,
693 pub created_at: String,
695}
696
697#[derive(Debug, Clone, Deserialize)]
699pub struct ContactListDetail {
700 #[serde(flatten)]
702 pub list: ContactList,
703 pub contacts: Vec<Contact>,
705}
706
707#[derive(Debug, Clone, Serialize, Default)]
709pub struct CreateList {
710 pub name: String,
712 #[serde(skip_serializing_if = "Option::is_none")]
714 pub description: Option<String>,
715 #[serde(rename = "icon_seed", skip_serializing_if = "Option::is_none")]
717 pub icon_seed: Option<String>,
718}
719
720impl CreateList {
721 pub fn new(name: impl Into<String>) -> Self {
723 Self {
724 name: name.into(),
725 description: None,
726 icon_seed: None,
727 }
728 }
729
730 pub fn description(mut self, description: impl Into<String>) -> Self {
732 self.description = Some(description.into());
733 self
734 }
735
736 pub fn icon_seed(mut self, icon_seed: impl Into<String>) -> Self {
738 self.icon_seed = Some(icon_seed.into());
739 self
740 }
741}
742
743#[derive(Debug, Clone, Serialize, Default)]
745pub struct UpdateList {
746 #[serde(skip_serializing_if = "Option::is_none")]
748 pub name: Option<String>,
749 #[serde(skip_serializing_if = "Option::is_none")]
751 pub description: Option<String>,
752 #[serde(rename = "icon_seed", skip_serializing_if = "Option::is_none")]
754 pub icon_seed: Option<String>,
755}
756
757impl UpdateList {
758 pub fn name(mut self, name: impl Into<String>) -> Self {
760 self.name = Some(name.into());
761 self
762 }
763
764 pub fn description(mut self, description: impl Into<String>) -> Self {
766 self.description = Some(description.into());
767 self
768 }
769
770 pub fn icon_seed(mut self, icon_seed: impl Into<String>) -> Self {
772 self.icon_seed = Some(icon_seed.into());
773 self
774 }
775}
776
777#[derive(Debug, Clone, Serialize)]
779pub struct AddContact {
780 pub email: String,
782 #[serde(skip_serializing_if = "Option::is_none")]
784 pub name: Option<String>,
785 #[serde(skip_serializing_if = "Option::is_none")]
787 pub metadata: Option<Value>,
788}
789
790impl AddContact {
791 pub fn new(email: impl Into<String>) -> Self {
793 Self {
794 email: email.into(),
795 name: None,
796 metadata: None,
797 }
798 }
799
800 pub fn name(mut self, name: impl Into<String>) -> Self {
802 self.name = Some(name.into());
803 self
804 }
805
806 pub fn metadata(mut self, metadata: Value) -> Self {
808 self.metadata = Some(metadata);
809 self
810 }
811}
812
813#[derive(Debug, Clone, Deserialize)]
815pub struct CsvImportResult {
816 pub imported: u64,
818 pub skipped: u64,
820 pub errors: Vec<String>,
822}
823
824#[derive(Debug, Clone, Serialize)]
826pub struct BulkSend {
827 pub contact_list_id: String,
829 pub sender_address_id: String,
831 pub subject: String,
833 #[serde(skip_serializing_if = "Option::is_none")]
835 pub html: Option<String>,
836 #[serde(skip_serializing_if = "Option::is_none")]
838 pub text: Option<String>,
839 #[serde(skip_serializing_if = "Option::is_none")]
841 pub tags: Option<Vec<String>>,
842}
843
844impl BulkSend {
845 pub fn new(sender_address_id: impl Into<String>, subject: impl Into<String>) -> Self {
848 Self {
849 contact_list_id: String::new(),
850 sender_address_id: sender_address_id.into(),
851 subject: subject.into(),
852 html: None,
853 text: None,
854 tags: None,
855 }
856 }
857
858 pub fn html(mut self, html: impl Into<String>) -> Self {
860 self.html = Some(html.into());
861 self
862 }
863
864 pub fn text(mut self, text: impl Into<String>) -> Self {
866 self.text = Some(text.into());
867 self
868 }
869
870 pub fn tags(mut self, tags: Vec<String>) -> Self {
872 self.tags = Some(tags);
873 self
874 }
875}
876
877#[derive(Debug, Clone, Deserialize)]
879pub struct BulkSendResult {
880 pub queued: u64,
882 pub skipped: u64,
884 pub errors: Vec<String>,
886}
887
888#[derive(Debug, Clone, Deserialize)]
892pub struct Suppression {
893 pub id: String,
895 pub email_address: String,
897 pub reason: String,
899 #[serde(default)]
901 pub created_at: Option<String>,
902}
903
904#[derive(Debug, Clone, Serialize)]
906pub struct AddSuppression {
907 #[serde(rename = "email_address")]
909 pub email: String,
910 pub reason: String,
912}
913
914impl AddSuppression {
915 pub fn new(email: impl Into<String>) -> Self {
917 Self {
918 email: email.into(),
919 reason: "manual".to_string(),
920 }
921 }
922
923 pub fn reason(mut self, reason: impl Into<String>) -> Self {
925 self.reason = reason.into();
926 self
927 }
928}
929
930#[derive(Debug, Clone, Deserialize)]
932pub struct BulkSuppressionResult {
933 pub added: u64,
935 pub skipped: u64,
937 pub total_processed: u64,
939}
940
941#[derive(Debug, Clone, Deserialize)]
945pub struct Template {
946 pub id: String,
948 pub name: String,
950 pub subject: Option<String>,
952 pub html_body: Option<String>,
954 pub text_body: Option<String>,
956 #[serde(default)]
958 pub variables: Option<Vec<String>>,
959 #[serde(default)]
961 pub blocks_json: Option<Value>,
962 pub created_at: String,
964 pub updated_at: String,
966}
967
968#[derive(Debug, Clone, Serialize)]
970pub struct CreateTemplate {
971 pub name: String,
973 #[serde(skip_serializing_if = "Option::is_none")]
975 pub subject: Option<String>,
976 #[serde(rename = "html_body", skip_serializing_if = "Option::is_none")]
978 pub html: Option<String>,
979 #[serde(rename = "text_body", skip_serializing_if = "Option::is_none")]
981 pub text: Option<String>,
982 #[serde(rename = "blocks_json", skip_serializing_if = "Option::is_none")]
984 pub blocks_json: Option<Value>,
985}
986
987impl CreateTemplate {
988 pub fn new(name: impl Into<String>) -> Self {
990 Self {
991 name: name.into(),
992 subject: None,
993 html: None,
994 text: None,
995 blocks_json: None,
996 }
997 }
998
999 pub fn subject(mut self, subject: impl Into<String>) -> Self {
1001 self.subject = Some(subject.into());
1002 self
1003 }
1004
1005 pub fn html(mut self, html: impl Into<String>) -> Self {
1007 self.html = Some(html.into());
1008 self
1009 }
1010
1011 pub fn text(mut self, text: impl Into<String>) -> Self {
1013 self.text = Some(text.into());
1014 self
1015 }
1016
1017 pub fn blocks_json(mut self, blocks_json: Value) -> Self {
1019 self.blocks_json = Some(blocks_json);
1020 self
1021 }
1022}
1023
1024#[derive(Debug, Clone, Serialize, Default)]
1026pub struct UpdateTemplate {
1027 #[serde(skip_serializing_if = "Option::is_none")]
1029 pub name: Option<String>,
1030 #[serde(skip_serializing_if = "Option::is_none")]
1032 pub subject: Option<String>,
1033 #[serde(rename = "html_body", skip_serializing_if = "Option::is_none")]
1035 pub html: Option<String>,
1036 #[serde(rename = "text_body", skip_serializing_if = "Option::is_none")]
1038 pub text: Option<String>,
1039 #[serde(rename = "blocks_json", skip_serializing_if = "Option::is_none")]
1041 pub blocks_json: Option<Value>,
1042}
1043
1044impl UpdateTemplate {
1045 pub fn name(mut self, name: impl Into<String>) -> Self {
1047 self.name = Some(name.into());
1048 self
1049 }
1050
1051 pub fn subject(mut self, subject: impl Into<String>) -> Self {
1053 self.subject = Some(subject.into());
1054 self
1055 }
1056
1057 pub fn html(mut self, html: impl Into<String>) -> Self {
1059 self.html = Some(html.into());
1060 self
1061 }
1062
1063 pub fn text(mut self, text: impl Into<String>) -> Self {
1065 self.text = Some(text.into());
1066 self
1067 }
1068
1069 pub fn blocks_json(mut self, blocks_json: Value) -> Self {
1071 self.blocks_json = Some(blocks_json);
1072 self
1073 }
1074}
1075
1076#[derive(Debug, Clone, Deserialize)]
1080pub struct Webhook {
1081 pub id: String,
1083 pub url: String,
1085 pub events: Vec<String>,
1087 pub secret: String,
1089 pub is_active: bool,
1091 pub created_at: String,
1093}
1094
1095#[derive(Debug, Clone, Serialize)]
1097pub struct CreateWebhook {
1098 pub url: String,
1100 pub events: Vec<String>,
1102}
1103
1104impl CreateWebhook {
1105 pub fn new(url: impl Into<String>, events: Vec<String>) -> Self {
1107 Self {
1108 url: url.into(),
1109 events,
1110 }
1111 }
1112}
1113
1114#[derive(Debug, Clone, Serialize, Default)]
1116pub struct UpdateWebhook {
1117 #[serde(skip_serializing_if = "Option::is_none")]
1119 pub url: Option<String>,
1120 #[serde(skip_serializing_if = "Option::is_none")]
1122 pub events: Option<Vec<String>>,
1123 #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
1125 pub is_active: Option<bool>,
1126}
1127
1128impl UpdateWebhook {
1129 pub fn url(mut self, url: impl Into<String>) -> Self {
1131 self.url = Some(url.into());
1132 self
1133 }
1134
1135 pub fn events(mut self, events: Vec<String>) -> Self {
1137 self.events = Some(events);
1138 self
1139 }
1140
1141 pub fn is_active(mut self, is_active: bool) -> Self {
1143 self.is_active = Some(is_active);
1144 self
1145 }
1146}
1147
1148#[derive(Debug, Clone, Deserialize)]
1150pub struct WebhookTestResult {
1151 pub queued: bool,
1153 pub url: String,
1155}
1156
1157#[derive(Debug, Clone, Deserialize)]
1159pub struct WebhookDelivery {
1160 pub id: String,
1162 pub webhook_id: String,
1164 pub event_type: Option<String>,
1166 pub status: String,
1168 pub response_status: Option<i64>,
1170 pub attempt: i64,
1172 pub next_retry_at: Option<String>,
1174 pub created_at: Option<String>,
1176}
1177
1178#[derive(Debug, Clone, Deserialize)]
1180pub struct WebhookDeliveryDetail {
1181 #[serde(flatten)]
1183 pub delivery: WebhookDelivery,
1184 pub payload: Value,
1186 pub response_body: Option<String>,
1188 pub endpoint_url: String,
1190}
1191
1192#[derive(Debug, Clone, Serialize)]
1196pub struct TransferDomain {
1197 pub target_email: String,
1199 #[serde(skip_serializing_if = "Option::is_none")]
1201 pub note: Option<String>,
1202}
1203
1204impl TransferDomain {
1205 pub fn new(target_email: impl Into<String>) -> Self {
1207 Self {
1208 target_email: target_email.into(),
1209 note: None,
1210 }
1211 }
1212
1213 pub fn note(mut self, note: impl Into<String>) -> Self {
1215 self.note = Some(note.into());
1216 self
1217 }
1218}