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.
- package/.mock/definition/empathic-voice/__package__.yml +24 -0
- package/.mock/definition/empathic-voice/configs.yml +2 -0
- package/.mock/definition/tts/__package__.yml +28 -0
- package/.mock/fern.config.json +1 -1
- package/Client.d.ts +11 -7
- package/Client.js +54 -6
- package/api/resources/empathicVoice/errors/BadRequestError.d.ts +2 -1
- package/api/resources/empathicVoice/errors/BadRequestError.js +2 -1
- package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +7 -3
- package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +79 -52
- package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +5 -2
- package/api/resources/empathicVoice/resources/chats/client/Client.js +59 -39
- package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +17 -8
- package/api/resources/empathicVoice/resources/configs/client/Client.js +144 -83
- package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
- package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
- package/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +13 -6
- package/api/resources/empathicVoice/resources/customVoices/client/Client.js +95 -53
- package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +19 -9
- package/api/resources/empathicVoice/resources/prompts/client/Client.js +143 -81
- package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +17 -8
- package/api/resources/empathicVoice/resources/tools/client/Client.js +144 -83
- package/api/resources/empathicVoice/types/PostedNudgeSpec.d.ts +12 -0
- package/api/resources/empathicVoice/types/PostedNudgeSpec.js +5 -0
- package/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
- package/api/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +12 -0
- package/api/resources/empathicVoice/types/ReturnNudgeSpec.js +5 -0
- package/api/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +2 -1
- package/api/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
- package/api/resources/empathicVoice/types/index.d.ts +2 -0
- package/api/resources/empathicVoice/types/index.js +2 -0
- package/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +15 -7
- package/api/resources/expressionMeasurement/resources/batch/client/Client.js +96 -52
- package/api/resources/tts/client/Client.d.ts +27 -19
- package/api/resources/tts/client/Client.js +89 -50
- package/api/resources/tts/client/index.d.ts +1 -1
- package/api/resources/tts/client/index.js +15 -0
- package/api/resources/tts/client/requests/SynthesizeJsonRequest.d.ts +36 -0
- package/api/resources/tts/client/requests/SynthesizeJsonRequest.js +5 -0
- package/api/resources/tts/client/requests/index.d.ts +1 -0
- package/api/resources/tts/client/requests/index.js +2 -0
- package/api/resources/tts/errors/BadRequestError.d.ts +2 -1
- package/api/resources/tts/errors/BadRequestError.js +2 -1
- package/api/resources/tts/errors/UnprocessableEntityError.d.ts +2 -1
- package/api/resources/tts/errors/UnprocessableEntityError.js +2 -1
- package/api/resources/tts/resources/voices/client/Client.d.ts +7 -3
- package/api/resources/tts/resources/voices/client/Client.js +49 -29
- package/api/resources/tts/types/Snippet.d.ts +2 -0
- package/api/resources/tts/types/SnippetAudioChunk.d.ts +2 -0
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/Fetcher.d.ts +2 -1
- package/core/fetcher/Fetcher.js +29 -9
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/core/form-data-utils/FormDataWrapper.js +53 -13
- package/core/form-data-utils/toReadableStream.d.ts +1 -0
- package/core/form-data-utils/toReadableStream.js +50 -0
- package/core/headers.d.ts +3 -0
- package/core/headers.js +29 -0
- package/core/index.d.ts +4 -4
- package/core/index.js +5 -4
- package/core/pagination/Page.d.ts +5 -2
- package/core/pagination/Page.js +5 -2
- package/core/pagination/Pageable.d.ts +2 -0
- package/core/runtime/runtime.js +0 -1
- package/dist/Client.d.ts +11 -7
- package/dist/Client.js +54 -6
- package/dist/api/resources/empathicVoice/errors/BadRequestError.d.ts +2 -1
- package/dist/api/resources/empathicVoice/errors/BadRequestError.js +2 -1
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +7 -3
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +79 -52
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +5 -2
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +59 -39
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +17 -8
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +144 -83
- package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +13 -6
- package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.js +95 -53
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +19 -9
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +143 -81
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +17 -8
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +144 -83
- package/dist/api/resources/empathicVoice/types/PostedNudgeSpec.d.ts +12 -0
- package/dist/api/resources/empathicVoice/types/PostedNudgeSpec.js +5 -0
- package/dist/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +12 -0
- package/dist/api/resources/empathicVoice/types/ReturnNudgeSpec.js +5 -0
- package/dist/api/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +2 -1
- package/dist/api/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
- package/dist/api/resources/empathicVoice/types/index.d.ts +2 -0
- package/dist/api/resources/empathicVoice/types/index.js +2 -0
- package/dist/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +15 -7
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +96 -52
- package/dist/api/resources/tts/client/Client.d.ts +27 -19
- package/dist/api/resources/tts/client/Client.js +89 -50
- package/dist/api/resources/tts/client/index.d.ts +1 -1
- package/dist/api/resources/tts/client/index.js +15 -0
- package/dist/api/resources/tts/client/requests/SynthesizeJsonRequest.d.ts +36 -0
- package/dist/api/resources/tts/client/requests/SynthesizeJsonRequest.js +5 -0
- package/dist/api/resources/tts/client/requests/index.d.ts +1 -0
- package/dist/api/resources/tts/client/requests/index.js +2 -0
- package/dist/api/resources/tts/errors/BadRequestError.d.ts +2 -1
- package/dist/api/resources/tts/errors/BadRequestError.js +2 -1
- package/dist/api/resources/tts/errors/UnprocessableEntityError.d.ts +2 -1
- package/dist/api/resources/tts/errors/UnprocessableEntityError.js +2 -1
- package/dist/api/resources/tts/resources/voices/client/Client.d.ts +7 -3
- package/dist/api/resources/tts/resources/voices/client/Client.js +49 -29
- package/dist/api/resources/tts/types/Snippet.d.ts +2 -0
- package/dist/api/resources/tts/types/SnippetAudioChunk.d.ts +2 -0
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/Fetcher.d.ts +2 -1
- package/dist/core/fetcher/Fetcher.js +29 -9
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +53 -13
- package/dist/core/form-data-utils/toReadableStream.d.ts +1 -0
- package/dist/core/form-data-utils/toReadableStream.js +50 -0
- package/dist/core/headers.d.ts +3 -0
- package/dist/core/headers.js +29 -0
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +5 -4
- package/dist/core/pagination/Page.d.ts +5 -2
- package/dist/core/pagination/Page.js +5 -2
- package/dist/core/pagination/Pageable.d.ts +2 -0
- package/dist/core/runtime/runtime.js +0 -1
- package/dist/errors/HumeError.d.ts +7 -2
- package/dist/errors/HumeError.js +10 -10
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
- package/dist/serialization/resources/empathicVoice/types/PostedNudgeSpec.d.ts +13 -0
- package/dist/serialization/resources/empathicVoice/types/PostedNudgeSpec.js +44 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +13 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnNudgeSpec.js +44 -0
- package/dist/serialization/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +1 -1
- package/dist/serialization/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
- package/dist/serialization/resources/empathicVoice/types/index.d.ts +2 -0
- package/dist/serialization/resources/empathicVoice/types/index.js +2 -0
- package/dist/serialization/resources/tts/types/Snippet.d.ts +1 -0
- package/dist/serialization/resources/tts/types/Snippet.js +1 -0
- package/dist/serialization/resources/tts/types/SnippetAudioChunk.d.ts +1 -0
- package/dist/serialization/resources/tts/types/SnippetAudioChunk.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/expressionMeasurement/ExpressionMeasurementClient.js +2 -0
- package/dist/wrapper/expressionMeasurement/batch/BatchClient.d.ts +2 -1
- package/dist/wrapper/expressionMeasurement/batch/BatchClient.js +43 -17
- package/errors/HumeError.d.ts +7 -2
- package/errors/HumeError.js +10 -10
- package/package.json +9 -4
- package/reference.md +17 -15
- package/scripts/rename-to-esm-files.js +10 -2
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
- package/serialization/resources/empathicVoice/types/PostedNudgeSpec.d.ts +13 -0
- package/serialization/resources/empathicVoice/types/PostedNudgeSpec.js +44 -0
- package/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
- package/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
- package/serialization/resources/empathicVoice/types/ReturnNudgeSpec.d.ts +13 -0
- package/serialization/resources/empathicVoice/types/ReturnNudgeSpec.js +44 -0
- package/serialization/resources/empathicVoice/types/WebhookEventChatStatus.d.ts +1 -1
- package/serialization/resources/empathicVoice/types/WebhookEventChatStatus.js +1 -0
- package/serialization/resources/empathicVoice/types/index.d.ts +2 -0
- package/serialization/resources/empathicVoice/types/index.js +2 -0
- package/serialization/resources/tts/types/Snippet.d.ts +1 -0
- package/serialization/resources/tts/types/Snippet.js +1 -0
- package/serialization/resources/tts/types/SnippetAudioChunk.d.ts +1 -0
- package/serialization/resources/tts/types/SnippetAudioChunk.js +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/expressionMeasurement/ExpressionMeasurementClient.js +2 -0
- package/wrapper/expressionMeasurement/batch/BatchClient.d.ts +2 -1
- package/wrapper/expressionMeasurement/batch/BatchClient.js +43 -17
- /package/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
- /package/core/{streaming-fetcher → stream}/Stream.js +0 -0
- /package/core/{streaming-fetcher → stream}/index.d.ts +0 -0
- /package/core/{streaming-fetcher → stream}/index.js +0 -0
- /package/dist/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
- /package/dist/core/{streaming-fetcher → stream}/Stream.js +0 -0
- /package/dist/core/{streaming-fetcher → stream}/index.d.ts +0 -0
- /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):
|
|
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:
|
|
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
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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:
|
|
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:
|
|
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
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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:
|
|
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:
|
|
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
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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):
|
|
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
|
}>;
|