@eusend_dev/sdk 0.1.0
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 +536 -0
- package/dist/index.cjs +385 -0
- package/dist/index.d.cts +418 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +418 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +386 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +35 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
//#region src/emails.ts
|
|
2
|
+
function toApiPayload(options) {
|
|
3
|
+
return {
|
|
4
|
+
from: options.from,
|
|
5
|
+
to: options.to,
|
|
6
|
+
cc: options.cc,
|
|
7
|
+
bcc: options.bcc,
|
|
8
|
+
reply_to: options.replyTo,
|
|
9
|
+
subject: options.subject,
|
|
10
|
+
html: options.html,
|
|
11
|
+
text: options.text,
|
|
12
|
+
template_id: options.templateId,
|
|
13
|
+
variables: options.variables,
|
|
14
|
+
headers: options.headers,
|
|
15
|
+
track_opens: options.trackOpens,
|
|
16
|
+
track_clicks: options.trackClicks
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
var Emails = class {
|
|
20
|
+
constructor(client) {
|
|
21
|
+
this.client = client;
|
|
22
|
+
}
|
|
23
|
+
async send(options, requestOptions) {
|
|
24
|
+
const extraHeaders = {};
|
|
25
|
+
if (requestOptions?.idempotencyKey) extraHeaders["Idempotency-Key"] = requestOptions.idempotencyKey;
|
|
26
|
+
return this.client.post("/emails", toApiPayload(options), extraHeaders);
|
|
27
|
+
}
|
|
28
|
+
async batch(emails) {
|
|
29
|
+
return this.client.post("/emails/batch", { emails: emails.map(toApiPayload) });
|
|
30
|
+
}
|
|
31
|
+
async list(options = {}) {
|
|
32
|
+
const params = new URLSearchParams();
|
|
33
|
+
if (options.limit != null) params.set("limit", String(options.limit));
|
|
34
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
35
|
+
if (options.status) params.set("status", options.status);
|
|
36
|
+
if (options.from) params.set("from", options.from);
|
|
37
|
+
if (options.to) params.set("to", options.to);
|
|
38
|
+
const qs = params.toString();
|
|
39
|
+
const res = await this.client.get(qs ? `/emails?${qs}` : "/emails");
|
|
40
|
+
if (res.error) return res;
|
|
41
|
+
return {
|
|
42
|
+
data: {
|
|
43
|
+
data: res.data.data,
|
|
44
|
+
nextCursor: res.data.next_cursor
|
|
45
|
+
},
|
|
46
|
+
error: null,
|
|
47
|
+
headers: res.headers
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
get(id) {
|
|
51
|
+
return this.client.get(`/emails/${id}`);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/domains.ts
|
|
56
|
+
var Domains = class {
|
|
57
|
+
constructor(client) {
|
|
58
|
+
this.client = client;
|
|
59
|
+
}
|
|
60
|
+
create(name) {
|
|
61
|
+
return this.client.post("/domains", { name });
|
|
62
|
+
}
|
|
63
|
+
list() {
|
|
64
|
+
return this.client.get("/domains");
|
|
65
|
+
}
|
|
66
|
+
get(id) {
|
|
67
|
+
return this.client.get(`/domains/${id}`);
|
|
68
|
+
}
|
|
69
|
+
delete(id) {
|
|
70
|
+
return this.client.delete(`/domains/${id}`);
|
|
71
|
+
}
|
|
72
|
+
verify(id) {
|
|
73
|
+
return this.client.post(`/domains/${id}/verify`);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/api-keys.ts
|
|
78
|
+
var ApiKeys = class {
|
|
79
|
+
constructor(client) {
|
|
80
|
+
this.client = client;
|
|
81
|
+
}
|
|
82
|
+
async create(options) {
|
|
83
|
+
const res = await this.client.post("/api-keys", {
|
|
84
|
+
name: options.name,
|
|
85
|
+
test_mode: options.testMode ?? false
|
|
86
|
+
});
|
|
87
|
+
if (res.error) return res;
|
|
88
|
+
return {
|
|
89
|
+
data: {
|
|
90
|
+
id: res.data.id,
|
|
91
|
+
name: res.data.name,
|
|
92
|
+
key: res.data.key,
|
|
93
|
+
prefix: res.data.prefix,
|
|
94
|
+
testMode: res.data.test_mode,
|
|
95
|
+
createdAt: res.data.created_at
|
|
96
|
+
},
|
|
97
|
+
error: null,
|
|
98
|
+
headers: res.headers
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
list() {
|
|
102
|
+
return this.client.get("/api-keys");
|
|
103
|
+
}
|
|
104
|
+
delete(id) {
|
|
105
|
+
return this.client.delete(`/api-keys/${id}`);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/audiences.ts
|
|
110
|
+
var Audiences = class {
|
|
111
|
+
constructor(client) {
|
|
112
|
+
this.client = client;
|
|
113
|
+
}
|
|
114
|
+
create(name) {
|
|
115
|
+
return this.client.post("/audiences", { name });
|
|
116
|
+
}
|
|
117
|
+
async list() {
|
|
118
|
+
const res = await this.client.get("/audiences");
|
|
119
|
+
if (res.error) return res;
|
|
120
|
+
return {
|
|
121
|
+
data: res.data.data,
|
|
122
|
+
error: null,
|
|
123
|
+
headers: res.headers
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
delete(id) {
|
|
127
|
+
return this.client.delete(`/audiences/${id}`);
|
|
128
|
+
}
|
|
129
|
+
createContact(audienceId, options) {
|
|
130
|
+
return this.client.post(`/audiences/${audienceId}/contacts`, {
|
|
131
|
+
email: options.email,
|
|
132
|
+
first_name: options.firstName,
|
|
133
|
+
last_name: options.lastName
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async listContacts(audienceId, options = {}) {
|
|
137
|
+
const params = new URLSearchParams();
|
|
138
|
+
if (options.limit != null) params.set("limit", String(options.limit));
|
|
139
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
140
|
+
if (options.search) params.set("search", options.search);
|
|
141
|
+
if (options.subscribed != null) params.set("subscribed", String(options.subscribed));
|
|
142
|
+
const qs = params.toString();
|
|
143
|
+
return this.client.get(qs ? `/audiences/${audienceId}/contacts?${qs}` : `/audiences/${audienceId}/contacts`);
|
|
144
|
+
}
|
|
145
|
+
getContact(audienceId, contactId) {
|
|
146
|
+
return this.client.get(`/audiences/${audienceId}/contacts/${contactId}`);
|
|
147
|
+
}
|
|
148
|
+
updateContact(audienceId, contactId, options) {
|
|
149
|
+
return this.client.patch(`/audiences/${audienceId}/contacts/${contactId}`, {
|
|
150
|
+
first_name: options.firstName,
|
|
151
|
+
last_name: options.lastName,
|
|
152
|
+
unsubscribed: options.unsubscribed
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
deleteContact(audienceId, contactId) {
|
|
156
|
+
return this.client.delete(`/audiences/${audienceId}/contacts/${contactId}`);
|
|
157
|
+
}
|
|
158
|
+
batchCreateContacts(audienceId, options) {
|
|
159
|
+
return this.client.post(`/audiences/${audienceId}/contacts/batch`, { contacts: options.contacts.map((c) => ({
|
|
160
|
+
email: c.email,
|
|
161
|
+
first_name: c.firstName,
|
|
162
|
+
last_name: c.lastName
|
|
163
|
+
})) });
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/templates.ts
|
|
168
|
+
var Templates = class {
|
|
169
|
+
constructor(client) {
|
|
170
|
+
this.client = client;
|
|
171
|
+
}
|
|
172
|
+
create(options) {
|
|
173
|
+
return this.client.post("/templates", {
|
|
174
|
+
name: options.name,
|
|
175
|
+
subject: options.subject,
|
|
176
|
+
html: options.html,
|
|
177
|
+
react_source: options.reactSource
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async list() {
|
|
181
|
+
const res = await this.client.get("/templates");
|
|
182
|
+
if (res.error) return res;
|
|
183
|
+
return {
|
|
184
|
+
data: res.data.data,
|
|
185
|
+
error: null,
|
|
186
|
+
headers: res.headers
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
get(id) {
|
|
190
|
+
return this.client.get(`/templates/${id}`);
|
|
191
|
+
}
|
|
192
|
+
update(id, options) {
|
|
193
|
+
return this.client.patch(`/templates/${id}`, {
|
|
194
|
+
name: options.name,
|
|
195
|
+
subject: options.subject,
|
|
196
|
+
html: options.html,
|
|
197
|
+
react_source: options.reactSource
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
delete(id) {
|
|
201
|
+
return this.client.delete(`/templates/${id}`);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/webhooks.ts
|
|
206
|
+
var Webhooks = class {
|
|
207
|
+
constructor(client) {
|
|
208
|
+
this.client = client;
|
|
209
|
+
}
|
|
210
|
+
create(options) {
|
|
211
|
+
return this.client.post("/webhooks", {
|
|
212
|
+
url: options.url,
|
|
213
|
+
events: options.events
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
async list() {
|
|
217
|
+
const res = await this.client.get("/webhooks");
|
|
218
|
+
if (res.error) return res;
|
|
219
|
+
return {
|
|
220
|
+
data: res.data.data,
|
|
221
|
+
error: null,
|
|
222
|
+
headers: res.headers
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
get(id) {
|
|
226
|
+
return this.client.get(`/webhooks/${id}`);
|
|
227
|
+
}
|
|
228
|
+
update(id, options) {
|
|
229
|
+
return this.client.patch(`/webhooks/${id}`, {
|
|
230
|
+
url: options.url,
|
|
231
|
+
events: options.events
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
delete(id) {
|
|
235
|
+
return this.client.delete(`/webhooks/${id}`);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/broadcasts.ts
|
|
240
|
+
var Broadcasts = class {
|
|
241
|
+
constructor(client) {
|
|
242
|
+
this.client = client;
|
|
243
|
+
}
|
|
244
|
+
create(options) {
|
|
245
|
+
return this.client.post("/broadcasts", {
|
|
246
|
+
name: options.name,
|
|
247
|
+
audience_id: options.audienceId,
|
|
248
|
+
from: options.from,
|
|
249
|
+
subject: options.subject,
|
|
250
|
+
html: options.html,
|
|
251
|
+
template_id: options.templateId,
|
|
252
|
+
template_variables: options.templateVariables
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
async list() {
|
|
256
|
+
const res = await this.client.get("/broadcasts");
|
|
257
|
+
if (res.error) return res;
|
|
258
|
+
return {
|
|
259
|
+
data: res.data.data,
|
|
260
|
+
error: null,
|
|
261
|
+
headers: res.headers
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
get(id) {
|
|
265
|
+
return this.client.get(`/broadcasts/${id}`);
|
|
266
|
+
}
|
|
267
|
+
update(id, options) {
|
|
268
|
+
return this.client.patch(`/broadcasts/${id}`, {
|
|
269
|
+
name: options.name,
|
|
270
|
+
audience_id: options.audienceId,
|
|
271
|
+
from: options.from,
|
|
272
|
+
subject: options.subject,
|
|
273
|
+
html: options.html,
|
|
274
|
+
template_id: options.templateId,
|
|
275
|
+
template_variables: options.templateVariables,
|
|
276
|
+
scheduled_at: options.scheduledAt
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
send(id, options = {}) {
|
|
280
|
+
return this.client.post(`/broadcasts/${id}/send`, { scheduled_at: options.scheduledAt });
|
|
281
|
+
}
|
|
282
|
+
cancel(id) {
|
|
283
|
+
return this.client.post(`/broadcasts/${id}/cancel`);
|
|
284
|
+
}
|
|
285
|
+
delete(id) {
|
|
286
|
+
return this.client.delete(`/broadcasts/${id}`);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/eusend.ts
|
|
291
|
+
const DEFAULT_BASE_URL = "https://api.eusend.dev";
|
|
292
|
+
const SDK_VERSION = "0.1.0";
|
|
293
|
+
var Eusend = class {
|
|
294
|
+
constructor(key, options) {
|
|
295
|
+
const apiKey = key ?? (typeof process !== "undefined" ? process.env["EUSEND_API_KEY"] : void 0);
|
|
296
|
+
if (!apiKey) throw new Error("Missing Eusend API key. Pass it to the constructor or set the EUSEND_API_KEY environment variable.");
|
|
297
|
+
this.apiKey = apiKey;
|
|
298
|
+
this.baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
|
|
299
|
+
this.emails = new Emails(this);
|
|
300
|
+
this.domains = new Domains(this);
|
|
301
|
+
this.apiKeys = new ApiKeys(this);
|
|
302
|
+
this.audiences = new Audiences(this);
|
|
303
|
+
this.templates = new Templates(this);
|
|
304
|
+
this.webhooks = new Webhooks(this);
|
|
305
|
+
this.broadcasts = new Broadcasts(this);
|
|
306
|
+
}
|
|
307
|
+
async fetchRequest(path, init = {}, extraHeaders = {}) {
|
|
308
|
+
const headers = {
|
|
309
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
310
|
+
"Content-Type": "application/json",
|
|
311
|
+
"User-Agent": `eusend-node/${SDK_VERSION}`,
|
|
312
|
+
...extraHeaders
|
|
313
|
+
};
|
|
314
|
+
try {
|
|
315
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
316
|
+
...init,
|
|
317
|
+
headers
|
|
318
|
+
});
|
|
319
|
+
const responseHeaders = Object.fromEntries(res.headers.entries());
|
|
320
|
+
if (!res.ok) {
|
|
321
|
+
let error;
|
|
322
|
+
try {
|
|
323
|
+
const json = await res.json();
|
|
324
|
+
error = {
|
|
325
|
+
message: json.error ?? "Unknown error",
|
|
326
|
+
statusCode: res.status,
|
|
327
|
+
name: json.code ?? "INTERNAL_ERROR"
|
|
328
|
+
};
|
|
329
|
+
} catch {
|
|
330
|
+
error = {
|
|
331
|
+
message: "Request failed",
|
|
332
|
+
statusCode: res.status,
|
|
333
|
+
name: "INTERNAL_ERROR"
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
return {
|
|
337
|
+
data: null,
|
|
338
|
+
error,
|
|
339
|
+
headers: responseHeaders
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
if (res.status === 204 || res.headers.get("content-length") === "0") return {
|
|
343
|
+
data: {},
|
|
344
|
+
error: null,
|
|
345
|
+
headers: responseHeaders
|
|
346
|
+
};
|
|
347
|
+
return {
|
|
348
|
+
data: await res.json(),
|
|
349
|
+
error: null,
|
|
350
|
+
headers: responseHeaders
|
|
351
|
+
};
|
|
352
|
+
} catch {
|
|
353
|
+
return {
|
|
354
|
+
data: null,
|
|
355
|
+
error: {
|
|
356
|
+
message: "Network request failed. The request could not be resolved.",
|
|
357
|
+
statusCode: null,
|
|
358
|
+
name: "application_error"
|
|
359
|
+
},
|
|
360
|
+
headers: null
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
get(path, extraHeaders) {
|
|
365
|
+
return this.fetchRequest(path, { method: "GET" }, extraHeaders);
|
|
366
|
+
}
|
|
367
|
+
post(path, body, extraHeaders) {
|
|
368
|
+
return this.fetchRequest(path, {
|
|
369
|
+
method: "POST",
|
|
370
|
+
body: body != null ? JSON.stringify(body) : void 0
|
|
371
|
+
}, extraHeaders);
|
|
372
|
+
}
|
|
373
|
+
patch(path, body) {
|
|
374
|
+
return this.fetchRequest(path, {
|
|
375
|
+
method: "PATCH",
|
|
376
|
+
body: body != null ? JSON.stringify(body) : void 0
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
delete(path) {
|
|
380
|
+
return this.fetchRequest(path, { method: "DELETE" });
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
//#endregion
|
|
384
|
+
export { Eusend };
|
|
385
|
+
|
|
386
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/emails.ts","../src/domains.ts","../src/api-keys.ts","../src/audiences.ts","../src/templates.ts","../src/webhooks.ts","../src/broadcasts.ts","../src/eusend.ts"],"sourcesContent":["import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type EmailStatus =\n | 'queued'\n | 'sending'\n | 'sent'\n | 'delivered'\n | 'bounced'\n | 'complained'\n | 'suppressed'\n | 'failed';\n\nexport type EmailEventType =\n | 'sent'\n | 'delivered'\n | 'opened'\n | 'clicked'\n | 'bounced'\n | 'complained';\n\nexport interface SendEmailOptions {\n from: string;\n to: string | string[];\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string | string[];\n subject?: string;\n html?: string;\n text?: string;\n templateId?: string;\n variables?: Record<string, unknown>;\n headers?: Record<string, string>;\n trackOpens?: boolean;\n trackClicks?: boolean;\n}\n\nexport interface SendEmailRequestOptions {\n idempotencyKey?: string;\n}\n\nexport interface SendEmailResponse {\n id: string;\n}\n\nexport interface BatchSendResponse {\n data: SendEmailResponse[];\n}\n\nexport interface EmailEvent {\n id: string;\n type: EmailEventType;\n metadata: Record<string, unknown>;\n createdAt: string;\n}\n\nexport interface Email {\n id: string;\n from: string;\n to: string[];\n cc: string[];\n bcc: string[];\n replyTo: string[];\n subject: string;\n html: string | null;\n text: string | null;\n status: EmailStatus;\n testMode: boolean;\n templateId: string | null;\n createdAt: string;\n events: EmailEvent[];\n}\n\nexport interface EmailListItem {\n id: string;\n from: string;\n to: string[];\n subject: string;\n status: EmailStatus;\n testMode: boolean;\n createdAt: string;\n}\n\nexport interface ListEmailsOptions {\n limit?: number;\n cursor?: string;\n status?: EmailStatus;\n from?: string;\n to?: string;\n}\n\nexport interface ListEmailsResponse {\n data: EmailListItem[];\n nextCursor: string | null;\n}\n\nfunction toApiPayload(options: SendEmailOptions) {\n return {\n from: options.from,\n to: options.to,\n cc: options.cc,\n bcc: options.bcc,\n reply_to: options.replyTo,\n subject: options.subject,\n html: options.html,\n text: options.text,\n template_id: options.templateId,\n variables: options.variables,\n headers: options.headers,\n track_opens: options.trackOpens,\n track_clicks: options.trackClicks,\n };\n}\n\nexport class Emails {\n constructor(private readonly client: Eusend) {}\n\n async send(\n options: SendEmailOptions,\n requestOptions?: SendEmailRequestOptions,\n ): Promise<EusendResponse<SendEmailResponse>> {\n const extraHeaders: Record<string, string> = {};\n if (requestOptions?.idempotencyKey) {\n extraHeaders['Idempotency-Key'] = requestOptions.idempotencyKey;\n }\n return this.client.post<SendEmailResponse>('/emails', toApiPayload(options), extraHeaders);\n }\n\n async batch(\n emails: SendEmailOptions[],\n ): Promise<EusendResponse<BatchSendResponse>> {\n return this.client.post<BatchSendResponse>('/emails/batch', {\n emails: emails.map(toApiPayload),\n });\n }\n\n async list(options: ListEmailsOptions = {}): Promise<EusendResponse<ListEmailsResponse>> {\n const params = new URLSearchParams();\n if (options.limit != null) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n if (options.status) params.set('status', options.status);\n if (options.from) params.set('from', options.from);\n if (options.to) params.set('to', options.to);\n const qs = params.toString();\n\n const res = await this.client.get<{ data: EmailListItem[]; next_cursor: string | null }>(\n qs ? `/emails?${qs}` : '/emails',\n );\n if (res.error) return res;\n return {\n data: { data: res.data.data, nextCursor: res.data.next_cursor },\n error: null,\n headers: res.headers,\n };\n }\n\n get(id: string): Promise<EusendResponse<Email>> {\n return this.client.get<Email>(`/emails/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type DomainStatus = 'pending' | 'verified' | 'failed';\n\nexport interface DnsRecord {\n type: string;\n name: string;\n value: string;\n}\n\nexport interface CreateDomainResponse {\n id: string;\n name: string;\n dkim: DnsRecord;\n spf: DnsRecord;\n dmarc: DnsRecord;\n}\n\nexport interface DomainListItem {\n id: string;\n name: string;\n status: DomainStatus;\n createdAt: string;\n}\n\nexport interface Domain {\n id: string;\n name: string;\n dkimPublicKey: string;\n dkimSelector: string;\n status: DomainStatus;\n createdAt: string;\n verifiedAt: string | null;\n}\n\nexport class Domains {\n constructor(private readonly client: Eusend) {}\n\n create(name: string): Promise<EusendResponse<CreateDomainResponse>> {\n return this.client.post<CreateDomainResponse>('/domains', { name });\n }\n\n list(): Promise<EusendResponse<DomainListItem[]>> {\n return this.client.get<DomainListItem[]>('/domains');\n }\n\n get(id: string): Promise<EusendResponse<Domain>> {\n return this.client.get<Domain>(`/domains/${id}`);\n }\n\n delete(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.delete<{ message: string }>(`/domains/${id}`);\n }\n\n verify(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.post<{ message: string }>(`/domains/${id}/verify`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport interface CreateApiKeyOptions {\n name: string;\n testMode?: boolean;\n}\n\nexport interface CreateApiKeyResponse {\n id: string;\n name: string;\n key: string;\n prefix: string;\n testMode: boolean;\n createdAt: string;\n}\n\nexport interface ApiKey {\n id: string;\n name: string;\n prefix: string;\n testMode: boolean;\n createdAt: string;\n lastUsedAt: string | null;\n}\n\ntype CreateApiKeyApiResponse = {\n id: string;\n name: string;\n key: string;\n prefix: string;\n test_mode: boolean;\n created_at: string;\n};\n\nexport class ApiKeys {\n constructor(private readonly client: Eusend) {}\n\n async create(options: CreateApiKeyOptions): Promise<EusendResponse<CreateApiKeyResponse>> {\n const res = await this.client.post<CreateApiKeyApiResponse>('/api-keys', {\n name: options.name,\n test_mode: options.testMode ?? false,\n });\n if (res.error) return res;\n return {\n data: {\n id: res.data.id,\n name: res.data.name,\n key: res.data.key,\n prefix: res.data.prefix,\n testMode: res.data.test_mode,\n createdAt: res.data.created_at,\n },\n error: null,\n headers: res.headers,\n };\n }\n\n list(): Promise<EusendResponse<ApiKey[]>> {\n return this.client.get<ApiKey[]>('/api-keys');\n }\n\n delete(id: string): Promise<EusendResponse<{ message: string }>> {\n return this.client.delete<{ message: string }>(`/api-keys/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type ContactStatus = 'subscribed' | 'unsubscribed';\n\nexport interface Audience {\n id: string;\n name: string;\n organizationId: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AudienceListItem {\n id: string;\n name: string;\n createdAt: string;\n contactCount: number;\n}\n\nexport interface Contact {\n id: string;\n audienceId: string;\n email: string;\n firstName: string | null;\n lastName: string | null;\n status: ContactStatus;\n unsubscribedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CreateContactOptions {\n email: string;\n firstName?: string;\n lastName?: string;\n}\n\nexport interface UpdateContactOptions {\n firstName?: string;\n lastName?: string;\n unsubscribed?: boolean;\n}\n\nexport interface ListContactsOptions {\n limit?: number;\n cursor?: string;\n search?: string;\n subscribed?: boolean;\n}\n\nexport interface ListContactsResponse {\n data: Contact[];\n nextCursor: string | null;\n}\n\nexport interface BatchCreateContactsOptions {\n contacts: CreateContactOptions[];\n}\n\nexport class Audiences {\n constructor(private readonly client: Eusend) {}\n\n create(name: string): Promise<EusendResponse<Audience>> {\n return this.client.post<Audience>('/audiences', { name });\n }\n\n async list(): Promise<EusendResponse<AudienceListItem[]>> {\n const res = await this.client.get<{ data: AudienceListItem[] }>('/audiences');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/audiences/${id}`);\n }\n\n createContact(\n audienceId: string,\n options: CreateContactOptions,\n ): Promise<EusendResponse<Contact>> {\n return this.client.post<Contact>(`/audiences/${audienceId}/contacts`, {\n email: options.email,\n first_name: options.firstName,\n last_name: options.lastName,\n });\n }\n\n async listContacts(\n audienceId: string,\n options: ListContactsOptions = {},\n ): Promise<EusendResponse<ListContactsResponse>> {\n const params = new URLSearchParams();\n if (options.limit != null) params.set('limit', String(options.limit));\n if (options.cursor) params.set('cursor', options.cursor);\n if (options.search) params.set('search', options.search);\n if (options.subscribed != null) params.set('subscribed', String(options.subscribed));\n const qs = params.toString();\n return this.client.get<ListContactsResponse>(\n qs ? `/audiences/${audienceId}/contacts?${qs}` : `/audiences/${audienceId}/contacts`,\n );\n }\n\n getContact(audienceId: string, contactId: string): Promise<EusendResponse<Contact>> {\n return this.client.get<Contact>(`/audiences/${audienceId}/contacts/${contactId}`);\n }\n\n updateContact(\n audienceId: string,\n contactId: string,\n options: UpdateContactOptions,\n ): Promise<EusendResponse<Contact>> {\n return this.client.patch<Contact>(`/audiences/${audienceId}/contacts/${contactId}`, {\n first_name: options.firstName,\n last_name: options.lastName,\n unsubscribed: options.unsubscribed,\n });\n }\n\n deleteContact(\n audienceId: string,\n contactId: string,\n ): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(\n `/audiences/${audienceId}/contacts/${contactId}`,\n );\n }\n\n batchCreateContacts(\n audienceId: string,\n options: BatchCreateContactsOptions,\n ): Promise<EusendResponse<{ count: number }>> {\n return this.client.post<{ count: number }>(`/audiences/${audienceId}/contacts/batch`, {\n contacts: options.contacts.map((c) => ({\n email: c.email,\n first_name: c.firstName,\n last_name: c.lastName,\n })),\n });\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport interface CreateTemplateOptions {\n name: string;\n subject: string;\n html?: string;\n reactSource?: string;\n}\n\nexport interface UpdateTemplateOptions {\n name?: string;\n subject?: string;\n html?: string;\n reactSource?: string;\n}\n\nexport interface Template {\n id: string;\n name: string;\n subject: string;\n html: string | null;\n reactSource: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface TemplateListItem {\n id: string;\n name: string;\n subject: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport class Templates {\n constructor(private readonly client: Eusend) {}\n\n create(options: CreateTemplateOptions): Promise<EusendResponse<Template>> {\n return this.client.post<Template>('/templates', {\n name: options.name,\n subject: options.subject,\n html: options.html,\n react_source: options.reactSource,\n });\n }\n\n async list(): Promise<EusendResponse<TemplateListItem[]>> {\n const res = await this.client.get<{ data: TemplateListItem[] }>('/templates');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<Template>> {\n return this.client.get<Template>(`/templates/${id}`);\n }\n\n update(id: string, options: UpdateTemplateOptions): Promise<EusendResponse<Template>> {\n return this.client.patch<Template>(`/templates/${id}`, {\n name: options.name,\n subject: options.subject,\n html: options.html,\n react_source: options.reactSource,\n });\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/templates/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type WebhookEvent =\n | 'email.sent'\n | 'email.delivered'\n | 'email.bounced'\n | 'email.complained'\n | 'email.opened'\n | 'email.clicked'\n | '*';\n\nexport interface CreateWebhookOptions {\n url: string;\n events: WebhookEvent[];\n}\n\nexport interface UpdateWebhookOptions {\n url?: string;\n events?: WebhookEvent[];\n}\n\nexport interface WebhookDelivery {\n id: string;\n webhookId: string;\n emailId: string | null;\n eventType: string;\n payload: Record<string, unknown>;\n status: 'pending' | 'success' | 'failed';\n responseStatus: number | null;\n attempts: number;\n createdAt: string;\n lastAttemptAt: string | null;\n}\n\nexport interface Webhook {\n id: string;\n url: string;\n events: WebhookEvent[];\n createdAt: string;\n}\n\nexport interface WebhookWithDeliveries extends Webhook {\n deliveries: WebhookDelivery[];\n}\n\nexport interface CreateWebhookResponse extends Webhook {\n secret: string;\n}\n\nexport class Webhooks {\n constructor(private readonly client: Eusend) {}\n\n create(options: CreateWebhookOptions): Promise<EusendResponse<CreateWebhookResponse>> {\n return this.client.post<CreateWebhookResponse>('/webhooks', {\n url: options.url,\n events: options.events,\n });\n }\n\n async list(): Promise<EusendResponse<Webhook[]>> {\n const res = await this.client.get<{ data: Webhook[] }>('/webhooks');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<WebhookWithDeliveries>> {\n return this.client.get<WebhookWithDeliveries>(`/webhooks/${id}`);\n }\n\n update(id: string, options: UpdateWebhookOptions): Promise<EusendResponse<Webhook>> {\n return this.client.patch<Webhook>(`/webhooks/${id}`, {\n url: options.url,\n events: options.events,\n });\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/webhooks/${id}`);\n }\n}\n","import type { Eusend } from './eusend';\nimport type { EusendResponse } from './interfaces';\n\nexport type BroadcastStatus =\n | 'draft'\n | 'scheduled'\n | 'sending'\n | 'sent'\n | 'paused'\n | 'cancelled';\n\nexport interface CreateBroadcastOptions {\n name: string;\n audienceId: string;\n from: string;\n subject: string;\n html?: string;\n templateId?: string;\n templateVariables?: Record<string, string>;\n}\n\nexport interface UpdateBroadcastOptions {\n name?: string;\n audienceId?: string;\n from?: string;\n subject?: string;\n html?: string;\n templateId?: string | null;\n templateVariables?: Record<string, string> | null;\n scheduledAt?: string | null;\n}\n\nexport interface SendBroadcastOptions {\n scheduledAt?: string;\n}\n\nexport interface Broadcast {\n id: string;\n name: string;\n status: BroadcastStatus;\n audienceId: string;\n fromAddress: string;\n subject: string;\n html: string | null;\n templateId: string | null;\n templateVariables: Record<string, string> | null;\n scheduledAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface BroadcastListItem {\n id: string;\n name: string;\n status: BroadcastStatus;\n audienceId: string;\n fromAddress: string;\n subject: string;\n recipientCount: number | null;\n sentCount: number | null;\n scheduledAt: string | null;\n startedAt: string | null;\n completedAt: string | null;\n createdAt: string;\n audienceName: string | null;\n}\n\nexport interface BroadcastDetail extends Broadcast {\n recipientCount: number | null;\n sentCount: number | null;\n startedAt: string | null;\n completedAt: string | null;\n stats: Record<string, number>;\n}\n\nexport interface SendBroadcastResponse {\n id: string;\n status: 'sending' | 'scheduled';\n scheduledAt: string | null;\n}\n\nexport class Broadcasts {\n constructor(private readonly client: Eusend) {}\n\n create(options: CreateBroadcastOptions): Promise<EusendResponse<Broadcast>> {\n return this.client.post<Broadcast>('/broadcasts', {\n name: options.name,\n audience_id: options.audienceId,\n from: options.from,\n subject: options.subject,\n html: options.html,\n template_id: options.templateId,\n template_variables: options.templateVariables,\n });\n }\n\n async list(): Promise<EusendResponse<BroadcastListItem[]>> {\n const res = await this.client.get<{ data: BroadcastListItem[] }>('/broadcasts');\n if (res.error) return res;\n return { data: res.data.data, error: null, headers: res.headers };\n }\n\n get(id: string): Promise<EusendResponse<BroadcastDetail>> {\n return this.client.get<BroadcastDetail>(`/broadcasts/${id}`);\n }\n\n update(id: string, options: UpdateBroadcastOptions): Promise<EusendResponse<Broadcast>> {\n return this.client.patch<Broadcast>(`/broadcasts/${id}`, {\n name: options.name,\n audience_id: options.audienceId,\n from: options.from,\n subject: options.subject,\n html: options.html,\n template_id: options.templateId,\n template_variables: options.templateVariables,\n scheduled_at: options.scheduledAt,\n });\n }\n\n send(id: string, options: SendBroadcastOptions = {}): Promise<EusendResponse<SendBroadcastResponse>> {\n return this.client.post<SendBroadcastResponse>(`/broadcasts/${id}/send`, {\n scheduled_at: options.scheduledAt,\n });\n }\n\n cancel(id: string): Promise<EusendResponse<Broadcast>> {\n return this.client.post<Broadcast>(`/broadcasts/${id}/cancel`);\n }\n\n delete(id: string): Promise<EusendResponse<Record<string, never>>> {\n return this.client.delete<Record<string, never>>(`/broadcasts/${id}`);\n }\n}\n","import type { EusendError, EusendResponse } from './interfaces';\nimport { Emails } from './emails';\nimport { Domains } from './domains';\nimport { ApiKeys } from './api-keys';\nimport { Audiences } from './audiences';\nimport { Templates } from './templates';\nimport { Webhooks } from './webhooks';\nimport { Broadcasts } from './broadcasts';\n\nconst DEFAULT_BASE_URL = 'https://api.eusend.dev';\nconst SDK_VERSION = '0.1.0';\n\nexport interface EusendOptions {\n baseUrl?: string;\n}\n\nexport class Eusend {\n readonly baseUrl: string;\n private readonly apiKey: string;\n\n readonly emails: Emails;\n readonly domains: Domains;\n readonly apiKeys: ApiKeys;\n readonly audiences: Audiences;\n readonly templates: Templates;\n readonly webhooks: Webhooks;\n readonly broadcasts: Broadcasts;\n\n constructor(key?: string, options?: EusendOptions) {\n const apiKey =\n key ?? (typeof process !== 'undefined' ? process.env['EUSEND_API_KEY'] : undefined);\n if (!apiKey) {\n throw new Error(\n 'Missing Eusend API key. Pass it to the constructor or set the EUSEND_API_KEY environment variable.',\n );\n }\n this.apiKey = apiKey;\n this.baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;\n\n this.emails = new Emails(this);\n this.domains = new Domains(this);\n this.apiKeys = new ApiKeys(this);\n this.audiences = new Audiences(this);\n this.templates = new Templates(this);\n this.webhooks = new Webhooks(this);\n this.broadcasts = new Broadcasts(this);\n }\n\n async fetchRequest<T>(\n path: string,\n init: RequestInit = {},\n extraHeaders: Record<string, string> = {},\n ): Promise<EusendResponse<T>> {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `eusend-node/${SDK_VERSION}`,\n ...extraHeaders,\n };\n\n try {\n const res = await fetch(`${this.baseUrl}${path}`, { ...init, headers });\n const responseHeaders = Object.fromEntries(res.headers.entries());\n\n if (!res.ok) {\n let error: EusendError;\n try {\n const json = (await res.json()) as { error?: string; code?: string };\n error = {\n message: json.error ?? 'Unknown error',\n statusCode: res.status,\n name: ((json.code as EusendError['name']) ?? 'INTERNAL_ERROR'),\n };\n } catch {\n error = { message: 'Request failed', statusCode: res.status, name: 'INTERNAL_ERROR' };\n }\n return { data: null, error, headers: responseHeaders };\n }\n\n if (res.status === 204 || res.headers.get('content-length') === '0') {\n return { data: {} as T, error: null, headers: responseHeaders };\n }\n\n const data = (await res.json()) as T;\n return { data, error: null, headers: responseHeaders };\n } catch {\n return {\n data: null,\n error: {\n message: 'Network request failed. The request could not be resolved.',\n statusCode: null,\n name: 'application_error',\n },\n headers: null,\n };\n }\n }\n\n get<T>(path: string, extraHeaders?: Record<string, string>): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, { method: 'GET' }, extraHeaders);\n }\n\n post<T>(\n path: string,\n body?: unknown,\n extraHeaders?: Record<string, string>,\n ): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(\n path,\n { method: 'POST', body: body != null ? JSON.stringify(body) : undefined },\n extraHeaders,\n );\n }\n\n patch<T>(path: string, body?: unknown): Promise<EusendResponse<T>> {\n return this.fetchRequest<T>(path, {\n method: 'PATCH',\n body: body != null ? JSON.stringify(body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ACF,QAAQ;KACN,QAAQ;MAAE,SAAS;MAAkB,YAAY,IAAI;MAAQ,MAAM;KAAiB;IACtF;IACA,OAAO;KAAE,MAAM;KAAM;KAAO,SAAS;IAAgB;GACvD;GAEA,IAAI,IAAI,WAAW,OAAO,IAAI,QAAQ,IAAI,gBAAgB,MAAM,KAC9D,OAAO;IAAE,MAAM,CAAC;IAAQ,OAAO;IAAM,SAAS;GAAgB;GAIhE,OAAO;IAAE,MAAA,MADW,IAAI,KAAK;IACd,OAAO;IAAM,SAAS;GAAgB;EACvD,QAAQ;GACN,OAAO;IACL,MAAM;IACN,OAAO;KACL,SAAS;KACT,YAAY;KACZ,MAAM;IACR;IACA,SAAS;GACX;EACF;CACF;CAEA,IAAO,MAAc,cAAmE;EACtF,OAAO,KAAK,aAAgB,MAAM,EAAE,QAAQ,MAAM,GAAG,YAAY;CACnE;CAEA,KACE,MACA,MACA,cAC4B;EAC5B,OAAO,KAAK,aACV,MACA;GAAE,QAAQ;GAAQ,MAAM,QAAQ,OAAO,KAAK,UAAU,IAAI,IAAI,KAAA;EAAU,GACxE,YACF;CACF;CAEA,MAAS,MAAc,MAA4C;EACjE,OAAO,KAAK,aAAgB,MAAM;GAChC,QAAQ;GACR,MAAM,QAAQ,OAAO,KAAK,UAAU,IAAI,IAAI,KAAA;EAC9C,CAAC;CACH;CAEA,OAAU,MAA0C;EAClD,OAAO,KAAK,aAAgB,MAAM,EAAE,QAAQ,SAAS,CAAC;CACxD;AACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@eusend_dev/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official Node.js SDK for the Eusend API",
|
|
5
|
+
"author": "Eusend",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
|
+
"default": "./dist/index.mjs"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": ["dist"],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsdown src/index.ts --format esm,cjs --dts",
|
|
25
|
+
"dev": "tsdown src/index.ts --format esm,cjs --dts --watch",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"tsdown": "^0.22.0",
|
|
30
|
+
"typescript": "^5.8.0"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
}
|
|
35
|
+
}
|