@open-apime/sdk 0.3.0 → 0.3.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/dist/index.cjs CHANGED
@@ -494,7 +494,7 @@ var MessagesResource = class {
494
494
  return this.http.request({ method: "POST", path: `${this.base}/audio`, body: form, ...options ? { options } : {} });
495
495
  }
496
496
  sendDocument(input, options) {
497
- const form = toForm(input, ["file"]);
497
+ const form = toForm(input, ["file", "filename"]);
498
498
  form.set("file", input.file, input.filename ?? fileName(input.file, "document"));
499
499
  return this.http.request({ method: "POST", path: `${this.base}/document`, body: form, ...options ? { options } : {} });
500
500
  }
@@ -516,7 +516,13 @@ function toForm(input, skip) {
516
516
  const form = new FormData();
517
517
  for (const [key, value] of Object.entries(input)) {
518
518
  if (skip.includes(key) || value === void 0 || value === null) continue;
519
- form.set(key, typeof value === "string" ? value : String(value));
519
+ if (typeof value === "string") {
520
+ form.set(key, value);
521
+ } else if (Array.isArray(value) || typeof value === "object" && !(value instanceof Blob)) {
522
+ form.set(key, JSON.stringify(value));
523
+ } else {
524
+ form.set(key, String(value));
525
+ }
520
526
  }
521
527
  return form;
522
528
  }
package/dist/index.js CHANGED
@@ -425,7 +425,7 @@ var MessagesResource = class {
425
425
  return this.http.request({ method: "POST", path: `${this.base}/audio`, body: form, ...options ? { options } : {} });
426
426
  }
427
427
  sendDocument(input, options) {
428
- const form = toForm(input, ["file"]);
428
+ const form = toForm(input, ["file", "filename"]);
429
429
  form.set("file", input.file, input.filename ?? fileName(input.file, "document"));
430
430
  return this.http.request({ method: "POST", path: `${this.base}/document`, body: form, ...options ? { options } : {} });
431
431
  }
@@ -447,7 +447,13 @@ function toForm(input, skip) {
447
447
  const form = new FormData();
448
448
  for (const [key, value] of Object.entries(input)) {
449
449
  if (skip.includes(key) || value === void 0 || value === null) continue;
450
- form.set(key, typeof value === "string" ? value : String(value));
450
+ if (typeof value === "string") {
451
+ form.set(key, value);
452
+ } else if (Array.isArray(value) || typeof value === "object" && !(value instanceof Blob)) {
453
+ form.set(key, JSON.stringify(value));
454
+ } else {
455
+ form.set(key, String(value));
456
+ }
451
457
  }
452
458
  return form;
453
459
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-apime/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Cliente TypeScript da API do apime: WhatsApp, instâncias e webhooks",
5
5
  "license": "MIT",
6
6
  "repository": {