phonic 0.30.33 → 0.30.34
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 +47 -12
- package/dist/cjs/api/resources/agents/client/Client.js +119 -18
- package/dist/cjs/api/resources/agents/client/requests/AgentsAddCustomPhoneNumberRequest.d.ts +23 -1
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +11 -3
- package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.d.ts +16 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.js +5 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.d.ts +38 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.js +5 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +13 -5
- package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +2 -2
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +2 -1
- package/dist/cjs/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.d.ts +6 -0
- package/dist/cjs/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.js +5 -0
- package/dist/cjs/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.d.ts +6 -0
- package/dist/cjs/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.js +5 -0
- package/dist/cjs/api/resources/agents/types/index.d.ts +2 -1
- package/dist/cjs/api/resources/agents/types/index.js +2 -1
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/conversations/client/Client.js +1 -1
- package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -1
- package/dist/cjs/api/types/Agent.d.ts +8 -0
- package/dist/cjs/api/types/CreateAgentRequest.d.ts +11 -3
- 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 +47 -12
- package/dist/esm/api/resources/agents/client/Client.mjs +119 -18
- package/dist/esm/api/resources/agents/client/requests/AgentsAddCustomPhoneNumberRequest.d.mts +23 -1
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +11 -3
- package/dist/esm/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.d.mts +16 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.mjs +4 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.d.mts +38 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsUpdatePhoneNumberRequest.mjs +4 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +13 -5
- package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +2 -2
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +2 -1
- package/dist/esm/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.d.mts +6 -0
- package/dist/esm/api/resources/agents/types/AgentsDeleteCustomPhoneNumberResponse.mjs +4 -0
- package/dist/esm/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.d.mts +6 -0
- package/dist/esm/api/resources/agents/types/AgentsUpdatePhoneNumberResponse.mjs +4 -0
- package/dist/esm/api/resources/agents/types/index.d.mts +2 -1
- package/dist/esm/api/resources/agents/types/index.mjs +2 -1
- package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/conversations/client/Client.mjs +1 -1
- package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -1
- package/dist/esm/api/types/Agent.d.mts +8 -0
- package/dist/esm/api/types/CreateAgentRequest.d.mts +11 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/index.d.mts +686 -0
- package/dist/index.d.ts +686 -0
- package/dist/index.js +643 -0
- package/dist/index.mjs +606 -0
- 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.34",
|
|
55
|
+
"User-Agent": "phonic/0.30.34",
|
|
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) });
|
|
@@ -61,7 +61,7 @@ export declare class Agents {
|
|
|
61
61
|
* name: "support-agent",
|
|
62
62
|
* phone_number: "assign-automatically",
|
|
63
63
|
* timezone: "America/Los_Angeles",
|
|
64
|
-
* voice_id: "
|
|
64
|
+
* voice_id: "sabrina",
|
|
65
65
|
* audio_speed: 1,
|
|
66
66
|
* background_noise_level: 0,
|
|
67
67
|
* generate_welcome_message: false,
|
|
@@ -69,7 +69,7 @@ export declare class Agents {
|
|
|
69
69
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
70
70
|
* template_variables: {
|
|
71
71
|
* "customer_name": {
|
|
72
|
-
* default_value:
|
|
72
|
+
* default_value: "David"
|
|
73
73
|
* },
|
|
74
74
|
* "subject": {
|
|
75
75
|
* default_value: "Chess"
|
|
@@ -106,7 +106,7 @@ export declare class Agents {
|
|
|
106
106
|
* name: "support-agent",
|
|
107
107
|
* phone_number: "assign-automatically",
|
|
108
108
|
* timezone: "America/Los_Angeles",
|
|
109
|
-
* voice_id: "
|
|
109
|
+
* voice_id: "sabrina",
|
|
110
110
|
* audio_speed: 1,
|
|
111
111
|
* background_noise_level: 0,
|
|
112
112
|
* generate_welcome_message: false,
|
|
@@ -114,7 +114,7 @@ export declare class Agents {
|
|
|
114
114
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
115
115
|
* template_variables: {
|
|
116
116
|
* "customer_name": {
|
|
117
|
-
* default_value:
|
|
117
|
+
* default_value: "David"
|
|
118
118
|
* },
|
|
119
119
|
* "subject": {
|
|
120
120
|
* default_value: "Chess"
|
|
@@ -187,7 +187,7 @@ export declare class Agents {
|
|
|
187
187
|
* name: "updated-support-agent",
|
|
188
188
|
* phone_number: "assign-automatically",
|
|
189
189
|
* timezone: "America/Los_Angeles",
|
|
190
|
-
* voice_id: "
|
|
190
|
+
* voice_id: "sabrina",
|
|
191
191
|
* audio_speed: 1,
|
|
192
192
|
* background_noise_level: 0,
|
|
193
193
|
* generate_welcome_message: false,
|
|
@@ -195,7 +195,7 @@ export declare class Agents {
|
|
|
195
195
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
196
196
|
* template_variables: {
|
|
197
197
|
* "customer_name": {
|
|
198
|
-
* default_value:
|
|
198
|
+
* default_value: "David"
|
|
199
199
|
* },
|
|
200
200
|
* "subject": {
|
|
201
201
|
* default_value: "Chess"
|
|
@@ -233,16 +233,23 @@ export declare class Agents {
|
|
|
233
233
|
* @example
|
|
234
234
|
* await client.agents.addCustomPhoneNumber("nameOrId", {
|
|
235
235
|
* project: "main",
|
|
236
|
-
* phone_number: "+15551234567"
|
|
236
|
+
* phone_number: "+15551234567",
|
|
237
|
+
* configuration_endpoint: {
|
|
238
|
+
* url: "https://api.example.com/config",
|
|
239
|
+
* headers: {
|
|
240
|
+
* "Authorization": "Bearer token123"
|
|
241
|
+
* },
|
|
242
|
+
* timeout_ms: 7000
|
|
243
|
+
* }
|
|
237
244
|
* })
|
|
238
245
|
*/
|
|
239
246
|
addCustomPhoneNumber(nameOrId: string, request: Phonic.AgentsAddCustomPhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsAddCustomPhoneNumberResponse>;
|
|
240
247
|
private __addCustomPhoneNumber;
|
|
241
248
|
/**
|
|
242
|
-
*
|
|
249
|
+
* Deletes a custom phone number from an agent.
|
|
243
250
|
*
|
|
244
251
|
* @param {string} nameOrId - The name or the ID of the agent.
|
|
245
|
-
* @param {Phonic.
|
|
252
|
+
* @param {Phonic.AgentsDeleteCustomPhoneNumberRequest} request
|
|
246
253
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
247
254
|
*
|
|
248
255
|
* @throws {@link Phonic.BadRequestError}
|
|
@@ -252,12 +259,40 @@ export declare class Agents {
|
|
|
252
259
|
* @throws {@link Phonic.ConflictError}
|
|
253
260
|
*
|
|
254
261
|
* @example
|
|
255
|
-
* await client.agents.
|
|
262
|
+
* await client.agents.deleteCustomPhoneNumber("nameOrId", {
|
|
256
263
|
* project: "main",
|
|
257
264
|
* phone_number: "+15551234567"
|
|
258
265
|
* })
|
|
259
266
|
*/
|
|
260
|
-
|
|
261
|
-
private
|
|
267
|
+
deleteCustomPhoneNumber(nameOrId: string, request: Phonic.AgentsDeleteCustomPhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsDeleteCustomPhoneNumberResponse>;
|
|
268
|
+
private __deleteCustomPhoneNumber;
|
|
269
|
+
/**
|
|
270
|
+
* Updates a phone number on an agent.
|
|
271
|
+
*
|
|
272
|
+
* @param {string} nameOrId - The name or the ID of the agent.
|
|
273
|
+
* @param {Phonic.AgentsUpdatePhoneNumberRequest} request
|
|
274
|
+
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
275
|
+
*
|
|
276
|
+
* @throws {@link Phonic.BadRequestError}
|
|
277
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
278
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
279
|
+
* @throws {@link Phonic.NotFoundError}
|
|
280
|
+
* @throws {@link Phonic.ConflictError}
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* await client.agents.updatePhoneNumber("nameOrId", {
|
|
284
|
+
* project: "main",
|
|
285
|
+
* phone_number: "+15551234567",
|
|
286
|
+
* configuration_endpoint: {
|
|
287
|
+
* url: "https://api.example.com/config",
|
|
288
|
+
* headers: {
|
|
289
|
+
* "Authorization": "Bearer token123"
|
|
290
|
+
* },
|
|
291
|
+
* timeout_ms: 7000
|
|
292
|
+
* }
|
|
293
|
+
* })
|
|
294
|
+
*/
|
|
295
|
+
updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
|
|
296
|
+
private __updatePhoneNumber;
|
|
262
297
|
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
263
298
|
}
|
|
@@ -151,7 +151,7 @@ class Agents {
|
|
|
151
151
|
* name: "support-agent",
|
|
152
152
|
* phone_number: "assign-automatically",
|
|
153
153
|
* timezone: "America/Los_Angeles",
|
|
154
|
-
* voice_id: "
|
|
154
|
+
* voice_id: "sabrina",
|
|
155
155
|
* audio_speed: 1,
|
|
156
156
|
* background_noise_level: 0,
|
|
157
157
|
* generate_welcome_message: false,
|
|
@@ -159,7 +159,7 @@ class Agents {
|
|
|
159
159
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
160
160
|
* template_variables: {
|
|
161
161
|
* "customer_name": {
|
|
162
|
-
* default_value:
|
|
162
|
+
* default_value: "David"
|
|
163
163
|
* },
|
|
164
164
|
* "subject": {
|
|
165
165
|
* default_value: "Chess"
|
|
@@ -257,7 +257,7 @@ class Agents {
|
|
|
257
257
|
* name: "support-agent",
|
|
258
258
|
* phone_number: "assign-automatically",
|
|
259
259
|
* timezone: "America/Los_Angeles",
|
|
260
|
-
* voice_id: "
|
|
260
|
+
* voice_id: "sabrina",
|
|
261
261
|
* audio_speed: 1,
|
|
262
262
|
* background_noise_level: 0,
|
|
263
263
|
* generate_welcome_message: false,
|
|
@@ -265,7 +265,7 @@ class Agents {
|
|
|
265
265
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
266
266
|
* template_variables: {
|
|
267
267
|
* "customer_name": {
|
|
268
|
-
* default_value:
|
|
268
|
+
* default_value: "David"
|
|
269
269
|
* },
|
|
270
270
|
* "subject": {
|
|
271
271
|
* default_value: "Chess"
|
|
@@ -503,7 +503,7 @@ class Agents {
|
|
|
503
503
|
* name: "updated-support-agent",
|
|
504
504
|
* phone_number: "assign-automatically",
|
|
505
505
|
* timezone: "America/Los_Angeles",
|
|
506
|
-
* voice_id: "
|
|
506
|
+
* voice_id: "sabrina",
|
|
507
507
|
* audio_speed: 1,
|
|
508
508
|
* background_noise_level: 0,
|
|
509
509
|
* generate_welcome_message: false,
|
|
@@ -511,7 +511,7 @@ class Agents {
|
|
|
511
511
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
512
512
|
* template_variables: {
|
|
513
513
|
* "customer_name": {
|
|
514
|
-
* default_value:
|
|
514
|
+
* default_value: "David"
|
|
515
515
|
* },
|
|
516
516
|
* "subject": {
|
|
517
517
|
* default_value: "Chess"
|
|
@@ -608,7 +608,14 @@ class Agents {
|
|
|
608
608
|
* @example
|
|
609
609
|
* await client.agents.addCustomPhoneNumber("nameOrId", {
|
|
610
610
|
* project: "main",
|
|
611
|
-
* phone_number: "+15551234567"
|
|
611
|
+
* phone_number: "+15551234567",
|
|
612
|
+
* configuration_endpoint: {
|
|
613
|
+
* url: "https://api.example.com/config",
|
|
614
|
+
* headers: {
|
|
615
|
+
* "Authorization": "Bearer token123"
|
|
616
|
+
* },
|
|
617
|
+
* timeout_ms: 7000
|
|
618
|
+
* }
|
|
612
619
|
* })
|
|
613
620
|
*/
|
|
614
621
|
addCustomPhoneNumber(nameOrId, request, requestOptions) {
|
|
@@ -630,7 +637,7 @@ class Agents {
|
|
|
630
637
|
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
631
638
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
632
639
|
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)
|
|
633
|
-
.base, `agents/${encodeURIComponent(nameOrId)}/
|
|
640
|
+
.base, `agents/${encodeURIComponent(nameOrId)}/custom-phone-numbers`),
|
|
634
641
|
method: "POST",
|
|
635
642
|
headers: _headers,
|
|
636
643
|
contentType: "application/json",
|
|
@@ -675,7 +682,7 @@ class Agents {
|
|
|
675
682
|
rawResponse: _response.rawResponse,
|
|
676
683
|
});
|
|
677
684
|
case "timeout":
|
|
678
|
-
throw new errors.PhonicTimeoutError("Timeout exceeded when calling POST /agents/{nameOrId}/
|
|
685
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling POST /agents/{nameOrId}/custom-phone-numbers.");
|
|
679
686
|
case "unknown":
|
|
680
687
|
throw new errors.PhonicError({
|
|
681
688
|
message: _response.error.errorMessage,
|
|
@@ -685,10 +692,10 @@ class Agents {
|
|
|
685
692
|
});
|
|
686
693
|
}
|
|
687
694
|
/**
|
|
688
|
-
*
|
|
695
|
+
* Deletes a custom phone number from an agent.
|
|
689
696
|
*
|
|
690
697
|
* @param {string} nameOrId - The name or the ID of the agent.
|
|
691
|
-
* @param {Phonic.
|
|
698
|
+
* @param {Phonic.AgentsDeleteCustomPhoneNumberRequest} request
|
|
692
699
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
693
700
|
*
|
|
694
701
|
* @throws {@link Phonic.BadRequestError}
|
|
@@ -698,15 +705,15 @@ class Agents {
|
|
|
698
705
|
* @throws {@link Phonic.ConflictError}
|
|
699
706
|
*
|
|
700
707
|
* @example
|
|
701
|
-
* await client.agents.
|
|
708
|
+
* await client.agents.deleteCustomPhoneNumber("nameOrId", {
|
|
702
709
|
* project: "main",
|
|
703
710
|
* phone_number: "+15551234567"
|
|
704
711
|
* })
|
|
705
712
|
*/
|
|
706
|
-
|
|
707
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
713
|
+
deleteCustomPhoneNumber(nameOrId, request, requestOptions) {
|
|
714
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCustomPhoneNumber(nameOrId, request, requestOptions));
|
|
708
715
|
}
|
|
709
|
-
|
|
716
|
+
__deleteCustomPhoneNumber(nameOrId, request, requestOptions) {
|
|
710
717
|
return __awaiter(this, void 0, void 0, function* () {
|
|
711
718
|
var _a, _b, _c, _d;
|
|
712
719
|
const { project } = request, _body = __rest(request, ["project"]);
|
|
@@ -717,8 +724,102 @@ class Agents {
|
|
|
717
724
|
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);
|
|
718
725
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
719
726
|
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)
|
|
720
|
-
.base, `agents/${encodeURIComponent(nameOrId)}/
|
|
721
|
-
method: "
|
|
727
|
+
.base, `agents/${encodeURIComponent(nameOrId)}/custom-phone-numbers`),
|
|
728
|
+
method: "DELETE",
|
|
729
|
+
headers: _headers,
|
|
730
|
+
contentType: "application/json",
|
|
731
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
732
|
+
requestType: "json",
|
|
733
|
+
body: _body,
|
|
734
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
735
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
736
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
737
|
+
});
|
|
738
|
+
if (_response.ok) {
|
|
739
|
+
return {
|
|
740
|
+
data: _response.body,
|
|
741
|
+
rawResponse: _response.rawResponse,
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
if (_response.error.reason === "status-code") {
|
|
745
|
+
switch (_response.error.statusCode) {
|
|
746
|
+
case 400:
|
|
747
|
+
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
748
|
+
case 401:
|
|
749
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
750
|
+
case 403:
|
|
751
|
+
throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
752
|
+
case 404:
|
|
753
|
+
throw new Phonic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
754
|
+
case 409:
|
|
755
|
+
throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
|
|
756
|
+
default:
|
|
757
|
+
throw new errors.PhonicError({
|
|
758
|
+
statusCode: _response.error.statusCode,
|
|
759
|
+
body: _response.error.body,
|
|
760
|
+
rawResponse: _response.rawResponse,
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
switch (_response.error.reason) {
|
|
765
|
+
case "non-json":
|
|
766
|
+
throw new errors.PhonicError({
|
|
767
|
+
statusCode: _response.error.statusCode,
|
|
768
|
+
body: _response.error.rawBody,
|
|
769
|
+
rawResponse: _response.rawResponse,
|
|
770
|
+
});
|
|
771
|
+
case "timeout":
|
|
772
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling DELETE /agents/{nameOrId}/custom-phone-numbers.");
|
|
773
|
+
case "unknown":
|
|
774
|
+
throw new errors.PhonicError({
|
|
775
|
+
message: _response.error.errorMessage,
|
|
776
|
+
rawResponse: _response.rawResponse,
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Updates a phone number on an agent.
|
|
783
|
+
*
|
|
784
|
+
* @param {string} nameOrId - The name or the ID of the agent.
|
|
785
|
+
* @param {Phonic.AgentsUpdatePhoneNumberRequest} request
|
|
786
|
+
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
787
|
+
*
|
|
788
|
+
* @throws {@link Phonic.BadRequestError}
|
|
789
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
790
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
791
|
+
* @throws {@link Phonic.NotFoundError}
|
|
792
|
+
* @throws {@link Phonic.ConflictError}
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* await client.agents.updatePhoneNumber("nameOrId", {
|
|
796
|
+
* project: "main",
|
|
797
|
+
* phone_number: "+15551234567",
|
|
798
|
+
* configuration_endpoint: {
|
|
799
|
+
* url: "https://api.example.com/config",
|
|
800
|
+
* headers: {
|
|
801
|
+
* "Authorization": "Bearer token123"
|
|
802
|
+
* },
|
|
803
|
+
* timeout_ms: 7000
|
|
804
|
+
* }
|
|
805
|
+
* })
|
|
806
|
+
*/
|
|
807
|
+
updatePhoneNumber(nameOrId, request, requestOptions) {
|
|
808
|
+
return core.HttpResponsePromise.fromPromise(this.__updatePhoneNumber(nameOrId, request, requestOptions));
|
|
809
|
+
}
|
|
810
|
+
__updatePhoneNumber(nameOrId, request, requestOptions) {
|
|
811
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
812
|
+
var _a, _b, _c, _d;
|
|
813
|
+
const { project } = request, _body = __rest(request, ["project"]);
|
|
814
|
+
const _queryParams = {};
|
|
815
|
+
if (project != null) {
|
|
816
|
+
_queryParams["project"] = project;
|
|
817
|
+
}
|
|
818
|
+
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);
|
|
819
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
820
|
+
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)
|
|
821
|
+
.base, `agents/${encodeURIComponent(nameOrId)}/phone-numbers`),
|
|
822
|
+
method: "PATCH",
|
|
722
823
|
headers: _headers,
|
|
723
824
|
contentType: "application/json",
|
|
724
825
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -762,7 +863,7 @@ class Agents {
|
|
|
762
863
|
rawResponse: _response.rawResponse,
|
|
763
864
|
});
|
|
764
865
|
case "timeout":
|
|
765
|
-
throw new errors.PhonicTimeoutError("Timeout exceeded when calling
|
|
866
|
+
throw new errors.PhonicTimeoutError("Timeout exceeded when calling PATCH /agents/{nameOrId}/phone-numbers.");
|
|
766
867
|
case "unknown":
|
|
767
868
|
throw new errors.PhonicError({
|
|
768
869
|
message: _response.error.errorMessage,
|
package/dist/cjs/api/resources/agents/client/requests/AgentsAddCustomPhoneNumberRequest.d.ts
CHANGED
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
7
|
* project: "main",
|
|
8
|
-
* phone_number: "+15551234567"
|
|
8
|
+
* phone_number: "+15551234567",
|
|
9
|
+
* configuration_endpoint: {
|
|
10
|
+
* url: "https://api.example.com/config",
|
|
11
|
+
* headers: {
|
|
12
|
+
* "Authorization": "Bearer token123"
|
|
13
|
+
* },
|
|
14
|
+
* timeout_ms: 7000
|
|
15
|
+
* }
|
|
9
16
|
* }
|
|
10
17
|
*/
|
|
11
18
|
export interface AgentsAddCustomPhoneNumberRequest {
|
|
@@ -19,4 +26,19 @@ export interface AgentsAddCustomPhoneNumberRequest {
|
|
|
19
26
|
"X-Sip-Auth-Password"?: string;
|
|
20
27
|
/** The E.164 formatted phone number to add (e.g., "+15551234567"). */
|
|
21
28
|
phone_number: string;
|
|
29
|
+
/** When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number. */
|
|
30
|
+
configuration_endpoint?: AgentsAddCustomPhoneNumberRequest.ConfigurationEndpoint | null;
|
|
31
|
+
}
|
|
32
|
+
export declare namespace AgentsAddCustomPhoneNumberRequest {
|
|
33
|
+
/**
|
|
34
|
+
* When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number.
|
|
35
|
+
*/
|
|
36
|
+
interface ConfigurationEndpoint {
|
|
37
|
+
/** URL to call */
|
|
38
|
+
url: string;
|
|
39
|
+
/** Object of key-value pairs. */
|
|
40
|
+
headers?: Record<string, string>;
|
|
41
|
+
/** Timeout in milliseconds for the endpoint call. */
|
|
42
|
+
timeout_ms?: number;
|
|
43
|
+
}
|
|
22
44
|
}
|
|
@@ -9,7 +9,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
9
9
|
* name: "support-agent",
|
|
10
10
|
* phone_number: "assign-automatically",
|
|
11
11
|
* timezone: "America/Los_Angeles",
|
|
12
|
-
* voice_id: "
|
|
12
|
+
* voice_id: "sabrina",
|
|
13
13
|
* audio_speed: 1,
|
|
14
14
|
* background_noise_level: 0,
|
|
15
15
|
* generate_welcome_message: false,
|
|
@@ -17,7 +17,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
17
17
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
18
18
|
* template_variables: {
|
|
19
19
|
* "customer_name": {
|
|
20
|
-
* default_value:
|
|
20
|
+
* default_value: "David"
|
|
21
21
|
* },
|
|
22
22
|
* "subject": {
|
|
23
23
|
* default_value: "Chess"
|
|
@@ -81,10 +81,18 @@ export interface AgentsCreateRequest {
|
|
|
81
81
|
languages?: Phonic.LanguageCode[];
|
|
82
82
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
83
83
|
boosted_keywords?: string[];
|
|
84
|
-
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint
|
|
84
|
+
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
85
85
|
configuration_endpoint?: Phonic.CreateAgentRequest.ConfigurationEndpoint | null;
|
|
86
86
|
/** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Defaults to `1.0`. Requires `phone_number` to be set when less than 1.0. */
|
|
87
87
|
inbound_rollout?: number;
|
|
88
88
|
/** E.164 formatted phone number where non-agent calls will be forwarded. Required when `inbound_rollout < 1.0`, must be `null` when `inbound_rollout = 1.0`. Defaults to `null`. */
|
|
89
89
|
inbound_rollout_forward_phone_number?: string | null;
|
|
90
|
+
/** Voice activity detection prebuffer duration in milliseconds. */
|
|
91
|
+
vad_prebuffer_duration_ms?: number;
|
|
92
|
+
/** Minimum speech duration for voice activity detection in milliseconds. */
|
|
93
|
+
vad_min_speech_duration_ms?: number;
|
|
94
|
+
/** Minimum silence duration for voice activity detection in milliseconds. */
|
|
95
|
+
vad_min_silence_duration_ms?: number;
|
|
96
|
+
/** Voice activity detection threshold. */
|
|
97
|
+
vad_threshold?: number;
|
|
90
98
|
}
|
package/dist/cjs/api/resources/agents/client/requests/AgentsDeleteCustomPhoneNumberRequest.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* project: "main",
|
|
8
|
+
* phone_number: "+15551234567"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface AgentsDeleteCustomPhoneNumberRequest {
|
|
12
|
+
/** The name of the project containing the agent. Only used when `nameOrId` is a name. */
|
|
13
|
+
project?: string;
|
|
14
|
+
/** The E.164 formatted phone number to remove (e.g., "+15551234567"). */
|
|
15
|
+
phone_number: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* project: "main",
|
|
8
|
+
* phone_number: "+15551234567",
|
|
9
|
+
* configuration_endpoint: {
|
|
10
|
+
* url: "https://api.example.com/config",
|
|
11
|
+
* headers: {
|
|
12
|
+
* "Authorization": "Bearer token123"
|
|
13
|
+
* },
|
|
14
|
+
* timeout_ms: 7000
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export interface AgentsUpdatePhoneNumberRequest {
|
|
19
|
+
/** The name of the project containing the agent. Only used when `nameOrId` is a name. */
|
|
20
|
+
project?: string;
|
|
21
|
+
/** The E.164 formatted phone number to add (e.g., "+15551234567"). */
|
|
22
|
+
phone_number: string;
|
|
23
|
+
/** When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number. */
|
|
24
|
+
configuration_endpoint?: AgentsUpdatePhoneNumberRequest.ConfigurationEndpoint | null;
|
|
25
|
+
}
|
|
26
|
+
export declare namespace AgentsUpdatePhoneNumberRequest {
|
|
27
|
+
/**
|
|
28
|
+
* When not `null`, the agent will call this endpoint to get configuration options for calls on this phone number.
|
|
29
|
+
*/
|
|
30
|
+
interface ConfigurationEndpoint {
|
|
31
|
+
/** URL to call */
|
|
32
|
+
url: string;
|
|
33
|
+
/** Object of key-value pairs. */
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
/** Timeout in milliseconds for the endpoint call. */
|
|
36
|
+
timeout_ms?: number;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -9,7 +9,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
9
9
|
* name: "updated-support-agent",
|
|
10
10
|
* phone_number: "assign-automatically",
|
|
11
11
|
* timezone: "America/Los_Angeles",
|
|
12
|
-
* voice_id: "
|
|
12
|
+
* voice_id: "sabrina",
|
|
13
13
|
* audio_speed: 1,
|
|
14
14
|
* background_noise_level: 0,
|
|
15
15
|
* generate_welcome_message: false,
|
|
@@ -17,7 +17,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
17
17
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
18
18
|
* template_variables: {
|
|
19
19
|
* "customer_name": {
|
|
20
|
-
* default_value:
|
|
20
|
+
* default_value: "David"
|
|
21
21
|
* },
|
|
22
22
|
* "subject": {
|
|
23
23
|
* default_value: "Chess"
|
|
@@ -81,12 +81,20 @@ export interface UpdateAgentRequest {
|
|
|
81
81
|
languages?: Phonic.LanguageCode[];
|
|
82
82
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
83
83
|
boosted_keywords?: string[];
|
|
84
|
-
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint
|
|
84
|
+
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
85
85
|
configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
|
|
86
86
|
/** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Requires `phone_number` to be set when less than 1.0. */
|
|
87
87
|
inbound_rollout?: number;
|
|
88
88
|
/** E.164 formatted phone number where non-agent calls will be forwarded. Required when `inbound_rollout < 1.0`, must be `null` when `inbound_rollout = 1.0`. */
|
|
89
89
|
inbound_rollout_forward_phone_number?: string | null;
|
|
90
|
+
/** Voice activity detection prebuffer duration in milliseconds. */
|
|
91
|
+
vad_prebuffer_duration_ms?: number;
|
|
92
|
+
/** Minimum speech duration for voice activity detection in milliseconds. */
|
|
93
|
+
vad_min_speech_duration_ms?: number;
|
|
94
|
+
/** Minimum silence duration for voice activity detection in milliseconds. */
|
|
95
|
+
vad_min_silence_duration_ms?: number;
|
|
96
|
+
/** Voice activity detection threshold. */
|
|
97
|
+
vad_threshold?: number;
|
|
90
98
|
}
|
|
91
99
|
export declare namespace UpdateAgentRequest {
|
|
92
100
|
type PhoneNumber = "assign-automatically" | "custom";
|
|
@@ -115,7 +123,7 @@ export declare namespace UpdateAgentRequest {
|
|
|
115
123
|
};
|
|
116
124
|
namespace TemplateVariables {
|
|
117
125
|
interface Value {
|
|
118
|
-
default_value: string
|
|
126
|
+
default_value: string;
|
|
119
127
|
is_boosted_keyword?: boolean;
|
|
120
128
|
}
|
|
121
129
|
}
|
|
@@ -127,7 +135,7 @@ export declare namespace UpdateAgentRequest {
|
|
|
127
135
|
| string;
|
|
128
136
|
}
|
|
129
137
|
/**
|
|
130
|
-
* When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint
|
|
138
|
+
* When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
|
|
131
139
|
*/
|
|
132
140
|
interface ConfigurationEndpoint {
|
|
133
141
|
/** URL to call */
|
|
@@ -9,7 +9,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
9
9
|
* name: "support-agent",
|
|
10
10
|
* phone_number: "assign-automatically",
|
|
11
11
|
* timezone: "America/Los_Angeles",
|
|
12
|
-
* voice_id: "
|
|
12
|
+
* voice_id: "sabrina",
|
|
13
13
|
* audio_speed: 1,
|
|
14
14
|
* background_noise_level: 0,
|
|
15
15
|
* generate_welcome_message: false,
|
|
@@ -17,7 +17,7 @@ import * as Phonic from "../../../../index.js";
|
|
|
17
17
|
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
|
|
18
18
|
* template_variables: {
|
|
19
19
|
* "customer_name": {
|
|
20
|
-
* default_value:
|
|
20
|
+
* default_value: "David"
|
|
21
21
|
* },
|
|
22
22
|
* "subject": {
|
|
23
23
|
* default_value: "Chess"
|
|
@@ -5,4 +5,5 @@ export { type AgentsGetRequest } from "./AgentsGetRequest.js";
|
|
|
5
5
|
export { type AgentsDeleteRequest } from "./AgentsDeleteRequest.js";
|
|
6
6
|
export { type UpdateAgentRequest } from "./UpdateAgentRequest.js";
|
|
7
7
|
export { type AgentsAddCustomPhoneNumberRequest } from "./AgentsAddCustomPhoneNumberRequest.js";
|
|
8
|
-
export { type
|
|
8
|
+
export { type AgentsDeleteCustomPhoneNumberRequest } from "./AgentsDeleteCustomPhoneNumberRequest.js";
|
|
9
|
+
export { type AgentsUpdatePhoneNumberRequest } from "./AgentsUpdatePhoneNumberRequest.js";
|
|
@@ -5,4 +5,5 @@ export * from "./AgentsGetResponse.js";
|
|
|
5
5
|
export * from "./AgentsDeleteResponse.js";
|
|
6
6
|
export * from "./AgentsUpdateResponse.js";
|
|
7
7
|
export * from "./AgentsAddCustomPhoneNumberResponse.js";
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./AgentsDeleteCustomPhoneNumberResponse.js";
|
|
9
|
+
export * from "./AgentsUpdatePhoneNumberResponse.js";
|
|
@@ -21,4 +21,5 @@ __exportStar(require("./AgentsGetResponse.js"), exports);
|
|
|
21
21
|
__exportStar(require("./AgentsDeleteResponse.js"), exports);
|
|
22
22
|
__exportStar(require("./AgentsUpdateResponse.js"), exports);
|
|
23
23
|
__exportStar(require("./AgentsAddCustomPhoneNumberResponse.js"), exports);
|
|
24
|
-
__exportStar(require("./
|
|
24
|
+
__exportStar(require("./AgentsDeleteCustomPhoneNumberResponse.js"), exports);
|
|
25
|
+
__exportStar(require("./AgentsUpdatePhoneNumberResponse.js"), exports);
|
|
@@ -201,7 +201,7 @@ export declare class Conversations {
|
|
|
201
201
|
* "customer_name": "David",
|
|
202
202
|
* "subject": "Chess"
|
|
203
203
|
* },
|
|
204
|
-
* voice_id: "
|
|
204
|
+
* voice_id: "sabrina",
|
|
205
205
|
* no_input_poke_sec: 30,
|
|
206
206
|
* no_input_poke_text: "Are you still there?",
|
|
207
207
|
* no_input_end_conversation_sec: 180,
|