retell-sdk 2.2.3 → 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 +48 -5
- package/example.js.map +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js.map +1 -1
- package/lib/security.d.ts.map +1 -1
- package/lib/security.js +5 -1
- package/lib/security.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 -187
- package/models/components/agent.js.map +1 -1
- package/models/components/agentpromptparams.d.ts.map +1 -1
- package/models/components/agentpromptparams.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 +44 -31
- package/models/components/calldetail.js.map +1 -1
- package/models/components/callphonenumber.d.ts.map +1 -1
- package/models/components/callphonenumber.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/components/phonenumber.d.ts.map +1 -1
- package/models/components/phonenumber.js.map +1 -1
- package/models/components/security.d.ts.map +1 -1
- package/models/errors/createagent.d.ts.map +1 -1
- package/models/errors/createagent.js +36 -12
- package/models/errors/createagent.js.map +1 -1
- package/models/errors/createphonecall.d.ts.map +1 -1
- package/models/errors/createphonecall.js +54 -18
- package/models/errors/createphonecall.js.map +1 -1
- package/models/errors/createphonenumber.d.ts.map +1 -1
- package/models/errors/createphonenumber.js +42 -14
- package/models/errors/createphonenumber.js.map +1 -1
- package/models/errors/deleteagent.d.ts.map +1 -1
- package/models/errors/deleteagent.js +36 -12
- package/models/errors/deleteagent.js.map +1 -1
- package/models/errors/deletephonenumber.d.ts.map +1 -1
- package/models/errors/deletephonenumber.js +33 -11
- package/models/errors/deletephonenumber.js.map +1 -1
- package/models/errors/getagent.d.ts.map +1 -1
- package/models/errors/getagent.js +36 -12
- package/models/errors/getagent.js.map +1 -1
- package/models/errors/getcall.d.ts.map +1 -1
- package/models/errors/getcall.js +30 -10
- package/models/errors/getcall.js.map +1 -1
- package/models/errors/getphonenumber.d.ts.map +1 -1
- package/models/errors/getphonenumber.js +36 -12
- package/models/errors/getphonenumber.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/listagents.d.ts.map +1 -1
- package/models/errors/listagents.js +15 -5
- package/models/errors/listagents.js.map +1 -1
- package/models/errors/listcalls.d.ts.map +1 -1
- package/models/errors/listcalls.js +24 -8
- package/models/errors/listcalls.js.map +1 -1
- package/models/errors/listphonenumbers.d.ts.map +1 -1
- package/models/errors/listphonenumbers.js +27 -9
- package/models/errors/listphonenumbers.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/errors/updateagent.d.ts.map +1 -1
- package/models/errors/updateagent.js +36 -12
- package/models/errors/updateagent.js.map +1 -1
- package/models/errors/updatephoneagent.d.ts.map +1 -1
- package/models/errors/updatephoneagent.js +36 -12
- package/models/errors/updatephoneagent.js.map +1 -1
- package/models/operations/createagent.d.ts +3 -16
- package/models/operations/createagent.d.ts.map +1 -1
- package/models/operations/createagent.js +4 -12
- package/models/operations/createagent.js.map +1 -1
- package/models/operations/createphonecall.d.ts.map +1 -1
- package/models/operations/createphonecall.js +18 -6
- package/models/operations/createphonecall.js.map +1 -1
- package/models/operations/createphonenumber.d.ts.map +1 -1
- package/models/operations/createphonenumber.js +6 -2
- package/models/operations/createphonenumber.js.map +1 -1
- package/models/operations/createwebcall.d.ts.map +1 -1
- package/models/operations/deleteagent.d.ts.map +1 -1
- package/models/operations/deleteagent.js.map +1 -1
- package/models/operations/deletephonenumber.d.ts.map +1 -1
- package/models/operations/deletephonenumber.js.map +1 -1
- package/models/operations/getagent.d.ts.map +1 -1
- package/models/operations/getagent.js.map +1 -1
- package/models/operations/getcall.d.ts +1 -1
- package/models/operations/getcall.d.ts.map +1 -1
- package/models/operations/getcall.js.map +1 -1
- package/models/operations/getphonenumber.d.ts.map +1 -1
- package/models/operations/getphonenumber.js +6 -2
- package/models/operations/getphonenumber.js.map +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/listagents.d.ts.map +1 -1
- package/models/operations/listagents.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 +6 -6
- package/models/operations/listcalls.js.map +1 -1
- package/models/operations/listphonenumbers.d.ts.map +1 -1
- package/models/operations/listphonenumbers.js +6 -2
- package/models/operations/listphonenumbers.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 +9 -13
- package/models/operations/updateagent.js.map +1 -1
- package/models/operations/updatephoneagent.d.ts.map +1 -1
- package/models/operations/updatephoneagent.js +6 -2
- package/models/operations/updatephoneagent.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/liveClient.d.ts.map +1 -1
- package/sdk/liveClient.js +7 -2
- package/sdk/liveClient.js.map +1 -1
- package/sdk/sdk.d.ts +1 -23
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +21 -430
- package/sdk/sdk.js.map +1 -1
- package/src/example.ts +136 -88
- package/src/lib/config.ts +32 -32
- package/src/lib/sdks.ts +91 -82
- package/src/lib/security.ts +133 -118
- package/src/models/components/agent.ts +71 -451
- package/src/models/components/calldetail.ts +147 -130
- package/src/models/components/index.ts +0 -3
- package/src/models/components/security.ts +1 -1
- package/src/models/errors/createagent.ts +359 -311
- package/src/models/errors/deleteagent.ts +359 -311
- package/src/models/errors/getagent.ts +358 -302
- package/src/models/errors/getcall.ts +348 -294
- package/src/models/errors/index.ts +1 -6
- package/src/models/errors/listagents.ts +174 -147
- package/src/models/errors/listcalls.ts +251 -211
- package/src/models/errors/registercall.ts +662 -0
- package/src/models/errors/updateagent.ts +359 -311
- package/src/models/operations/createagent.ts +124 -130
- package/src/models/operations/deleteagent.ts +94 -78
- package/src/models/operations/getagent.ts +104 -88
- package/src/models/operations/getcall.ts +101 -88
- package/src/models/operations/index.ts +1 -7
- package/src/models/operations/listagents.ts +68 -60
- package/src/models/operations/listcalls.ts +228 -213
- package/src/models/operations/registercall.ts +167 -0
- package/src/models/operations/updateagent.ts +180 -174
- package/src/sdk/audioWsClient.ts +63 -0
- package/src/sdk/index.ts +1 -1
- package/src/sdk/sdk.ts +802 -1162
- package/src/models/components/agentpromptparams.ts +0 -53
- package/src/models/components/callphonenumber.ts +0 -56
- package/src/models/components/phonenumber.ts +0 -83
- package/src/models/errors/createphonecall.ts +0 -597
- package/src/models/errors/createphonenumber.ts +0 -500
- package/src/models/errors/deletephonenumber.ts +0 -400
- package/src/models/errors/getphonenumber.ts +0 -397
- package/src/models/errors/listphonenumbers.ts +0 -297
- package/src/models/errors/updatephoneagent.ts +0 -397
- package/src/models/operations/createphonecall.ts +0 -308
- package/src/models/operations/createphonenumber.ts +0 -124
- package/src/models/operations/createwebcall.ts +0 -16
- package/src/models/operations/deletephonenumber.ts +0 -103
- package/src/models/operations/getphonenumber.ts +0 -114
- package/src/models/operations/listphonenumbers.ts +0 -76
- package/src/models/operations/updatephoneagent.ts +0 -159
- package/src/sdk/liveClient.ts +0 -109
package/sdk/sdk.js
CHANGED
|
@@ -33,7 +33,6 @@ const http_1 = require("../lib/http");
|
|
|
33
33
|
const sdks_1 = require("../lib/sdks");
|
|
34
34
|
const errors = __importStar(require("../models/errors"));
|
|
35
35
|
const operations = __importStar(require("../models/operations"));
|
|
36
|
-
const liveClient_1 = require("./liveClient");
|
|
37
36
|
class RetellClient extends sdks_1.ClientSDK {
|
|
38
37
|
constructor(options = {}) {
|
|
39
38
|
super({
|
|
@@ -43,11 +42,6 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
43
42
|
this.options$ = options;
|
|
44
43
|
void this.options$;
|
|
45
44
|
}
|
|
46
|
-
async createWebCall(input) {
|
|
47
|
-
const liveClient = new liveClient_1.LiveClient(this.options$.apiKey, input);
|
|
48
|
-
await liveClient.waitForReady();
|
|
49
|
-
return liveClient;
|
|
50
|
-
}
|
|
51
45
|
/**
|
|
52
46
|
* Create a new agent
|
|
53
47
|
*/
|
|
@@ -131,15 +125,15 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
131
125
|
/**
|
|
132
126
|
* Initiate an outbound phone call.
|
|
133
127
|
*/
|
|
134
|
-
async
|
|
128
|
+
async registerCall(input, options) {
|
|
135
129
|
var _a;
|
|
136
130
|
const headers$ = new Headers();
|
|
137
131
|
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
138
132
|
headers$.set("Content-Type", "application/json");
|
|
139
133
|
headers$.set("Accept", "application/json");
|
|
140
|
-
const payload$ = operations.
|
|
134
|
+
const payload$ = operations.RegisterCallRequestBody$.outboundSchema.parse(input);
|
|
141
135
|
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
142
|
-
const path$ = this.templateURLComponent("/
|
|
136
|
+
const path$ = this.templateURLComponent("/register-call")();
|
|
143
137
|
let security$;
|
|
144
138
|
if (typeof this.options$.apiKey === "function") {
|
|
145
139
|
security$ = { apiKey: await this.options$.apiKey() };
|
|
@@ -165,15 +159,15 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
165
159
|
};
|
|
166
160
|
if (this.matchResponse(response, 201, "application/json")) {
|
|
167
161
|
const responseBody = await response.json();
|
|
168
|
-
const result = operations.
|
|
162
|
+
const result = operations.RegisterCallResponse$.inboundSchema.parse({
|
|
169
163
|
...responseFields$,
|
|
170
|
-
|
|
164
|
+
CallDetail: responseBody,
|
|
171
165
|
});
|
|
172
166
|
return result;
|
|
173
167
|
}
|
|
174
168
|
else if (this.matchResponse(response, 400, "application/json")) {
|
|
175
169
|
const responseBody = await response.json();
|
|
176
|
-
const result = errors.
|
|
170
|
+
const result = errors.RegisterCallResponseBody$.inboundSchema.parse({
|
|
177
171
|
...responseFields$,
|
|
178
172
|
...responseBody,
|
|
179
173
|
});
|
|
@@ -181,7 +175,7 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
181
175
|
}
|
|
182
176
|
else if (this.matchResponse(response, 401, "application/json")) {
|
|
183
177
|
const responseBody = await response.json();
|
|
184
|
-
const result = errors.
|
|
178
|
+
const result = errors.RegisterCallResponseResponseBody$.inboundSchema.parse({
|
|
185
179
|
...responseFields$,
|
|
186
180
|
...responseBody,
|
|
187
181
|
});
|
|
@@ -189,7 +183,7 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
189
183
|
}
|
|
190
184
|
else if (this.matchResponse(response, 402, "application/json")) {
|
|
191
185
|
const responseBody = await response.json();
|
|
192
|
-
const result = errors.
|
|
186
|
+
const result = errors.RegisterCallResponse402ResponseBody$.inboundSchema.parse({
|
|
193
187
|
...responseFields$,
|
|
194
188
|
...responseBody,
|
|
195
189
|
});
|
|
@@ -197,7 +191,7 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
197
191
|
}
|
|
198
192
|
else if (this.matchResponse(response, 422, "application/json")) {
|
|
199
193
|
const responseBody = await response.json();
|
|
200
|
-
const result = errors.
|
|
194
|
+
const result = errors.RegisterCallResponse422ResponseBody$.inboundSchema.parse({
|
|
201
195
|
...responseFields$,
|
|
202
196
|
...responseBody,
|
|
203
197
|
});
|
|
@@ -205,7 +199,7 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
205
199
|
}
|
|
206
200
|
else if (this.matchResponse(response, 429, "application/json")) {
|
|
207
201
|
const responseBody = await response.json();
|
|
208
|
-
const result = errors.
|
|
202
|
+
const result = errors.RegisterCallResponse429ResponseBody$.inboundSchema.parse({
|
|
209
203
|
...responseFields$,
|
|
210
204
|
...responseBody,
|
|
211
205
|
});
|
|
@@ -213,95 +207,7 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
213
207
|
}
|
|
214
208
|
else if (this.matchResponse(response, 500, "application/json")) {
|
|
215
209
|
const responseBody = await response.json();
|
|
216
|
-
const result = errors.
|
|
217
|
-
...responseFields$,
|
|
218
|
-
...responseBody,
|
|
219
|
-
});
|
|
220
|
-
throw result;
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
const responseBody = await response.text();
|
|
224
|
-
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Create a new phone number
|
|
229
|
-
*/
|
|
230
|
-
async createPhoneNumber(input, options) {
|
|
231
|
-
var _a;
|
|
232
|
-
const headers$ = new Headers();
|
|
233
|
-
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
234
|
-
headers$.set("Content-Type", "application/json");
|
|
235
|
-
headers$.set("Accept", "application/json");
|
|
236
|
-
const payload$ = operations.CreatePhoneNumberRequestBody$.outboundSchema.parse(input);
|
|
237
|
-
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
238
|
-
const path$ = this.templateURLComponent("/create-phone-number")();
|
|
239
|
-
let security$;
|
|
240
|
-
if (typeof this.options$.apiKey === "function") {
|
|
241
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
242
|
-
}
|
|
243
|
-
else if (this.options$.apiKey) {
|
|
244
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
security$ = {};
|
|
248
|
-
}
|
|
249
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
250
|
-
const response = await this.fetch$({
|
|
251
|
-
security: securitySettings$,
|
|
252
|
-
method: "post",
|
|
253
|
-
path: path$,
|
|
254
|
-
headers: headers$,
|
|
255
|
-
body: body$,
|
|
256
|
-
}, options);
|
|
257
|
-
const responseFields$ = {
|
|
258
|
-
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
259
|
-
StatusCode: response.status,
|
|
260
|
-
RawResponse: response,
|
|
261
|
-
};
|
|
262
|
-
if (this.matchResponse(response, 201, "application/json")) {
|
|
263
|
-
const responseBody = await response.json();
|
|
264
|
-
const result = operations.CreatePhoneNumberResponse$.inboundSchema.parse({
|
|
265
|
-
...responseFields$,
|
|
266
|
-
PhoneNumber: responseBody,
|
|
267
|
-
});
|
|
268
|
-
return result;
|
|
269
|
-
}
|
|
270
|
-
else if (this.matchResponse(response, 400, "application/json")) {
|
|
271
|
-
const responseBody = await response.json();
|
|
272
|
-
const result = errors.CreatePhoneNumberResponseBody$.inboundSchema.parse({
|
|
273
|
-
...responseFields$,
|
|
274
|
-
...responseBody,
|
|
275
|
-
});
|
|
276
|
-
throw result;
|
|
277
|
-
}
|
|
278
|
-
else if (this.matchResponse(response, 401, "application/json")) {
|
|
279
|
-
const responseBody = await response.json();
|
|
280
|
-
const result = errors.CreatePhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
281
|
-
...responseFields$,
|
|
282
|
-
...responseBody,
|
|
283
|
-
});
|
|
284
|
-
throw result;
|
|
285
|
-
}
|
|
286
|
-
else if (this.matchResponse(response, 402, "application/json")) {
|
|
287
|
-
const responseBody = await response.json();
|
|
288
|
-
const result = errors.CreatePhoneNumberResponse402ResponseBody$.inboundSchema.parse({
|
|
289
|
-
...responseFields$,
|
|
290
|
-
...responseBody,
|
|
291
|
-
});
|
|
292
|
-
throw result;
|
|
293
|
-
}
|
|
294
|
-
else if (this.matchResponse(response, 422, "application/json")) {
|
|
295
|
-
const responseBody = await response.json();
|
|
296
|
-
const result = errors.CreatePhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
297
|
-
...responseFields$,
|
|
298
|
-
...responseBody,
|
|
299
|
-
});
|
|
300
|
-
throw result;
|
|
301
|
-
}
|
|
302
|
-
else if (this.matchResponse(response, 500, "application/json")) {
|
|
303
|
-
const responseBody = await response.json();
|
|
304
|
-
const result = errors.CreatePhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
210
|
+
const result = errors.RegisterCallResponse500ResponseBody$.inboundSchema.parse({
|
|
305
211
|
...responseFields$,
|
|
306
212
|
...responseBody,
|
|
307
213
|
});
|
|
@@ -396,90 +302,6 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
396
302
|
}
|
|
397
303
|
return operations.DeleteAgentResponse$.inboundSchema.parse(responseFields$);
|
|
398
304
|
}
|
|
399
|
-
/**
|
|
400
|
-
* Delete a specific phone number
|
|
401
|
-
*/
|
|
402
|
-
async deletePhoneNumber(phoneNumber, options) {
|
|
403
|
-
var _a;
|
|
404
|
-
const input$ = {
|
|
405
|
-
phoneNumber: phoneNumber,
|
|
406
|
-
};
|
|
407
|
-
const headers$ = new Headers();
|
|
408
|
-
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
409
|
-
headers$.set("Accept", "application/json");
|
|
410
|
-
const payload$ = operations.DeletePhoneNumberRequest$.outboundSchema.parse(input$);
|
|
411
|
-
const body$ = null;
|
|
412
|
-
const pathParams$ = {
|
|
413
|
-
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
414
|
-
explode: false,
|
|
415
|
-
charEncoding: "percent",
|
|
416
|
-
}),
|
|
417
|
-
};
|
|
418
|
-
const path$ = this.templateURLComponent("/delete-phone-number/{phone_number}")(pathParams$);
|
|
419
|
-
let security$;
|
|
420
|
-
if (typeof this.options$.apiKey === "function") {
|
|
421
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
422
|
-
}
|
|
423
|
-
else if (this.options$.apiKey) {
|
|
424
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
security$ = {};
|
|
428
|
-
}
|
|
429
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
430
|
-
const response = await this.fetch$({
|
|
431
|
-
security: securitySettings$,
|
|
432
|
-
method: "delete",
|
|
433
|
-
path: path$,
|
|
434
|
-
headers: headers$,
|
|
435
|
-
body: body$,
|
|
436
|
-
}, options);
|
|
437
|
-
const responseFields$ = {
|
|
438
|
-
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
439
|
-
StatusCode: response.status,
|
|
440
|
-
RawResponse: response,
|
|
441
|
-
};
|
|
442
|
-
if (this.matchStatusCode(response, 204)) {
|
|
443
|
-
// fallthrough
|
|
444
|
-
}
|
|
445
|
-
else if (this.matchResponse(response, 400, "application/json")) {
|
|
446
|
-
const responseBody = await response.json();
|
|
447
|
-
const result = errors.DeletePhoneNumberResponseBody$.inboundSchema.parse({
|
|
448
|
-
...responseFields$,
|
|
449
|
-
...responseBody,
|
|
450
|
-
});
|
|
451
|
-
throw result;
|
|
452
|
-
}
|
|
453
|
-
else if (this.matchResponse(response, 401, "application/json")) {
|
|
454
|
-
const responseBody = await response.json();
|
|
455
|
-
const result = errors.DeletePhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
456
|
-
...responseFields$,
|
|
457
|
-
...responseBody,
|
|
458
|
-
});
|
|
459
|
-
throw result;
|
|
460
|
-
}
|
|
461
|
-
else if (this.matchResponse(response, 422, "application/json")) {
|
|
462
|
-
const responseBody = await response.json();
|
|
463
|
-
const result = errors.DeletePhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
464
|
-
...responseFields$,
|
|
465
|
-
...responseBody,
|
|
466
|
-
});
|
|
467
|
-
throw result;
|
|
468
|
-
}
|
|
469
|
-
else if (this.matchResponse(response, 500, "application/json")) {
|
|
470
|
-
const responseBody = await response.json();
|
|
471
|
-
const result = errors.DeletePhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
472
|
-
...responseFields$,
|
|
473
|
-
...responseBody,
|
|
474
|
-
});
|
|
475
|
-
throw result;
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
const responseBody = await response.text();
|
|
479
|
-
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
480
|
-
}
|
|
481
|
-
return operations.DeletePhoneNumberResponse$.inboundSchema.parse(responseFields$);
|
|
482
|
-
}
|
|
483
305
|
/**
|
|
484
306
|
* Retrieve details of a specific agent
|
|
485
307
|
*/
|
|
@@ -657,25 +479,14 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
657
479
|
}
|
|
658
480
|
}
|
|
659
481
|
/**
|
|
660
|
-
*
|
|
482
|
+
* List all agents
|
|
661
483
|
*/
|
|
662
|
-
async
|
|
484
|
+
async listAgents(options) {
|
|
663
485
|
var _a;
|
|
664
|
-
const input$ = {
|
|
665
|
-
phoneNumber: phoneNumber,
|
|
666
|
-
};
|
|
667
486
|
const headers$ = new Headers();
|
|
668
487
|
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
669
488
|
headers$.set("Accept", "application/json");
|
|
670
|
-
const
|
|
671
|
-
const body$ = null;
|
|
672
|
-
const pathParams$ = {
|
|
673
|
-
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
674
|
-
explode: false,
|
|
675
|
-
charEncoding: "percent",
|
|
676
|
-
}),
|
|
677
|
-
};
|
|
678
|
-
const path$ = this.templateURLComponent("/get-phone-number/{phone_number}")(pathParams$);
|
|
489
|
+
const path$ = this.templateURLComponent("/list-agents")();
|
|
679
490
|
let security$;
|
|
680
491
|
if (typeof this.options$.apiKey === "function") {
|
|
681
492
|
security$ = { apiKey: await this.options$.apiKey() };
|
|
@@ -692,84 +503,12 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
692
503
|
method: "get",
|
|
693
504
|
path: path$,
|
|
694
505
|
headers: headers$,
|
|
695
|
-
body: body$,
|
|
696
506
|
}, options);
|
|
697
507
|
const responseFields$ = {
|
|
698
508
|
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
699
509
|
StatusCode: response.status,
|
|
700
510
|
RawResponse: response,
|
|
701
511
|
};
|
|
702
|
-
if (this.matchResponse(response, 200, "application/json")) {
|
|
703
|
-
const responseBody = await response.json();
|
|
704
|
-
const result = operations.GetPhoneNumberResponse$.inboundSchema.parse({
|
|
705
|
-
...responseFields$,
|
|
706
|
-
PhoneNumber: responseBody,
|
|
707
|
-
});
|
|
708
|
-
return result;
|
|
709
|
-
}
|
|
710
|
-
else if (this.matchResponse(response, 400, "application/json")) {
|
|
711
|
-
const responseBody = await response.json();
|
|
712
|
-
const result = errors.GetPhoneNumberResponseBody$.inboundSchema.parse({
|
|
713
|
-
...responseFields$,
|
|
714
|
-
...responseBody,
|
|
715
|
-
});
|
|
716
|
-
throw result;
|
|
717
|
-
}
|
|
718
|
-
else if (this.matchResponse(response, 401, "application/json")) {
|
|
719
|
-
const responseBody = await response.json();
|
|
720
|
-
const result = errors.GetPhoneNumberResponseResponseBody$.inboundSchema.parse({
|
|
721
|
-
...responseFields$,
|
|
722
|
-
...responseBody,
|
|
723
|
-
});
|
|
724
|
-
throw result;
|
|
725
|
-
}
|
|
726
|
-
else if (this.matchResponse(response, 422, "application/json")) {
|
|
727
|
-
const responseBody = await response.json();
|
|
728
|
-
const result = errors.GetPhoneNumberResponse422ResponseBody$.inboundSchema.parse({
|
|
729
|
-
...responseFields$,
|
|
730
|
-
...responseBody,
|
|
731
|
-
});
|
|
732
|
-
throw result;
|
|
733
|
-
}
|
|
734
|
-
else if (this.matchResponse(response, 500, "application/json")) {
|
|
735
|
-
const responseBody = await response.json();
|
|
736
|
-
const result = errors.GetPhoneNumberResponse500ResponseBody$.inboundSchema.parse({
|
|
737
|
-
...responseFields$,
|
|
738
|
-
...responseBody,
|
|
739
|
-
});
|
|
740
|
-
throw result;
|
|
741
|
-
}
|
|
742
|
-
else {
|
|
743
|
-
const responseBody = await response.text();
|
|
744
|
-
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
/**
|
|
748
|
-
* List all agents
|
|
749
|
-
*/
|
|
750
|
-
async listAgents(options) {
|
|
751
|
-
var _a;
|
|
752
|
-
const headers$ = new Headers();
|
|
753
|
-
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
754
|
-
headers$.set("Accept", "application/json");
|
|
755
|
-
const path$ = this.templateURLComponent("/list-agents")();
|
|
756
|
-
let security$;
|
|
757
|
-
if (typeof this.options$.apiKey === "function") {
|
|
758
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
759
|
-
}
|
|
760
|
-
else if (this.options$.apiKey) {
|
|
761
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
762
|
-
}
|
|
763
|
-
else {
|
|
764
|
-
security$ = {};
|
|
765
|
-
}
|
|
766
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
767
|
-
const response = await this.fetch$({ security: securitySettings$, method: "get", path: path$, headers: headers$ }, options);
|
|
768
|
-
const responseFields$ = {
|
|
769
|
-
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
770
|
-
StatusCode: response.status,
|
|
771
|
-
RawResponse: response,
|
|
772
|
-
};
|
|
773
512
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
774
513
|
const responseBody = await response.json();
|
|
775
514
|
const result = operations.ListAgentsResponse$.inboundSchema.parse({
|
|
@@ -820,7 +559,10 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
820
559
|
explode: true,
|
|
821
560
|
charEncoding: "percent",
|
|
822
561
|
}),
|
|
823
|
-
enc$.encodeForm("limit", payload$.limit, {
|
|
562
|
+
enc$.encodeForm("limit", payload$.limit, {
|
|
563
|
+
explode: true,
|
|
564
|
+
charEncoding: "percent",
|
|
565
|
+
}),
|
|
824
566
|
enc$.encodeForm("sort_order", payload$.sort_order, {
|
|
825
567
|
explode: true,
|
|
826
568
|
charEncoding: "percent",
|
|
@@ -889,69 +631,6 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
889
631
|
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
890
632
|
}
|
|
891
633
|
}
|
|
892
|
-
/**
|
|
893
|
-
* List all purchased and active phone numbers
|
|
894
|
-
*/
|
|
895
|
-
async listPhoneNumbers(options) {
|
|
896
|
-
var _a;
|
|
897
|
-
const headers$ = new Headers();
|
|
898
|
-
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
899
|
-
headers$.set("Accept", "application/json");
|
|
900
|
-
const path$ = this.templateURLComponent("/list-phone-numbers")();
|
|
901
|
-
let security$;
|
|
902
|
-
if (typeof this.options$.apiKey === "function") {
|
|
903
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
904
|
-
}
|
|
905
|
-
else if (this.options$.apiKey) {
|
|
906
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
907
|
-
}
|
|
908
|
-
else {
|
|
909
|
-
security$ = {};
|
|
910
|
-
}
|
|
911
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
912
|
-
const response = await this.fetch$({ security: securitySettings$, method: "get", path: path$, headers: headers$ }, options);
|
|
913
|
-
const responseFields$ = {
|
|
914
|
-
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
915
|
-
StatusCode: response.status,
|
|
916
|
-
RawResponse: response,
|
|
917
|
-
};
|
|
918
|
-
if (this.matchResponse(response, 200, "application/json")) {
|
|
919
|
-
const responseBody = await response.json();
|
|
920
|
-
const result = operations.ListPhoneNumbersResponse$.inboundSchema.parse({
|
|
921
|
-
...responseFields$,
|
|
922
|
-
phoneNumbers: responseBody,
|
|
923
|
-
});
|
|
924
|
-
return result;
|
|
925
|
-
}
|
|
926
|
-
else if (this.matchResponse(response, 400, "application/json")) {
|
|
927
|
-
const responseBody = await response.json();
|
|
928
|
-
const result = errors.ListPhoneNumbersResponseBody$.inboundSchema.parse({
|
|
929
|
-
...responseFields$,
|
|
930
|
-
...responseBody,
|
|
931
|
-
});
|
|
932
|
-
throw result;
|
|
933
|
-
}
|
|
934
|
-
else if (this.matchResponse(response, 401, "application/json")) {
|
|
935
|
-
const responseBody = await response.json();
|
|
936
|
-
const result = errors.ListPhoneNumbersResponseResponseBody$.inboundSchema.parse({
|
|
937
|
-
...responseFields$,
|
|
938
|
-
...responseBody,
|
|
939
|
-
});
|
|
940
|
-
throw result;
|
|
941
|
-
}
|
|
942
|
-
else if (this.matchResponse(response, 500, "application/json")) {
|
|
943
|
-
const responseBody = await response.json();
|
|
944
|
-
const result = errors.ListPhoneNumbersResponse500ResponseBody$.inboundSchema.parse({
|
|
945
|
-
...responseFields$,
|
|
946
|
-
...responseBody,
|
|
947
|
-
});
|
|
948
|
-
throw result;
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
951
|
-
const responseBody = await response.text();
|
|
952
|
-
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
634
|
/**
|
|
956
635
|
* Update an existing agent
|
|
957
636
|
*/
|
|
@@ -966,7 +645,9 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
966
645
|
headers$.set("Content-Type", "application/json");
|
|
967
646
|
headers$.set("Accept", "application/json");
|
|
968
647
|
const payload$ = operations.UpdateAgentRequest$.outboundSchema.parse(input$);
|
|
969
|
-
const body$ = enc$.encodeJSON("body", payload$.RequestBody, {
|
|
648
|
+
const body$ = enc$.encodeJSON("body", payload$.RequestBody, {
|
|
649
|
+
explode: true,
|
|
650
|
+
});
|
|
970
651
|
const pathParams$ = {
|
|
971
652
|
agent_id: enc$.encodeSimple("agent_id", payload$.agent_id, {
|
|
972
653
|
explode: false,
|
|
@@ -1042,96 +723,6 @@ class RetellClient extends sdks_1.ClientSDK {
|
|
|
1042
723
|
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
1043
724
|
}
|
|
1044
725
|
}
|
|
1045
|
-
/**
|
|
1046
|
-
* Update an existing phone number
|
|
1047
|
-
*/
|
|
1048
|
-
async updatePhoneAgent(requestBody, phoneNumber, options) {
|
|
1049
|
-
var _a;
|
|
1050
|
-
const input$ = {
|
|
1051
|
-
requestBody: requestBody,
|
|
1052
|
-
phoneNumber: phoneNumber,
|
|
1053
|
-
};
|
|
1054
|
-
const headers$ = new Headers();
|
|
1055
|
-
headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
|
|
1056
|
-
headers$.set("Content-Type", "application/json");
|
|
1057
|
-
headers$.set("Accept", "application/json");
|
|
1058
|
-
const payload$ = operations.UpdatePhoneAgentRequest$.outboundSchema.parse(input$);
|
|
1059
|
-
const body$ = enc$.encodeJSON("body", payload$.RequestBody, { explode: true });
|
|
1060
|
-
const pathParams$ = {
|
|
1061
|
-
phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
|
|
1062
|
-
explode: false,
|
|
1063
|
-
charEncoding: "percent",
|
|
1064
|
-
}),
|
|
1065
|
-
};
|
|
1066
|
-
const path$ = this.templateURLComponent("/update-phone-agent/{phone_number}")(pathParams$);
|
|
1067
|
-
let security$;
|
|
1068
|
-
if (typeof this.options$.apiKey === "function") {
|
|
1069
|
-
security$ = { apiKey: await this.options$.apiKey() };
|
|
1070
|
-
}
|
|
1071
|
-
else if (this.options$.apiKey) {
|
|
1072
|
-
security$ = { apiKey: this.options$.apiKey };
|
|
1073
|
-
}
|
|
1074
|
-
else {
|
|
1075
|
-
security$ = {};
|
|
1076
|
-
}
|
|
1077
|
-
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
1078
|
-
const response = await this.fetch$({
|
|
1079
|
-
security: securitySettings$,
|
|
1080
|
-
method: "PATCH",
|
|
1081
|
-
path: path$,
|
|
1082
|
-
headers: headers$,
|
|
1083
|
-
body: body$,
|
|
1084
|
-
}, options);
|
|
1085
|
-
const responseFields$ = {
|
|
1086
|
-
ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
|
|
1087
|
-
StatusCode: response.status,
|
|
1088
|
-
RawResponse: response,
|
|
1089
|
-
};
|
|
1090
|
-
if (this.matchResponse(response, 200, "application/json")) {
|
|
1091
|
-
const responseBody = await response.json();
|
|
1092
|
-
const result = operations.UpdatePhoneAgentResponse$.inboundSchema.parse({
|
|
1093
|
-
...responseFields$,
|
|
1094
|
-
PhoneNumber: responseBody,
|
|
1095
|
-
});
|
|
1096
|
-
return result;
|
|
1097
|
-
}
|
|
1098
|
-
else if (this.matchResponse(response, 400, "application/json")) {
|
|
1099
|
-
const responseBody = await response.json();
|
|
1100
|
-
const result = errors.UpdatePhoneAgentResponseBody$.inboundSchema.parse({
|
|
1101
|
-
...responseFields$,
|
|
1102
|
-
...responseBody,
|
|
1103
|
-
});
|
|
1104
|
-
throw result;
|
|
1105
|
-
}
|
|
1106
|
-
else if (this.matchResponse(response, 401, "application/json")) {
|
|
1107
|
-
const responseBody = await response.json();
|
|
1108
|
-
const result = errors.UpdatePhoneAgentResponseResponseBody$.inboundSchema.parse({
|
|
1109
|
-
...responseFields$,
|
|
1110
|
-
...responseBody,
|
|
1111
|
-
});
|
|
1112
|
-
throw result;
|
|
1113
|
-
}
|
|
1114
|
-
else if (this.matchResponse(response, 422, "application/json")) {
|
|
1115
|
-
const responseBody = await response.json();
|
|
1116
|
-
const result = errors.UpdatePhoneAgentResponse422ResponseBody$.inboundSchema.parse({
|
|
1117
|
-
...responseFields$,
|
|
1118
|
-
...responseBody,
|
|
1119
|
-
});
|
|
1120
|
-
throw result;
|
|
1121
|
-
}
|
|
1122
|
-
else if (this.matchResponse(response, 500, "application/json")) {
|
|
1123
|
-
const responseBody = await response.json();
|
|
1124
|
-
const result = errors.UpdatePhoneAgentResponse500ResponseBody$.inboundSchema.parse({
|
|
1125
|
-
...responseFields$,
|
|
1126
|
-
...responseBody,
|
|
1127
|
-
});
|
|
1128
|
-
throw result;
|
|
1129
|
-
}
|
|
1130
|
-
else {
|
|
1131
|
-
const responseBody = await response.text();
|
|
1132
|
-
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
726
|
}
|
|
1136
727
|
exports.RetellClient = RetellClient;
|
|
1137
728
|
//# sourceMappingURL=sdk.js.map
|