phonic 0.30.34 → 0.30.36
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/agents/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/agents/client/Client.js +8 -6
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +2 -1
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -1
- package/dist/cjs/api/resources/auth/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/auth/client/Client.js +5 -3
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/conversations/client/Client.js +5 -3
- package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/extractionSchemas/client/Client.js +5 -3
- package/dist/cjs/api/resources/projects/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/projects/client/Client.js +8 -6
- package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +2 -1
- package/dist/cjs/api/resources/tools/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/tools/client/Client.js +5 -3
- package/dist/cjs/api/resources/voices/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/voices/client/Client.js +5 -3
- package/dist/cjs/api/types/AssistantFinishedSpeakingPayload.d.ts +6 -0
- package/dist/cjs/api/types/AssistantFinishedSpeakingPayload.js +5 -0
- package/dist/cjs/api/types/AssistantStartedSpeakingPayload.d.ts +6 -0
- package/dist/cjs/api/types/AssistantStartedSpeakingPayload.js +5 -0
- package/dist/cjs/api/types/CreateAgentRequest.d.ts +2 -1
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -0
- 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 +2 -2
- package/dist/esm/api/resources/agents/client/Client.mjs +8 -6
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +2 -1
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -1
- package/dist/esm/api/resources/auth/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/auth/client/Client.mjs +5 -3
- package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/conversations/client/Client.mjs +5 -3
- package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +5 -3
- package/dist/esm/api/resources/projects/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/projects/client/Client.mjs +8 -6
- package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +2 -1
- package/dist/esm/api/resources/tools/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/tools/client/Client.mjs +5 -3
- package/dist/esm/api/resources/voices/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/voices/client/Client.mjs +5 -3
- package/dist/esm/api/types/AssistantFinishedSpeakingPayload.d.mts +6 -0
- package/dist/esm/api/types/AssistantFinishedSpeakingPayload.mjs +4 -0
- package/dist/esm/api/types/AssistantStartedSpeakingPayload.d.mts +6 -0
- package/dist/esm/api/types/AssistantStartedSpeakingPayload.mjs +4 -0
- package/dist/esm/api/types/CreateAgentRequest.d.mts +2 -1
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/Client.js
CHANGED
|
@@ -51,8 +51,8 @@ class PhonicClient {
|
|
|
51
51
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
52
52
|
"X-Fern-Language": "JavaScript",
|
|
53
53
|
"X-Fern-SDK-Name": "phonic",
|
|
54
|
-
"X-Fern-SDK-Version": "0.30.
|
|
55
|
-
"User-Agent": "phonic/0.30.
|
|
54
|
+
"X-Fern-SDK-Version": "0.30.36",
|
|
55
|
+
"User-Agent": "phonic/0.30.36",
|
|
56
56
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
57
57
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
58
58
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -215,7 +215,7 @@ export declare class Agents {
|
|
|
215
215
|
* }
|
|
216
216
|
* })
|
|
217
217
|
*/
|
|
218
|
-
update(nameOrId: string, request
|
|
218
|
+
update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
|
|
219
219
|
private __update;
|
|
220
220
|
/**
|
|
221
221
|
* Adds a custom phone number to an agent. The user must configure their SIP trunk to point to Phonic's SIP server.
|
|
@@ -294,5 +294,5 @@ export declare class Agents {
|
|
|
294
294
|
*/
|
|
295
295
|
updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
|
|
296
296
|
private __updatePhoneNumber;
|
|
297
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
297
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
298
298
|
}
|
|
@@ -531,11 +531,11 @@ class Agents {
|
|
|
531
531
|
* }
|
|
532
532
|
* })
|
|
533
533
|
*/
|
|
534
|
-
update(nameOrId, request, requestOptions) {
|
|
534
|
+
update(nameOrId, request = {}, requestOptions) {
|
|
535
535
|
return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
|
|
536
536
|
}
|
|
537
|
-
__update(
|
|
538
|
-
return __awaiter(this,
|
|
537
|
+
__update(nameOrId_1) {
|
|
538
|
+
return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
|
|
539
539
|
var _a, _b, _c, _d;
|
|
540
540
|
const { project } = request, _body = __rest(request, ["project"]);
|
|
541
541
|
const _queryParams = {};
|
|
@@ -876,10 +876,12 @@ class Agents {
|
|
|
876
876
|
return __awaiter(this, void 0, void 0, function* () {
|
|
877
877
|
var _a;
|
|
878
878
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
879
|
-
if (bearer
|
|
880
|
-
|
|
879
|
+
if (bearer == null) {
|
|
880
|
+
throw new errors.PhonicError({
|
|
881
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
882
|
+
});
|
|
881
883
|
}
|
|
882
|
-
return
|
|
884
|
+
return `Bearer ${bearer}`;
|
|
883
885
|
});
|
|
884
886
|
}
|
|
885
887
|
}
|
|
@@ -42,7 +42,8 @@ export interface AgentsCreateRequest {
|
|
|
42
42
|
project?: string;
|
|
43
43
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
44
44
|
name: string;
|
|
45
|
-
|
|
45
|
+
/** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
|
|
46
|
+
phone_number?: Phonic.CreateAgentRequest.PhoneNumber | null;
|
|
46
47
|
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
47
48
|
custom_phone_number?: string | null;
|
|
48
49
|
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
@@ -42,7 +42,8 @@ export interface UpdateAgentRequest {
|
|
|
42
42
|
project?: string;
|
|
43
43
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
44
44
|
name?: string;
|
|
45
|
-
|
|
45
|
+
/** When set to `null`, the agent will not be associated with a phone number anymore. When set to `"assign-automatically"`, the agent will be assigned a random phone number if it doesn't have one yet. If the agent already has a phone number, `"assign-automatically"` has no effect. When set to `"custom"`, you must provide `custom_phone_numbers`. */
|
|
46
|
+
phone_number?: UpdateAgentRequest.PhoneNumber | null;
|
|
46
47
|
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
47
48
|
custom_phone_number?: string | null;
|
|
48
49
|
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
@@ -48,5 +48,5 @@ export declare class Auth {
|
|
|
48
48
|
*/
|
|
49
49
|
createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
|
|
50
50
|
private __createSessionToken;
|
|
51
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
51
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
52
52
|
}
|
|
@@ -136,10 +136,12 @@ class Auth {
|
|
|
136
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
137
|
var _a;
|
|
138
138
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
139
|
-
if (bearer
|
|
140
|
-
|
|
139
|
+
if (bearer == null) {
|
|
140
|
+
throw new errors.PhonicError({
|
|
141
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
142
|
+
});
|
|
141
143
|
}
|
|
142
|
-
return
|
|
144
|
+
return `Bearer ${bearer}`;
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
147
|
}
|
|
@@ -233,5 +233,5 @@ export declare class Conversations {
|
|
|
233
233
|
sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
|
|
234
234
|
private __sipOutboundCall;
|
|
235
235
|
connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
|
|
236
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
236
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
237
237
|
}
|
|
@@ -886,10 +886,12 @@ class Conversations {
|
|
|
886
886
|
return __awaiter(this, void 0, void 0, function* () {
|
|
887
887
|
var _a;
|
|
888
888
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
889
|
-
if (bearer
|
|
890
|
-
|
|
889
|
+
if (bearer == null) {
|
|
890
|
+
throw new errors.PhonicError({
|
|
891
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
892
|
+
});
|
|
891
893
|
}
|
|
892
|
-
return
|
|
894
|
+
return `Bearer ${bearer}`;
|
|
893
895
|
});
|
|
894
896
|
}
|
|
895
897
|
}
|
|
@@ -138,5 +138,5 @@ export declare class ExtractionSchemas {
|
|
|
138
138
|
*/
|
|
139
139
|
update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>;
|
|
140
140
|
private __update;
|
|
141
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
141
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
142
142
|
}
|
|
@@ -461,10 +461,12 @@ class ExtractionSchemas {
|
|
|
461
461
|
return __awaiter(this, void 0, void 0, function* () {
|
|
462
462
|
var _a;
|
|
463
463
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
464
|
-
if (bearer
|
|
465
|
-
|
|
464
|
+
if (bearer == null) {
|
|
465
|
+
throw new errors.PhonicError({
|
|
466
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
467
|
+
});
|
|
466
468
|
}
|
|
467
|
-
return
|
|
469
|
+
return `Bearer ${bearer}`;
|
|
468
470
|
});
|
|
469
471
|
}
|
|
470
472
|
}
|
|
@@ -113,7 +113,7 @@ export declare class Projects {
|
|
|
113
113
|
* default_agent: "another-agent"
|
|
114
114
|
* })
|
|
115
115
|
*/
|
|
116
|
-
update(nameOrId: string, request
|
|
116
|
+
update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
|
|
117
117
|
private __update;
|
|
118
118
|
/**
|
|
119
119
|
* Returns all conversation evaluation prompts for a project.
|
|
@@ -153,5 +153,5 @@ export declare class Projects {
|
|
|
153
153
|
*/
|
|
154
154
|
createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
|
|
155
155
|
private __createEvalPrompt;
|
|
156
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
156
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
157
157
|
}
|
|
@@ -349,11 +349,11 @@ class Projects {
|
|
|
349
349
|
* default_agent: "another-agent"
|
|
350
350
|
* })
|
|
351
351
|
*/
|
|
352
|
-
update(nameOrId, request, requestOptions) {
|
|
352
|
+
update(nameOrId, request = {}, requestOptions) {
|
|
353
353
|
return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
|
|
354
354
|
}
|
|
355
|
-
__update(
|
|
356
|
-
return __awaiter(this,
|
|
355
|
+
__update(nameOrId_1) {
|
|
356
|
+
return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
|
|
357
357
|
var _a, _b, _c, _d;
|
|
358
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
359
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -572,10 +572,12 @@ class Projects {
|
|
|
572
572
|
return __awaiter(this, void 0, void 0, function* () {
|
|
573
573
|
var _a;
|
|
574
574
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
575
|
-
if (bearer
|
|
576
|
-
|
|
575
|
+
if (bearer == null) {
|
|
576
|
+
throw new errors.PhonicError({
|
|
577
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
578
|
+
});
|
|
577
579
|
}
|
|
578
|
-
return
|
|
580
|
+
return `Bearer ${bearer}`;
|
|
579
581
|
});
|
|
580
582
|
}
|
|
581
583
|
}
|
|
@@ -11,5 +11,6 @@
|
|
|
11
11
|
export interface UpdateProjectRequest {
|
|
12
12
|
/** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
|
|
13
13
|
name?: string;
|
|
14
|
-
|
|
14
|
+
/** The name of the new project's default agent. Set to `null` to remove the default agent. */
|
|
15
|
+
default_agent?: string | null;
|
|
15
16
|
}
|
|
@@ -210,5 +210,5 @@ export declare class Tools {
|
|
|
210
210
|
*/
|
|
211
211
|
update(nameOrId: string, request?: Phonic.UpdateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsUpdateResponse>;
|
|
212
212
|
private __update;
|
|
213
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
213
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
214
214
|
}
|
|
@@ -526,10 +526,12 @@ class Tools {
|
|
|
526
526
|
return __awaiter(this, void 0, void 0, function* () {
|
|
527
527
|
var _a;
|
|
528
528
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
529
|
-
if (bearer
|
|
530
|
-
|
|
529
|
+
if (bearer == null) {
|
|
530
|
+
throw new errors.PhonicError({
|
|
531
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
532
|
+
});
|
|
531
533
|
}
|
|
532
|
-
return
|
|
534
|
+
return `Bearer ${bearer}`;
|
|
533
535
|
});
|
|
534
536
|
}
|
|
535
537
|
}
|
|
@@ -61,5 +61,5 @@ export declare class Voices {
|
|
|
61
61
|
*/
|
|
62
62
|
get(id: string, requestOptions?: Voices.RequestOptions): core.HttpResponsePromise<Phonic.VoicesGetResponse>;
|
|
63
63
|
private __get;
|
|
64
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
64
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
65
65
|
}
|
|
@@ -193,10 +193,12 @@ class Voices {
|
|
|
193
193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
194
194
|
var _a;
|
|
195
195
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
196
|
-
if (bearer
|
|
197
|
-
|
|
196
|
+
if (bearer == null) {
|
|
197
|
+
throw new errors.PhonicError({
|
|
198
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
199
|
+
});
|
|
198
200
|
}
|
|
199
|
-
return
|
|
201
|
+
return `Bearer ${bearer}`;
|
|
200
202
|
});
|
|
201
203
|
}
|
|
202
204
|
}
|
|
@@ -5,7 +5,8 @@ import * as Phonic from "../index.js";
|
|
|
5
5
|
export interface CreateAgentRequest {
|
|
6
6
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
7
7
|
name: string;
|
|
8
|
-
|
|
8
|
+
/** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
|
|
9
|
+
phone_number?: CreateAgentRequest.PhoneNumber | null;
|
|
9
10
|
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
10
11
|
custom_phone_number?: string | null;
|
|
11
12
|
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
@@ -35,6 +35,8 @@ export * from "./InputCancelledPayload.js";
|
|
|
35
35
|
export * from "./AudioChunkResponsePayload.js";
|
|
36
36
|
export * from "./UserStartedSpeakingPayload.js";
|
|
37
37
|
export * from "./UserFinishedSpeakingPayload.js";
|
|
38
|
+
export * from "./AssistantStartedSpeakingPayload.js";
|
|
39
|
+
export * from "./AssistantFinishedSpeakingPayload.js";
|
|
38
40
|
export * from "./IsUserSpeakingPayload.js";
|
|
39
41
|
export * from "./DtmfPayload.js";
|
|
40
42
|
export * from "./ToolCallPayload.js";
|
|
@@ -51,6 +51,8 @@ __exportStar(require("./InputCancelledPayload.js"), exports);
|
|
|
51
51
|
__exportStar(require("./AudioChunkResponsePayload.js"), exports);
|
|
52
52
|
__exportStar(require("./UserStartedSpeakingPayload.js"), exports);
|
|
53
53
|
__exportStar(require("./UserFinishedSpeakingPayload.js"), exports);
|
|
54
|
+
__exportStar(require("./AssistantStartedSpeakingPayload.js"), exports);
|
|
55
|
+
__exportStar(require("./AssistantFinishedSpeakingPayload.js"), exports);
|
|
54
56
|
__exportStar(require("./IsUserSpeakingPayload.js"), exports);
|
|
55
57
|
__exportStar(require("./DtmfPayload.js"), exports);
|
|
56
58
|
__exportStar(require("./ToolCallPayload.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.30.
|
|
1
|
+
export declare const SDK_VERSION = "0.30.36";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -15,8 +15,8 @@ export class PhonicClient {
|
|
|
15
15
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
16
16
|
"X-Fern-Language": "JavaScript",
|
|
17
17
|
"X-Fern-SDK-Name": "phonic",
|
|
18
|
-
"X-Fern-SDK-Version": "0.30.
|
|
19
|
-
"User-Agent": "phonic/0.30.
|
|
18
|
+
"X-Fern-SDK-Version": "0.30.36",
|
|
19
|
+
"User-Agent": "phonic/0.30.36",
|
|
20
20
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
21
21
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
22
22
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -215,7 +215,7 @@ export declare class Agents {
|
|
|
215
215
|
* }
|
|
216
216
|
* })
|
|
217
217
|
*/
|
|
218
|
-
update(nameOrId: string, request
|
|
218
|
+
update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
|
|
219
219
|
private __update;
|
|
220
220
|
/**
|
|
221
221
|
* Adds a custom phone number to an agent. The user must configure their SIP trunk to point to Phonic's SIP server.
|
|
@@ -294,5 +294,5 @@ export declare class Agents {
|
|
|
294
294
|
*/
|
|
295
295
|
updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
|
|
296
296
|
private __updatePhoneNumber;
|
|
297
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
297
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
298
298
|
}
|
|
@@ -495,11 +495,11 @@ export class Agents {
|
|
|
495
495
|
* }
|
|
496
496
|
* })
|
|
497
497
|
*/
|
|
498
|
-
update(nameOrId, request, requestOptions) {
|
|
498
|
+
update(nameOrId, request = {}, requestOptions) {
|
|
499
499
|
return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
|
|
500
500
|
}
|
|
501
|
-
__update(
|
|
502
|
-
return __awaiter(this,
|
|
501
|
+
__update(nameOrId_1) {
|
|
502
|
+
return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
|
|
503
503
|
var _a, _b, _c, _d;
|
|
504
504
|
const { project } = request, _body = __rest(request, ["project"]);
|
|
505
505
|
const _queryParams = {};
|
|
@@ -840,10 +840,12 @@ export class Agents {
|
|
|
840
840
|
return __awaiter(this, void 0, void 0, function* () {
|
|
841
841
|
var _a;
|
|
842
842
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
843
|
-
if (bearer
|
|
844
|
-
|
|
843
|
+
if (bearer == null) {
|
|
844
|
+
throw new errors.PhonicError({
|
|
845
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
846
|
+
});
|
|
845
847
|
}
|
|
846
|
-
return
|
|
848
|
+
return `Bearer ${bearer}`;
|
|
847
849
|
});
|
|
848
850
|
}
|
|
849
851
|
}
|
|
@@ -42,7 +42,8 @@ export interface AgentsCreateRequest {
|
|
|
42
42
|
project?: string;
|
|
43
43
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
44
44
|
name: string;
|
|
45
|
-
|
|
45
|
+
/** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
|
|
46
|
+
phone_number?: Phonic.CreateAgentRequest.PhoneNumber | null;
|
|
46
47
|
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
47
48
|
custom_phone_number?: string | null;
|
|
48
49
|
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
@@ -42,7 +42,8 @@ export interface UpdateAgentRequest {
|
|
|
42
42
|
project?: string;
|
|
43
43
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
44
44
|
name?: string;
|
|
45
|
-
|
|
45
|
+
/** When set to `null`, the agent will not be associated with a phone number anymore. When set to `"assign-automatically"`, the agent will be assigned a random phone number if it doesn't have one yet. If the agent already has a phone number, `"assign-automatically"` has no effect. When set to `"custom"`, you must provide `custom_phone_numbers`. */
|
|
46
|
+
phone_number?: UpdateAgentRequest.PhoneNumber | null;
|
|
46
47
|
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
47
48
|
custom_phone_number?: string | null;
|
|
48
49
|
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
@@ -48,5 +48,5 @@ export declare class Auth {
|
|
|
48
48
|
*/
|
|
49
49
|
createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
|
|
50
50
|
private __createSessionToken;
|
|
51
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
51
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
52
52
|
}
|
|
@@ -100,10 +100,12 @@ export class Auth {
|
|
|
100
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
101
|
var _a;
|
|
102
102
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
103
|
-
if (bearer
|
|
104
|
-
|
|
103
|
+
if (bearer == null) {
|
|
104
|
+
throw new errors.PhonicError({
|
|
105
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
106
|
+
});
|
|
105
107
|
}
|
|
106
|
-
return
|
|
108
|
+
return `Bearer ${bearer}`;
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -233,5 +233,5 @@ export declare class Conversations {
|
|
|
233
233
|
sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
|
|
234
234
|
private __sipOutboundCall;
|
|
235
235
|
connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
|
|
236
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
236
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
237
237
|
}
|
|
@@ -850,10 +850,12 @@ export class Conversations {
|
|
|
850
850
|
return __awaiter(this, void 0, void 0, function* () {
|
|
851
851
|
var _a;
|
|
852
852
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
853
|
-
if (bearer
|
|
854
|
-
|
|
853
|
+
if (bearer == null) {
|
|
854
|
+
throw new errors.PhonicError({
|
|
855
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
856
|
+
});
|
|
855
857
|
}
|
|
856
|
-
return
|
|
858
|
+
return `Bearer ${bearer}`;
|
|
857
859
|
});
|
|
858
860
|
}
|
|
859
861
|
}
|
|
@@ -138,5 +138,5 @@ export declare class ExtractionSchemas {
|
|
|
138
138
|
*/
|
|
139
139
|
update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>;
|
|
140
140
|
private __update;
|
|
141
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
141
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
142
142
|
}
|
|
@@ -425,10 +425,12 @@ export class ExtractionSchemas {
|
|
|
425
425
|
return __awaiter(this, void 0, void 0, function* () {
|
|
426
426
|
var _a;
|
|
427
427
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
428
|
-
if (bearer
|
|
429
|
-
|
|
428
|
+
if (bearer == null) {
|
|
429
|
+
throw new errors.PhonicError({
|
|
430
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
431
|
+
});
|
|
430
432
|
}
|
|
431
|
-
return
|
|
433
|
+
return `Bearer ${bearer}`;
|
|
432
434
|
});
|
|
433
435
|
}
|
|
434
436
|
}
|
|
@@ -113,7 +113,7 @@ export declare class Projects {
|
|
|
113
113
|
* default_agent: "another-agent"
|
|
114
114
|
* })
|
|
115
115
|
*/
|
|
116
|
-
update(nameOrId: string, request
|
|
116
|
+
update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
|
|
117
117
|
private __update;
|
|
118
118
|
/**
|
|
119
119
|
* Returns all conversation evaluation prompts for a project.
|
|
@@ -153,5 +153,5 @@ export declare class Projects {
|
|
|
153
153
|
*/
|
|
154
154
|
createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
|
|
155
155
|
private __createEvalPrompt;
|
|
156
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
156
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
157
157
|
}
|
|
@@ -313,11 +313,11 @@ export class Projects {
|
|
|
313
313
|
* default_agent: "another-agent"
|
|
314
314
|
* })
|
|
315
315
|
*/
|
|
316
|
-
update(nameOrId, request, requestOptions) {
|
|
316
|
+
update(nameOrId, request = {}, requestOptions) {
|
|
317
317
|
return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
|
|
318
318
|
}
|
|
319
|
-
__update(
|
|
320
|
-
return __awaiter(this,
|
|
319
|
+
__update(nameOrId_1) {
|
|
320
|
+
return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
|
|
321
321
|
var _a, _b, _c, _d;
|
|
322
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
323
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -536,10 +536,12 @@ export class Projects {
|
|
|
536
536
|
return __awaiter(this, void 0, void 0, function* () {
|
|
537
537
|
var _a;
|
|
538
538
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
539
|
-
if (bearer
|
|
540
|
-
|
|
539
|
+
if (bearer == null) {
|
|
540
|
+
throw new errors.PhonicError({
|
|
541
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
542
|
+
});
|
|
541
543
|
}
|
|
542
|
-
return
|
|
544
|
+
return `Bearer ${bearer}`;
|
|
543
545
|
});
|
|
544
546
|
}
|
|
545
547
|
}
|
|
@@ -11,5 +11,6 @@
|
|
|
11
11
|
export interface UpdateProjectRequest {
|
|
12
12
|
/** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
|
|
13
13
|
name?: string;
|
|
14
|
-
|
|
14
|
+
/** The name of the new project's default agent. Set to `null` to remove the default agent. */
|
|
15
|
+
default_agent?: string | null;
|
|
15
16
|
}
|
|
@@ -210,5 +210,5 @@ export declare class Tools {
|
|
|
210
210
|
*/
|
|
211
211
|
update(nameOrId: string, request?: Phonic.UpdateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsUpdateResponse>;
|
|
212
212
|
private __update;
|
|
213
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
213
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
214
214
|
}
|
|
@@ -490,10 +490,12 @@ export class Tools {
|
|
|
490
490
|
return __awaiter(this, void 0, void 0, function* () {
|
|
491
491
|
var _a;
|
|
492
492
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
493
|
-
if (bearer
|
|
494
|
-
|
|
493
|
+
if (bearer == null) {
|
|
494
|
+
throw new errors.PhonicError({
|
|
495
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
496
|
+
});
|
|
495
497
|
}
|
|
496
|
-
return
|
|
498
|
+
return `Bearer ${bearer}`;
|
|
497
499
|
});
|
|
498
500
|
}
|
|
499
501
|
}
|
|
@@ -61,5 +61,5 @@ export declare class Voices {
|
|
|
61
61
|
*/
|
|
62
62
|
get(id: string, requestOptions?: Voices.RequestOptions): core.HttpResponsePromise<Phonic.VoicesGetResponse>;
|
|
63
63
|
private __get;
|
|
64
|
-
protected _getAuthorizationHeader(): Promise<string
|
|
64
|
+
protected _getAuthorizationHeader(): Promise<string>;
|
|
65
65
|
}
|
|
@@ -157,10 +157,12 @@ export class Voices {
|
|
|
157
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
158
|
var _a;
|
|
159
159
|
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
|
|
160
|
-
if (bearer
|
|
161
|
-
|
|
160
|
+
if (bearer == null) {
|
|
161
|
+
throw new errors.PhonicError({
|
|
162
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
|
|
163
|
+
});
|
|
162
164
|
}
|
|
163
|
-
return
|
|
165
|
+
return `Bearer ${bearer}`;
|
|
164
166
|
});
|
|
165
167
|
}
|
|
166
168
|
}
|
|
@@ -5,7 +5,8 @@ import * as Phonic from "../index.mjs";
|
|
|
5
5
|
export interface CreateAgentRequest {
|
|
6
6
|
/** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
|
|
7
7
|
name: string;
|
|
8
|
-
|
|
8
|
+
/** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
|
|
9
|
+
phone_number?: CreateAgentRequest.PhoneNumber | null;
|
|
9
10
|
/** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
|
|
10
11
|
custom_phone_number?: string | null;
|
|
11
12
|
/** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
|
|
@@ -35,6 +35,8 @@ export * from "./InputCancelledPayload.mjs";
|
|
|
35
35
|
export * from "./AudioChunkResponsePayload.mjs";
|
|
36
36
|
export * from "./UserStartedSpeakingPayload.mjs";
|
|
37
37
|
export * from "./UserFinishedSpeakingPayload.mjs";
|
|
38
|
+
export * from "./AssistantStartedSpeakingPayload.mjs";
|
|
39
|
+
export * from "./AssistantFinishedSpeakingPayload.mjs";
|
|
38
40
|
export * from "./IsUserSpeakingPayload.mjs";
|
|
39
41
|
export * from "./DtmfPayload.mjs";
|
|
40
42
|
export * from "./ToolCallPayload.mjs";
|
|
@@ -35,6 +35,8 @@ export * from "./InputCancelledPayload.mjs";
|
|
|
35
35
|
export * from "./AudioChunkResponsePayload.mjs";
|
|
36
36
|
export * from "./UserStartedSpeakingPayload.mjs";
|
|
37
37
|
export * from "./UserFinishedSpeakingPayload.mjs";
|
|
38
|
+
export * from "./AssistantStartedSpeakingPayload.mjs";
|
|
39
|
+
export * from "./AssistantFinishedSpeakingPayload.mjs";
|
|
38
40
|
export * from "./IsUserSpeakingPayload.mjs";
|
|
39
41
|
export * from "./DtmfPayload.mjs";
|
|
40
42
|
export * from "./ToolCallPayload.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.36";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.30.
|
|
1
|
+
export const SDK_VERSION = "0.30.36";
|