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
|
@@ -36,11 +36,12 @@ export class Projects {
|
|
|
36
36
|
__list(requestOptions) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
var _a, _b, _c, _d;
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
40
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
41
|
+
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)
|
|
41
42
|
.base, "projects"),
|
|
42
43
|
method: "GET",
|
|
43
|
-
headers:
|
|
44
|
+
headers: _headers,
|
|
44
45
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
45
46
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
46
47
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -102,11 +103,12 @@ export class Projects {
|
|
|
102
103
|
__create(request, requestOptions) {
|
|
103
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
105
|
var _a, _b, _c, _d;
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
107
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
108
|
+
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)
|
|
107
109
|
.base, "projects"),
|
|
108
110
|
method: "POST",
|
|
109
|
-
headers:
|
|
111
|
+
headers: _headers,
|
|
110
112
|
contentType: "application/json",
|
|
111
113
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
112
114
|
requestType: "json",
|
|
@@ -173,11 +175,12 @@ export class Projects {
|
|
|
173
175
|
__get(nameOrId, requestOptions) {
|
|
174
176
|
return __awaiter(this, void 0, void 0, function* () {
|
|
175
177
|
var _a, _b, _c, _d;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
179
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
180
|
+
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)
|
|
178
181
|
.base, `projects/${encodeURIComponent(nameOrId)}`),
|
|
179
182
|
method: "GET",
|
|
180
|
-
headers:
|
|
183
|
+
headers: _headers,
|
|
181
184
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
182
185
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
183
186
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -241,11 +244,12 @@ export class Projects {
|
|
|
241
244
|
__delete(nameOrId, requestOptions) {
|
|
242
245
|
return __awaiter(this, void 0, void 0, function* () {
|
|
243
246
|
var _a, _b, _c, _d;
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
248
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
249
|
+
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)
|
|
246
250
|
.base, `projects/${encodeURIComponent(nameOrId)}`),
|
|
247
251
|
method: "DELETE",
|
|
248
|
-
headers:
|
|
252
|
+
headers: _headers,
|
|
249
253
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
250
254
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
251
255
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -315,11 +319,12 @@ export class Projects {
|
|
|
315
319
|
__update(nameOrId_1) {
|
|
316
320
|
return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
|
|
317
321
|
var _a, _b, _c, _d;
|
|
318
|
-
|
|
319
|
-
|
|
322
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
323
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
324
|
+
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)
|
|
320
325
|
.base, `projects/${encodeURIComponent(nameOrId)}`),
|
|
321
326
|
method: "PATCH",
|
|
322
|
-
headers:
|
|
327
|
+
headers: _headers,
|
|
323
328
|
contentType: "application/json",
|
|
324
329
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
325
330
|
requestType: "json",
|
|
@@ -390,11 +395,12 @@ export class Projects {
|
|
|
390
395
|
__listEvalPrompts(id, requestOptions) {
|
|
391
396
|
return __awaiter(this, void 0, void 0, function* () {
|
|
392
397
|
var _a, _b, _c, _d;
|
|
393
|
-
|
|
394
|
-
|
|
398
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
399
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
400
|
+
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)
|
|
395
401
|
.base, `projects/${encodeURIComponent(id)}/conversation_eval_prompts`),
|
|
396
402
|
method: "GET",
|
|
397
|
-
headers:
|
|
403
|
+
headers: _headers,
|
|
398
404
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
399
405
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
400
406
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -467,11 +473,12 @@ export class Projects {
|
|
|
467
473
|
__createEvalPrompt(id, request, requestOptions) {
|
|
468
474
|
return __awaiter(this, void 0, void 0, function* () {
|
|
469
475
|
var _a, _b, _c, _d;
|
|
470
|
-
|
|
471
|
-
|
|
476
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
477
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
478
|
+
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)
|
|
472
479
|
.base, `projects/${encodeURIComponent(id)}/conversation_eval_prompts`),
|
|
473
480
|
method: "POST",
|
|
474
|
-
headers:
|
|
481
|
+
headers: _headers,
|
|
475
482
|
contentType: "application/json",
|
|
476
483
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
477
484
|
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;
|
|
@@ -54,11 +54,12 @@ export class Tools {
|
|
|
54
54
|
if (project != null) {
|
|
55
55
|
_queryParams["project"] = project;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
58
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
59
|
+
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)
|
|
59
60
|
.base, "tools"),
|
|
60
61
|
method: "GET",
|
|
61
|
-
headers:
|
|
62
|
+
headers: _headers,
|
|
62
63
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
63
64
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
64
65
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -148,6 +149,16 @@ export class Tools {
|
|
|
148
149
|
* }],
|
|
149
150
|
* tool_call_output_timeout_ms: 5000
|
|
150
151
|
* })
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* await client.tools.create({
|
|
155
|
+
* project: "main",
|
|
156
|
+
* name: "transfer_to_support",
|
|
157
|
+
* description: "Transfers the caller to the support team",
|
|
158
|
+
* type: "built_in_transfer_to_phone_number",
|
|
159
|
+
* execution_mode: "sync",
|
|
160
|
+
* phone_number: "+15551234567"
|
|
161
|
+
* })
|
|
151
162
|
*/
|
|
152
163
|
create(request, requestOptions) {
|
|
153
164
|
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
@@ -160,11 +171,12 @@ export class Tools {
|
|
|
160
171
|
if (project != null) {
|
|
161
172
|
_queryParams["project"] = project;
|
|
162
173
|
}
|
|
163
|
-
|
|
164
|
-
|
|
174
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
175
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
176
|
+
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)
|
|
165
177
|
.base, "tools"),
|
|
166
178
|
method: "POST",
|
|
167
|
-
headers:
|
|
179
|
+
headers: _headers,
|
|
168
180
|
contentType: "application/json",
|
|
169
181
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
170
182
|
requestType: "json",
|
|
@@ -235,11 +247,12 @@ export class Tools {
|
|
|
235
247
|
if (project != null) {
|
|
236
248
|
_queryParams["project"] = project;
|
|
237
249
|
}
|
|
238
|
-
|
|
239
|
-
|
|
250
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
251
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
252
|
+
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)
|
|
240
253
|
.base, `tools/${encodeURIComponent(nameOrId)}`),
|
|
241
254
|
method: "GET",
|
|
242
|
-
headers:
|
|
255
|
+
headers: _headers,
|
|
243
256
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
244
257
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
245
258
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -304,11 +317,12 @@ export class Tools {
|
|
|
304
317
|
if (project != null) {
|
|
305
318
|
_queryParams["project"] = project;
|
|
306
319
|
}
|
|
307
|
-
|
|
308
|
-
|
|
320
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
321
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
322
|
+
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)
|
|
309
323
|
.base, `tools/${encodeURIComponent(nameOrId)}`),
|
|
310
324
|
method: "DELETE",
|
|
311
|
-
headers:
|
|
325
|
+
headers: _headers,
|
|
312
326
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
313
327
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
314
328
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -378,11 +392,12 @@ export class Tools {
|
|
|
378
392
|
if (project != null) {
|
|
379
393
|
_queryParams["project"] = project;
|
|
380
394
|
}
|
|
381
|
-
|
|
382
|
-
|
|
395
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
396
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
397
|
+
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)
|
|
383
398
|
.base, `tools/${encodeURIComponent(nameOrId)}`),
|
|
384
399
|
method: "PATCH",
|
|
385
|
-
headers:
|
|
400
|
+
headers: _headers,
|
|
386
401
|
contentType: "application/json",
|
|
387
402
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
388
403
|
requestType: "json",
|
|
@@ -45,11 +45,19 @@ import * as Phonic from "../../../../index.mjs";
|
|
|
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.mjs";
|
|
|
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.
|
|
@@ -43,11 +43,12 @@ export class Voices {
|
|
|
43
43
|
const { model } = request;
|
|
44
44
|
const _queryParams = {};
|
|
45
45
|
_queryParams["model"] = model;
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
47
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
48
|
+
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)
|
|
48
49
|
.base, "voices"),
|
|
49
50
|
method: "GET",
|
|
50
|
-
headers:
|
|
51
|
+
headers: _headers,
|
|
51
52
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
52
53
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
53
54
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -107,11 +108,12 @@ export class Voices {
|
|
|
107
108
|
__get(id, requestOptions) {
|
|
108
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
110
|
var _a, _b, _c, _d;
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
112
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
113
|
+
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)
|
|
112
114
|
.base, `voices/${encodeURIComponent(id)}`),
|
|
113
115
|
method: "GET",
|
|
114
|
-
headers:
|
|
116
|
+
headers: _headers,
|
|
115
117
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
116
118
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
117
119
|
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.mjs";
|
|
|
34
34
|
export * from "./AudioFinishedPayload.mjs";
|
|
35
35
|
export * from "./UserStartedSpeakingPayload.mjs";
|
|
36
36
|
export * from "./UserFinishedSpeakingPayload.mjs";
|
|
37
|
+
export * from "./IsUserSpeakingPayload.mjs";
|
|
37
38
|
export * from "./InterruptedResponsePayload.mjs";
|
|
38
39
|
export * from "./DtmfPayload.mjs";
|
|
39
40
|
export * from "./ToolCallPayload.mjs";
|
|
@@ -34,6 +34,7 @@ export * from "./AudioChunkResponsePayload.mjs";
|
|
|
34
34
|
export * from "./AudioFinishedPayload.mjs";
|
|
35
35
|
export * from "./UserStartedSpeakingPayload.mjs";
|
|
36
36
|
export * from "./UserFinishedSpeakingPayload.mjs";
|
|
37
|
+
export * from "./IsUserSpeakingPayload.mjs";
|
|
37
38
|
export * from "./InterruptedResponsePayload.mjs";
|
|
38
39
|
export * from "./DtmfPayload.mjs";
|
|
39
40
|
export * from "./ToolCallPayload.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,15 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { toJson } from "../json.mjs";
|
|
11
|
-
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
12
|
-
import { Supplier } from "./Supplier.mjs";
|
|
13
11
|
import { createRequestUrl } from "./createRequestUrl.mjs";
|
|
14
12
|
import { getErrorResponseBody } from "./getErrorResponseBody.mjs";
|
|
15
13
|
import { getFetchFn } from "./getFetchFn.mjs";
|
|
16
14
|
import { getRequestBody } from "./getRequestBody.mjs";
|
|
17
15
|
import { getResponseBody } from "./getResponseBody.mjs";
|
|
18
16
|
import { makeRequest } from "./makeRequest.mjs";
|
|
17
|
+
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
19
18
|
import { requestWithRetries } from "./requestWithRetries.mjs";
|
|
19
|
+
import { Supplier } from "./Supplier.mjs";
|
|
20
20
|
function getHeaders(args) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const newHeaders = {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type { APIResponse } from "./APIResponse.mjs";
|
|
2
|
-
export {
|
|
2
|
+
export type { BinaryResponse } from "./BinaryResponse.mjs";
|
|
3
3
|
export type { Fetcher, FetchFunction } from "./Fetcher.mjs";
|
|
4
|
+
export { fetcher } from "./Fetcher.mjs";
|
|
4
5
|
export { getHeader } from "./getHeader.mjs";
|
|
5
|
-
export { Supplier } from "./Supplier.mjs";
|
|
6
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
7
|
-
export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
|
|
8
6
|
export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
|
|
9
|
-
export {
|
|
7
|
+
export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
|
|
8
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
9
|
+
export { Supplier } from "./Supplier.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { fetcher } from "./Fetcher.mjs";
|
|
2
2
|
export { getHeader } from "./getHeader.mjs";
|
|
3
|
-
export { Supplier } from "./Supplier.mjs";
|
|
4
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
5
3
|
export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
|
|
4
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
5
|
+
export { Supplier } from "./Supplier.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.30.
|
|
1
|
+
export declare const SDK_VERSION = "0.30.4";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.30.
|
|
1
|
+
export const SDK_VERSION = "0.30.4";
|