-
Notifications
You must be signed in to change notification settings - Fork 778
/
personalization.d.ts
128 lines (105 loc) · 2.42 KB
/
personalization.d.ts
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import { EmailData, EmailJSON } from "./email-address";
export interface PersonalizationData {
to: EmailData | EmailData[],
from?: EmailData,
cc?: EmailData | EmailData[],
bcc?: EmailData | EmailData[],
subject?: string;
headers?: { [key: string]: string };
substitutions?: { [key: string]: string };
dynamicTemplateData?: { [key: string]: any; };
customArgs?: { [key: string]: string };
sendAt?: number;
}
export interface PersonalizationJSON {
to: EmailJSON | EmailJSON[];
from?: EmailJSON;
cc?: EmailJSON[];
bcc?: EmailJSON[];
headers?: { [key: string]: string; };
substitutions?: { [key: string]: string; };
dynamic_template_data?: { [key: string]: string; };
custom_args?: { [key: string]: string; };
subject?: string;
send_at?: number;
}
export default class Personalization {
constructor(data?: PersonalizationData);
fromData(data: PersonalizationData): void;
/**
* Set subject
*/
setSubject(subject: string): void;
/**
* Set send at
*/
setSendAt(sendAt: number): void;
/**
* Set to
*/
setTo(to: EmailData | EmailData[]): void;
/**
* Set from
*/
setFrom(from: EmailData): void;
/**
* Add a single to
*/
addTo(to: EmailData): void;
/**
* Set cc
*/
setCc(cc: EmailData | EmailData[]): void;
/**
* Add a single cc
*/
addCc(cc: EmailData): void;
/**
* Set bcc
*/
setBcc(bcc: EmailData | EmailData[]): void;
/**
* Add a single bcc
*/
addBcc(bcc: EmailData): void;
/**
* Set headers
*/
setHeaders(headers: { [key: string]: string }): void;
/**
* Add a header
*/
addHeader(key: string, value: string): void;
/**
* Set custom args
*/
setCustomArgs(customArgs: { [key: string]: string }): void;
/**
* Add a custom arg
*/
addCustomArg(key: string, value: string): void;
/**
* Set substitutions
*/
setSubstitutions(substitutions: { [key: string]: string }): void;
/**
* Add a substitution
*/
addSubstitution(key: string, value: string): void;
/**
* Reverse merge substitutions, preserving existing ones
*/
reverseMergeSubstitutions(substitutions: { [key: string]: string }): void;
/**
* Set substitution wrappers
*/
setSubstitutionWrappers(wrappers: string[]): void;
/**
* Set dynamic template data
*/
setDynamicTemplateData(dynamicTemplateData: { [key: string]: any }): void;
/**
* To JSON
*/
toJSON(): PersonalizationJSON;
}