hume 0.11.1 → 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 (203) hide show
  1. package/.mock/definition/empathic-voice/__package__.yml +24 -0
  2. package/.mock/definition/empathic-voice/configs.yml +2 -0
  3. package/.mock/definition/tts/__package__.yml +28 -0
  4. package/.mock/fern.config.json +1 -1
  5. package/Client.d.ts +11 -7
  6. package/Client.js +54 -6
  7. package/api/resources/empathicVoice/errors/BadRequestError.d.ts +2 -1
  8. package/api/resources/empathicVoice/errors/BadRequestError.js +2 -1
  9. package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +7 -3
  10. package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +79 -52
  11. package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +5 -2
  12. package/api/resources/empathicVoice/resources/chats/client/Client.js +59 -39
  13. package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +17 -8
  14. package/api/resources/empathicVoice/resources/configs/client/Client.js +144 -83
  15. package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
  16. package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
  17. package/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +13 -6
  18. package/api/resources/empathicVoice/resources/customVoices/client/Client.js +95 -53
  19. package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +19 -9
  20. package/api/resources/empathicVoice/resources/prompts/client/Client.js +143 -81
  21. package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +17 -8
  22. package/api/resources/empathicVoice/resources/tools/client/Client.js +144 -83
  23. package/api/resources/empathicVoice/types/PostedNudgeSpec.d.ts +12 -0
  24. package/api/resources/empathicVoice/types/PostedNudgeSpec.js +5 -0
  25. package/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
  26. package/api/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +12 -0
  27. package/api/resources/empathicVoice/types/ReturnNudgeSpec.js +5 -0
  28. package/api/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +2 -1
  29. package/api/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  30. package/api/resources/empathicVoice/types/index.d.ts +2 -0
  31. package/api/resources/empathicVoice/types/index.js +2 -0
  32. package/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  33. package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +15 -7
  34. package/api/resources/expressionMeasurement/resources/batch/client/Client.js +96 -52
  35. package/api/resources/tts/client/Client.d.ts +27 -19
  36. package/api/resources/tts/client/Client.js +89 -50
  37. package/api/resources/tts/client/index.d.ts +1 -1
  38. package/api/resources/tts/client/index.js +15 -0
  39. package/api/resources/tts/client/requests/SynthesizeJsonRequest.d.ts +36 -0
  40. package/api/resources/tts/client/requests/SynthesizeJsonRequest.js +5 -0
  41. package/api/resources/tts/client/requests/index.d.ts +1 -0
  42. package/api/resources/tts/client/requests/index.js +2 -0
  43. package/api/resources/tts/errors/BadRequestError.d.ts +2 -1
  44. package/api/resources/tts/errors/BadRequestError.js +2 -1
  45. package/api/resources/tts/errors/UnprocessableEntityError.d.ts +2 -1
  46. package/api/resources/tts/errors/UnprocessableEntityError.js +2 -1
  47. package/api/resources/tts/resources/voices/client/Client.d.ts +7 -3
  48. package/api/resources/tts/resources/voices/client/Client.js +49 -29
  49. package/api/resources/tts/types/Snippet.d.ts +2 -0
  50. package/api/resources/tts/types/SnippetAudioChunk.d.ts +2 -0
  51. package/core/fetcher/APIResponse.d.ts +10 -0
  52. package/core/fetcher/Fetcher.d.ts +2 -1
  53. package/core/fetcher/Fetcher.js +29 -9
  54. package/core/fetcher/Headers.d.ts +2 -0
  55. package/core/fetcher/Headers.js +84 -0
  56. package/core/fetcher/HttpResponsePromise.d.ts +58 -0
  57. package/core/fetcher/HttpResponsePromise.js +103 -0
  58. package/core/fetcher/RawResponse.d.ts +29 -0
  59. package/core/fetcher/RawResponse.js +44 -0
  60. package/core/fetcher/index.d.ts +3 -0
  61. package/core/fetcher/index.js +7 -1
  62. package/core/form-data-utils/FormDataWrapper.d.ts +3 -0
  63. package/core/form-data-utils/FormDataWrapper.js +53 -13
  64. package/core/form-data-utils/toReadableStream.d.ts +1 -0
  65. package/core/form-data-utils/toReadableStream.js +50 -0
  66. package/core/headers.d.ts +3 -0
  67. package/core/headers.js +29 -0
  68. package/core/index.d.ts +4 -4
  69. package/core/index.js +5 -4
  70. package/core/pagination/Page.d.ts +5 -2
  71. package/core/pagination/Page.js +5 -2
  72. package/core/pagination/Pageable.d.ts +2 -0
  73. package/core/runtime/runtime.js +0 -1
  74. package/dist/Client.d.ts +11 -7
  75. package/dist/Client.js +54 -6
  76. package/dist/api/resources/empathicVoice/errors/BadRequestError.d.ts +2 -1
  77. package/dist/api/resources/empathicVoice/errors/BadRequestError.js +2 -1
  78. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +7 -3
  79. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +79 -52
  80. package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +5 -2
  81. package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +59 -39
  82. package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +17 -8
  83. package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +144 -83
  84. package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
  85. package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
  86. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +13 -6
  87. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.js +95 -53
  88. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +19 -9
  89. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +143 -81
  90. package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +17 -8
  91. package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +144 -83
  92. package/dist/api/resources/empathicVoice/types/PostedNudgeSpec.d.ts +12 -0
  93. package/dist/api/resources/empathicVoice/types/PostedNudgeSpec.js +5 -0
  94. package/dist/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
  95. package/dist/api/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +12 -0
  96. package/dist/api/resources/empathicVoice/types/ReturnNudgeSpec.js +5 -0
  97. package/dist/api/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +2 -1
  98. package/dist/api/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  99. package/dist/api/resources/empathicVoice/types/index.d.ts +2 -0
  100. package/dist/api/resources/empathicVoice/types/index.js +2 -0
  101. package/dist/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  102. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +15 -7
  103. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +96 -52
  104. package/dist/api/resources/tts/client/Client.d.ts +27 -19
  105. package/dist/api/resources/tts/client/Client.js +89 -50
  106. package/dist/api/resources/tts/client/index.d.ts +1 -1
  107. package/dist/api/resources/tts/client/index.js +15 -0
  108. package/dist/api/resources/tts/client/requests/SynthesizeJsonRequest.d.ts +36 -0
  109. package/dist/api/resources/tts/client/requests/SynthesizeJsonRequest.js +5 -0
  110. package/dist/api/resources/tts/client/requests/index.d.ts +1 -0
  111. package/dist/api/resources/tts/client/requests/index.js +2 -0
  112. package/dist/api/resources/tts/errors/BadRequestError.d.ts +2 -1
  113. package/dist/api/resources/tts/errors/BadRequestError.js +2 -1
  114. package/dist/api/resources/tts/errors/UnprocessableEntityError.d.ts +2 -1
  115. package/dist/api/resources/tts/errors/UnprocessableEntityError.js +2 -1
  116. package/dist/api/resources/tts/resources/voices/client/Client.d.ts +7 -3
  117. package/dist/api/resources/tts/resources/voices/client/Client.js +49 -29
  118. package/dist/api/resources/tts/types/Snippet.d.ts +2 -0
  119. package/dist/api/resources/tts/types/SnippetAudioChunk.d.ts +2 -0
  120. package/dist/core/fetcher/APIResponse.d.ts +10 -0
  121. package/dist/core/fetcher/Fetcher.d.ts +2 -1
  122. package/dist/core/fetcher/Fetcher.js +29 -9
  123. package/dist/core/fetcher/Headers.d.ts +2 -0
  124. package/dist/core/fetcher/Headers.js +84 -0
  125. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  126. package/dist/core/fetcher/HttpResponsePromise.js +103 -0
  127. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  128. package/dist/core/fetcher/RawResponse.js +44 -0
  129. package/dist/core/fetcher/index.d.ts +3 -0
  130. package/dist/core/fetcher/index.js +7 -1
  131. package/dist/core/form-data-utils/FormDataWrapper.d.ts +3 -0
  132. package/dist/core/form-data-utils/FormDataWrapper.js +53 -13
  133. package/dist/core/form-data-utils/toReadableStream.d.ts +1 -0
  134. package/dist/core/form-data-utils/toReadableStream.js +50 -0
  135. package/dist/core/headers.d.ts +3 -0
  136. package/dist/core/headers.js +29 -0
  137. package/dist/core/index.d.ts +4 -4
  138. package/dist/core/index.js +5 -4
  139. package/dist/core/pagination/Page.d.ts +5 -2
  140. package/dist/core/pagination/Page.js +5 -2
  141. package/dist/core/pagination/Pageable.d.ts +2 -0
  142. package/dist/core/runtime/runtime.js +0 -1
  143. package/dist/errors/HumeError.d.ts +7 -2
  144. package/dist/errors/HumeError.js +10 -10
  145. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
  146. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
  147. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
  148. package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
  149. package/dist/serialization/resources/empathicVoice/types/PostedNudgeSpec.d.ts +13 -0
  150. package/dist/serialization/resources/empathicVoice/types/PostedNudgeSpec.js +44 -0
  151. package/dist/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
  152. package/dist/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
  153. package/dist/serialization/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +13 -0
  154. package/dist/serialization/resources/empathicVoice/types/ReturnNudgeSpec.js +44 -0
  155. package/dist/serialization/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +1 -1
  156. package/dist/serialization/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  157. package/dist/serialization/resources/empathicVoice/types/index.d.ts +2 -0
  158. package/dist/serialization/resources/empathicVoice/types/index.js +2 -0
  159. package/dist/serialization/resources/tts/types/Snippet.d.ts +1 -0
  160. package/dist/serialization/resources/tts/types/Snippet.js +1 -0
  161. package/dist/serialization/resources/tts/types/SnippetAudioChunk.d.ts +1 -0
  162. package/dist/serialization/resources/tts/types/SnippetAudioChunk.js +1 -0
  163. package/dist/version.d.ts +1 -1
  164. package/dist/version.js +1 -1
  165. package/dist/wrapper/expressionMeasurement/ExpressionMeasurementClient.js +2 -0
  166. package/dist/wrapper/expressionMeasurement/batch/BatchClient.d.ts +2 -1
  167. package/dist/wrapper/expressionMeasurement/batch/BatchClient.js +43 -17
  168. package/errors/HumeError.d.ts +7 -2
  169. package/errors/HumeError.js +10 -10
  170. package/package.json +9 -4
  171. package/reference.md +17 -15
  172. package/scripts/rename-to-esm-files.js +10 -2
  173. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
  174. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
  175. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
  176. package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
  177. package/serialization/resources/empathicVoice/types/PostedNudgeSpec.d.ts +13 -0
  178. package/serialization/resources/empathicVoice/types/PostedNudgeSpec.js +44 -0
  179. package/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
  180. package/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
  181. package/serialization/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +13 -0
  182. package/serialization/resources/empathicVoice/types/ReturnNudgeSpec.js +44 -0
  183. package/serialization/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +1 -1
  184. package/serialization/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
  185. package/serialization/resources/empathicVoice/types/index.d.ts +2 -0
  186. package/serialization/resources/empathicVoice/types/index.js +2 -0
  187. package/serialization/resources/tts/types/Snippet.d.ts +1 -0
  188. package/serialization/resources/tts/types/Snippet.js +1 -0
  189. package/serialization/resources/tts/types/SnippetAudioChunk.d.ts +1 -0
  190. package/serialization/resources/tts/types/SnippetAudioChunk.js +1 -0
  191. package/version.d.ts +1 -1
  192. package/version.js +1 -1
  193. package/wrapper/expressionMeasurement/ExpressionMeasurementClient.js +2 -0
  194. package/wrapper/expressionMeasurement/batch/BatchClient.d.ts +2 -1
  195. package/wrapper/expressionMeasurement/batch/BatchClient.js +43 -17
  196. /package/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  197. /package/core/{streaming-fetcher → stream}/Stream.js +0 -0
  198. /package/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  199. /package/core/{streaming-fetcher → stream}/index.js +0 -0
  200. /package/dist/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  201. /package/dist/core/{streaming-fetcher → stream}/Stream.js +0 -0
  202. /package/dist/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  203. /package/dist/core/{streaming-fetcher → stream}/index.js +0 -0
@@ -10,6 +10,8 @@ export declare namespace Chats {
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 Chats {
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 Chats {
@@ -70,7 +72,8 @@ export declare class Chats {
70
72
  * @example
71
73
  * await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0")
72
74
  */
73
- getAudio(id: string, requestOptions?: Chats.RequestOptions): Promise<Hume.empathicVoice.ReturnChatAudioReconstruction>;
75
+ getAudio(id: string, requestOptions?: Chats.RequestOptions): core.HttpResponsePromise<Hume.empathicVoice.ReturnChatAudioReconstruction>;
76
+ private __getAudio;
74
77
  protected _getCustomAuthorizationHeaders(): Promise<{
75
78
  "X-Hume-Api-Key": string | undefined;
76
79
  }>;
@@ -52,6 +52,7 @@ exports.Chats = 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"));
@@ -76,8 +77,8 @@ class Chats {
76
77
  */
77
78
  listChats() {
78
79
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
79
- const list = (request) => __awaiter(this, void 0, void 0, function* () {
80
- var _a, _b, _c;
80
+ const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
81
+ var _a, _b, _c, _d;
81
82
  const { pageNumber, pageSize, ascendingOrder, configId } = request;
82
83
  const _queryParams = {};
83
84
  if (pageNumber != null) {
@@ -95,21 +96,22 @@ class Chats {
95
96
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
96
97
  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/chats"),
97
98
  method: "GET",
98
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "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),
99
- contentType: "application/json",
99
+ 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),
100
100
  queryParameters: _queryParams,
101
- requestType: "json",
102
101
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
103
102
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
104
103
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
105
104
  });
106
105
  if (_response.ok) {
107
- return serializers.empathicVoice.ReturnPagedChats.parseOrThrow(_response.body, {
108
- unrecognizedObjectKeys: "passthrough",
109
- allowUnrecognizedUnionMembers: true,
110
- allowUnrecognizedEnumValues: true,
111
- breadcrumbsPrefix: ["response"],
112
- });
106
+ return {
107
+ data: serializers.empathicVoice.ReturnPagedChats.parseOrThrow(_response.body, {
108
+ unrecognizedObjectKeys: "passthrough",
109
+ allowUnrecognizedUnionMembers: true,
110
+ allowUnrecognizedEnumValues: true,
111
+ breadcrumbsPrefix: ["response"],
112
+ }),
113
+ rawResponse: _response.rawResponse,
114
+ };
113
115
  }
114
116
  if (_response.error.reason === "status-code") {
115
117
  switch (_response.error.statusCode) {
@@ -119,11 +121,12 @@ class Chats {
119
121
  allowUnrecognizedUnionMembers: true,
120
122
  allowUnrecognizedEnumValues: true,
121
123
  breadcrumbsPrefix: ["response"],
122
- }));
124
+ }), _response.rawResponse);
123
125
  default:
124
126
  throw new errors.HumeError({
125
127
  statusCode: _response.error.statusCode,
126
128
  body: _response.error.body,
129
+ rawResponse: _response.rawResponse,
127
130
  });
128
131
  }
129
132
  }
@@ -132,18 +135,22 @@ class Chats {
132
135
  throw new errors.HumeError({
133
136
  statusCode: _response.error.statusCode,
134
137
  body: _response.error.rawBody,
138
+ rawResponse: _response.rawResponse,
135
139
  });
136
140
  case "timeout":
137
141
  throw new errors.HumeTimeoutError("Timeout exceeded when calling GET /v0/evi/chats.");
138
142
  case "unknown":
139
143
  throw new errors.HumeError({
140
144
  message: _response.error.errorMessage,
145
+ rawResponse: _response.rawResponse,
141
146
  });
142
147
  }
143
- });
148
+ }));
144
149
  let _offset = (request === null || request === void 0 ? void 0 : request.pageNumber) != null ? request === null || request === void 0 ? void 0 : request.pageNumber : 0;
150
+ const dataWithRawResponse = yield list(request).withRawResponse();
145
151
  return new core.Pageable({
146
- response: yield list(request),
152
+ response: dataWithRawResponse.data,
153
+ rawResponse: dataWithRawResponse.rawResponse,
147
154
  hasNextPage: (response) => { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.chatsPage) !== null && _a !== void 0 ? _a : []).length > 0; },
148
155
  getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.chatsPage) !== null && _a !== void 0 ? _a : []; },
149
156
  loadPage: (_response) => {
@@ -171,8 +178,8 @@ class Chats {
171
178
  */
172
179
  listChatEvents(id_1) {
173
180
  return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
174
- const list = (request) => __awaiter(this, void 0, void 0, function* () {
175
- var _a, _b, _c;
181
+ const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
182
+ var _a, _b, _c, _d;
176
183
  const { pageSize, pageNumber, ascendingOrder } = request;
177
184
  const _queryParams = {};
178
185
  if (pageSize != null) {
@@ -187,21 +194,22 @@ class Chats {
187
194
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
188
195
  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/chats/${encodeURIComponent(id)}`),
189
196
  method: "GET",
190
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "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),
191
- contentType: "application/json",
197
+ 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),
192
198
  queryParameters: _queryParams,
193
- requestType: "json",
194
199
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
195
200
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
196
201
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
197
202
  });
198
203
  if (_response.ok) {
199
- return serializers.empathicVoice.ReturnChatPagedEvents.parseOrThrow(_response.body, {
200
- unrecognizedObjectKeys: "passthrough",
201
- allowUnrecognizedUnionMembers: true,
202
- allowUnrecognizedEnumValues: true,
203
- breadcrumbsPrefix: ["response"],
204
- });
204
+ return {
205
+ data: serializers.empathicVoice.ReturnChatPagedEvents.parseOrThrow(_response.body, {
206
+ unrecognizedObjectKeys: "passthrough",
207
+ allowUnrecognizedUnionMembers: true,
208
+ allowUnrecognizedEnumValues: true,
209
+ breadcrumbsPrefix: ["response"],
210
+ }),
211
+ rawResponse: _response.rawResponse,
212
+ };
205
213
  }
206
214
  if (_response.error.reason === "status-code") {
207
215
  switch (_response.error.statusCode) {
@@ -211,11 +219,12 @@ class Chats {
211
219
  allowUnrecognizedUnionMembers: true,
212
220
  allowUnrecognizedEnumValues: true,
213
221
  breadcrumbsPrefix: ["response"],
214
- }));
222
+ }), _response.rawResponse);
215
223
  default:
216
224
  throw new errors.HumeError({
217
225
  statusCode: _response.error.statusCode,
218
226
  body: _response.error.body,
227
+ rawResponse: _response.rawResponse,
219
228
  });
220
229
  }
221
230
  }
@@ -224,18 +233,22 @@ class Chats {
224
233
  throw new errors.HumeError({
225
234
  statusCode: _response.error.statusCode,
226
235
  body: _response.error.rawBody,
236
+ rawResponse: _response.rawResponse,
227
237
  });
228
238
  case "timeout":
229
239
  throw new errors.HumeTimeoutError("Timeout exceeded when calling GET /v0/evi/chats/{id}.");
230
240
  case "unknown":
231
241
  throw new errors.HumeError({
232
242
  message: _response.error.errorMessage,
243
+ rawResponse: _response.rawResponse,
233
244
  });
234
245
  }
235
- });
246
+ }));
236
247
  let _offset = (request === null || request === void 0 ? void 0 : request.pageNumber) != null ? request === null || request === void 0 ? void 0 : request.pageNumber : 0;
248
+ const dataWithRawResponse = yield list(request).withRawResponse();
237
249
  return new core.Pageable({
238
- response: yield list(request),
250
+ response: dataWithRawResponse.data,
251
+ rawResponse: dataWithRawResponse.rawResponse,
239
252
  hasNextPage: (response) => { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.eventsPage) !== null && _a !== void 0 ? _a : []).length > 0; },
240
253
  getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.eventsPage) !== null && _a !== void 0 ? _a : []; },
241
254
  loadPage: (_response) => {
@@ -257,25 +270,29 @@ class Chats {
257
270
  * await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0")
258
271
  */
259
272
  getAudio(id, requestOptions) {
273
+ return core.HttpResponsePromise.fromPromise(this.__getAudio(id, requestOptions));
274
+ }
275
+ __getAudio(id, requestOptions) {
260
276
  return __awaiter(this, void 0, void 0, function* () {
261
- var _a, _b, _c;
277
+ var _a, _b, _c, _d;
262
278
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
263
279
  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/chats/${encodeURIComponent(id)}/audio`),
264
280
  method: "GET",
265
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.1", "User-Agent": "hume/0.11.1", "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),
266
- contentType: "application/json",
267
- requestType: "json",
281
+ 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),
268
282
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
269
283
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
270
284
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
271
285
  });
272
286
  if (_response.ok) {
273
- return serializers.empathicVoice.ReturnChatAudioReconstruction.parseOrThrow(_response.body, {
274
- unrecognizedObjectKeys: "passthrough",
275
- allowUnrecognizedUnionMembers: true,
276
- allowUnrecognizedEnumValues: true,
277
- breadcrumbsPrefix: ["response"],
278
- });
287
+ return {
288
+ data: serializers.empathicVoice.ReturnChatAudioReconstruction.parseOrThrow(_response.body, {
289
+ unrecognizedObjectKeys: "passthrough",
290
+ allowUnrecognizedUnionMembers: true,
291
+ allowUnrecognizedEnumValues: true,
292
+ breadcrumbsPrefix: ["response"],
293
+ }),
294
+ rawResponse: _response.rawResponse,
295
+ };
279
296
  }
280
297
  if (_response.error.reason === "status-code") {
281
298
  switch (_response.error.statusCode) {
@@ -285,11 +302,12 @@ class Chats {
285
302
  allowUnrecognizedUnionMembers: true,
286
303
  allowUnrecognizedEnumValues: true,
287
304
  breadcrumbsPrefix: ["response"],
288
- }));
305
+ }), _response.rawResponse);
289
306
  default:
290
307
  throw new errors.HumeError({
291
308
  statusCode: _response.error.statusCode,
292
309
  body: _response.error.body,
310
+ rawResponse: _response.rawResponse,
293
311
  });
294
312
  }
295
313
  }
@@ -298,12 +316,14 @@ class Chats {
298
316
  throw new errors.HumeError({
299
317
  statusCode: _response.error.statusCode,
300
318
  body: _response.error.rawBody,
319
+ rawResponse: _response.rawResponse,
301
320
  });
302
321
  case "timeout":
303
322
  throw new errors.HumeTimeoutError("Timeout exceeded when calling GET /v0/evi/chats/{id}/audio.");
304
323
  case "unknown":
305
324
  throw new errors.HumeError({
306
325
  message: _response.error.errorMessage,
326
+ rawResponse: _response.rawResponse,
307
327
  });
308
328
  }
309
329
  });
@@ -10,6 +10,8 @@ export declare namespace Configs {
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 Configs {
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 Configs {
@@ -86,7 +88,8 @@ export declare class Configs {
86
88
  * }
87
89
  * })
88
90
  */
89
- createConfig(request: Hume.empathicVoice.PostedConfig, requestOptions?: Configs.RequestOptions): Promise<Hume.empathicVoice.ReturnConfig>;
91
+ createConfig(request: Hume.empathicVoice.PostedConfig, requestOptions?: Configs.RequestOptions): core.HttpResponsePromise<Hume.empathicVoice.ReturnConfig>;
92
+ private __createConfig;
90
93
  /**
91
94
  * Fetches a list of a **Config's** versions.
92
95
  *
@@ -149,7 +152,8 @@ export declare class Configs {
149
152
  * }
150
153
  * })
151
154
  */
152
- createConfigVersion(id: string, request: Hume.empathicVoice.PostedConfigVersion, requestOptions?: Configs.RequestOptions): Promise<Hume.empathicVoice.ReturnConfig>;
155
+ createConfigVersion(id: string, request: Hume.empathicVoice.PostedConfigVersion, requestOptions?: Configs.RequestOptions): core.HttpResponsePromise<Hume.empathicVoice.ReturnConfig>;
156
+ private __createConfigVersion;
153
157
  /**
154
158
  * Deletes a **Config** and its versions.
155
159
  *
@@ -163,7 +167,8 @@ export declare class Configs {
163
167
  * @example
164
168
  * await client.empathicVoice.configs.deleteConfig("1b60e1a0-cc59-424a-8d2c-189d354db3f3")
165
169
  */
166
- deleteConfig(id: string, requestOptions?: Configs.RequestOptions): Promise<void>;
170
+ deleteConfig(id: string, requestOptions?: Configs.RequestOptions): core.HttpResponsePromise<void>;
171
+ private __deleteConfig;
167
172
  /**
168
173
  * Updates the name of a **Config**.
169
174
  *
@@ -180,7 +185,8 @@ export declare class Configs {
180
185
  * name: "Updated Weather Assistant Config Name"
181
186
  * })
182
187
  */
183
- updateConfigName(id: string, request: Hume.empathicVoice.PostedConfigName, requestOptions?: Configs.RequestOptions): Promise<string>;
188
+ updateConfigName(id: string, request: Hume.empathicVoice.PostedConfigName, requestOptions?: Configs.RequestOptions): core.HttpResponsePromise<string>;
189
+ private __updateConfigName;
184
190
  /**
185
191
  * Fetches a specified version of a **Config**.
186
192
  *
@@ -199,7 +205,8 @@ export declare class Configs {
199
205
  * @example
200
206
  * await client.empathicVoice.configs.getConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1)
201
207
  */
202
- getConfigVersion(id: string, version: number, requestOptions?: Configs.RequestOptions): Promise<Hume.empathicVoice.ReturnConfig>;
208
+ getConfigVersion(id: string, version: number, requestOptions?: Configs.RequestOptions): core.HttpResponsePromise<Hume.empathicVoice.ReturnConfig>;
209
+ private __getConfigVersion;
203
210
  /**
204
211
  * Deletes a specified version of a **Config**.
205
212
  *
@@ -218,7 +225,8 @@ export declare class Configs {
218
225
  * @example
219
226
  * await client.empathicVoice.configs.deleteConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1)
220
227
  */
221
- deleteConfigVersion(id: string, version: number, requestOptions?: Configs.RequestOptions): Promise<void>;
228
+ deleteConfigVersion(id: string, version: number, requestOptions?: Configs.RequestOptions): core.HttpResponsePromise<void>;
229
+ private __deleteConfigVersion;
222
230
  /**
223
231
  * Updates the description of a **Config**.
224
232
  *
@@ -240,7 +248,8 @@ export declare class Configs {
240
248
  * versionDescription: "This is an updated version_description."
241
249
  * })
242
250
  */
243
- updateConfigDescription(id: string, version: number, request?: Hume.empathicVoice.PostedConfigVersionDescription, requestOptions?: Configs.RequestOptions): Promise<Hume.empathicVoice.ReturnConfig>;
251
+ updateConfigDescription(id: string, version: number, request?: Hume.empathicVoice.PostedConfigVersionDescription, requestOptions?: Configs.RequestOptions): core.HttpResponsePromise<Hume.empathicVoice.ReturnConfig>;
252
+ private __updateConfigDescription;
244
253
  protected _getCustomAuthorizationHeaders(): Promise<{
245
254
  "X-Hume-Api-Key": string | undefined;
246
255
  }>;