@keystrokehq/sendgrid 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +225 -0
- package/dist/_official/index.d.mts +2 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +2 -0
- package/dist/_runtime/index.mjs +3 -0
- package/dist/alerts.d.mts +193 -0
- package/dist/alerts.mjs +101 -0
- package/dist/api-keys.d.mts +160 -0
- package/dist/api-keys.mjs +113 -0
- package/dist/client.d.mts +73 -0
- package/dist/client.mjs +261 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/domains.d.mts +114 -0
- package/dist/domains.mjs +62 -0
- package/dist/email-validation.d.mts +134 -0
- package/dist/email-validation.mjs +73 -0
- package/dist/events.d.mts +69 -0
- package/dist/events.mjs +28 -0
- package/dist/factory-BSL0D2L0.mjs +25 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-37BovSeK.mjs +23 -0
- package/dist/integration-CmJ2TILG.d.mts +57 -0
- package/dist/mail-send.d.mts +315 -0
- package/dist/mail-send.mjs +218 -0
- package/dist/marketing-contacts.d.mts +607 -0
- package/dist/marketing-contacts.mjs +277 -0
- package/dist/marketing-customfields.d.mts +94 -0
- package/dist/marketing-customfields.mjs +70 -0
- package/dist/marketing-lists.d.mts +184 -0
- package/dist/marketing-lists.mjs +130 -0
- package/dist/marketing-segments.d.mts +340 -0
- package/dist/marketing-segments.mjs +179 -0
- package/dist/marketing-singlesends.d.mts +648 -0
- package/dist/marketing-singlesends.mjs +277 -0
- package/dist/operations.d.mts +25 -0
- package/dist/operations.mjs +69 -0
- package/dist/schemas/index.d.mts +1395 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/sender-identities.d.mts +218 -0
- package/dist/sender-identities.mjs +109 -0
- package/dist/senders.d.mts +227 -0
- package/dist/senders.mjs +83 -0
- package/dist/shared-CQ8JFNXi.mjs +13 -0
- package/dist/stats.d.mts +215 -0
- package/dist/stats.mjs +107 -0
- package/dist/suppressions.d.mts +785 -0
- package/dist/suppressions.mjs +539 -0
- package/dist/templates.d.mts +451 -0
- package/dist/templates.mjs +238 -0
- package/dist/triggers.d.mts +35 -0
- package/dist/triggers.mjs +98 -0
- package/dist/user-account.d.mts +108 -0
- package/dist/user-account.mjs +59 -0
- package/dist/verification.d.mts +67 -0
- package/dist/verification.mjs +72 -0
- package/dist/webhooks/event.d.mts +287 -0
- package/dist/webhooks/event.mjs +147 -0
- package/dist/webhooks/parse.d.mts +172 -0
- package/dist/webhooks/parse.mjs +125 -0
- package/dist/webhooks-CKdsIikb.mjs +735 -0
- package/package.json +162 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/templates.d.ts
|
|
6
|
+
declare const createTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
generation: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
dynamic: "dynamic";
|
|
10
|
+
legacy: "legacy";
|
|
11
|
+
}>>;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
generation: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
dynamic: "dynamic";
|
|
17
|
+
legacy: "legacy";
|
|
18
|
+
}>>;
|
|
19
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
20
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
template_id: z.ZodString;
|
|
23
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
name: z.ZodOptional<z.ZodString>;
|
|
25
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
26
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
27
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
29
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
code: "code";
|
|
31
|
+
design: "design";
|
|
32
|
+
}>>;
|
|
33
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
35
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
36
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
37
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
38
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
39
|
+
global: "global";
|
|
40
|
+
eu: "eu";
|
|
41
|
+
}>>;
|
|
42
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
43
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
45
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
46
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
47
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
48
|
+
global: "global";
|
|
49
|
+
eu: "eu";
|
|
50
|
+
}>>;
|
|
51
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
52
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
54
|
+
declare const updateTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
55
|
+
templateId: z.ZodString;
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
generation: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
dynamic: "dynamic";
|
|
62
|
+
legacy: "legacy";
|
|
63
|
+
}>>;
|
|
64
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
65
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
template_id: z.ZodString;
|
|
68
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
name: z.ZodOptional<z.ZodString>;
|
|
70
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
71
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
72
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
74
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
code: "code";
|
|
76
|
+
design: "design";
|
|
77
|
+
}>>;
|
|
78
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
80
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
81
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
82
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
83
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
84
|
+
global: "global";
|
|
85
|
+
eu: "eu";
|
|
86
|
+
}>>;
|
|
87
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
88
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
90
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
91
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
92
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
93
|
+
global: "global";
|
|
94
|
+
eu: "eu";
|
|
95
|
+
}>>;
|
|
96
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
97
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
99
|
+
declare const deleteTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
100
|
+
templateId: z.ZodString;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
success: z.ZodBoolean;
|
|
103
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
104
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
105
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
106
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
107
|
+
global: "global";
|
|
108
|
+
eu: "eu";
|
|
109
|
+
}>>;
|
|
110
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
111
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
112
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
113
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
114
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
115
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
116
|
+
global: "global";
|
|
117
|
+
eu: "eu";
|
|
118
|
+
}>>;
|
|
119
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
120
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
122
|
+
declare const duplicateTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
123
|
+
templateId: z.ZodString;
|
|
124
|
+
name: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
name: z.ZodString;
|
|
128
|
+
generation: z.ZodOptional<z.ZodEnum<{
|
|
129
|
+
dynamic: "dynamic";
|
|
130
|
+
legacy: "legacy";
|
|
131
|
+
}>>;
|
|
132
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
133
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
134
|
+
id: z.ZodString;
|
|
135
|
+
template_id: z.ZodString;
|
|
136
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
name: z.ZodOptional<z.ZodString>;
|
|
138
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
139
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
140
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
142
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
143
|
+
code: "code";
|
|
144
|
+
design: "design";
|
|
145
|
+
}>>;
|
|
146
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
147
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
148
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
149
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
150
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
151
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
152
|
+
global: "global";
|
|
153
|
+
eu: "eu";
|
|
154
|
+
}>>;
|
|
155
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
156
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
158
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
159
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
160
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
161
|
+
global: "global";
|
|
162
|
+
eu: "eu";
|
|
163
|
+
}>>;
|
|
164
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
165
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
166
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
167
|
+
declare const getTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
168
|
+
templateId: z.ZodString;
|
|
169
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
name: z.ZodString;
|
|
172
|
+
generation: z.ZodOptional<z.ZodEnum<{
|
|
173
|
+
dynamic: "dynamic";
|
|
174
|
+
legacy: "legacy";
|
|
175
|
+
}>>;
|
|
176
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
177
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
template_id: z.ZodString;
|
|
180
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
name: z.ZodOptional<z.ZodString>;
|
|
182
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
183
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
184
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
186
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
187
|
+
code: "code";
|
|
188
|
+
design: "design";
|
|
189
|
+
}>>;
|
|
190
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
191
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
192
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
193
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
194
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
195
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
196
|
+
global: "global";
|
|
197
|
+
eu: "eu";
|
|
198
|
+
}>>;
|
|
199
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
200
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
202
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
203
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
204
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
205
|
+
global: "global";
|
|
206
|
+
eu: "eu";
|
|
207
|
+
}>>;
|
|
208
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
209
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
211
|
+
declare const listTemplates: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
|
|
212
|
+
generations: z.ZodOptional<z.ZodEnum<{
|
|
213
|
+
dynamic: "dynamic";
|
|
214
|
+
legacy: "legacy";
|
|
215
|
+
"legacy,dynamic": "legacy,dynamic";
|
|
216
|
+
}>>;
|
|
217
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
218
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
219
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
220
|
+
result: z.ZodArray<z.ZodObject<{
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
name: z.ZodString;
|
|
223
|
+
generation: z.ZodOptional<z.ZodEnum<{
|
|
224
|
+
dynamic: "dynamic";
|
|
225
|
+
legacy: "legacy";
|
|
226
|
+
}>>;
|
|
227
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
228
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
229
|
+
id: z.ZodString;
|
|
230
|
+
template_id: z.ZodString;
|
|
231
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
name: z.ZodOptional<z.ZodString>;
|
|
233
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
234
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
235
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
236
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
237
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
238
|
+
code: "code";
|
|
239
|
+
design: "design";
|
|
240
|
+
}>>;
|
|
241
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
242
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
243
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
244
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
245
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
246
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
247
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
248
|
+
global: "global";
|
|
249
|
+
eu: "eu";
|
|
250
|
+
}>>;
|
|
251
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
252
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
253
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
254
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
255
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
256
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
257
|
+
global: "global";
|
|
258
|
+
eu: "eu";
|
|
259
|
+
}>>;
|
|
260
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
261
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
262
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
263
|
+
declare const createTemplateVersion: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
264
|
+
templateId: z.ZodString;
|
|
265
|
+
name: z.ZodString;
|
|
266
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
267
|
+
htmlContent: z.ZodOptional<z.ZodString>;
|
|
268
|
+
plainContent: z.ZodOptional<z.ZodString>;
|
|
269
|
+
generatePlainContent: z.ZodOptional<z.ZodBoolean>;
|
|
270
|
+
active: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
271
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
272
|
+
code: "code";
|
|
273
|
+
design: "design";
|
|
274
|
+
}>>;
|
|
275
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
276
|
+
id: z.ZodString;
|
|
277
|
+
template_id: z.ZodString;
|
|
278
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
name: z.ZodOptional<z.ZodString>;
|
|
280
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
281
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
282
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
283
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
284
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
285
|
+
code: "code";
|
|
286
|
+
design: "design";
|
|
287
|
+
}>>;
|
|
288
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
289
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
290
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
291
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
292
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
293
|
+
global: "global";
|
|
294
|
+
eu: "eu";
|
|
295
|
+
}>>;
|
|
296
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
297
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
298
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
299
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
300
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
301
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
302
|
+
global: "global";
|
|
303
|
+
eu: "eu";
|
|
304
|
+
}>>;
|
|
305
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
306
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
307
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
308
|
+
declare const updateTemplateVersion: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
309
|
+
templateId: z.ZodString;
|
|
310
|
+
versionId: z.ZodString;
|
|
311
|
+
name: z.ZodOptional<z.ZodString>;
|
|
312
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
313
|
+
htmlContent: z.ZodOptional<z.ZodString>;
|
|
314
|
+
plainContent: z.ZodOptional<z.ZodString>;
|
|
315
|
+
generatePlainContent: z.ZodOptional<z.ZodBoolean>;
|
|
316
|
+
active: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
317
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
318
|
+
code: "code";
|
|
319
|
+
design: "design";
|
|
320
|
+
}>>;
|
|
321
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
322
|
+
id: z.ZodString;
|
|
323
|
+
template_id: z.ZodString;
|
|
324
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
325
|
+
name: z.ZodOptional<z.ZodString>;
|
|
326
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
327
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
328
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
329
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
330
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
331
|
+
code: "code";
|
|
332
|
+
design: "design";
|
|
333
|
+
}>>;
|
|
334
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
335
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
336
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
337
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
338
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
339
|
+
global: "global";
|
|
340
|
+
eu: "eu";
|
|
341
|
+
}>>;
|
|
342
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
343
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
344
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
345
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
346
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
347
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
348
|
+
global: "global";
|
|
349
|
+
eu: "eu";
|
|
350
|
+
}>>;
|
|
351
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
352
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
353
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
354
|
+
declare const deleteTemplateVersion: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
355
|
+
templateId: z.ZodString;
|
|
356
|
+
versionId: z.ZodString;
|
|
357
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
358
|
+
success: z.ZodBoolean;
|
|
359
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
360
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
361
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
362
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
363
|
+
global: "global";
|
|
364
|
+
eu: "eu";
|
|
365
|
+
}>>;
|
|
366
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
367
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
368
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
369
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
370
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
371
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
372
|
+
global: "global";
|
|
373
|
+
eu: "eu";
|
|
374
|
+
}>>;
|
|
375
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
376
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
377
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
378
|
+
declare const getTemplateVersion: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
379
|
+
templateId: z.ZodString;
|
|
380
|
+
versionId: z.ZodString;
|
|
381
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
382
|
+
id: z.ZodString;
|
|
383
|
+
template_id: z.ZodString;
|
|
384
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
385
|
+
name: z.ZodOptional<z.ZodString>;
|
|
386
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
387
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
388
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
389
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
390
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
391
|
+
code: "code";
|
|
392
|
+
design: "design";
|
|
393
|
+
}>>;
|
|
394
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
395
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
396
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
397
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
398
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
399
|
+
global: "global";
|
|
400
|
+
eu: "eu";
|
|
401
|
+
}>>;
|
|
402
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
403
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
404
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
405
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
406
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
407
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
408
|
+
global: "global";
|
|
409
|
+
eu: "eu";
|
|
410
|
+
}>>;
|
|
411
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
412
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
413
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
414
|
+
declare const activateTemplateVersion: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
415
|
+
templateId: z.ZodString;
|
|
416
|
+
versionId: z.ZodString;
|
|
417
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
418
|
+
id: z.ZodString;
|
|
419
|
+
template_id: z.ZodString;
|
|
420
|
+
active: z.ZodOptional<z.ZodNumber>;
|
|
421
|
+
name: z.ZodOptional<z.ZodString>;
|
|
422
|
+
html_content: z.ZodOptional<z.ZodString>;
|
|
423
|
+
plain_content: z.ZodOptional<z.ZodString>;
|
|
424
|
+
generate_plain_content: z.ZodOptional<z.ZodBoolean>;
|
|
425
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
426
|
+
editor: z.ZodOptional<z.ZodEnum<{
|
|
427
|
+
code: "code";
|
|
428
|
+
design: "design";
|
|
429
|
+
}>>;
|
|
430
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
431
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
|
|
432
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
433
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
434
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
435
|
+
global: "global";
|
|
436
|
+
eu: "eu";
|
|
437
|
+
}>>;
|
|
438
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
439
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
440
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
441
|
+
SENDGRID_API_KEY: z.ZodString;
|
|
442
|
+
SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
|
|
443
|
+
SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
444
|
+
global: "global";
|
|
445
|
+
eu: "eu";
|
|
446
|
+
}>>;
|
|
447
|
+
SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
|
|
448
|
+
SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
|
|
449
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
450
|
+
//#endregion
|
|
451
|
+
export { activateTemplateVersion, createTemplate, createTemplateVersion, deleteTemplate, deleteTemplateVersion, duplicateTemplate, getTemplate, getTemplateVersion, listTemplates, updateTemplate, updateTemplateVersion };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { n as __exportAll, t as sendgridOperation } from "./factory-BSL0D2L0.mjs";
|
|
2
|
+
import { n as omitUndefined } from "./shared-CQ8JFNXi.mjs";
|
|
3
|
+
import { createSendGridClient } from "./client.mjs";
|
|
4
|
+
import { _ as sendgridTemplateGenerationSchema, b as sendgridTemplateVersionSchema, on as sendgridIdSchema, v as sendgridTemplateListSchema, y as sendgridTemplateSchema } from "./webhooks-CKdsIikb.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/templates.ts
|
|
8
|
+
var templates_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
activateTemplateVersion: () => activateTemplateVersion,
|
|
10
|
+
createTemplate: () => createTemplate,
|
|
11
|
+
createTemplateVersion: () => createTemplateVersion,
|
|
12
|
+
deleteTemplate: () => deleteTemplate,
|
|
13
|
+
deleteTemplateVersion: () => deleteTemplateVersion,
|
|
14
|
+
duplicateTemplate: () => duplicateTemplate,
|
|
15
|
+
getTemplate: () => getTemplate,
|
|
16
|
+
getTemplateVersion: () => getTemplateVersion,
|
|
17
|
+
listTemplates: () => listTemplates,
|
|
18
|
+
updateTemplate: () => updateTemplate,
|
|
19
|
+
updateTemplateVersion: () => updateTemplateVersion
|
|
20
|
+
});
|
|
21
|
+
function tpl(path) {
|
|
22
|
+
return `/templates${path}`;
|
|
23
|
+
}
|
|
24
|
+
const createTemplate = sendgridOperation({
|
|
25
|
+
id: "create_template",
|
|
26
|
+
name: "Create Transactional Template",
|
|
27
|
+
description: "Create a new transactional template.",
|
|
28
|
+
input: z.object({
|
|
29
|
+
name: z.string().min(1),
|
|
30
|
+
generation: sendgridTemplateGenerationSchema.optional()
|
|
31
|
+
}),
|
|
32
|
+
output: sendgridTemplateSchema,
|
|
33
|
+
needsApproval: true,
|
|
34
|
+
run: async (input, credentials) => {
|
|
35
|
+
const response = await createSendGridClient(credentials).request(tpl(""), {
|
|
36
|
+
method: "POST",
|
|
37
|
+
body: omitUndefined({
|
|
38
|
+
name: input.name,
|
|
39
|
+
generation: input.generation
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
return sendgridTemplateSchema.parse(response);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const updateTemplate = sendgridOperation({
|
|
46
|
+
id: "update_template",
|
|
47
|
+
name: "Edit Transactional Template",
|
|
48
|
+
description: "Rename a transactional template.",
|
|
49
|
+
input: z.object({
|
|
50
|
+
templateId: sendgridIdSchema,
|
|
51
|
+
name: z.string().min(1)
|
|
52
|
+
}),
|
|
53
|
+
output: sendgridTemplateSchema,
|
|
54
|
+
needsApproval: true,
|
|
55
|
+
run: async (input, credentials) => {
|
|
56
|
+
const response = await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}`), {
|
|
57
|
+
method: "PATCH",
|
|
58
|
+
body: { name: input.name }
|
|
59
|
+
});
|
|
60
|
+
return sendgridTemplateSchema.parse(response);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const deleteTemplate = sendgridOperation({
|
|
64
|
+
id: "delete_template",
|
|
65
|
+
name: "Delete Transactional Template",
|
|
66
|
+
description: "Delete a transactional template and all its versions.",
|
|
67
|
+
input: z.object({ templateId: sendgridIdSchema }),
|
|
68
|
+
output: z.object({ success: z.boolean() }),
|
|
69
|
+
needsApproval: true,
|
|
70
|
+
run: async (input, credentials) => {
|
|
71
|
+
await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}`), { method: "DELETE" });
|
|
72
|
+
return { success: true };
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const duplicateTemplate = sendgridOperation({
|
|
76
|
+
id: "duplicate_template",
|
|
77
|
+
name: "Duplicate Transactional Template",
|
|
78
|
+
description: "Duplicate a transactional template. Optionally rename the copy.",
|
|
79
|
+
input: z.object({
|
|
80
|
+
templateId: sendgridIdSchema,
|
|
81
|
+
name: z.string().min(1).optional()
|
|
82
|
+
}),
|
|
83
|
+
output: sendgridTemplateSchema,
|
|
84
|
+
needsApproval: true,
|
|
85
|
+
run: async (input, credentials) => {
|
|
86
|
+
const response = await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}`), {
|
|
87
|
+
method: "POST",
|
|
88
|
+
body: omitUndefined({ name: input.name })
|
|
89
|
+
});
|
|
90
|
+
return sendgridTemplateSchema.parse(response);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const getTemplate = sendgridOperation({
|
|
94
|
+
id: "get_template",
|
|
95
|
+
name: "Get Transactional Template",
|
|
96
|
+
description: "Retrieve a single transactional template by ID.",
|
|
97
|
+
input: z.object({ templateId: sendgridIdSchema }),
|
|
98
|
+
output: sendgridTemplateSchema,
|
|
99
|
+
run: async (input, credentials) => {
|
|
100
|
+
const response = await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}`));
|
|
101
|
+
return sendgridTemplateSchema.parse(response);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const listTemplates = sendgridOperation({
|
|
105
|
+
id: "list_templates",
|
|
106
|
+
name: "List Transactional Templates",
|
|
107
|
+
description: "List transactional templates with optional generation filter and paging.",
|
|
108
|
+
input: z.object({
|
|
109
|
+
generations: z.enum([
|
|
110
|
+
"legacy",
|
|
111
|
+
"dynamic",
|
|
112
|
+
"legacy,dynamic"
|
|
113
|
+
]).optional(),
|
|
114
|
+
pageSize: z.number().int().positive().max(200).optional(),
|
|
115
|
+
pageToken: z.string().min(1).optional()
|
|
116
|
+
}).optional(),
|
|
117
|
+
output: sendgridTemplateListSchema,
|
|
118
|
+
run: async (input, credentials) => {
|
|
119
|
+
const response = await createSendGridClient(credentials).request(tpl(""), { query: omitUndefined({
|
|
120
|
+
generations: input?.generations,
|
|
121
|
+
page_size: input?.pageSize,
|
|
122
|
+
page_token: input?.pageToken
|
|
123
|
+
}) });
|
|
124
|
+
return sendgridTemplateListSchema.parse(response ?? { result: [] });
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const createTemplateVersion = sendgridOperation({
|
|
128
|
+
id: "create_template_version",
|
|
129
|
+
name: "Create Template Version",
|
|
130
|
+
description: "Add a new version to a transactional template.",
|
|
131
|
+
input: z.object({
|
|
132
|
+
templateId: sendgridIdSchema,
|
|
133
|
+
name: z.string().min(1),
|
|
134
|
+
subject: z.string().optional(),
|
|
135
|
+
htmlContent: z.string().optional(),
|
|
136
|
+
plainContent: z.string().optional(),
|
|
137
|
+
generatePlainContent: z.boolean().optional(),
|
|
138
|
+
active: z.union([z.literal(0), z.literal(1)]).optional(),
|
|
139
|
+
editor: z.enum(["code", "design"]).optional()
|
|
140
|
+
}),
|
|
141
|
+
output: sendgridTemplateVersionSchema,
|
|
142
|
+
needsApproval: true,
|
|
143
|
+
run: async (input, credentials) => {
|
|
144
|
+
const response = await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}/versions`), {
|
|
145
|
+
method: "POST",
|
|
146
|
+
body: omitUndefined({
|
|
147
|
+
name: input.name,
|
|
148
|
+
subject: input.subject,
|
|
149
|
+
html_content: input.htmlContent,
|
|
150
|
+
plain_content: input.plainContent,
|
|
151
|
+
generate_plain_content: input.generatePlainContent,
|
|
152
|
+
active: input.active,
|
|
153
|
+
editor: input.editor
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
return sendgridTemplateVersionSchema.parse(response);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const updateTemplateVersion = sendgridOperation({
|
|
160
|
+
id: "update_template_version",
|
|
161
|
+
name: "Edit Template Version",
|
|
162
|
+
description: "Update a version of a transactional template.",
|
|
163
|
+
input: z.object({
|
|
164
|
+
templateId: sendgridIdSchema,
|
|
165
|
+
versionId: sendgridIdSchema,
|
|
166
|
+
name: z.string().min(1).optional(),
|
|
167
|
+
subject: z.string().optional(),
|
|
168
|
+
htmlContent: z.string().optional(),
|
|
169
|
+
plainContent: z.string().optional(),
|
|
170
|
+
generatePlainContent: z.boolean().optional(),
|
|
171
|
+
active: z.union([z.literal(0), z.literal(1)]).optional(),
|
|
172
|
+
editor: z.enum(["code", "design"]).optional()
|
|
173
|
+
}),
|
|
174
|
+
output: sendgridTemplateVersionSchema,
|
|
175
|
+
needsApproval: true,
|
|
176
|
+
run: async (input, credentials) => {
|
|
177
|
+
const response = await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}/versions/${encodeURIComponent(input.versionId)}`), {
|
|
178
|
+
method: "PATCH",
|
|
179
|
+
body: omitUndefined({
|
|
180
|
+
name: input.name,
|
|
181
|
+
subject: input.subject,
|
|
182
|
+
html_content: input.htmlContent,
|
|
183
|
+
plain_content: input.plainContent,
|
|
184
|
+
generate_plain_content: input.generatePlainContent,
|
|
185
|
+
active: input.active,
|
|
186
|
+
editor: input.editor
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
return sendgridTemplateVersionSchema.parse(response);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const deleteTemplateVersion = sendgridOperation({
|
|
193
|
+
id: "delete_template_version",
|
|
194
|
+
name: "Delete Template Version",
|
|
195
|
+
description: "Delete a specific version of a transactional template.",
|
|
196
|
+
input: z.object({
|
|
197
|
+
templateId: sendgridIdSchema,
|
|
198
|
+
versionId: sendgridIdSchema
|
|
199
|
+
}),
|
|
200
|
+
output: z.object({ success: z.boolean() }),
|
|
201
|
+
needsApproval: true,
|
|
202
|
+
run: async (input, credentials) => {
|
|
203
|
+
await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}/versions/${encodeURIComponent(input.versionId)}`), { method: "DELETE" });
|
|
204
|
+
return { success: true };
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const getTemplateVersion = sendgridOperation({
|
|
208
|
+
id: "get_template_version",
|
|
209
|
+
name: "Get Template Version",
|
|
210
|
+
description: "Retrieve a single transactional template version.",
|
|
211
|
+
input: z.object({
|
|
212
|
+
templateId: sendgridIdSchema,
|
|
213
|
+
versionId: sendgridIdSchema
|
|
214
|
+
}),
|
|
215
|
+
output: sendgridTemplateVersionSchema,
|
|
216
|
+
run: async (input, credentials) => {
|
|
217
|
+
const response = await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}/versions/${encodeURIComponent(input.versionId)}`));
|
|
218
|
+
return sendgridTemplateVersionSchema.parse(response);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
const activateTemplateVersion = sendgridOperation({
|
|
222
|
+
id: "activate_template_version",
|
|
223
|
+
name: "Activate Template Version",
|
|
224
|
+
description: "Make the specified version the active version of the template.",
|
|
225
|
+
input: z.object({
|
|
226
|
+
templateId: sendgridIdSchema,
|
|
227
|
+
versionId: sendgridIdSchema
|
|
228
|
+
}),
|
|
229
|
+
output: sendgridTemplateVersionSchema,
|
|
230
|
+
needsApproval: true,
|
|
231
|
+
run: async (input, credentials) => {
|
|
232
|
+
const response = await createSendGridClient(credentials).request(tpl(`/${encodeURIComponent(input.templateId)}/versions/${encodeURIComponent(input.versionId)}/activate`), { method: "POST" });
|
|
233
|
+
return sendgridTemplateVersionSchema.parse(response);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
//#endregion
|
|
238
|
+
export { activateTemplateVersion, createTemplate, createTemplateVersion, deleteTemplate, deleteTemplateVersion, duplicateTemplate, getTemplate, getTemplateVersion, listTemplates, templates_exports as t, updateTemplate, updateTemplateVersion };
|