smartletter 1.0.0 → 1.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 CHANGED
@@ -48,6 +48,8 @@ Renamed concepts:
48
48
 
49
49
  Resend methods with no Smartletter route, so absent from the client: `domains.update`, `domains.remove`, `domains.claims`, `emails.share`, `emails.metrics`, `emails.attachments`, `emails.receiving`, `webhooks.events`. Resend's raw HTTP methods on the client (`post`, `get`, `put`, `patch`, `delete`) are absent too.
50
50
 
51
+ `attachments[].filename` accepts `false` like Resend (the key is then left out of the request). That only makes sense with `path`.
52
+
51
53
  Also supported, with the same call styles as Resend:
52
54
 
53
55
  ```ts
package/dist/index.cjs CHANGED
@@ -81,7 +81,7 @@ var Client = class {
81
81
  }
82
82
  this.key = resolved;
83
83
  this.baseUrl = (options.baseUrl || env("SMARTLETTER_BASE_URL") || DEFAULT_BASE_URL).replace(/\/+$/, "");
84
- this.userAgent = options.userAgent ?? `smartletter-node/${"1.0.0"}`;
84
+ this.userAgent = options.userAgent ?? `smartletter-node/${"1.1.0"}`;
85
85
  }
86
86
  async call(op, args, options = {}) {
87
87
  const headers = new Headers(options.headers);
@@ -238,6 +238,9 @@ var OPERATIONS = {
238
238
  scheduledAt: {
239
239
  wire: "scheduled_at"
240
240
  },
241
+ topicId: {
242
+ wire: "topic_id"
243
+ },
241
244
  attachments: {
242
245
  wire: "attachments",
243
246
  items: {
@@ -320,6 +323,9 @@ var OPERATIONS = {
320
323
  },
321
324
  scheduledAt: {
322
325
  wire: "scheduled_at"
326
+ },
327
+ topicId: {
328
+ wire: "topic_id"
323
329
  }
324
330
  }
325
331
  },
@@ -2564,7 +2570,14 @@ async function prepare(email) {
2564
2570
  const out = { ...rest };
2565
2571
  if (react) out.html = await renderReact(react);
2566
2572
  if (attachments) {
2567
- out.attachments = attachments.map((a) => a.content instanceof Uint8Array ? { ...a, content: toBase64(a.content) } : a);
2573
+ out.attachments = attachments.map((a) => {
2574
+ const { filename, ...file } = a;
2575
+ return {
2576
+ ...file,
2577
+ ...filename === false ? {} : { filename },
2578
+ ...a.content instanceof Uint8Array ? { content: toBase64(a.content) } : {}
2579
+ };
2580
+ });
2568
2581
  }
2569
2582
  return out;
2570
2583
  }