hume 0.11.2 → 0.11.3

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.
Files changed (72) hide show
  1. package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -1
  2. package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +9 -16
  3. package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -1
  4. package/api/resources/empathicVoice/resources/chats/client/Client.js +7 -12
  5. package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -1
  6. package/api/resources/empathicVoice/resources/configs/client/Client.js +19 -28
  7. package/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +3 -1
  8. package/api/resources/empathicVoice/resources/customVoices/client/Client.js +13 -18
  9. package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -1
  10. package/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -28
  11. package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -1
  12. package/api/resources/empathicVoice/resources/tools/client/Client.js +19 -28
  13. package/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  14. package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -1
  15. package/api/resources/expressionMeasurement/resources/batch/client/Client.js +13 -20
  16. package/api/resources/tts/client/Client.d.ts +3 -1
  17. package/api/resources/tts/client/Client.js +9 -8
  18. package/api/resources/tts/resources/voices/client/Client.d.ts +3 -1
  19. package/api/resources/tts/resources/voices/client/Client.js +7 -10
  20. package/core/fetcher/Fetcher.d.ts +2 -1
  21. package/core/fetcher/Fetcher.js +22 -9
  22. package/core/form-data-utils/FormDataWrapper.js +5 -4
  23. package/core/form-data-utils/toReadableStream.d.ts +1 -0
  24. package/core/form-data-utils/toReadableStream.js +50 -0
  25. package/core/headers.d.ts +3 -0
  26. package/core/headers.js +29 -0
  27. package/core/index.d.ts +4 -4
  28. package/core/index.js +5 -4
  29. package/core/runtime/runtime.js +0 -1
  30. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -1
  31. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +9 -16
  32. package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -1
  33. package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +7 -12
  34. package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -1
  35. package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +19 -28
  36. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +3 -1
  37. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.js +13 -18
  38. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -1
  39. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -28
  40. package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -1
  41. package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +19 -28
  42. package/dist/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  43. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -1
  44. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +13 -20
  45. package/dist/api/resources/tts/client/Client.d.ts +3 -1
  46. package/dist/api/resources/tts/client/Client.js +9 -8
  47. package/dist/api/resources/tts/resources/voices/client/Client.d.ts +3 -1
  48. package/dist/api/resources/tts/resources/voices/client/Client.js +7 -10
  49. package/dist/core/fetcher/Fetcher.d.ts +2 -1
  50. package/dist/core/fetcher/Fetcher.js +22 -9
  51. package/dist/core/form-data-utils/FormDataWrapper.js +5 -4
  52. package/dist/core/form-data-utils/toReadableStream.d.ts +1 -0
  53. package/dist/core/form-data-utils/toReadableStream.js +50 -0
  54. package/dist/core/headers.d.ts +3 -0
  55. package/dist/core/headers.js +29 -0
  56. package/dist/core/index.d.ts +4 -4
  57. package/dist/core/index.js +5 -4
  58. package/dist/core/runtime/runtime.js +0 -1
  59. package/dist/version.d.ts +1 -1
  60. package/dist/version.js +1 -1
  61. package/package.json +7 -3
  62. package/scripts/rename-to-esm-files.js +10 -2
  63. package/version.d.ts +1 -1
  64. package/version.js +1 -1
  65. /package/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  66. /package/core/{streaming-fetcher → stream}/Stream.js +0 -0
  67. /package/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  68. /package/core/{streaming-fetcher → stream}/index.js +0 -0
  69. /package/dist/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  70. /package/dist/core/{streaming-fetcher → stream}/Stream.js +0 -0
  71. /package/dist/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  72. /package/dist/core/{streaming-fetcher → stream}/index.js +0 -0
@@ -52,6 +52,7 @@ exports.Prompts = void 0;
52
52
  const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
54
  const Hume = __importStar(require("../../../../../index"));
55
+ const headers_js_1 = require("../../../../../../core/headers.js");
55
56
  const url_join_1 = __importDefault(require("url-join"));
56
57
  const serializers = __importStar(require("../../../../../../serialization/index"));
57
58
  const errors = __importStar(require("../../../../../../errors/index"));
@@ -78,7 +79,7 @@ class Prompts {
78
79
  listPrompts() {
79
80
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
80
81
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
81
- var _a, _b, _c;
82
+ var _a, _b, _c, _d;
82
83
  const { pageNumber, pageSize, restrictToMostRecent, name } = request;
83
84
  const _queryParams = {};
84
85
  if (pageNumber != null) {
@@ -96,10 +97,8 @@ class Prompts {
96
97
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
97
98
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/evi/prompts"),
98
99
  method: "GET",
99
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
100
- contentType: "application/json",
100
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
101
101
  queryParameters: _queryParams,
102
- requestType: "json",
103
102
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
104
103
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
105
104
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -183,11 +182,11 @@ class Prompts {
183
182
  }
184
183
  __createPrompt(request, requestOptions) {
185
184
  return __awaiter(this, void 0, void 0, function* () {
186
- var _a, _b, _c;
185
+ var _a, _b, _c, _d;
187
186
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
188
187
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/evi/prompts"),
189
188
  method: "POST",
190
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
189
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
191
190
  contentType: "application/json",
192
191
  requestType: "json",
193
192
  body: serializers.empathicVoice.PostedPrompt.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -259,7 +258,7 @@ class Prompts {
259
258
  }
260
259
  __listPromptVersions(id_1) {
261
260
  return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
262
- var _a, _b, _c;
261
+ var _a, _b, _c, _d;
263
262
  const { pageNumber, pageSize, restrictToMostRecent } = request;
264
263
  const _queryParams = {};
265
264
  if (pageNumber != null) {
@@ -274,10 +273,8 @@ class Prompts {
274
273
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
275
274
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/prompts/${encodeURIComponent(id)}`),
276
275
  method: "GET",
277
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
278
- contentType: "application/json",
276
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
279
277
  queryParameters: _queryParams,
280
- requestType: "json",
281
278
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
282
279
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
283
280
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -349,11 +346,11 @@ class Prompts {
349
346
  }
350
347
  __createPromptVersion(id, request, requestOptions) {
351
348
  return __awaiter(this, void 0, void 0, function* () {
352
- var _a, _b, _c;
349
+ var _a, _b, _c, _d;
353
350
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
354
351
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/prompts/${encodeURIComponent(id)}`),
355
352
  method: "POST",
356
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
353
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
357
354
  contentType: "application/json",
358
355
  requestType: "json",
359
356
  body: serializers.empathicVoice.PostedPromptVersion.jsonOrThrow(request, {
@@ -426,13 +423,11 @@ class Prompts {
426
423
  }
427
424
  __deletePrompt(id, requestOptions) {
428
425
  return __awaiter(this, void 0, void 0, function* () {
429
- var _a, _b, _c;
426
+ var _a, _b, _c, _d;
430
427
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
431
428
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/prompts/${encodeURIComponent(id)}`),
432
429
  method: "DELETE",
433
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
434
- contentType: "application/json",
435
- requestType: "json",
430
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
436
431
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
437
432
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
438
433
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -495,11 +490,11 @@ class Prompts {
495
490
  }
496
491
  __updatePromptName(id, request, requestOptions) {
497
492
  return __awaiter(this, void 0, void 0, function* () {
498
- var _a, _b, _c;
493
+ var _a, _b, _c, _d;
499
494
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
500
495
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/prompts/${encodeURIComponent(id)}`),
501
496
  method: "PATCH",
502
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
497
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
503
498
  contentType: "application/json",
504
499
  requestType: "json",
505
500
  body: serializers.empathicVoice.PostedPromptName.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -568,13 +563,11 @@ class Prompts {
568
563
  }
569
564
  __getPromptVersion(id, version, requestOptions) {
570
565
  return __awaiter(this, void 0, void 0, function* () {
571
- var _a, _b, _c;
566
+ var _a, _b, _c, _d;
572
567
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
573
568
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/prompts/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
574
569
  method: "GET",
575
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
576
- contentType: "application/json",
577
- requestType: "json",
570
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
578
571
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
579
572
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
580
573
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -647,13 +640,11 @@ class Prompts {
647
640
  }
648
641
  __deletePromptVersion(id, version, requestOptions) {
649
642
  return __awaiter(this, void 0, void 0, function* () {
650
- var _a, _b, _c;
643
+ var _a, _b, _c, _d;
651
644
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
652
645
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/prompts/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
653
646
  method: "DELETE",
654
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
655
- contentType: "application/json",
656
- requestType: "json",
647
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
657
648
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
658
649
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
659
650
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -721,11 +712,11 @@ class Prompts {
721
712
  }
722
713
  __updatePromptDescription(id_1, version_1) {
723
714
  return __awaiter(this, arguments, void 0, function* (id, version, request = {}, requestOptions) {
724
- var _a, _b, _c;
715
+ var _a, _b, _c, _d;
725
716
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
726
717
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/prompts/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
727
718
  method: "PATCH",
728
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
719
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
729
720
  contentType: "application/json",
730
721
  requestType: "json",
731
722
  body: serializers.empathicVoice.PostedPromptVersionDescription.jsonOrThrow(request, {
@@ -10,6 +10,8 @@ export declare namespace Tools {
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<string | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
13
15
  fetcher?: core.FetchFunction;
14
16
  }
15
17
  interface RequestOptions {
@@ -20,7 +22,7 @@ export declare namespace Tools {
20
22
  /** A hook to abort the request. */
21
23
  abortSignal?: AbortSignal;
22
24
  /** Additional headers to include in the request. */
23
- headers?: Record<string, string>;
25
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
24
26
  }
25
27
  }
26
28
  export declare class Tools {
@@ -52,6 +52,7 @@ exports.Tools = void 0;
52
52
  const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
54
  const Hume = __importStar(require("../../../../../index"));
55
+ const headers_js_1 = require("../../../../../../core/headers.js");
55
56
  const url_join_1 = __importDefault(require("url-join"));
56
57
  const serializers = __importStar(require("../../../../../../serialization/index"));
57
58
  const errors = __importStar(require("../../../../../../errors/index"));
@@ -78,7 +79,7 @@ class Tools {
78
79
  listTools() {
79
80
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
80
81
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
81
- var _a, _b, _c;
82
+ var _a, _b, _c, _d;
82
83
  const { pageNumber, pageSize, restrictToMostRecent, name } = request;
83
84
  const _queryParams = {};
84
85
  if (pageNumber != null) {
@@ -96,10 +97,8 @@ class Tools {
96
97
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
97
98
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/evi/tools"),
98
99
  method: "GET",
99
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
100
- contentType: "application/json",
100
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
101
101
  queryParameters: _queryParams,
102
- requestType: "json",
103
102
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
104
103
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
105
104
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -186,11 +185,11 @@ class Tools {
186
185
  }
187
186
  __createTool(request, requestOptions) {
188
187
  return __awaiter(this, void 0, void 0, function* () {
189
- var _a, _b, _c;
188
+ var _a, _b, _c, _d;
190
189
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
191
190
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/evi/tools"),
192
191
  method: "POST",
193
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
192
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
194
193
  contentType: "application/json",
195
194
  requestType: "json",
196
195
  body: serializers.empathicVoice.PostedUserDefinedTool.jsonOrThrow(request, {
@@ -262,7 +261,7 @@ class Tools {
262
261
  listToolVersions(id_1) {
263
262
  return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
264
263
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
265
- var _a, _b, _c;
264
+ var _a, _b, _c, _d;
266
265
  const { pageNumber, pageSize, restrictToMostRecent } = request;
267
266
  const _queryParams = {};
268
267
  if (pageNumber != null) {
@@ -277,10 +276,8 @@ class Tools {
277
276
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
278
277
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
279
278
  method: "GET",
280
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
281
- contentType: "application/json",
279
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
282
280
  queryParameters: _queryParams,
283
- requestType: "json",
284
281
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
285
282
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
286
283
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -367,11 +364,11 @@ class Tools {
367
364
  }
368
365
  __createToolVersion(id, request, requestOptions) {
369
366
  return __awaiter(this, void 0, void 0, function* () {
370
- var _a, _b, _c;
367
+ var _a, _b, _c, _d;
371
368
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
372
369
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
373
370
  method: "POST",
374
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
371
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
375
372
  contentType: "application/json",
376
373
  requestType: "json",
377
374
  body: serializers.empathicVoice.PostedUserDefinedToolVersion.jsonOrThrow(request, {
@@ -444,13 +441,11 @@ class Tools {
444
441
  }
445
442
  __deleteTool(id, requestOptions) {
446
443
  return __awaiter(this, void 0, void 0, function* () {
447
- var _a, _b, _c;
444
+ var _a, _b, _c, _d;
448
445
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
449
446
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
450
447
  method: "DELETE",
451
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
452
- contentType: "application/json",
453
- requestType: "json",
448
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
454
449
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
455
450
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
456
451
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -513,11 +508,11 @@ class Tools {
513
508
  }
514
509
  __updateToolName(id, request, requestOptions) {
515
510
  return __awaiter(this, void 0, void 0, function* () {
516
- var _a, _b, _c;
511
+ var _a, _b, _c, _d;
517
512
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
518
513
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
519
514
  method: "PATCH",
520
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
515
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
521
516
  contentType: "application/json",
522
517
  requestType: "json",
523
518
  body: serializers.empathicVoice.PostedUserDefinedToolName.jsonOrThrow(request, {
@@ -588,13 +583,11 @@ class Tools {
588
583
  }
589
584
  __getToolVersion(id, version, requestOptions) {
590
585
  return __awaiter(this, void 0, void 0, function* () {
591
- var _a, _b, _c;
586
+ var _a, _b, _c, _d;
592
587
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
593
588
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
594
589
  method: "GET",
595
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
596
- contentType: "application/json",
597
- requestType: "json",
590
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
598
591
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
599
592
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
600
593
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -667,13 +660,11 @@ class Tools {
667
660
  }
668
661
  __deleteToolVersion(id, version, requestOptions) {
669
662
  return __awaiter(this, void 0, void 0, function* () {
670
- var _a, _b, _c;
663
+ var _a, _b, _c, _d;
671
664
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
672
665
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
673
666
  method: "DELETE",
674
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
675
- contentType: "application/json",
676
- requestType: "json",
667
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
677
668
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
678
669
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
679
670
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -741,11 +732,11 @@ class Tools {
741
732
  }
742
733
  __updateToolDescription(id_1, version_1) {
743
734
  return __awaiter(this, arguments, void 0, function* (id, version, request = {}, requestOptions) {
744
- var _a, _b, _c;
735
+ var _a, _b, _c, _d;
745
736
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
746
737
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
747
738
  method: "PATCH",
748
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
739
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
749
740
  contentType: "application/json",
750
741
  requestType: "json",
751
742
  body: serializers.empathicVoice.PostedUserDefinedToolVersionDescription.jsonOrThrow(request, {
@@ -10,6 +10,8 @@ export declare namespace ExpressionMeasurement {
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<string | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
13
15
  fetcher?: core.FetchFunction;
14
16
  }
15
17
  }
@@ -13,6 +13,8 @@ export declare namespace Batch {
13
13
  /** Specify a custom URL to connect the client to. */
14
14
  baseUrl?: core.Supplier<string>;
15
15
  apiKey?: core.Supplier<string | undefined>;
16
+ /** Additional headers to include in requests. */
17
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
16
18
  fetcher?: core.FetchFunction;
17
19
  }
18
20
  interface RequestOptions {
@@ -23,7 +25,7 @@ export declare namespace Batch {
23
25
  /** A hook to abort the request. */
24
26
  abortSignal?: AbortSignal;
25
27
  /** Additional headers to include in the request. */
26
- headers?: Record<string, string>;
28
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
29
  }
28
30
  }
29
31
  export declare class Batch {
@@ -52,6 +52,7 @@ exports.Batch = void 0;
52
52
  const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
54
  const serializers = __importStar(require("../../../../../../serialization/index"));
55
+ const headers_js_1 = require("../../../../../../core/headers.js");
55
56
  const url_join_1 = __importDefault(require("url-join"));
56
57
  const errors = __importStar(require("../../../../../../errors/index"));
57
58
  const json_1 = require("../../../../../../core/json");
@@ -73,7 +74,7 @@ class Batch {
73
74
  }
74
75
  __listJobs() {
75
76
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
76
- var _a, _b, _c;
77
+ var _a, _b, _c, _d;
77
78
  const { limit, status, when, timestampMs, sortBy, direction } = request;
78
79
  const _queryParams = {};
79
80
  if (limit != null) {
@@ -112,10 +113,8 @@ class Batch {
112
113
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
113
114
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
114
115
  method: "GET",
115
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
116
- contentType: "application/json",
116
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
117
117
  queryParameters: _queryParams,
118
- requestType: "json",
119
118
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
120
119
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
121
120
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -172,11 +171,11 @@ class Batch {
172
171
  }
173
172
  __startInferenceJob(request, requestOptions) {
174
173
  return __awaiter(this, void 0, void 0, function* () {
175
- var _a, _b, _c;
174
+ var _a, _b, _c, _d;
176
175
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
177
176
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
178
177
  method: "POST",
179
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
178
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
180
179
  contentType: "application/json",
181
180
  requestType: "json",
182
181
  body: serializers.expressionMeasurement.batch.InferenceBaseRequest.jsonOrThrow(request, {
@@ -235,13 +234,11 @@ class Batch {
235
234
  }
236
235
  __getJobDetails(id, requestOptions) {
237
236
  return __awaiter(this, void 0, void 0, function* () {
238
- var _a, _b, _c;
237
+ var _a, _b, _c, _d;
239
238
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
240
239
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}`),
241
240
  method: "GET",
242
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
243
- contentType: "application/json",
244
- requestType: "json",
241
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
245
242
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
246
243
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
247
244
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -295,13 +292,11 @@ class Batch {
295
292
  }
296
293
  __getJobPredictions(id, requestOptions) {
297
294
  return __awaiter(this, void 0, void 0, function* () {
298
- var _a, _b, _c;
295
+ var _a, _b, _c, _d;
299
296
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
300
297
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/predictions`),
301
298
  method: "GET",
302
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
303
- contentType: "application/json",
304
- requestType: "json",
299
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
305
300
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
306
301
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
307
302
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -349,13 +344,11 @@ class Batch {
349
344
  }
350
345
  __getJobArtifacts(id, requestOptions) {
351
346
  return __awaiter(this, void 0, void 0, function* () {
352
- var _a, _b, _c;
347
+ var _a, _b, _c, _d;
353
348
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
354
349
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/artifacts`),
355
350
  method: "GET",
356
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
357
- contentType: "application/json",
358
- requestType: "json",
351
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
359
352
  responseType: "streaming",
360
353
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
361
354
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -403,7 +396,7 @@ class Batch {
403
396
  }
404
397
  __startInferenceJobFromLocalFile(file, request, requestOptions) {
405
398
  return __awaiter(this, void 0, void 0, function* () {
406
- var _a, _b, _c;
399
+ var _a, _b, _c, _d;
407
400
  const _request = yield core.newFormData();
408
401
  if (request.json != null) {
409
402
  _request.append("json", (0, json_1.toJson)(serializers.expressionMeasurement.batch.InferenceBaseRequest.jsonOrThrow(request.json, {
@@ -417,7 +410,7 @@ class Batch {
417
410
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
418
411
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
419
412
  method: "POST",
420
- headers: Object.assign(Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
413
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign(Object.assign({}, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
421
414
  requestType: "file",
422
415
  duplex: _maybeEncodedRequest.duplex,
423
416
  body: _maybeEncodedRequest.body,
@@ -12,6 +12,8 @@ export declare namespace Tts {
12
12
  /** Specify a custom URL to connect the client to. */
13
13
  baseUrl?: core.Supplier<string>;
14
14
  apiKey?: core.Supplier<string | undefined>;
15
+ /** Additional headers to include in requests. */
16
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
17
  fetcher?: core.FetchFunction;
16
18
  }
17
19
  interface RequestOptions {
@@ -22,7 +24,7 @@ export declare namespace Tts {
22
24
  /** A hook to abort the request. */
23
25
  abortSignal?: AbortSignal;
24
26
  /** Additional headers to include in the request. */
25
- headers?: Record<string, string>;
27
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
26
28
  }
27
29
  }
28
30
  export declare class Tts {
@@ -52,6 +52,7 @@ exports.Tts = void 0;
52
52
  const environments = __importStar(require("../../../../environments"));
53
53
  const core = __importStar(require("../../../../core"));
54
54
  const Hume = __importStar(require("../../../index"));
55
+ const headers_js_1 = require("../../../../core/headers.js");
55
56
  const serializers = __importStar(require("../../../../serialization/index"));
56
57
  const url_join_1 = __importDefault(require("url-join"));
57
58
  const errors = __importStar(require("../../../../errors/index"));
@@ -99,7 +100,7 @@ class Tts {
99
100
  }
100
101
  __synthesizeJson(request, requestOptions) {
101
102
  return __awaiter(this, void 0, void 0, function* () {
102
- var _a, _b, _c;
103
+ var _a, _b, _c, _d;
103
104
  const { accessToken, body: _body } = request;
104
105
  const _queryParams = {};
105
106
  if (accessToken != null) {
@@ -108,7 +109,7 @@ class Tts {
108
109
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
109
110
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts"),
110
111
  method: "POST",
111
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
112
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
112
113
  contentType: "application/json",
113
114
  queryParameters: _queryParams,
114
115
  requestType: "json",
@@ -173,11 +174,11 @@ class Tts {
173
174
  }
174
175
  __synthesizeFile(request, requestOptions) {
175
176
  return __awaiter(this, void 0, void 0, function* () {
176
- var _a, _b, _c;
177
+ var _a, _b, _c, _d;
177
178
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
178
179
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/file"),
179
180
  method: "POST",
180
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
181
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
181
182
  contentType: "application/json",
182
183
  requestType: "json",
183
184
  body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -232,11 +233,11 @@ class Tts {
232
233
  }
233
234
  __synthesizeFileStreaming(request, requestOptions) {
234
235
  return __awaiter(this, void 0, void 0, function* () {
235
- var _a, _b, _c;
236
+ var _a, _b, _c, _d;
236
237
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
237
238
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/stream/file"),
238
239
  method: "POST",
239
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
240
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
240
241
  contentType: "application/json",
241
242
  requestType: "json",
242
243
  body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -292,11 +293,11 @@ class Tts {
292
293
  }
293
294
  __synthesizeJsonStreaming(request, requestOptions) {
294
295
  return __awaiter(this, void 0, void 0, function* () {
295
- var _a, _b, _c;
296
+ var _a, _b, _c, _d;
296
297
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
297
298
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/stream/json"),
298
299
  method: "POST",
299
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
300
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
300
301
  contentType: "application/json",
301
302
  requestType: "json",
302
303
  body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),