resend 4.7.0-preview-topics.2 → 4.8.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/dist/index.js CHANGED
@@ -72,7 +72,7 @@ __export(src_exports, {
72
72
  module.exports = __toCommonJS(src_exports);
73
73
 
74
74
  // package.json
75
- var version = "4.7.0-preview-topics.2";
75
+ var version = "4.8.0";
76
76
 
77
77
  // src/api-keys/api-keys.ts
78
78
  var ApiKeys = class {
@@ -145,9 +145,18 @@ var Audiences = class {
145
145
  };
146
146
 
147
147
  // src/common/utils/parse-email-to-api-options.ts
148
+ function parseAttachments(attachments) {
149
+ return attachments == null ? void 0 : attachments.map((attachment) => ({
150
+ content: attachment.content,
151
+ filename: attachment.filename,
152
+ path: attachment.path,
153
+ content_type: attachment.contentType,
154
+ inline_content_id: attachment.inlineContentId
155
+ }));
156
+ }
148
157
  function parseEmailToApiOptions(email) {
149
158
  return {
150
- attachments: email.attachments,
159
+ attachments: parseAttachments(email.attachments),
151
160
  bcc: email.bcc,
152
161
  cc: email.cc,
153
162
  from: email.from,
@@ -158,8 +167,7 @@ function parseEmailToApiOptions(email) {
158
167
  subject: email.subject,
159
168
  tags: email.tags,
160
169
  text: email.text,
161
- to: email.to,
162
- topic_id: email.topicId
170
+ to: email.to
163
171
  };
164
172
  }
165
173
 
@@ -235,8 +243,7 @@ var Broadcasts = class {
235
243
  html: payload.html,
236
244
  reply_to: payload.replyTo,
237
245
  subject: payload.subject,
238
- text: payload.text,
239
- topic_id: payload.topicId
246
+ text: payload.text
240
247
  },
241
248
  options
242
249
  );
@@ -286,8 +293,7 @@ var Broadcasts = class {
286
293
  text: payload.text,
287
294
  subject: payload.subject,
288
295
  reply_to: payload.replyTo,
289
- preview_text: payload.previewText,
290
- topic_id: payload.topicId
296
+ preview_text: payload.previewText
291
297
  }
292
298
  );
293
299
  return data;
@@ -295,55 +301,10 @@ var Broadcasts = class {
295
301
  }
296
302
  };
297
303
 
298
- // src/contacts/topics/contact-topics.ts
299
- var ContactTopics = class {
300
- constructor(resend) {
301
- this.resend = resend;
302
- }
303
- update(payload) {
304
- return __async(this, null, function* () {
305
- if (!payload.id && !payload.email) {
306
- return {
307
- data: null,
308
- error: {
309
- message: "Missing `id` or `email` field.",
310
- name: "missing_required_field"
311
- }
312
- };
313
- }
314
- const identifier = payload.email ? payload.email : payload.id;
315
- const data = yield this.resend.patch(
316
- `/contacts/${identifier}/topics`,
317
- payload.topics
318
- );
319
- return data;
320
- });
321
- }
322
- get(options) {
323
- return __async(this, null, function* () {
324
- if (!options.id && !options.email) {
325
- return {
326
- data: null,
327
- error: {
328
- message: "Missing `id` or `email` field.",
329
- name: "missing_required_field"
330
- }
331
- };
332
- }
333
- const identifier = options.email ? options.email : options.id;
334
- const data = yield this.resend.get(
335
- `/contacts/${identifier}/topics`
336
- );
337
- return data;
338
- });
339
- }
340
- };
341
-
342
304
  // src/contacts/contacts.ts
343
305
  var Contacts = class {
344
306
  constructor(resend) {
345
307
  this.resend = resend;
346
- this.topics = new ContactTopics(this.resend);
347
308
  }
348
309
  create(_0) {
349
310
  return __async(this, arguments, function* (payload, options = {}) {
@@ -559,80 +520,6 @@ var Emails = class {
559
520
  }
560
521
  };
561
522
 
562
- // src/topics/topics.ts
563
- var Topics = class {
564
- constructor(resend) {
565
- this.resend = resend;
566
- }
567
- create(payload) {
568
- return __async(this, null, function* () {
569
- const data = yield this.resend.post(
570
- "/topics",
571
- payload
572
- );
573
- return data;
574
- });
575
- }
576
- list() {
577
- return __async(this, null, function* () {
578
- const data = yield this.resend.get("/topics");
579
- return data;
580
- });
581
- }
582
- get(id) {
583
- return __async(this, null, function* () {
584
- if (!id) {
585
- return {
586
- data: null,
587
- error: {
588
- message: "Missing `id` field.",
589
- name: "missing_required_field"
590
- }
591
- };
592
- }
593
- const data = yield this.resend.get(
594
- `/topics/${id}`
595
- );
596
- return data;
597
- });
598
- }
599
- update(payload) {
600
- return __async(this, null, function* () {
601
- if (!payload.id) {
602
- return {
603
- data: null,
604
- error: {
605
- message: "Missing `id` field.",
606
- name: "missing_required_field"
607
- }
608
- };
609
- }
610
- const data = yield this.resend.patch(
611
- `/topics/${payload.id}`,
612
- payload
613
- );
614
- return data;
615
- });
616
- }
617
- remove(id) {
618
- return __async(this, null, function* () {
619
- if (!id) {
620
- return {
621
- data: null,
622
- error: {
623
- message: "Missing `id` field.",
624
- name: "missing_required_field"
625
- }
626
- };
627
- }
628
- const data = yield this.resend.delete(
629
- `/topics/${id}`
630
- );
631
- return data;
632
- });
633
- }
634
- };
635
-
636
523
  // src/resend.ts
637
524
  var defaultBaseUrl = "https://api.resend.com";
638
525
  var defaultUserAgent = `resend-node:${version}`;
@@ -648,7 +535,6 @@ var Resend = class {
648
535
  this.contacts = new Contacts(this);
649
536
  this.domains = new Domains(this);
650
537
  this.emails = new Emails(this);
651
- this.topics = new Topics(this);
652
538
  if (!key) {
653
539
  if (typeof process !== "undefined" && process.env) {
654
540
  this.key = process.env.RESEND_API_KEY;
package/dist/index.mjs CHANGED
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
39
39
  };
40
40
 
41
41
  // package.json
42
- var version = "4.7.0-preview-topics.2";
42
+ var version = "4.8.0";
43
43
 
44
44
  // src/api-keys/api-keys.ts
45
45
  var ApiKeys = class {
@@ -112,9 +112,18 @@ var Audiences = class {
112
112
  };
113
113
 
114
114
  // src/common/utils/parse-email-to-api-options.ts
115
+ function parseAttachments(attachments) {
116
+ return attachments == null ? void 0 : attachments.map((attachment) => ({
117
+ content: attachment.content,
118
+ filename: attachment.filename,
119
+ path: attachment.path,
120
+ content_type: attachment.contentType,
121
+ inline_content_id: attachment.inlineContentId
122
+ }));
123
+ }
115
124
  function parseEmailToApiOptions(email) {
116
125
  return {
117
- attachments: email.attachments,
126
+ attachments: parseAttachments(email.attachments),
118
127
  bcc: email.bcc,
119
128
  cc: email.cc,
120
129
  from: email.from,
@@ -125,8 +134,7 @@ function parseEmailToApiOptions(email) {
125
134
  subject: email.subject,
126
135
  tags: email.tags,
127
136
  text: email.text,
128
- to: email.to,
129
- topic_id: email.topicId
137
+ to: email.to
130
138
  };
131
139
  }
132
140
 
@@ -202,8 +210,7 @@ var Broadcasts = class {
202
210
  html: payload.html,
203
211
  reply_to: payload.replyTo,
204
212
  subject: payload.subject,
205
- text: payload.text,
206
- topic_id: payload.topicId
213
+ text: payload.text
207
214
  },
208
215
  options
209
216
  );
@@ -253,8 +260,7 @@ var Broadcasts = class {
253
260
  text: payload.text,
254
261
  subject: payload.subject,
255
262
  reply_to: payload.replyTo,
256
- preview_text: payload.previewText,
257
- topic_id: payload.topicId
263
+ preview_text: payload.previewText
258
264
  }
259
265
  );
260
266
  return data;
@@ -262,55 +268,10 @@ var Broadcasts = class {
262
268
  }
263
269
  };
264
270
 
265
- // src/contacts/topics/contact-topics.ts
266
- var ContactTopics = class {
267
- constructor(resend) {
268
- this.resend = resend;
269
- }
270
- update(payload) {
271
- return __async(this, null, function* () {
272
- if (!payload.id && !payload.email) {
273
- return {
274
- data: null,
275
- error: {
276
- message: "Missing `id` or `email` field.",
277
- name: "missing_required_field"
278
- }
279
- };
280
- }
281
- const identifier = payload.email ? payload.email : payload.id;
282
- const data = yield this.resend.patch(
283
- `/contacts/${identifier}/topics`,
284
- payload.topics
285
- );
286
- return data;
287
- });
288
- }
289
- get(options) {
290
- return __async(this, null, function* () {
291
- if (!options.id && !options.email) {
292
- return {
293
- data: null,
294
- error: {
295
- message: "Missing `id` or `email` field.",
296
- name: "missing_required_field"
297
- }
298
- };
299
- }
300
- const identifier = options.email ? options.email : options.id;
301
- const data = yield this.resend.get(
302
- `/contacts/${identifier}/topics`
303
- );
304
- return data;
305
- });
306
- }
307
- };
308
-
309
271
  // src/contacts/contacts.ts
310
272
  var Contacts = class {
311
273
  constructor(resend) {
312
274
  this.resend = resend;
313
- this.topics = new ContactTopics(this.resend);
314
275
  }
315
276
  create(_0) {
316
277
  return __async(this, arguments, function* (payload, options = {}) {
@@ -526,80 +487,6 @@ var Emails = class {
526
487
  }
527
488
  };
528
489
 
529
- // src/topics/topics.ts
530
- var Topics = class {
531
- constructor(resend) {
532
- this.resend = resend;
533
- }
534
- create(payload) {
535
- return __async(this, null, function* () {
536
- const data = yield this.resend.post(
537
- "/topics",
538
- payload
539
- );
540
- return data;
541
- });
542
- }
543
- list() {
544
- return __async(this, null, function* () {
545
- const data = yield this.resend.get("/topics");
546
- return data;
547
- });
548
- }
549
- get(id) {
550
- return __async(this, null, function* () {
551
- if (!id) {
552
- return {
553
- data: null,
554
- error: {
555
- message: "Missing `id` field.",
556
- name: "missing_required_field"
557
- }
558
- };
559
- }
560
- const data = yield this.resend.get(
561
- `/topics/${id}`
562
- );
563
- return data;
564
- });
565
- }
566
- update(payload) {
567
- return __async(this, null, function* () {
568
- if (!payload.id) {
569
- return {
570
- data: null,
571
- error: {
572
- message: "Missing `id` field.",
573
- name: "missing_required_field"
574
- }
575
- };
576
- }
577
- const data = yield this.resend.patch(
578
- `/topics/${payload.id}`,
579
- payload
580
- );
581
- return data;
582
- });
583
- }
584
- remove(id) {
585
- return __async(this, null, function* () {
586
- if (!id) {
587
- return {
588
- data: null,
589
- error: {
590
- message: "Missing `id` field.",
591
- name: "missing_required_field"
592
- }
593
- };
594
- }
595
- const data = yield this.resend.delete(
596
- `/topics/${id}`
597
- );
598
- return data;
599
- });
600
- }
601
- };
602
-
603
490
  // src/resend.ts
604
491
  var defaultBaseUrl = "https://api.resend.com";
605
492
  var defaultUserAgent = `resend-node:${version}`;
@@ -615,7 +502,6 @@ var Resend = class {
615
502
  this.contacts = new Contacts(this);
616
503
  this.domains = new Domains(this);
617
504
  this.emails = new Emails(this);
618
- this.topics = new Topics(this);
619
505
  if (!key) {
620
506
  if (typeof process !== "undefined" && process.env) {
621
507
  this.key = process.env.RESEND_API_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "4.7.0-preview-topics.2",
3
+ "version": "4.8.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",