phonic 0.30.2 → 0.30.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -771
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/agents/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/agents/client/Client.js +27 -21
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +2 -4
- package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteRequest.d.ts +1 -3
- package/dist/cjs/api/resources/agents/client/requests/AgentsGetRequest.d.ts +1 -3
- package/dist/cjs/api/resources/agents/client/requests/AgentsListRequest.d.ts +1 -3
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -4
- package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +2 -4
- package/dist/cjs/api/resources/conversations/client/requests/ConversationsListRequest.d.ts +9 -27
- package/dist/cjs/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.ts +5 -15
- package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -1
- package/dist/cjs/api/resources/extractionSchemas/client/Client.js +20 -15
- package/dist/cjs/api/resources/extractionSchemas/client/requests/CreateExtractionSchemaRequest.d.ts +1 -3
- package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasDeleteRequest.d.ts +1 -3
- package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasGetRequest.d.ts +1 -3
- package/dist/cjs/api/resources/extractionSchemas/client/requests/ExtractionSchemasListRequest.d.ts +1 -3
- package/dist/cjs/api/resources/extractionSchemas/client/requests/UpdateExtractionSchemaRequest.d.ts +1 -3
- package/dist/cjs/api/resources/projects/client/Client.js +28 -21
- package/dist/cjs/api/resources/tools/client/Client.d.ts +10 -0
- package/dist/cjs/api/resources/tools/client/Client.js +30 -15
- package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +15 -4
- package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.js +1 -0
- package/dist/cjs/api/resources/tools/client/requests/ToolsDeleteRequest.d.ts +1 -3
- package/dist/cjs/api/resources/tools/client/requests/ToolsGetRequest.d.ts +6 -3
- package/dist/cjs/api/resources/tools/client/requests/ToolsListRequest.d.ts +1 -3
- package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +5 -4
- package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.js +1 -0
- package/dist/cjs/api/resources/voices/client/Client.js +8 -6
- package/dist/cjs/api/resources/voices/client/requests/VoicesListRequest.d.ts +1 -3
- package/dist/cjs/api/types/Conversation.d.ts +2 -0
- package/dist/cjs/api/types/ConversationItem.d.ts +0 -2
- package/dist/cjs/api/types/IsUserSpeakingPayload.d.ts +8 -0
- package/dist/cjs/api/types/IsUserSpeakingPayload.js +5 -0
- package/dist/cjs/api/types/OutboundCallConfig.d.ts +1 -1
- package/dist/cjs/api/types/Tool.d.ts +4 -1
- package/dist/cjs/api/types/Tool.js +1 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +4 -0
- package/dist/cjs/core/auth/AuthProvider.js +2 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/index.d.ts +2 -0
- package/dist/cjs/core/fetcher/Fetcher.js +2 -2
- package/dist/cjs/core/fetcher/index.d.ts +5 -5
- package/dist/cjs/core/fetcher/index.js +5 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/agents/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/agents/client/Client.mjs +27 -21
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +2 -4
- package/dist/esm/api/resources/agents/client/requests/AgentsDeleteRequest.d.mts +1 -3
- package/dist/esm/api/resources/agents/client/requests/AgentsGetRequest.d.mts +1 -3
- package/dist/esm/api/resources/agents/client/requests/AgentsListRequest.d.mts +1 -3
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -4
- package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +2 -4
- package/dist/esm/api/resources/conversations/client/requests/ConversationsListRequest.d.mts +9 -27
- package/dist/esm/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.mts +5 -15
- package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -1
- package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +20 -15
- package/dist/esm/api/resources/extractionSchemas/client/requests/CreateExtractionSchemaRequest.d.mts +1 -3
- package/dist/esm/api/resources/extractionSchemas/client/requests/ExtractionSchemasDeleteRequest.d.mts +1 -3
- package/dist/esm/api/resources/extractionSchemas/client/requests/ExtractionSchemasGetRequest.d.mts +1 -3
- package/dist/esm/api/resources/extractionSchemas/client/requests/ExtractionSchemasListRequest.d.mts +1 -3
- package/dist/esm/api/resources/extractionSchemas/client/requests/UpdateExtractionSchemaRequest.d.mts +1 -3
- package/dist/esm/api/resources/projects/client/Client.mjs +28 -21
- package/dist/esm/api/resources/tools/client/Client.d.mts +10 -0
- package/dist/esm/api/resources/tools/client/Client.mjs +30 -15
- package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.d.mts +15 -4
- package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.mjs +1 -0
- package/dist/esm/api/resources/tools/client/requests/ToolsDeleteRequest.d.mts +1 -3
- package/dist/esm/api/resources/tools/client/requests/ToolsGetRequest.d.mts +6 -3
- package/dist/esm/api/resources/tools/client/requests/ToolsListRequest.d.mts +1 -3
- package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.d.mts +5 -4
- package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.mjs +1 -0
- package/dist/esm/api/resources/voices/client/Client.mjs +8 -6
- package/dist/esm/api/resources/voices/client/requests/VoicesListRequest.d.mts +1 -3
- package/dist/esm/api/types/Conversation.d.mts +2 -0
- package/dist/esm/api/types/ConversationItem.d.mts +0 -2
- package/dist/esm/api/types/IsUserSpeakingPayload.d.mts +8 -0
- package/dist/esm/api/types/IsUserSpeakingPayload.mjs +4 -0
- package/dist/esm/api/types/OutboundCallConfig.d.mts +1 -1
- package/dist/esm/api/types/Tool.d.mts +4 -1
- package/dist/esm/api/types/Tool.mjs +1 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +4 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/index.d.mts +2 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +2 -2
- package/dist/esm/core/fetcher/index.d.mts +5 -5
- package/dist/esm/core/fetcher/index.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/reference.md +4 -4
- package/dist/index.d.mts +0 -686
- package/dist/index.d.ts +0 -686
- package/dist/index.js +0 -643
- package/dist/index.mjs +0 -606
|
@@ -72,11 +72,12 @@ class Projects {
|
|
|
72
72
|
__list(requestOptions) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
var _a, _b, _c, _d;
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
76
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
77
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
77
78
|
.base, "projects"),
|
|
78
79
|
method: "GET",
|
|
79
|
-
headers:
|
|
80
|
+
headers: _headers,
|
|
80
81
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
81
82
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
82
83
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -138,11 +139,12 @@ class Projects {
|
|
|
138
139
|
__create(request, requestOptions) {
|
|
139
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
140
141
|
var _a, _b, _c, _d;
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
143
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
144
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
143
145
|
.base, "projects"),
|
|
144
146
|
method: "POST",
|
|
145
|
-
headers:
|
|
147
|
+
headers: _headers,
|
|
146
148
|
contentType: "application/json",
|
|
147
149
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
148
150
|
requestType: "json",
|
|
@@ -209,11 +211,12 @@ class Projects {
|
|
|
209
211
|
__get(nameOrId, requestOptions) {
|
|
210
212
|
return __awaiter(this, void 0, void 0, function* () {
|
|
211
213
|
var _a, _b, _c, _d;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
215
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
216
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
214
217
|
.base, `projects/${encodeURIComponent(nameOrId)}`),
|
|
215
218
|
method: "GET",
|
|
216
|
-
headers:
|
|
219
|
+
headers: _headers,
|
|
217
220
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
218
221
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
219
222
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -277,11 +280,12 @@ class Projects {
|
|
|
277
280
|
__delete(nameOrId, requestOptions) {
|
|
278
281
|
return __awaiter(this, void 0, void 0, function* () {
|
|
279
282
|
var _a, _b, _c, _d;
|
|
280
|
-
|
|
281
|
-
|
|
283
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
284
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
285
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
282
286
|
.base, `projects/${encodeURIComponent(nameOrId)}`),
|
|
283
287
|
method: "DELETE",
|
|
284
|
-
headers:
|
|
288
|
+
headers: _headers,
|
|
285
289
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
286
290
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
287
291
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -351,11 +355,12 @@ class Projects {
|
|
|
351
355
|
__update(nameOrId_1) {
|
|
352
356
|
return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
|
|
353
357
|
var _a, _b, _c, _d;
|
|
354
|
-
|
|
355
|
-
|
|
358
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
359
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
360
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
356
361
|
.base, `projects/${encodeURIComponent(nameOrId)}`),
|
|
357
362
|
method: "PATCH",
|
|
358
|
-
headers:
|
|
363
|
+
headers: _headers,
|
|
359
364
|
contentType: "application/json",
|
|
360
365
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
361
366
|
requestType: "json",
|
|
@@ -426,11 +431,12 @@ class Projects {
|
|
|
426
431
|
__listEvalPrompts(id, requestOptions) {
|
|
427
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
428
433
|
var _a, _b, _c, _d;
|
|
429
|
-
|
|
430
|
-
|
|
434
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
435
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
436
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
431
437
|
.base, `projects/${encodeURIComponent(id)}/conversation_eval_prompts`),
|
|
432
438
|
method: "GET",
|
|
433
|
-
headers:
|
|
439
|
+
headers: _headers,
|
|
434
440
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
435
441
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
436
442
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -503,11 +509,12 @@ class Projects {
|
|
|
503
509
|
__createEvalPrompt(id, request, requestOptions) {
|
|
504
510
|
return __awaiter(this, void 0, void 0, function* () {
|
|
505
511
|
var _a, _b, _c, _d;
|
|
506
|
-
|
|
507
|
-
|
|
512
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
513
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
514
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
508
515
|
.base, `projects/${encodeURIComponent(id)}/conversation_eval_prompts`),
|
|
509
516
|
method: "POST",
|
|
510
|
-
headers:
|
|
517
|
+
headers: _headers,
|
|
511
518
|
contentType: "application/json",
|
|
512
519
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
513
520
|
requestType: "json",
|
|
@@ -97,6 +97,16 @@ export declare class Tools {
|
|
|
97
97
|
* }],
|
|
98
98
|
* tool_call_output_timeout_ms: 5000
|
|
99
99
|
* })
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* await client.tools.create({
|
|
103
|
+
* project: "main",
|
|
104
|
+
* name: "transfer_to_support",
|
|
105
|
+
* description: "Transfers the caller to the support team",
|
|
106
|
+
* type: "built_in_transfer_to_phone_number",
|
|
107
|
+
* execution_mode: "sync",
|
|
108
|
+
* phone_number: "+15551234567"
|
|
109
|
+
* })
|
|
100
110
|
*/
|
|
101
111
|
create(request: Phonic.CreateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsCreateResponse>;
|
|
102
112
|
private __create;
|
|
@@ -90,11 +90,12 @@ class Tools {
|
|
|
90
90
|
if (project != null) {
|
|
91
91
|
_queryParams["project"] = project;
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
94
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
95
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
95
96
|
.base, "tools"),
|
|
96
97
|
method: "GET",
|
|
97
|
-
headers:
|
|
98
|
+
headers: _headers,
|
|
98
99
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
99
100
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
100
101
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -184,6 +185,16 @@ class Tools {
|
|
|
184
185
|
* }],
|
|
185
186
|
* tool_call_output_timeout_ms: 5000
|
|
186
187
|
* })
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* await client.tools.create({
|
|
191
|
+
* project: "main",
|
|
192
|
+
* name: "transfer_to_support",
|
|
193
|
+
* description: "Transfers the caller to the support team",
|
|
194
|
+
* type: "built_in_transfer_to_phone_number",
|
|
195
|
+
* execution_mode: "sync",
|
|
196
|
+
* phone_number: "+15551234567"
|
|
197
|
+
* })
|
|
187
198
|
*/
|
|
188
199
|
create(request, requestOptions) {
|
|
189
200
|
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
@@ -196,11 +207,12 @@ class Tools {
|
|
|
196
207
|
if (project != null) {
|
|
197
208
|
_queryParams["project"] = project;
|
|
198
209
|
}
|
|
199
|
-
|
|
200
|
-
|
|
210
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
211
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
212
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
201
213
|
.base, "tools"),
|
|
202
214
|
method: "POST",
|
|
203
|
-
headers:
|
|
215
|
+
headers: _headers,
|
|
204
216
|
contentType: "application/json",
|
|
205
217
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
206
218
|
requestType: "json",
|
|
@@ -271,11 +283,12 @@ class Tools {
|
|
|
271
283
|
if (project != null) {
|
|
272
284
|
_queryParams["project"] = project;
|
|
273
285
|
}
|
|
274
|
-
|
|
275
|
-
|
|
286
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
287
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
288
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
276
289
|
.base, `tools/${encodeURIComponent(nameOrId)}`),
|
|
277
290
|
method: "GET",
|
|
278
|
-
headers:
|
|
291
|
+
headers: _headers,
|
|
279
292
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
280
293
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
281
294
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -340,11 +353,12 @@ class Tools {
|
|
|
340
353
|
if (project != null) {
|
|
341
354
|
_queryParams["project"] = project;
|
|
342
355
|
}
|
|
343
|
-
|
|
344
|
-
|
|
356
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
357
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
358
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
345
359
|
.base, `tools/${encodeURIComponent(nameOrId)}`),
|
|
346
360
|
method: "DELETE",
|
|
347
|
-
headers:
|
|
361
|
+
headers: _headers,
|
|
348
362
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
349
363
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
350
364
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -414,11 +428,12 @@ class Tools {
|
|
|
414
428
|
if (project != null) {
|
|
415
429
|
_queryParams["project"] = project;
|
|
416
430
|
}
|
|
417
|
-
|
|
418
|
-
|
|
431
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
432
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
433
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
419
434
|
.base, `tools/${encodeURIComponent(nameOrId)}`),
|
|
420
435
|
method: "PATCH",
|
|
421
|
-
headers:
|
|
436
|
+
headers: _headers,
|
|
422
437
|
contentType: "application/json",
|
|
423
438
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
424
439
|
requestType: "json",
|
|
@@ -45,11 +45,19 @@ import * as Phonic from "../../../../index.js";
|
|
|
45
45
|
* }],
|
|
46
46
|
* tool_call_output_timeout_ms: 5000
|
|
47
47
|
* }
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* {
|
|
51
|
+
* project: "main",
|
|
52
|
+
* name: "transfer_to_support",
|
|
53
|
+
* description: "Transfers the caller to the support team",
|
|
54
|
+
* type: "built_in_transfer_to_phone_number",
|
|
55
|
+
* execution_mode: "sync",
|
|
56
|
+
* phone_number: "+15551234567"
|
|
57
|
+
* }
|
|
48
58
|
*/
|
|
49
59
|
export interface CreateToolRequest {
|
|
50
|
-
/**
|
|
51
|
-
* The name of the project to create the tool in.
|
|
52
|
-
*/
|
|
60
|
+
/** The name of the project to create the tool in. */
|
|
53
61
|
project?: string;
|
|
54
62
|
/** The name of the tool. Must be snake_case and unique within the organization. */
|
|
55
63
|
name: string;
|
|
@@ -71,15 +79,18 @@ export interface CreateToolRequest {
|
|
|
71
79
|
endpoint_timeout_ms?: number;
|
|
72
80
|
/** Timeout for WebSocket tool responses. */
|
|
73
81
|
tool_call_output_timeout_ms?: number;
|
|
82
|
+
/** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
|
|
83
|
+
phone_number?: string;
|
|
74
84
|
}
|
|
75
85
|
export declare namespace CreateToolRequest {
|
|
76
86
|
/**
|
|
77
87
|
* The type of tool.
|
|
78
88
|
*/
|
|
79
|
-
type Type = "custom_webhook" | "custom_websocket";
|
|
89
|
+
type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
|
|
80
90
|
const Type: {
|
|
81
91
|
readonly CustomWebhook: "custom_webhook";
|
|
82
92
|
readonly CustomWebsocket: "custom_websocket";
|
|
93
|
+
readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
|
|
83
94
|
};
|
|
84
95
|
/**
|
|
85
96
|
* Mode of operation.
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
* }
|
|
9
9
|
*/
|
|
10
10
|
export interface ToolsDeleteRequest {
|
|
11
|
-
/**
|
|
12
|
-
* The name of the project containing the tool. Only used when `nameOrId` is a name.
|
|
13
|
-
*/
|
|
11
|
+
/** The name of the project containing the tool. Only used when `nameOrId` is a name. */
|
|
14
12
|
project?: string;
|
|
15
13
|
}
|
|
@@ -11,10 +11,13 @@
|
|
|
11
11
|
* {
|
|
12
12
|
* project: "main"
|
|
13
13
|
* }
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* {
|
|
17
|
+
* project: "main"
|
|
18
|
+
* }
|
|
14
19
|
*/
|
|
15
20
|
export interface ToolsGetRequest {
|
|
16
|
-
/**
|
|
17
|
-
* The name of the project containing the tool. Only used when `nameOrId` is a name.
|
|
18
|
-
*/
|
|
21
|
+
/** The name of the project containing the tool. Only used when `nameOrId` is a name. */
|
|
19
22
|
project?: string;
|
|
20
23
|
}
|
|
@@ -14,9 +14,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
14
14
|
* }
|
|
15
15
|
*/
|
|
16
16
|
export interface UpdateToolRequest {
|
|
17
|
-
/**
|
|
18
|
-
* The name of the project containing the tool. Only used when `nameOrId` is a name.
|
|
19
|
-
*/
|
|
17
|
+
/** The name of the project containing the tool. Only used when `nameOrId` is a name. */
|
|
20
18
|
project?: string;
|
|
21
19
|
/** The name of the tool. Must be snake_case and unique within the organization. */
|
|
22
20
|
name?: string;
|
|
@@ -33,15 +31,18 @@ export interface UpdateToolRequest {
|
|
|
33
31
|
endpoint_headers?: Record<string, string>;
|
|
34
32
|
endpoint_timeout_ms?: number;
|
|
35
33
|
tool_call_output_timeout_ms?: number;
|
|
34
|
+
/** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
|
|
35
|
+
phone_number?: string;
|
|
36
36
|
}
|
|
37
37
|
export declare namespace UpdateToolRequest {
|
|
38
38
|
/**
|
|
39
39
|
* The type of tool.
|
|
40
40
|
*/
|
|
41
|
-
type Type = "custom_webhook" | "custom_websocket";
|
|
41
|
+
type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
|
|
42
42
|
const Type: {
|
|
43
43
|
readonly CustomWebhook: "custom_webhook";
|
|
44
44
|
readonly CustomWebsocket: "custom_websocket";
|
|
45
|
+
readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
|
|
45
46
|
};
|
|
46
47
|
/**
|
|
47
48
|
* Mode of operation.
|
|
@@ -79,11 +79,12 @@ class Voices {
|
|
|
79
79
|
const { model } = request;
|
|
80
80
|
const _queryParams = {};
|
|
81
81
|
_queryParams["model"] = model;
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
83
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
84
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
84
85
|
.base, "voices"),
|
|
85
86
|
method: "GET",
|
|
86
|
-
headers:
|
|
87
|
+
headers: _headers,
|
|
87
88
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
88
89
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
89
90
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -143,11 +144,12 @@ class Voices {
|
|
|
143
144
|
__get(id, requestOptions) {
|
|
144
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
146
|
var _a, _b, _c, _d;
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
148
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
149
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
148
150
|
.base, `voices/${encodeURIComponent(id)}`),
|
|
149
151
|
method: "GET",
|
|
150
|
-
headers:
|
|
152
|
+
headers: _headers,
|
|
151
153
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
152
154
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
153
155
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -31,6 +31,8 @@ export interface Conversation {
|
|
|
31
31
|
started_at: string;
|
|
32
32
|
/** When the conversation ended. */
|
|
33
33
|
ended_at?: string;
|
|
34
|
+
/** System prompt used for the conversation. */
|
|
35
|
+
system_prompt: string;
|
|
34
36
|
/** Array of conversation items (turns). */
|
|
35
37
|
items: Phonic.ConversationItem[];
|
|
36
38
|
/** Results from conversation evaluations and extractions. */
|
|
@@ -14,8 +14,6 @@ export interface ConversationItem {
|
|
|
14
14
|
duration_ms: number;
|
|
15
15
|
/** When this turn started. */
|
|
16
16
|
started_at: string;
|
|
17
|
-
/** System prompt used (assistant only). */
|
|
18
|
-
system_prompt?: string;
|
|
19
17
|
/** Voice ID used (assistant only). */
|
|
20
18
|
voice_id?: string;
|
|
21
19
|
/** Audio speed used (assistant only). */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export interface OutboundCallConfig {
|
|
8
8
|
/** The name of the agent to use for the call. */
|
|
9
9
|
agent?: string;
|
|
10
|
-
/** The name of the project to use for the call.
|
|
10
|
+
/** The name of the project to use for the call. */
|
|
11
11
|
project?: string;
|
|
12
12
|
/** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. */
|
|
13
13
|
welcome_message?: string;
|
|
@@ -26,6 +26,8 @@ export interface Tool {
|
|
|
26
26
|
endpoint_timeout_ms?: number;
|
|
27
27
|
/** Timeout in milliseconds for WebSocket tool responses. */
|
|
28
28
|
tool_call_output_timeout_ms?: number;
|
|
29
|
+
/** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
|
|
30
|
+
phone_number?: string;
|
|
29
31
|
}
|
|
30
32
|
export declare namespace Tool {
|
|
31
33
|
interface Project {
|
|
@@ -35,10 +37,11 @@ export declare namespace Tool {
|
|
|
35
37
|
/**
|
|
36
38
|
* The type of tool.
|
|
37
39
|
*/
|
|
38
|
-
type Type = "custom_webhook" | "custom_websocket";
|
|
40
|
+
type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
|
|
39
41
|
const Type: {
|
|
40
42
|
readonly CustomWebhook: "custom_webhook";
|
|
41
43
|
readonly CustomWebsocket: "custom_websocket";
|
|
44
|
+
readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
|
|
42
45
|
};
|
|
43
46
|
/**
|
|
44
47
|
* Mode of operation - sync waits for response, async continues without waiting.
|
|
@@ -34,6 +34,7 @@ export * from "./AudioChunkResponsePayload.js";
|
|
|
34
34
|
export * from "./AudioFinishedPayload.js";
|
|
35
35
|
export * from "./UserStartedSpeakingPayload.js";
|
|
36
36
|
export * from "./UserFinishedSpeakingPayload.js";
|
|
37
|
+
export * from "./IsUserSpeakingPayload.js";
|
|
37
38
|
export * from "./InterruptedResponsePayload.js";
|
|
38
39
|
export * from "./DtmfPayload.js";
|
|
39
40
|
export * from "./ToolCallPayload.js";
|
|
@@ -50,6 +50,7 @@ __exportStar(require("./AudioChunkResponsePayload.js"), exports);
|
|
|
50
50
|
__exportStar(require("./AudioFinishedPayload.js"), exports);
|
|
51
51
|
__exportStar(require("./UserStartedSpeakingPayload.js"), exports);
|
|
52
52
|
__exportStar(require("./UserFinishedSpeakingPayload.js"), exports);
|
|
53
|
+
__exportStar(require("./IsUserSpeakingPayload.js"), exports);
|
|
53
54
|
__exportStar(require("./InterruptedResponsePayload.js"), exports);
|
|
54
55
|
__exportStar(require("./DtmfPayload.js"), exports);
|
|
55
56
|
__exportStar(require("./ToolCallPayload.js"), exports);
|
|
@@ -12,15 +12,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.fetcher = void 0;
|
|
13
13
|
exports.fetcherImpl = fetcherImpl;
|
|
14
14
|
const json_js_1 = require("../json.js");
|
|
15
|
-
const RawResponse_js_1 = require("./RawResponse.js");
|
|
16
|
-
const Supplier_js_1 = require("./Supplier.js");
|
|
17
15
|
const createRequestUrl_js_1 = require("./createRequestUrl.js");
|
|
18
16
|
const getErrorResponseBody_js_1 = require("./getErrorResponseBody.js");
|
|
19
17
|
const getFetchFn_js_1 = require("./getFetchFn.js");
|
|
20
18
|
const getRequestBody_js_1 = require("./getRequestBody.js");
|
|
21
19
|
const getResponseBody_js_1 = require("./getResponseBody.js");
|
|
22
20
|
const makeRequest_js_1 = require("./makeRequest.js");
|
|
21
|
+
const RawResponse_js_1 = require("./RawResponse.js");
|
|
23
22
|
const requestWithRetries_js_1 = require("./requestWithRetries.js");
|
|
23
|
+
const Supplier_js_1 = require("./Supplier.js");
|
|
24
24
|
function getHeaders(args) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
const newHeaders = {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type { APIResponse } from "./APIResponse.js";
|
|
2
|
-
export {
|
|
2
|
+
export type { BinaryResponse } from "./BinaryResponse.js";
|
|
3
3
|
export type { Fetcher, FetchFunction } from "./Fetcher.js";
|
|
4
|
+
export { fetcher } from "./Fetcher.js";
|
|
4
5
|
export { getHeader } from "./getHeader.js";
|
|
5
|
-
export { Supplier } from "./Supplier.js";
|
|
6
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
7
|
-
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
|
|
8
6
|
export { HttpResponsePromise } from "./HttpResponsePromise.js";
|
|
9
|
-
export {
|
|
7
|
+
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
|
|
8
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
9
|
+
export { Supplier } from "./Supplier.js";
|