retell-sdk 2.2.4 → 2.2.6
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/example.js +15 -4
- package/example.js.map +1 -1
- package/models/components/agent.d.ts +3 -205
- package/models/components/agent.d.ts.map +1 -1
- package/models/components/agent.js +5 -221
- package/models/components/agent.js.map +1 -1
- package/models/components/calldetail.d.ts +33 -22
- package/models/components/calldetail.d.ts.map +1 -1
- package/models/components/calldetail.js +32 -31
- package/models/components/calldetail.js.map +1 -1
- package/models/components/index.d.ts +0 -3
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +0 -3
- package/models/components/index.js.map +1 -1
- package/models/errors/index.d.ts +1 -6
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +1 -6
- package/models/errors/index.js.map +1 -1
- package/models/errors/registercall.d.ts +218 -0
- package/models/errors/registercall.d.ts.map +1 -0
- package/models/errors/registercall.js +386 -0
- package/models/errors/registercall.js.map +1 -0
- package/models/operations/createagent.d.ts +3 -16
- package/models/operations/createagent.d.ts.map +1 -1
- package/models/operations/createagent.js +4 -22
- package/models/operations/createagent.js.map +1 -1
- package/models/operations/getcall.d.ts +1 -1
- package/models/operations/index.d.ts +1 -7
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -7
- package/models/operations/index.js.map +1 -1
- package/models/operations/listcalls.d.ts +1 -7
- package/models/operations/listcalls.d.ts.map +1 -1
- package/models/operations/listcalls.js +0 -4
- package/models/operations/listcalls.js.map +1 -1
- package/models/operations/registercall.d.ts +74 -0
- package/models/operations/registercall.d.ts.map +1 -0
- package/models/operations/registercall.js +104 -0
- package/models/operations/registercall.js.map +1 -0
- package/models/operations/updateagent.d.ts +3 -16
- package/models/operations/updateagent.d.ts.map +1 -1
- package/models/operations/updateagent.js +7 -25
- package/models/operations/updateagent.js.map +1 -1
- package/package.json +1 -1
- package/sdk/audioWsClient.d.ts +10 -0
- package/sdk/audioWsClient.d.ts.map +1 -0
- package/sdk/audioWsClient.js +60 -0
- package/sdk/audioWsClient.js.map +1 -0
- package/sdk/index.d.ts +1 -1
- package/sdk/index.d.ts.map +1 -1
- package/sdk/index.js +1 -1
- package/sdk/index.js.map +1 -1
- package/sdk/sdk.d.ts +1 -23
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +11 -437
- package/sdk/sdk.js.map +1 -1
- package/src/example.ts +18 -4
- package/src/models/components/agent.ts +8 -460
- package/src/models/components/calldetail.ts +47 -42
- package/src/models/components/index.ts +0 -3
- package/src/models/errors/index.ts +1 -6
- package/src/models/errors/{createphonecall.ts → registercall.ts} +60 -60
- package/src/models/operations/createagent.ts +8 -50
- package/src/models/operations/getcall.ts +1 -1
- package/src/models/operations/index.ts +1 -7
- package/src/models/operations/listcalls.ts +1 -11
- package/src/models/operations/registercall.ts +167 -0
- package/src/models/operations/updateagent.ts +11 -58
- package/src/sdk/audioWsClient.ts +63 -0
- package/src/sdk/index.ts +1 -1
- package/src/sdk/sdk.ts +13 -526
- package/src/models/components/agentpromptparams.ts +0 -61
- package/src/models/components/callphonenumber.ts +0 -64
- package/src/models/components/phonenumber.ts +0 -84
- package/src/models/errors/createphonenumber.ts +0 -552
- package/src/models/errors/deletephonenumber.ts +0 -442
- package/src/models/errors/getphonenumber.ts +0 -442
- package/src/models/errors/listphonenumbers.ts +0 -332
- package/src/models/errors/updatephoneagent.ts +0 -442
- package/src/models/operations/createphonecall.ts +0 -353
- package/src/models/operations/createphonenumber.ts +0 -144
- package/src/models/operations/createwebcall.ts +0 -16
- package/src/models/operations/deletephonenumber.ts +0 -119
- package/src/models/operations/getphonenumber.ts +0 -134
- package/src/models/operations/listphonenumbers.ts +0 -88
- package/src/models/operations/updatephoneagent.ts +0 -187
- package/src/sdk/liveClient.ts +0 -113
package/src/sdk/sdk.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { HTTPClient } from "../lib/http";
|
|
|
8
8
|
import { ClientSDK, RequestOptions } from "../lib/sdks";
|
|
9
9
|
import * as errors from "../models/errors";
|
|
10
10
|
import * as operations from "../models/operations";
|
|
11
|
-
import { LiveClient } from "./liveClient";
|
|
12
11
|
|
|
13
12
|
export class RetellClient extends ClientSDK {
|
|
14
13
|
private readonly options$: SDKOptions;
|
|
@@ -23,17 +22,6 @@ export class RetellClient extends ClientSDK {
|
|
|
23
22
|
void this.options$;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
async createWebCall(
|
|
27
|
-
input: operations.CreateWebCallRequestBody,
|
|
28
|
-
): Promise<LiveClient> {
|
|
29
|
-
const liveClient = new LiveClient(
|
|
30
|
-
this.options$.apiKey as unknown as string,
|
|
31
|
-
input,
|
|
32
|
-
);
|
|
33
|
-
await liveClient.waitForReady();
|
|
34
|
-
return liveClient;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
/**
|
|
38
26
|
* Create a new agent
|
|
39
27
|
*/
|
|
@@ -131,20 +119,20 @@ export class RetellClient extends ClientSDK {
|
|
|
131
119
|
/**
|
|
132
120
|
* Initiate an outbound phone call.
|
|
133
121
|
*/
|
|
134
|
-
async
|
|
135
|
-
input: operations.
|
|
122
|
+
async registerCall(
|
|
123
|
+
input: operations.RegisterCallRequestBody,
|
|
136
124
|
options?: RequestOptions,
|
|
137
|
-
): Promise<operations.
|
|
125
|
+
): Promise<operations.RegisterCallResponse> {
|
|
138
126
|
const headers$ = new Headers();
|
|
139
127
|
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
140
128
|
headers$.set("Content-Type", "application/json");
|
|
141
129
|
headers$.set("Accept", "application/json");
|
|
142
130
|
|
|
143
131
|
const payload$ =
|
|
144
|
-
operations.
|
|
132
|
+
operations.RegisterCallRequestBody$.outboundSchema.parse(input);
|
|
145
133
|
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
146
134
|
|
|
147
|
-
const path$ = this.templateURLComponent("/
|
|
135
|
+
const path$ = this.templateURLComponent("/register-call")();
|
|
148
136
|
|
|
149
137
|
let security$;
|
|
150
138
|
if (typeof this.options$.apiKey === "function") {
|
|
@@ -176,14 +164,14 @@ export class RetellClient extends ClientSDK {
|
|
|
176
164
|
|
|
177
165
|
if (this.matchResponse(response, 201, "application/json")) {
|
|
178
166
|
const responseBody = await response.json();
|
|
179
|
-
const result = operations.
|
|
167
|
+
const result = operations.RegisterCallResponse$.inboundSchema.parse({
|
|
180
168
|
...responseFields$,
|
|
181
|
-
|
|
169
|
+
CallDetail: responseBody,
|
|
182
170
|
});
|
|
183
171
|
return result;
|
|
184
172
|
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
185
173
|
const responseBody = await response.json();
|
|
186
|
-
const result = errors.
|
|
174
|
+
const result = errors.RegisterCallResponseBody$.inboundSchema.parse({
|
|
187
175
|
...responseFields$,
|
|
188
176
|
...responseBody,
|
|
189
177
|
});
|
|
@@ -191,7 +179,7 @@ export class RetellClient extends ClientSDK {
|
|
|
191
179
|
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
192
180
|
const responseBody = await response.json();
|
|
193
181
|
const result =
|
|
194
|
-
errors.
|
|
182
|
+
errors.RegisterCallResponseResponseBody$.inboundSchema.parse({
|
|
195
183
|
...responseFields$,
|
|
196
184
|
...responseBody,
|
|
197
185
|
});
|
|
@@ -199,7 +187,7 @@ export class RetellClient extends ClientSDK {
|
|
|
199
187
|
} else if (this.matchResponse(response, 402, "application/json")) {
|
|
200
188
|
const responseBody = await response.json();
|
|
201
189
|
const result =
|
|
202
|
-
errors.
|
|
190
|
+
errors.RegisterCallResponse402ResponseBody$.inboundSchema.parse({
|
|
203
191
|
...responseFields$,
|
|
204
192
|
...responseBody,
|
|
205
193
|
});
|
|
@@ -207,7 +195,7 @@ export class RetellClient extends ClientSDK {
|
|
|
207
195
|
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
208
196
|
const responseBody = await response.json();
|
|
209
197
|
const result =
|
|
210
|
-
errors.
|
|
198
|
+
errors.RegisterCallResponse422ResponseBody$.inboundSchema.parse({
|
|
211
199
|
...responseFields$,
|
|
212
200
|
...responseBody,
|
|
213
201
|
});
|
|
@@ -215,7 +203,7 @@ export class RetellClient extends ClientSDK {
|
|
|
215
203
|
} else if (this.matchResponse(response, 429, "application/json")) {
|
|
216
204
|
const responseBody = await response.json();
|
|
217
205
|
const result =
|
|
218
|
-
errors.
|
|
206
|
+
errors.RegisterCallResponse429ResponseBody$.inboundSchema.parse({
|
|
219
207
|
...responseFields$,
|
|
220
208
|
...responseBody,
|
|
221
209
|
});
|
|
@@ -223,109 +211,7 @@ export class RetellClient extends ClientSDK {
|
|
|
223
211
|
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
224
212
|
const responseBody = await response.json();
|
|
225
213
|
const result =
|
|
226
|
-
errors.
|
|
227
|
-
...responseFields$,
|
|
228
|
-
...responseBody,
|
|
229
|
-
});
|
|
230
|
-
throw result;
|
|
231
|
-
} else {
|
|
232
|
-
const responseBody = await response.text();
|
|
233
|
-
throw new errors.SDKError(
|
|
234
|
-
"Unexpected API response",
|
|
235
|
-
response,
|
|
236
|
-
responseBody,
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Create a new phone number
|
|
243
|
-
*/
|
|
244
|
-
async createPhoneNumber(
|
|
245
|
-
input: operations.CreatePhoneNumberRequestBody,
|
|
246
|
-
options?: RequestOptions,
|
|
247
|
-
): Promise<operations.CreatePhoneNumberResponse> {
|
|
248
|
-
const headers$ = new Headers();
|
|
249
|
-
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
250
|
-
headers$.set("Content-Type", "application/json");
|
|
251
|
-
headers$.set("Accept", "application/json");
|
|
252
|
-
|
|
253
|
-
const payload$ =
|
|
254
|
-
operations.CreatePhoneNumberRequestBody$.outboundSchema.parse(input);
|
|
255
|
-
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
256
|
-
|
|
257
|
-
const path$ = this.templateURLComponent("/create-phone-number")();
|
|
258
|
-
|
|
259
|
-
let security$;
|
|
260
|
-
if (typeof this.options$.apiKey === "function") {
|
|
261
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
262
|
-
} else if (this.options$.apiKey) {
|
|
263
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
264
|
-
} else {
|
|
265
|
-
security$ = {};
|
|
266
|
-
}
|
|
267
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
268
|
-
|
|
269
|
-
const response = await this.fetch$(
|
|
270
|
-
{
|
|
271
|
-
security: securitySettings$,
|
|
272
|
-
method: "post",
|
|
273
|
-
path: path$,
|
|
274
|
-
headers: headers$,
|
|
275
|
-
body: body$,
|
|
276
|
-
},
|
|
277
|
-
options,
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
const responseFields$ = {
|
|
281
|
-
ContentType:
|
|
282
|
-
response.headers.get("content-type") ?? "application/octet-stream",
|
|
283
|
-
StatusCode: response.status,
|
|
284
|
-
RawResponse: response,
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
if (this.matchResponse(response, 201, "application/json")) {
|
|
288
|
-
const responseBody = await response.json();
|
|
289
|
-
const result = operations.CreatePhoneNumberResponse$.inboundSchema.parse({
|
|
290
|
-
...responseFields$,
|
|
291
|
-
PhoneNumber: responseBody,
|
|
292
|
-
});
|
|
293
|
-
return result;
|
|
294
|
-
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
295
|
-
const responseBody = await response.json();
|
|
296
|
-
const result = errors.CreatePhoneNumberResponseBody$.inboundSchema.parse({
|
|
297
|
-
...responseFields$,
|
|
298
|
-
...responseBody,
|
|
299
|
-
});
|
|
300
|
-
throw result;
|
|
301
|
-
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
302
|
-
const responseBody = await response.json();
|
|
303
|
-
const result =
|
|
304
|
-
errors.CreatePhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
305
|
-
...responseFields$,
|
|
306
|
-
...responseBody,
|
|
307
|
-
});
|
|
308
|
-
throw result;
|
|
309
|
-
} else if (this.matchResponse(response, 402, "application/json")) {
|
|
310
|
-
const responseBody = await response.json();
|
|
311
|
-
const result =
|
|
312
|
-
errors.CreatePhoneNumberResponse402ResponseBody$.inboundSchema.parse({
|
|
313
|
-
...responseFields$,
|
|
314
|
-
...responseBody,
|
|
315
|
-
});
|
|
316
|
-
throw result;
|
|
317
|
-
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
318
|
-
const responseBody = await response.json();
|
|
319
|
-
const result =
|
|
320
|
-
errors.CreatePhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
321
|
-
...responseFields$,
|
|
322
|
-
...responseBody,
|
|
323
|
-
});
|
|
324
|
-
throw result;
|
|
325
|
-
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
326
|
-
const responseBody = await response.json();
|
|
327
|
-
const result =
|
|
328
|
-
errors.CreatePhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
214
|
+
errors.RegisterCallResponse500ResponseBody$.inboundSchema.parse({
|
|
329
215
|
...responseFields$,
|
|
330
216
|
...responseBody,
|
|
331
217
|
});
|
|
@@ -442,110 +328,6 @@ export class RetellClient extends ClientSDK {
|
|
|
442
328
|
return operations.DeleteAgentResponse$.inboundSchema.parse(responseFields$);
|
|
443
329
|
}
|
|
444
330
|
|
|
445
|
-
/**
|
|
446
|
-
* Delete a specific phone number
|
|
447
|
-
*/
|
|
448
|
-
async deletePhoneNumber(
|
|
449
|
-
phoneNumber: string,
|
|
450
|
-
options?: RequestOptions,
|
|
451
|
-
): Promise<operations.DeletePhoneNumberResponse> {
|
|
452
|
-
const input$: operations.DeletePhoneNumberRequest = {
|
|
453
|
-
phoneNumber: phoneNumber,
|
|
454
|
-
};
|
|
455
|
-
const headers$ = new Headers();
|
|
456
|
-
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
457
|
-
headers$.set("Accept", "application/json");
|
|
458
|
-
|
|
459
|
-
const payload$ =
|
|
460
|
-
operations.DeletePhoneNumberRequest$.outboundSchema.parse(input$);
|
|
461
|
-
const body$ = null;
|
|
462
|
-
|
|
463
|
-
const pathParams$ = {
|
|
464
|
-
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
465
|
-
explode: false,
|
|
466
|
-
charEncoding: "percent",
|
|
467
|
-
}),
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
const path$ = this.templateURLComponent(
|
|
471
|
-
"/delete-phone-number/{phone_number}",
|
|
472
|
-
)(pathParams$);
|
|
473
|
-
|
|
474
|
-
let security$;
|
|
475
|
-
if (typeof this.options$.apiKey === "function") {
|
|
476
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
477
|
-
} else if (this.options$.apiKey) {
|
|
478
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
479
|
-
} else {
|
|
480
|
-
security$ = {};
|
|
481
|
-
}
|
|
482
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
483
|
-
|
|
484
|
-
const response = await this.fetch$(
|
|
485
|
-
{
|
|
486
|
-
security: securitySettings$,
|
|
487
|
-
method: "delete",
|
|
488
|
-
path: path$,
|
|
489
|
-
headers: headers$,
|
|
490
|
-
body: body$,
|
|
491
|
-
},
|
|
492
|
-
options,
|
|
493
|
-
);
|
|
494
|
-
|
|
495
|
-
const responseFields$ = {
|
|
496
|
-
ContentType:
|
|
497
|
-
response.headers.get("content-type") ?? "application/octet-stream",
|
|
498
|
-
StatusCode: response.status,
|
|
499
|
-
RawResponse: response,
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
if (this.matchStatusCode(response, 204)) {
|
|
503
|
-
// fallthrough
|
|
504
|
-
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
505
|
-
const responseBody = await response.json();
|
|
506
|
-
const result = errors.DeletePhoneNumberResponseBody$.inboundSchema.parse({
|
|
507
|
-
...responseFields$,
|
|
508
|
-
...responseBody,
|
|
509
|
-
});
|
|
510
|
-
throw result;
|
|
511
|
-
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
512
|
-
const responseBody = await response.json();
|
|
513
|
-
const result =
|
|
514
|
-
errors.DeletePhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
515
|
-
...responseFields$,
|
|
516
|
-
...responseBody,
|
|
517
|
-
});
|
|
518
|
-
throw result;
|
|
519
|
-
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
520
|
-
const responseBody = await response.json();
|
|
521
|
-
const result =
|
|
522
|
-
errors.DeletePhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
523
|
-
...responseFields$,
|
|
524
|
-
...responseBody,
|
|
525
|
-
});
|
|
526
|
-
throw result;
|
|
527
|
-
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
528
|
-
const responseBody = await response.json();
|
|
529
|
-
const result =
|
|
530
|
-
errors.DeletePhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
531
|
-
...responseFields$,
|
|
532
|
-
...responseBody,
|
|
533
|
-
});
|
|
534
|
-
throw result;
|
|
535
|
-
} else {
|
|
536
|
-
const responseBody = await response.text();
|
|
537
|
-
throw new errors.SDKError(
|
|
538
|
-
"Unexpected API response",
|
|
539
|
-
response,
|
|
540
|
-
responseBody,
|
|
541
|
-
);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
return operations.DeletePhoneNumberResponse$.inboundSchema.parse(
|
|
545
|
-
responseFields$,
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
331
|
/**
|
|
550
332
|
* Retrieve details of a specific agent
|
|
551
333
|
*/
|
|
@@ -752,111 +534,6 @@ export class RetellClient extends ClientSDK {
|
|
|
752
534
|
}
|
|
753
535
|
}
|
|
754
536
|
|
|
755
|
-
/**
|
|
756
|
-
* Retrieve info about a specific number
|
|
757
|
-
*/
|
|
758
|
-
async getPhoneNumber(
|
|
759
|
-
phoneNumber: string,
|
|
760
|
-
options?: RequestOptions,
|
|
761
|
-
): Promise<operations.GetPhoneNumberResponse> {
|
|
762
|
-
const input$: operations.GetPhoneNumberRequest = {
|
|
763
|
-
phoneNumber: phoneNumber,
|
|
764
|
-
};
|
|
765
|
-
const headers$ = new Headers();
|
|
766
|
-
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
767
|
-
headers$.set("Accept", "application/json");
|
|
768
|
-
|
|
769
|
-
const payload$ =
|
|
770
|
-
operations.GetPhoneNumberRequest$.outboundSchema.parse(input$);
|
|
771
|
-
const body$ = null;
|
|
772
|
-
|
|
773
|
-
const pathParams$ = {
|
|
774
|
-
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
775
|
-
explode: false,
|
|
776
|
-
charEncoding: "percent",
|
|
777
|
-
}),
|
|
778
|
-
};
|
|
779
|
-
|
|
780
|
-
const path$ = this.templateURLComponent("/get-phone-number/{phone_number}")(
|
|
781
|
-
pathParams$,
|
|
782
|
-
);
|
|
783
|
-
|
|
784
|
-
let security$;
|
|
785
|
-
if (typeof this.options$.apiKey === "function") {
|
|
786
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
787
|
-
} else if (this.options$.apiKey) {
|
|
788
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
789
|
-
} else {
|
|
790
|
-
security$ = {};
|
|
791
|
-
}
|
|
792
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
793
|
-
|
|
794
|
-
const response = await this.fetch$(
|
|
795
|
-
{
|
|
796
|
-
security: securitySettings$,
|
|
797
|
-
method: "get",
|
|
798
|
-
path: path$,
|
|
799
|
-
headers: headers$,
|
|
800
|
-
body: body$,
|
|
801
|
-
},
|
|
802
|
-
options,
|
|
803
|
-
);
|
|
804
|
-
|
|
805
|
-
const responseFields$ = {
|
|
806
|
-
ContentType:
|
|
807
|
-
response.headers.get("content-type") ?? "application/octet-stream",
|
|
808
|
-
StatusCode: response.status,
|
|
809
|
-
RawResponse: response,
|
|
810
|
-
};
|
|
811
|
-
|
|
812
|
-
if (this.matchResponse(response, 200, "application/json")) {
|
|
813
|
-
const responseBody = await response.json();
|
|
814
|
-
const result = operations.GetPhoneNumberResponse$.inboundSchema.parse({
|
|
815
|
-
...responseFields$,
|
|
816
|
-
PhoneNumber: responseBody,
|
|
817
|
-
});
|
|
818
|
-
return result;
|
|
819
|
-
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
820
|
-
const responseBody = await response.json();
|
|
821
|
-
const result = errors.GetPhoneNumberResponseBody$.inboundSchema.parse({
|
|
822
|
-
...responseFields$,
|
|
823
|
-
...responseBody,
|
|
824
|
-
});
|
|
825
|
-
throw result;
|
|
826
|
-
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
827
|
-
const responseBody = await response.json();
|
|
828
|
-
const result =
|
|
829
|
-
errors.GetPhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
830
|
-
...responseFields$,
|
|
831
|
-
...responseBody,
|
|
832
|
-
});
|
|
833
|
-
throw result;
|
|
834
|
-
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
835
|
-
const responseBody = await response.json();
|
|
836
|
-
const result =
|
|
837
|
-
errors.GetPhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
838
|
-
...responseFields$,
|
|
839
|
-
...responseBody,
|
|
840
|
-
});
|
|
841
|
-
throw result;
|
|
842
|
-
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
843
|
-
const responseBody = await response.json();
|
|
844
|
-
const result =
|
|
845
|
-
errors.GetPhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
846
|
-
...responseFields$,
|
|
847
|
-
...responseBody,
|
|
848
|
-
});
|
|
849
|
-
throw result;
|
|
850
|
-
} else {
|
|
851
|
-
const responseBody = await response.text();
|
|
852
|
-
throw new errors.SDKError(
|
|
853
|
-
"Unexpected API response",
|
|
854
|
-
response,
|
|
855
|
-
responseBody,
|
|
856
|
-
);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
|
|
860
537
|
/**
|
|
861
538
|
* List all agents
|
|
862
539
|
*/
|
|
@@ -1041,85 +718,6 @@ export class RetellClient extends ClientSDK {
|
|
|
1041
718
|
}
|
|
1042
719
|
}
|
|
1043
720
|
|
|
1044
|
-
/**
|
|
1045
|
-
* List all purchased and active phone numbers
|
|
1046
|
-
*/
|
|
1047
|
-
async listPhoneNumbers(
|
|
1048
|
-
options?: RequestOptions,
|
|
1049
|
-
): Promise<operations.ListPhoneNumbersResponse> {
|
|
1050
|
-
const headers$ = new Headers();
|
|
1051
|
-
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
1052
|
-
headers$.set("Accept", "application/json");
|
|
1053
|
-
|
|
1054
|
-
const path$ = this.templateURLComponent("/list-phone-numbers")();
|
|
1055
|
-
|
|
1056
|
-
let security$;
|
|
1057
|
-
if (typeof this.options$.apiKey === "function") {
|
|
1058
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
1059
|
-
} else if (this.options$.apiKey) {
|
|
1060
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
1061
|
-
} else {
|
|
1062
|
-
security$ = {};
|
|
1063
|
-
}
|
|
1064
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
1065
|
-
|
|
1066
|
-
const response = await this.fetch$(
|
|
1067
|
-
{
|
|
1068
|
-
security: securitySettings$,
|
|
1069
|
-
method: "get",
|
|
1070
|
-
path: path$,
|
|
1071
|
-
headers: headers$,
|
|
1072
|
-
},
|
|
1073
|
-
options,
|
|
1074
|
-
);
|
|
1075
|
-
|
|
1076
|
-
const responseFields$ = {
|
|
1077
|
-
ContentType:
|
|
1078
|
-
response.headers.get("content-type") ?? "application/octet-stream",
|
|
1079
|
-
StatusCode: response.status,
|
|
1080
|
-
RawResponse: response,
|
|
1081
|
-
};
|
|
1082
|
-
|
|
1083
|
-
if (this.matchResponse(response, 200, "application/json")) {
|
|
1084
|
-
const responseBody = await response.json();
|
|
1085
|
-
const result = operations.ListPhoneNumbersResponse$.inboundSchema.parse({
|
|
1086
|
-
...responseFields$,
|
|
1087
|
-
phoneNumbers: responseBody,
|
|
1088
|
-
});
|
|
1089
|
-
return result;
|
|
1090
|
-
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
1091
|
-
const responseBody = await response.json();
|
|
1092
|
-
const result = errors.ListPhoneNumbersResponseBody$.inboundSchema.parse({
|
|
1093
|
-
...responseFields$,
|
|
1094
|
-
...responseBody,
|
|
1095
|
-
});
|
|
1096
|
-
throw result;
|
|
1097
|
-
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
1098
|
-
const responseBody = await response.json();
|
|
1099
|
-
const result =
|
|
1100
|
-
errors.ListPhoneNumbersResponseResponseBody$.inboundSchema.parse({
|
|
1101
|
-
...responseFields$,
|
|
1102
|
-
...responseBody,
|
|
1103
|
-
});
|
|
1104
|
-
throw result;
|
|
1105
|
-
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
1106
|
-
const responseBody = await response.json();
|
|
1107
|
-
const result =
|
|
1108
|
-
errors.ListPhoneNumbersResponse500ResponseBody$.inboundSchema.parse({
|
|
1109
|
-
...responseFields$,
|
|
1110
|
-
...responseBody,
|
|
1111
|
-
});
|
|
1112
|
-
throw result;
|
|
1113
|
-
} else {
|
|
1114
|
-
const responseBody = await response.text();
|
|
1115
|
-
throw new errors.SDKError(
|
|
1116
|
-
"Unexpected API response",
|
|
1117
|
-
response,
|
|
1118
|
-
responseBody,
|
|
1119
|
-
);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
721
|
/**
|
|
1124
722
|
* Update an existing agent
|
|
1125
723
|
*/
|
|
@@ -1230,115 +828,4 @@ export class RetellClient extends ClientSDK {
|
|
|
1230
828
|
);
|
|
1231
829
|
}
|
|
1232
830
|
}
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Update an existing phone number
|
|
1236
|
-
*/
|
|
1237
|
-
async updatePhoneAgent(
|
|
1238
|
-
requestBody: operations.UpdatePhoneAgentRequestBody,
|
|
1239
|
-
phoneNumber: string,
|
|
1240
|
-
options?: RequestOptions,
|
|
1241
|
-
): Promise<operations.UpdatePhoneAgentResponse> {
|
|
1242
|
-
const input$: operations.UpdatePhoneAgentRequest = {
|
|
1243
|
-
requestBody: requestBody,
|
|
1244
|
-
phoneNumber: phoneNumber,
|
|
1245
|
-
};
|
|
1246
|
-
const headers$ = new Headers();
|
|
1247
|
-
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
1248
|
-
headers$.set("Content-Type", "application/json");
|
|
1249
|
-
headers$.set("Accept", "application/json");
|
|
1250
|
-
|
|
1251
|
-
const payload$ =
|
|
1252
|
-
operations.UpdatePhoneAgentRequest$.outboundSchema.parse(input$);
|
|
1253
|
-
|
|
1254
|
-
const body$ = enc$.encodeJSON("body", payload$.RequestBody, {
|
|
1255
|
-
explode: true,
|
|
1256
|
-
});
|
|
1257
|
-
|
|
1258
|
-
const pathParams$ = {
|
|
1259
|
-
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
1260
|
-
explode: false,
|
|
1261
|
-
charEncoding: "percent",
|
|
1262
|
-
}),
|
|
1263
|
-
};
|
|
1264
|
-
|
|
1265
|
-
const path$ = this.templateURLComponent(
|
|
1266
|
-
"/update-phone-agent/{phone_number}",
|
|
1267
|
-
)(pathParams$);
|
|
1268
|
-
|
|
1269
|
-
let security$;
|
|
1270
|
-
if (typeof this.options$.apiKey === "function") {
|
|
1271
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
1272
|
-
} else if (this.options$.apiKey) {
|
|
1273
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
1274
|
-
} else {
|
|
1275
|
-
security$ = {};
|
|
1276
|
-
}
|
|
1277
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
1278
|
-
|
|
1279
|
-
const response = await this.fetch$(
|
|
1280
|
-
{
|
|
1281
|
-
security: securitySettings$,
|
|
1282
|
-
method: "PATCH",
|
|
1283
|
-
path: path$,
|
|
1284
|
-
headers: headers$,
|
|
1285
|
-
body: body$,
|
|
1286
|
-
},
|
|
1287
|
-
options,
|
|
1288
|
-
);
|
|
1289
|
-
|
|
1290
|
-
const responseFields$ = {
|
|
1291
|
-
ContentType:
|
|
1292
|
-
response.headers.get("content-type") ?? "application/octet-stream",
|
|
1293
|
-
StatusCode: response.status,
|
|
1294
|
-
RawResponse: response,
|
|
1295
|
-
};
|
|
1296
|
-
|
|
1297
|
-
if (this.matchResponse(response, 200, "application/json")) {
|
|
1298
|
-
const responseBody = await response.json();
|
|
1299
|
-
const result = operations.UpdatePhoneAgentResponse$.inboundSchema.parse({
|
|
1300
|
-
...responseFields$,
|
|
1301
|
-
PhoneNumber: responseBody,
|
|
1302
|
-
});
|
|
1303
|
-
return result;
|
|
1304
|
-
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
1305
|
-
const responseBody = await response.json();
|
|
1306
|
-
const result = errors.UpdatePhoneAgentResponseBody$.inboundSchema.parse({
|
|
1307
|
-
...responseFields$,
|
|
1308
|
-
...responseBody,
|
|
1309
|
-
});
|
|
1310
|
-
throw result;
|
|
1311
|
-
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
1312
|
-
const responseBody = await response.json();
|
|
1313
|
-
const result =
|
|
1314
|
-
errors.UpdatePhoneAgentResponseResponseBody$.inboundSchema.parse({
|
|
1315
|
-
...responseFields$,
|
|
1316
|
-
...responseBody,
|
|
1317
|
-
});
|
|
1318
|
-
throw result;
|
|
1319
|
-
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
1320
|
-
const responseBody = await response.json();
|
|
1321
|
-
const result =
|
|
1322
|
-
errors.UpdatePhoneAgentResponse422ResponseBody$.inboundSchema.parse({
|
|
1323
|
-
...responseFields$,
|
|
1324
|
-
...responseBody,
|
|
1325
|
-
});
|
|
1326
|
-
throw result;
|
|
1327
|
-
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
1328
|
-
const responseBody = await response.json();
|
|
1329
|
-
const result =
|
|
1330
|
-
errors.UpdatePhoneAgentResponse500ResponseBody$.inboundSchema.parse({
|
|
1331
|
-
...responseFields$,
|
|
1332
|
-
...responseBody,
|
|
1333
|
-
});
|
|
1334
|
-
throw result;
|
|
1335
|
-
} else {
|
|
1336
|
-
const responseBody = await response.text();
|
|
1337
|
-
throw new errors.SDKError(
|
|
1338
|
-
"Unexpected API response",
|
|
1339
|
-
response,
|
|
1340
|
-
responseBody,
|
|
1341
|
-
);
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
831
|
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
export type AgentPromptParams = {
|
|
8
|
-
/**
|
|
9
|
-
* The name of the parameter enclosed as `${YOUR_PARAM_NAME}` in agent prompt.
|
|
10
|
-
*/
|
|
11
|
-
name: string;
|
|
12
|
-
/**
|
|
13
|
-
* The value of parameter to substitute in agent prompt.
|
|
14
|
-
*/
|
|
15
|
-
value: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/** @internal */
|
|
19
|
-
export namespace AgentPromptParams$ {
|
|
20
|
-
export type Inbound = {
|
|
21
|
-
name: string;
|
|
22
|
-
value: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const inboundSchema: z.ZodType<
|
|
26
|
-
AgentPromptParams,
|
|
27
|
-
z.ZodTypeDef,
|
|
28
|
-
Inbound
|
|
29
|
-
> = z
|
|
30
|
-
.object({
|
|
31
|
-
name: z.string(),
|
|
32
|
-
value: z.string(),
|
|
33
|
-
})
|
|
34
|
-
.transform((v) => {
|
|
35
|
-
return {
|
|
36
|
-
name: v.name,
|
|
37
|
-
value: v.value,
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export type Outbound = {
|
|
42
|
-
name: string;
|
|
43
|
-
value: string;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const outboundSchema: z.ZodType<
|
|
47
|
-
Outbound,
|
|
48
|
-
z.ZodTypeDef,
|
|
49
|
-
AgentPromptParams
|
|
50
|
-
> = z
|
|
51
|
-
.object({
|
|
52
|
-
name: z.string(),
|
|
53
|
-
value: z.string(),
|
|
54
|
-
})
|
|
55
|
-
.transform((v) => {
|
|
56
|
-
return {
|
|
57
|
-
name: v.name,
|
|
58
|
-
value: v.value,
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
}
|