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.
Files changed (87) hide show
  1. package/example.js +15 -4
  2. package/example.js.map +1 -1
  3. package/models/components/agent.d.ts +3 -205
  4. package/models/components/agent.d.ts.map +1 -1
  5. package/models/components/agent.js +5 -221
  6. package/models/components/agent.js.map +1 -1
  7. package/models/components/calldetail.d.ts +33 -22
  8. package/models/components/calldetail.d.ts.map +1 -1
  9. package/models/components/calldetail.js +32 -31
  10. package/models/components/calldetail.js.map +1 -1
  11. package/models/components/index.d.ts +0 -3
  12. package/models/components/index.d.ts.map +1 -1
  13. package/models/components/index.js +0 -3
  14. package/models/components/index.js.map +1 -1
  15. package/models/errors/index.d.ts +1 -6
  16. package/models/errors/index.d.ts.map +1 -1
  17. package/models/errors/index.js +1 -6
  18. package/models/errors/index.js.map +1 -1
  19. package/models/errors/registercall.d.ts +218 -0
  20. package/models/errors/registercall.d.ts.map +1 -0
  21. package/models/errors/registercall.js +386 -0
  22. package/models/errors/registercall.js.map +1 -0
  23. package/models/operations/createagent.d.ts +3 -16
  24. package/models/operations/createagent.d.ts.map +1 -1
  25. package/models/operations/createagent.js +4 -22
  26. package/models/operations/createagent.js.map +1 -1
  27. package/models/operations/getcall.d.ts +1 -1
  28. package/models/operations/index.d.ts +1 -7
  29. package/models/operations/index.d.ts.map +1 -1
  30. package/models/operations/index.js +1 -7
  31. package/models/operations/index.js.map +1 -1
  32. package/models/operations/listcalls.d.ts +1 -7
  33. package/models/operations/listcalls.d.ts.map +1 -1
  34. package/models/operations/listcalls.js +0 -4
  35. package/models/operations/listcalls.js.map +1 -1
  36. package/models/operations/registercall.d.ts +74 -0
  37. package/models/operations/registercall.d.ts.map +1 -0
  38. package/models/operations/registercall.js +104 -0
  39. package/models/operations/registercall.js.map +1 -0
  40. package/models/operations/updateagent.d.ts +3 -16
  41. package/models/operations/updateagent.d.ts.map +1 -1
  42. package/models/operations/updateagent.js +7 -25
  43. package/models/operations/updateagent.js.map +1 -1
  44. package/package.json +1 -1
  45. package/sdk/audioWsClient.d.ts +10 -0
  46. package/sdk/audioWsClient.d.ts.map +1 -0
  47. package/sdk/audioWsClient.js +60 -0
  48. package/sdk/audioWsClient.js.map +1 -0
  49. package/sdk/index.d.ts +1 -1
  50. package/sdk/index.d.ts.map +1 -1
  51. package/sdk/index.js +1 -1
  52. package/sdk/index.js.map +1 -1
  53. package/sdk/sdk.d.ts +1 -23
  54. package/sdk/sdk.d.ts.map +1 -1
  55. package/sdk/sdk.js +11 -437
  56. package/sdk/sdk.js.map +1 -1
  57. package/src/example.ts +18 -4
  58. package/src/models/components/agent.ts +8 -460
  59. package/src/models/components/calldetail.ts +47 -42
  60. package/src/models/components/index.ts +0 -3
  61. package/src/models/errors/index.ts +1 -6
  62. package/src/models/errors/{createphonecall.ts → registercall.ts} +60 -60
  63. package/src/models/operations/createagent.ts +8 -50
  64. package/src/models/operations/getcall.ts +1 -1
  65. package/src/models/operations/index.ts +1 -7
  66. package/src/models/operations/listcalls.ts +1 -11
  67. package/src/models/operations/registercall.ts +167 -0
  68. package/src/models/operations/updateagent.ts +11 -58
  69. package/src/sdk/audioWsClient.ts +63 -0
  70. package/src/sdk/index.ts +1 -1
  71. package/src/sdk/sdk.ts +13 -526
  72. package/src/models/components/agentpromptparams.ts +0 -61
  73. package/src/models/components/callphonenumber.ts +0 -64
  74. package/src/models/components/phonenumber.ts +0 -84
  75. package/src/models/errors/createphonenumber.ts +0 -552
  76. package/src/models/errors/deletephonenumber.ts +0 -442
  77. package/src/models/errors/getphonenumber.ts +0 -442
  78. package/src/models/errors/listphonenumbers.ts +0 -332
  79. package/src/models/errors/updatephoneagent.ts +0 -442
  80. package/src/models/operations/createphonecall.ts +0 -353
  81. package/src/models/operations/createphonenumber.ts +0 -144
  82. package/src/models/operations/createwebcall.ts +0 -16
  83. package/src/models/operations/deletephonenumber.ts +0 -119
  84. package/src/models/operations/getphonenumber.ts +0 -134
  85. package/src/models/operations/listphonenumbers.ts +0 -88
  86. package/src/models/operations/updatephoneagent.ts +0 -187
  87. package/src/sdk/liveClient.ts +0 -113
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 createPhoneCall(input, options) {
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.CreatePhoneCallRequestBody$.outboundSchema.parse(input);
134
+ const payload$ = operations.RegisterCallRequestBody$.outboundSchema.parse(input);
141
135
  const body$ = enc$.encodeJSON("body", payload$, { explode: true });
142
- const path$ = this.templateURLComponent("/create-phone-call")();
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.CreatePhoneCallResponse$.inboundSchema.parse({
162
+ const result = operations.RegisterCallResponse$.inboundSchema.parse({
169
163
  ...responseFields$,
170
- callDetail: responseBody,
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.CreatePhoneCallResponseBody$.inboundSchema.parse({
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.CreatePhoneCallResponseResponseBody$.inboundSchema.parse({
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.CreatePhoneCallResponse402ResponseBody$.inboundSchema.parse({
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.CreatePhoneCallResponse422ResponseBody$.inboundSchema.parse({
194
+ const result = errors.RegisterCallResponse422ResponseBody$.inboundSchema.parse({
201
195
  ...responseFields$,
202
196
  ...responseBody,
203
197
  });
@@ -205,95 +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.CreatePhoneCallResponse429ResponseBody$.inboundSchema.parse({
209
- ...responseFields$,
210
- ...responseBody,
211
- });
212
- throw result;
213
- }
214
- else if (this.matchResponse(response, 500, "application/json")) {
215
- const responseBody = await response.json();
216
- const result = errors.CreatePhoneCallResponse500ResponseBody$.inboundSchema.parse({
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({
202
+ const result = errors.RegisterCallResponse429ResponseBody$.inboundSchema.parse({
297
203
  ...responseFields$,
298
204
  ...responseBody,
299
205
  });
@@ -301,7 +207,7 @@ class RetellClient extends sdks_1.ClientSDK {
301
207
  }
302
208
  else if (this.matchResponse(response, 500, "application/json")) {
303
209
  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
  */
@@ -656,94 +478,6 @@ class RetellClient extends sdks_1.ClientSDK {
656
478
  throw new errors.SDKError("Unexpected API response", response, responseBody);
657
479
  }
658
480
  }
659
- /**
660
- * Retrieve info about a specific number
661
- */
662
- async getPhoneNumber(phoneNumber, options) {
663
- var _a;
664
- const input$ = {
665
- phoneNumber: phoneNumber,
666
- };
667
- const headers$ = new Headers();
668
- headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
669
- headers$.set("Accept", "application/json");
670
- const payload$ = operations.GetPhoneNumberRequest$.outboundSchema.parse(input$);
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$);
679
- let security$;
680
- if (typeof this.options$.apiKey === "function") {
681
- security$ = { apiKey: await this.options$.apiKey() };
682
- }
683
- else if (this.options$.apiKey) {
684
- security$ = { apiKey: this.options$.apiKey };
685
- }
686
- else {
687
- security$ = {};
688
- }
689
- const securitySettings$ = this.resolveGlobalSecurity(security$);
690
- const response = await this.fetch$({
691
- security: securitySettings$,
692
- method: "get",
693
- path: path$,
694
- headers: headers$,
695
- body: body$,
696
- }, options);
697
- const responseFields$ = {
698
- ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
699
- StatusCode: response.status,
700
- RawResponse: response,
701
- };
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
481
  /**
748
482
  * List all agents
749
483
  */
@@ -897,74 +631,6 @@ class RetellClient extends sdks_1.ClientSDK {
897
631
  throw new errors.SDKError("Unexpected API response", response, responseBody);
898
632
  }
899
633
  }
900
- /**
901
- * List all purchased and active phone numbers
902
- */
903
- async listPhoneNumbers(options) {
904
- var _a;
905
- const headers$ = new Headers();
906
- headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
907
- headers$.set("Accept", "application/json");
908
- const path$ = this.templateURLComponent("/list-phone-numbers")();
909
- let security$;
910
- if (typeof this.options$.apiKey === "function") {
911
- security$ = { apiKey: await this.options$.apiKey() };
912
- }
913
- else if (this.options$.apiKey) {
914
- security$ = { apiKey: this.options$.apiKey };
915
- }
916
- else {
917
- security$ = {};
918
- }
919
- const securitySettings$ = this.resolveGlobalSecurity(security$);
920
- const response = await this.fetch$({
921
- security: securitySettings$,
922
- method: "get",
923
- path: path$,
924
- headers: headers$,
925
- }, options);
926
- const responseFields$ = {
927
- ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
928
- StatusCode: response.status,
929
- RawResponse: response,
930
- };
931
- if (this.matchResponse(response, 200, "application/json")) {
932
- const responseBody = await response.json();
933
- const result = operations.ListPhoneNumbersResponse$.inboundSchema.parse({
934
- ...responseFields$,
935
- phoneNumbers: responseBody,
936
- });
937
- return result;
938
- }
939
- else if (this.matchResponse(response, 400, "application/json")) {
940
- const responseBody = await response.json();
941
- const result = errors.ListPhoneNumbersResponseBody$.inboundSchema.parse({
942
- ...responseFields$,
943
- ...responseBody,
944
- });
945
- throw result;
946
- }
947
- else if (this.matchResponse(response, 401, "application/json")) {
948
- const responseBody = await response.json();
949
- const result = errors.ListPhoneNumbersResponseResponseBody$.inboundSchema.parse({
950
- ...responseFields$,
951
- ...responseBody,
952
- });
953
- throw result;
954
- }
955
- else if (this.matchResponse(response, 500, "application/json")) {
956
- const responseBody = await response.json();
957
- const result = errors.ListPhoneNumbersResponse500ResponseBody$.inboundSchema.parse({
958
- ...responseFields$,
959
- ...responseBody,
960
- });
961
- throw result;
962
- }
963
- else {
964
- const responseBody = await response.text();
965
- throw new errors.SDKError("Unexpected API response", response, responseBody);
966
- }
967
- }
968
634
  /**
969
635
  * Update an existing agent
970
636
  */
@@ -1057,98 +723,6 @@ class RetellClient extends sdks_1.ClientSDK {
1057
723
  throw new errors.SDKError("Unexpected API response", response, responseBody);
1058
724
  }
1059
725
  }
1060
- /**
1061
- * Update an existing phone number
1062
- */
1063
- async updatePhoneAgent(requestBody, phoneNumber, options) {
1064
- var _a;
1065
- const input$ = {
1066
- requestBody: requestBody,
1067
- phoneNumber: phoneNumber,
1068
- };
1069
- const headers$ = new Headers();
1070
- headers$.set("user-agent", config_1.SDK_METADATA.userAgent);
1071
- headers$.set("Content-Type", "application/json");
1072
- headers$.set("Accept", "application/json");
1073
- const payload$ = operations.UpdatePhoneAgentRequest$.outboundSchema.parse(input$);
1074
- const body$ = enc$.encodeJSON("body", payload$.RequestBody, {
1075
- explode: true,
1076
- });
1077
- const pathParams$ = {
1078
- phone_number: enc$.encodeSimple("phone_number", payload$.phone_number, {
1079
- explode: false,
1080
- charEncoding: "percent",
1081
- }),
1082
- };
1083
- const path$ = this.templateURLComponent("/update-phone-agent/{phone_number}")(pathParams$);
1084
- let security$;
1085
- if (typeof this.options$.apiKey === "function") {
1086
- security$ = { apiKey: await this.options$.apiKey() };
1087
- }
1088
- else if (this.options$.apiKey) {
1089
- security$ = { apiKey: this.options$.apiKey };
1090
- }
1091
- else {
1092
- security$ = {};
1093
- }
1094
- const securitySettings$ = this.resolveGlobalSecurity(security$);
1095
- const response = await this.fetch$({
1096
- security: securitySettings$,
1097
- method: "PATCH",
1098
- path: path$,
1099
- headers: headers$,
1100
- body: body$,
1101
- }, options);
1102
- const responseFields$ = {
1103
- ContentType: (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "application/octet-stream",
1104
- StatusCode: response.status,
1105
- RawResponse: response,
1106
- };
1107
- if (this.matchResponse(response, 200, "application/json")) {
1108
- const responseBody = await response.json();
1109
- const result = operations.UpdatePhoneAgentResponse$.inboundSchema.parse({
1110
- ...responseFields$,
1111
- PhoneNumber: responseBody,
1112
- });
1113
- return result;
1114
- }
1115
- else if (this.matchResponse(response, 400, "application/json")) {
1116
- const responseBody = await response.json();
1117
- const result = errors.UpdatePhoneAgentResponseBody$.inboundSchema.parse({
1118
- ...responseFields$,
1119
- ...responseBody,
1120
- });
1121
- throw result;
1122
- }
1123
- else if (this.matchResponse(response, 401, "application/json")) {
1124
- const responseBody = await response.json();
1125
- const result = errors.UpdatePhoneAgentResponseResponseBody$.inboundSchema.parse({
1126
- ...responseFields$,
1127
- ...responseBody,
1128
- });
1129
- throw result;
1130
- }
1131
- else if (this.matchResponse(response, 422, "application/json")) {
1132
- const responseBody = await response.json();
1133
- const result = errors.UpdatePhoneAgentResponse422ResponseBody$.inboundSchema.parse({
1134
- ...responseFields$,
1135
- ...responseBody,
1136
- });
1137
- throw result;
1138
- }
1139
- else if (this.matchResponse(response, 500, "application/json")) {
1140
- const responseBody = await response.json();
1141
- const result = errors.UpdatePhoneAgentResponse500ResponseBody$.inboundSchema.parse({
1142
- ...responseFields$,
1143
- ...responseBody,
1144
- });
1145
- throw result;
1146
- }
1147
- else {
1148
- const responseBody = await response.text();
1149
- throw new errors.SDKError("Unexpected API response", response, responseBody);
1150
- }
1151
- }
1152
726
  }
1153
727
  exports.RetellClient = RetellClient;
1154
728
  //# sourceMappingURL=sdk.js.map