pingram 1.0.16 → 1.0.17-alpha.1302

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 (157) hide show
  1. package/dist/generated/src/apis/NumbersApi.d.ts +4 -4
  2. package/dist/generated/src/apis/NumbersApi.js +2 -2
  3. package/dist/generated/src/apis/OrganizationApi.d.ts +9 -5
  4. package/dist/generated/src/apis/OrganizationApi.js +9 -4
  5. package/dist/generated/src/apis/ProfileApi.d.ts +25 -1
  6. package/dist/generated/src/apis/ProfileApi.js +55 -0
  7. package/dist/generated/src/apis/VoiceApi.d.ts +296 -0
  8. package/dist/generated/src/apis/VoiceApi.js +669 -0
  9. package/dist/generated/src/apis/index.d.ts +4 -2
  10. package/dist/generated/src/apis/index.js +3 -1
  11. package/dist/generated/src/models/ApiErrorBody.d.ts +0 -12
  12. package/dist/generated/src/models/ApiErrorBody.js +2 -6
  13. package/dist/generated/src/models/BillingPostRequestBody.d.ts +1 -7
  14. package/dist/generated/src/models/BillingPostRequestBody.js +0 -2
  15. package/dist/generated/src/models/BillingPostResponseBody.d.ts +14 -0
  16. package/dist/generated/src/models/BillingPostResponseBody.js +12 -1
  17. package/dist/generated/src/models/BindNumberRequest.d.ts +32 -0
  18. package/dist/generated/src/models/BindNumberRequest.js +50 -0
  19. package/dist/generated/src/models/BindNumberResponse.d.ts +33 -0
  20. package/dist/generated/src/models/BindNumberResponse.js +51 -0
  21. package/dist/generated/src/models/BindNumberResponseAgent.d.ts +85 -0
  22. package/dist/generated/src/models/BindNumberResponseAgent.js +92 -0
  23. package/dist/generated/src/models/BindNumberResponseAgentSpec.d.ts +87 -0
  24. package/dist/generated/src/models/BindNumberResponseAgentSpec.js +89 -0
  25. package/dist/generated/src/models/BindNumberResponseAgentSpecCompliance.d.ts +32 -0
  26. package/dist/generated/src/models/BindNumberResponseAgentSpecCompliance.js +50 -0
  27. package/dist/generated/src/models/BindNumberResponseAgentSpecConversation.d.ts +76 -0
  28. package/dist/generated/src/models/BindNumberResponseAgentSpecConversation.js +87 -0
  29. package/dist/generated/src/models/BindNumberResponseAgentSpecInbound.d.ts +46 -0
  30. package/dist/generated/src/models/BindNumberResponseAgentSpecInbound.js +64 -0
  31. package/dist/generated/src/models/BindNumberResponseAgentSpecModel.d.ts +23 -0
  32. package/dist/generated/src/models/BindNumberResponseAgentSpecModel.js +57 -0
  33. package/dist/generated/src/models/BindNumberResponseAgentSpecOutbound.d.ts +67 -0
  34. package/dist/generated/src/models/BindNumberResponseAgentSpecOutbound.js +80 -0
  35. package/dist/generated/src/models/BindNumberResponseAgentSpecToolsInner.d.ts +26 -0
  36. package/dist/generated/src/models/BindNumberResponseAgentSpecToolsInner.js +78 -0
  37. package/dist/generated/src/models/BindNumberResponseAgentSpecVariablesInner.d.ts +44 -0
  38. package/dist/generated/src/models/BindNumberResponseAgentSpecVariablesInner.js +54 -0
  39. package/dist/generated/src/models/Chained.d.ts +87 -0
  40. package/dist/generated/src/models/Chained.js +91 -0
  41. package/dist/generated/src/models/ChannelsEnum.d.ts +1 -0
  42. package/dist/generated/src/models/ChannelsEnum.js +1 -0
  43. package/dist/generated/src/models/CreateOrganizationRequest.d.ts +34 -0
  44. package/dist/generated/src/models/CreateOrganizationRequest.js +48 -0
  45. package/dist/generated/src/models/CreateVoiceAgentRequest.d.ts +33 -0
  46. package/dist/generated/src/models/CreateVoiceAgentRequest.js +51 -0
  47. package/dist/generated/src/models/CreateVoiceAgentResponse.d.ts +33 -0
  48. package/dist/generated/src/models/CreateVoiceAgentResponse.js +51 -0
  49. package/dist/generated/src/models/Custom.d.ts +65 -0
  50. package/dist/generated/src/models/Custom.js +73 -0
  51. package/dist/generated/src/models/DeleteAccountRequest.d.ts +32 -0
  52. package/dist/generated/src/models/DeleteAccountRequest.js +48 -0
  53. package/dist/generated/src/models/DeleteVoiceAgentResponse.d.ts +32 -0
  54. package/dist/generated/src/models/DeleteVoiceAgentResponse.js +50 -0
  55. package/dist/generated/src/models/Dtmf.d.ts +39 -0
  56. package/dist/generated/src/models/Dtmf.js +59 -0
  57. package/dist/generated/src/models/EventsWebhookResponse.d.ts +1 -2
  58. package/dist/generated/src/models/EventsWebhookResponse.js +0 -1
  59. package/dist/generated/src/models/EventsWebhookUpsertRequest.d.ts +1 -2
  60. package/dist/generated/src/models/EventsWebhookUpsertRequest.js +0 -1
  61. package/dist/generated/src/models/GetNotificationsResponseInnerOptions.d.ts +6 -0
  62. package/dist/generated/src/models/GetNotificationsResponseInnerOptions.js +4 -0
  63. package/dist/generated/src/models/GetSendersResponseInner.d.ts +7 -0
  64. package/dist/generated/src/models/GetSendersResponseInner.js +7 -2
  65. package/dist/generated/src/models/GetSendersResponseInnerVerificationRecords.d.ts +57 -0
  66. package/dist/generated/src/models/GetSendersResponseInnerVerificationRecords.js +67 -0
  67. package/dist/generated/src/models/GetSendersResponseInnerVerificationRecordsDkim.d.ts +70 -0
  68. package/dist/generated/src/models/GetSendersResponseInnerVerificationRecordsDkim.js +76 -0
  69. package/dist/generated/src/models/GetVoiceAgentResponse.d.ts +33 -0
  70. package/dist/generated/src/models/GetVoiceAgentResponse.js +51 -0
  71. package/dist/generated/src/models/GetVoiceCallResponse.d.ts +33 -0
  72. package/dist/generated/src/models/GetVoiceCallResponse.js +51 -0
  73. package/dist/generated/src/models/GetVoiceCallResponseCall.d.ts +186 -0
  74. package/dist/generated/src/models/GetVoiceCallResponseCall.js +164 -0
  75. package/dist/generated/src/models/GetVoiceCallResponseCallCost.d.ts +39 -0
  76. package/dist/generated/src/models/GetVoiceCallResponseCallCost.js +55 -0
  77. package/dist/generated/src/models/GetVoiceCallResponseCallCostLinesInner.d.ts +62 -0
  78. package/dist/generated/src/models/GetVoiceCallResponseCallCostLinesInner.js +64 -0
  79. package/dist/generated/src/models/GetVoiceCallResponseCallTimelineInner.d.ts +79 -0
  80. package/dist/generated/src/models/GetVoiceCallResponseCallTimelineInner.js +69 -0
  81. package/dist/generated/src/models/GetVoiceCallResponseCallTimelineInnerLatency.d.ts +50 -0
  82. package/dist/generated/src/models/GetVoiceCallResponseCallTimelineInnerLatency.js +56 -0
  83. package/dist/generated/src/models/InboundResponseBodyResultsInner.d.ts +3 -1
  84. package/dist/generated/src/models/InboundResponseBodyResultsInner.js +2 -0
  85. package/dist/generated/src/models/Knowledge.d.ts +46 -0
  86. package/dist/generated/src/models/Knowledge.js +64 -0
  87. package/dist/generated/src/models/KnowledgeDocumentsInner.d.ts +44 -0
  88. package/dist/generated/src/models/KnowledgeDocumentsInner.js +58 -0
  89. package/dist/generated/src/models/ListPhoneNumbersResponseNumbersInner.d.ts +6 -0
  90. package/dist/generated/src/models/ListPhoneNumbersResponseNumbersInner.js +4 -2
  91. package/dist/generated/src/models/ListVoiceAgentsResponse.d.ts +33 -0
  92. package/dist/generated/src/models/ListVoiceAgentsResponse.js +51 -0
  93. package/dist/generated/src/models/ListVoiceCallsResponse.d.ts +39 -0
  94. package/dist/generated/src/models/ListVoiceCallsResponse.js +53 -0
  95. package/dist/generated/src/models/ListVoiceCallsResponseCallsInner.d.ts +158 -0
  96. package/dist/generated/src/models/ListVoiceCallsResponseCallsInner.js +150 -0
  97. package/dist/generated/src/models/LogQueryPostBody.d.ts +1 -0
  98. package/dist/generated/src/models/LogQueryPostBody.js +1 -0
  99. package/dist/generated/src/models/LogsGetResponseLogsInner.d.ts +2 -0
  100. package/dist/generated/src/models/LogsGetResponseLogsInner.js +2 -0
  101. package/dist/generated/src/models/Mcp.d.ts +51 -0
  102. package/dist/generated/src/models/Mcp.js +65 -0
  103. package/dist/generated/src/models/Organization.d.ts +14 -0
  104. package/dist/generated/src/models/Organization.js +12 -1
  105. package/dist/generated/src/models/OrganizationUsage.d.ts +8 -32
  106. package/dist/generated/src/models/OrganizationUsage.js +10 -24
  107. package/dist/generated/src/models/OrganizationUsageCosts.d.ts +33 -0
  108. package/dist/generated/src/models/OrganizationUsageCosts.js +50 -0
  109. package/dist/generated/src/models/OrganizationUsageCounts.d.ts +74 -0
  110. package/dist/generated/src/models/OrganizationUsageCounts.js +78 -0
  111. package/dist/generated/src/models/OrganizationUsageHistoryItemsInner.d.ts +4 -35
  112. package/dist/generated/src/models/OrganizationUsageHistoryItemsInner.js +4 -23
  113. package/dist/generated/src/models/OrganizationUsageHistoryItemsInnerCounts.d.ts +74 -0
  114. package/dist/generated/src/models/OrganizationUsageHistoryItemsInnerCounts.js +78 -0
  115. package/dist/generated/src/models/PhoneVerifyConfirmRequest.d.ts +8 -0
  116. package/dist/generated/src/models/PhoneVerifyConfirmRequest.js +4 -2
  117. package/dist/generated/src/models/S2s.d.ts +63 -0
  118. package/dist/generated/src/models/S2s.js +75 -0
  119. package/dist/generated/src/models/SendEmailApiResponseAnyOf1Error.d.ts +0 -12
  120. package/dist/generated/src/models/SendEmailApiResponseAnyOf1Error.js +2 -6
  121. package/dist/generated/src/models/SendEmailRequest.d.ts +1 -1
  122. package/dist/generated/src/models/SendSmsResponseAnyOf1Error.d.ts +0 -12
  123. package/dist/generated/src/models/SendSmsResponseAnyOf1Error.js +2 -6
  124. package/dist/generated/src/models/SenderPostBodyOptionsEmail.d.ts +1 -1
  125. package/dist/generated/src/models/TenDlcBrandCreateRequest.d.ts +98 -0
  126. package/dist/generated/src/models/{A2pRegistrationCreateRequest.js → TenDlcBrandCreateRequest.js} +21 -17
  127. package/dist/generated/src/models/TenDlcBrandRegistration.d.ts +172 -0
  128. package/dist/generated/src/models/{A2pRegistration.js → TenDlcBrandRegistration.js} +43 -35
  129. package/dist/generated/src/models/TenDlcBrandUpdateRequest.d.ts +98 -0
  130. package/dist/generated/src/models/{A2pRegistrationUpdateRequest.js → TenDlcBrandUpdateRequest.js} +21 -15
  131. package/dist/generated/src/models/Transfer.d.ts +65 -0
  132. package/dist/generated/src/models/Transfer.js +78 -0
  133. package/dist/generated/src/models/UnbindNumberResponse.d.ts +33 -0
  134. package/dist/generated/src/models/UnbindNumberResponse.js +51 -0
  135. package/dist/generated/src/models/UpdateVoiceAgentRequest.d.ts +33 -0
  136. package/dist/generated/src/models/UpdateVoiceAgentRequest.js +51 -0
  137. package/dist/generated/src/models/UpdateVoiceAgentResponse.d.ts +33 -0
  138. package/dist/generated/src/models/UpdateVoiceAgentResponse.js +51 -0
  139. package/dist/generated/src/models/VoiceBrowserCallRequest.d.ts +47 -0
  140. package/dist/generated/src/models/VoiceBrowserCallRequest.js +55 -0
  141. package/dist/generated/src/models/VoiceBrowserCallResponse.d.ts +44 -0
  142. package/dist/generated/src/models/VoiceBrowserCallResponse.js +58 -0
  143. package/dist/generated/src/models/VoiceCallRequest.d.ts +53 -0
  144. package/dist/generated/src/models/VoiceCallRequest.js +59 -0
  145. package/dist/generated/src/models/VoiceCallResponse.d.ts +44 -0
  146. package/dist/generated/src/models/VoiceCallResponse.js +58 -0
  147. package/dist/generated/src/models/WebhookEvent.d.ts +1 -2
  148. package/dist/generated/src/models/WebhookEvent.js +0 -1
  149. package/dist/generated/src/models/index.d.ts +49 -3
  150. package/dist/generated/src/models/index.js +49 -3
  151. package/dist/src/client.d.ts +2 -0
  152. package/dist/src/client.js +8 -5
  153. package/dist/src/index.d.ts +2 -1
  154. package/package.json +2 -2
  155. package/dist/generated/src/models/A2pRegistration.d.ts +0 -134
  156. package/dist/generated/src/models/A2pRegistrationCreateRequest.d.ts +0 -80
  157. package/dist/generated/src/models/A2pRegistrationUpdateRequest.d.ts +0 -80
@@ -0,0 +1,669 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Pingram
6
+ * Internal API for notification delivery and management
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.VoiceApi = void 0;
50
+ const runtime = __importStar(require("../runtime"));
51
+ const index_1 = require("../models/index");
52
+ /**
53
+ *
54
+ */
55
+ class VoiceApi extends runtime.BaseAPI {
56
+ /**
57
+ * Bind a phone number to a deployed agent for inbound routing
58
+ */
59
+ async bindNumberRaw(requestParameters, initOverrides) {
60
+ if (requestParameters['agentId'] == null) {
61
+ throw new runtime.RequiredError('agentId', 'Required parameter "agentId" was null or undefined when calling bindNumber().');
62
+ }
63
+ if (requestParameters['bindNumberRequest'] == null) {
64
+ throw new runtime.RequiredError('bindNumberRequest', 'Required parameter "bindNumberRequest" was null or undefined when calling bindNumber().');
65
+ }
66
+ const queryParameters = {};
67
+ const headerParameters = {};
68
+ headerParameters['Content-Type'] = 'application/json';
69
+ if (this.configuration &&
70
+ (this.configuration.username !== undefined ||
71
+ this.configuration.password !== undefined)) {
72
+ headerParameters['Authorization'] =
73
+ 'Basic ' +
74
+ btoa(this.configuration.username + ':' + this.configuration.password);
75
+ }
76
+ if (this.configuration &&
77
+ (this.configuration.username !== undefined ||
78
+ this.configuration.password !== undefined)) {
79
+ headerParameters['Authorization'] =
80
+ 'Basic ' +
81
+ btoa(this.configuration.username + ':' + this.configuration.password);
82
+ }
83
+ if (this.configuration && this.configuration.accessToken) {
84
+ const token = this.configuration.accessToken;
85
+ const tokenString = await token('apiKey', []);
86
+ if (tokenString) {
87
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
88
+ }
89
+ }
90
+ if (this.configuration &&
91
+ (this.configuration.username !== undefined ||
92
+ this.configuration.password !== undefined)) {
93
+ headerParameters['Authorization'] =
94
+ 'Basic ' +
95
+ btoa(this.configuration.username + ':' + this.configuration.password);
96
+ }
97
+ let urlPath = `/voice/agents/{agentId}/numbers`;
98
+ urlPath = urlPath.replace(`{${'agentId'}}`, encodeURIComponent(String(requestParameters['agentId'])));
99
+ const response = await this.request({
100
+ path: urlPath,
101
+ method: 'POST',
102
+ headers: headerParameters,
103
+ query: queryParameters,
104
+ body: (0, index_1.BindNumberRequestToJSON)(requestParameters['bindNumberRequest'])
105
+ }, initOverrides);
106
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.BindNumberResponseFromJSON)(jsonValue));
107
+ }
108
+ /**
109
+ * Bind a phone number to a deployed agent for inbound routing
110
+ */
111
+ async bindNumber(agentId, bindNumberRequest, initOverrides) {
112
+ const response = await this.bindNumberRaw({ agentId: agentId, bindNumberRequest: bindNumberRequest }, initOverrides);
113
+ return await response.value();
114
+ }
115
+ /**
116
+ * Place an outbound call with an inline agent spec (ephemeral)
117
+ */
118
+ async callRaw(requestParameters, initOverrides) {
119
+ if (requestParameters['voiceCallRequest'] == null) {
120
+ throw new runtime.RequiredError('voiceCallRequest', 'Required parameter "voiceCallRequest" was null or undefined when calling call().');
121
+ }
122
+ const queryParameters = {};
123
+ const headerParameters = {};
124
+ headerParameters['Content-Type'] = 'application/json';
125
+ if (this.configuration &&
126
+ (this.configuration.username !== undefined ||
127
+ this.configuration.password !== undefined)) {
128
+ headerParameters['Authorization'] =
129
+ 'Basic ' +
130
+ btoa(this.configuration.username + ':' + this.configuration.password);
131
+ }
132
+ if (this.configuration &&
133
+ (this.configuration.username !== undefined ||
134
+ this.configuration.password !== undefined)) {
135
+ headerParameters['Authorization'] =
136
+ 'Basic ' +
137
+ btoa(this.configuration.username + ':' + this.configuration.password);
138
+ }
139
+ if (this.configuration && this.configuration.accessToken) {
140
+ const token = this.configuration.accessToken;
141
+ const tokenString = await token('apiKey', []);
142
+ if (tokenString) {
143
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
144
+ }
145
+ }
146
+ if (this.configuration &&
147
+ (this.configuration.username !== undefined ||
148
+ this.configuration.password !== undefined)) {
149
+ headerParameters['Authorization'] =
150
+ 'Basic ' +
151
+ btoa(this.configuration.username + ':' + this.configuration.password);
152
+ }
153
+ let urlPath = `/voice/call`;
154
+ const response = await this.request({
155
+ path: urlPath,
156
+ method: 'POST',
157
+ headers: headerParameters,
158
+ query: queryParameters,
159
+ body: (0, index_1.VoiceCallRequestToJSON)(requestParameters['voiceCallRequest'])
160
+ }, initOverrides);
161
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VoiceCallResponseFromJSON)(jsonValue));
162
+ }
163
+ /**
164
+ * Place an outbound call with an inline agent spec (ephemeral)
165
+ */
166
+ async call(voiceCallRequest, initOverrides) {
167
+ const response = await this.callRaw({ voiceCallRequest: voiceCallRequest }, initOverrides);
168
+ return await response.value();
169
+ }
170
+ /**
171
+ * Deploy a voice agent (persist spec for production routing)
172
+ */
173
+ async createAgentRaw(requestParameters, initOverrides) {
174
+ if (requestParameters['createVoiceAgentRequest'] == null) {
175
+ throw new runtime.RequiredError('createVoiceAgentRequest', 'Required parameter "createVoiceAgentRequest" was null or undefined when calling createAgent().');
176
+ }
177
+ const queryParameters = {};
178
+ const headerParameters = {};
179
+ headerParameters['Content-Type'] = 'application/json';
180
+ if (this.configuration &&
181
+ (this.configuration.username !== undefined ||
182
+ this.configuration.password !== undefined)) {
183
+ headerParameters['Authorization'] =
184
+ 'Basic ' +
185
+ btoa(this.configuration.username + ':' + this.configuration.password);
186
+ }
187
+ if (this.configuration &&
188
+ (this.configuration.username !== undefined ||
189
+ this.configuration.password !== undefined)) {
190
+ headerParameters['Authorization'] =
191
+ 'Basic ' +
192
+ btoa(this.configuration.username + ':' + this.configuration.password);
193
+ }
194
+ if (this.configuration && this.configuration.accessToken) {
195
+ const token = this.configuration.accessToken;
196
+ const tokenString = await token('apiKey', []);
197
+ if (tokenString) {
198
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
199
+ }
200
+ }
201
+ if (this.configuration &&
202
+ (this.configuration.username !== undefined ||
203
+ this.configuration.password !== undefined)) {
204
+ headerParameters['Authorization'] =
205
+ 'Basic ' +
206
+ btoa(this.configuration.username + ':' + this.configuration.password);
207
+ }
208
+ let urlPath = `/voice/agents`;
209
+ const response = await this.request({
210
+ path: urlPath,
211
+ method: 'POST',
212
+ headers: headerParameters,
213
+ query: queryParameters,
214
+ body: (0, index_1.CreateVoiceAgentRequestToJSON)(requestParameters['createVoiceAgentRequest'])
215
+ }, initOverrides);
216
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CreateVoiceAgentResponseFromJSON)(jsonValue));
217
+ }
218
+ /**
219
+ * Deploy a voice agent (persist spec for production routing)
220
+ */
221
+ async createAgent(createVoiceAgentRequest, initOverrides) {
222
+ const response = await this.createAgentRaw({ createVoiceAgentRequest: createVoiceAgentRequest }, initOverrides);
223
+ return await response.value();
224
+ }
225
+ /**
226
+ * Place an ephemeral browser playground call with an inline agent spec
227
+ */
228
+ async createBrowserCallRaw(requestParameters, initOverrides) {
229
+ if (requestParameters['voiceBrowserCallRequest'] == null) {
230
+ throw new runtime.RequiredError('voiceBrowserCallRequest', 'Required parameter "voiceBrowserCallRequest" was null or undefined when calling createBrowserCall().');
231
+ }
232
+ const queryParameters = {};
233
+ const headerParameters = {};
234
+ headerParameters['Content-Type'] = 'application/json';
235
+ if (this.configuration &&
236
+ (this.configuration.username !== undefined ||
237
+ this.configuration.password !== undefined)) {
238
+ headerParameters['Authorization'] =
239
+ 'Basic ' +
240
+ btoa(this.configuration.username + ':' + this.configuration.password);
241
+ }
242
+ if (this.configuration &&
243
+ (this.configuration.username !== undefined ||
244
+ this.configuration.password !== undefined)) {
245
+ headerParameters['Authorization'] =
246
+ 'Basic ' +
247
+ btoa(this.configuration.username + ':' + this.configuration.password);
248
+ }
249
+ if (this.configuration && this.configuration.accessToken) {
250
+ const token = this.configuration.accessToken;
251
+ const tokenString = await token('apiKey', []);
252
+ if (tokenString) {
253
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
254
+ }
255
+ }
256
+ if (this.configuration &&
257
+ (this.configuration.username !== undefined ||
258
+ this.configuration.password !== undefined)) {
259
+ headerParameters['Authorization'] =
260
+ 'Basic ' +
261
+ btoa(this.configuration.username + ':' + this.configuration.password);
262
+ }
263
+ let urlPath = `/voice/browser-call`;
264
+ const response = await this.request({
265
+ path: urlPath,
266
+ method: 'POST',
267
+ headers: headerParameters,
268
+ query: queryParameters,
269
+ body: (0, index_1.VoiceBrowserCallRequestToJSON)(requestParameters['voiceBrowserCallRequest'])
270
+ }, initOverrides);
271
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VoiceBrowserCallResponseFromJSON)(jsonValue));
272
+ }
273
+ /**
274
+ * Place an ephemeral browser playground call with an inline agent spec
275
+ */
276
+ async createBrowserCall(voiceBrowserCallRequest, initOverrides) {
277
+ const response = await this.createBrowserCallRaw({ voiceBrowserCallRequest: voiceBrowserCallRequest }, initOverrides);
278
+ return await response.value();
279
+ }
280
+ /**
281
+ * Remove a deployed voice agent and unbind its numbers
282
+ */
283
+ async deleteAgentRaw(requestParameters, initOverrides) {
284
+ if (requestParameters['agentId'] == null) {
285
+ throw new runtime.RequiredError('agentId', 'Required parameter "agentId" was null or undefined when calling deleteAgent().');
286
+ }
287
+ const queryParameters = {};
288
+ const headerParameters = {};
289
+ if (this.configuration &&
290
+ (this.configuration.username !== undefined ||
291
+ this.configuration.password !== undefined)) {
292
+ headerParameters['Authorization'] =
293
+ 'Basic ' +
294
+ btoa(this.configuration.username + ':' + this.configuration.password);
295
+ }
296
+ if (this.configuration &&
297
+ (this.configuration.username !== undefined ||
298
+ this.configuration.password !== undefined)) {
299
+ headerParameters['Authorization'] =
300
+ 'Basic ' +
301
+ btoa(this.configuration.username + ':' + this.configuration.password);
302
+ }
303
+ if (this.configuration && this.configuration.accessToken) {
304
+ const token = this.configuration.accessToken;
305
+ const tokenString = await token('apiKey', []);
306
+ if (tokenString) {
307
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
308
+ }
309
+ }
310
+ if (this.configuration &&
311
+ (this.configuration.username !== undefined ||
312
+ this.configuration.password !== undefined)) {
313
+ headerParameters['Authorization'] =
314
+ 'Basic ' +
315
+ btoa(this.configuration.username + ':' + this.configuration.password);
316
+ }
317
+ let urlPath = `/voice/agents/{agentId}`;
318
+ urlPath = urlPath.replace(`{${'agentId'}}`, encodeURIComponent(String(requestParameters['agentId'])));
319
+ const response = await this.request({
320
+ path: urlPath,
321
+ method: 'DELETE',
322
+ headers: headerParameters,
323
+ query: queryParameters
324
+ }, initOverrides);
325
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.DeleteVoiceAgentResponseFromJSON)(jsonValue));
326
+ }
327
+ /**
328
+ * Remove a deployed voice agent and unbind its numbers
329
+ */
330
+ async deleteAgent(agentId, initOverrides) {
331
+ const response = await this.deleteAgentRaw({ agentId: agentId }, initOverrides);
332
+ return await response.value();
333
+ }
334
+ /**
335
+ * Get a deployed voice agent
336
+ */
337
+ async getAgentRaw(requestParameters, initOverrides) {
338
+ if (requestParameters['agentId'] == null) {
339
+ throw new runtime.RequiredError('agentId', 'Required parameter "agentId" was null or undefined when calling getAgent().');
340
+ }
341
+ const queryParameters = {};
342
+ const headerParameters = {};
343
+ if (this.configuration &&
344
+ (this.configuration.username !== undefined ||
345
+ this.configuration.password !== undefined)) {
346
+ headerParameters['Authorization'] =
347
+ 'Basic ' +
348
+ btoa(this.configuration.username + ':' + this.configuration.password);
349
+ }
350
+ if (this.configuration &&
351
+ (this.configuration.username !== undefined ||
352
+ this.configuration.password !== undefined)) {
353
+ headerParameters['Authorization'] =
354
+ 'Basic ' +
355
+ btoa(this.configuration.username + ':' + this.configuration.password);
356
+ }
357
+ if (this.configuration && this.configuration.accessToken) {
358
+ const token = this.configuration.accessToken;
359
+ const tokenString = await token('apiKey', []);
360
+ if (tokenString) {
361
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
362
+ }
363
+ }
364
+ if (this.configuration &&
365
+ (this.configuration.username !== undefined ||
366
+ this.configuration.password !== undefined)) {
367
+ headerParameters['Authorization'] =
368
+ 'Basic ' +
369
+ btoa(this.configuration.username + ':' + this.configuration.password);
370
+ }
371
+ let urlPath = `/voice/agents/{agentId}`;
372
+ urlPath = urlPath.replace(`{${'agentId'}}`, encodeURIComponent(String(requestParameters['agentId'])));
373
+ const response = await this.request({
374
+ path: urlPath,
375
+ method: 'GET',
376
+ headers: headerParameters,
377
+ query: queryParameters
378
+ }, initOverrides);
379
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GetVoiceAgentResponseFromJSON)(jsonValue));
380
+ }
381
+ /**
382
+ * Get a deployed voice agent
383
+ */
384
+ async getAgent(agentId, initOverrides) {
385
+ const response = await this.getAgentRaw({ agentId: agentId }, initOverrides);
386
+ return await response.value();
387
+ }
388
+ /**
389
+ * Get a call with transcript timeline and recording playback URL
390
+ */
391
+ async getCallRaw(requestParameters, initOverrides) {
392
+ if (requestParameters['trackingId'] == null) {
393
+ throw new runtime.RequiredError('trackingId', 'Required parameter "trackingId" was null or undefined when calling getCall().');
394
+ }
395
+ const queryParameters = {};
396
+ const headerParameters = {};
397
+ if (this.configuration &&
398
+ (this.configuration.username !== undefined ||
399
+ this.configuration.password !== undefined)) {
400
+ headerParameters['Authorization'] =
401
+ 'Basic ' +
402
+ btoa(this.configuration.username + ':' + this.configuration.password);
403
+ }
404
+ if (this.configuration &&
405
+ (this.configuration.username !== undefined ||
406
+ this.configuration.password !== undefined)) {
407
+ headerParameters['Authorization'] =
408
+ 'Basic ' +
409
+ btoa(this.configuration.username + ':' + this.configuration.password);
410
+ }
411
+ if (this.configuration && this.configuration.accessToken) {
412
+ const token = this.configuration.accessToken;
413
+ const tokenString = await token('apiKey', []);
414
+ if (tokenString) {
415
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
416
+ }
417
+ }
418
+ if (this.configuration &&
419
+ (this.configuration.username !== undefined ||
420
+ this.configuration.password !== undefined)) {
421
+ headerParameters['Authorization'] =
422
+ 'Basic ' +
423
+ btoa(this.configuration.username + ':' + this.configuration.password);
424
+ }
425
+ let urlPath = `/voice/calls/{trackingId}`;
426
+ urlPath = urlPath.replace(`{${'trackingId'}}`, encodeURIComponent(String(requestParameters['trackingId'])));
427
+ const response = await this.request({
428
+ path: urlPath,
429
+ method: 'GET',
430
+ headers: headerParameters,
431
+ query: queryParameters
432
+ }, initOverrides);
433
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GetVoiceCallResponseFromJSON)(jsonValue));
434
+ }
435
+ /**
436
+ * Get a call with transcript timeline and recording playback URL
437
+ */
438
+ async getCall(trackingId, initOverrides) {
439
+ const response = await this.getCallRaw({ trackingId: trackingId }, initOverrides);
440
+ return await response.value();
441
+ }
442
+ /**
443
+ * List deployed voice agents for the account
444
+ */
445
+ async listAgentsRaw(initOverrides) {
446
+ const queryParameters = {};
447
+ const headerParameters = {};
448
+ if (this.configuration &&
449
+ (this.configuration.username !== undefined ||
450
+ this.configuration.password !== undefined)) {
451
+ headerParameters['Authorization'] =
452
+ 'Basic ' +
453
+ btoa(this.configuration.username + ':' + this.configuration.password);
454
+ }
455
+ if (this.configuration &&
456
+ (this.configuration.username !== undefined ||
457
+ this.configuration.password !== undefined)) {
458
+ headerParameters['Authorization'] =
459
+ 'Basic ' +
460
+ btoa(this.configuration.username + ':' + this.configuration.password);
461
+ }
462
+ if (this.configuration && this.configuration.accessToken) {
463
+ const token = this.configuration.accessToken;
464
+ const tokenString = await token('apiKey', []);
465
+ if (tokenString) {
466
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
467
+ }
468
+ }
469
+ if (this.configuration &&
470
+ (this.configuration.username !== undefined ||
471
+ this.configuration.password !== undefined)) {
472
+ headerParameters['Authorization'] =
473
+ 'Basic ' +
474
+ btoa(this.configuration.username + ':' + this.configuration.password);
475
+ }
476
+ let urlPath = `/voice/agents`;
477
+ const response = await this.request({
478
+ path: urlPath,
479
+ method: 'GET',
480
+ headers: headerParameters,
481
+ query: queryParameters
482
+ }, initOverrides);
483
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ListVoiceAgentsResponseFromJSON)(jsonValue));
484
+ }
485
+ /**
486
+ * List deployed voice agents for the account
487
+ */
488
+ async listAgents(initOverrides) {
489
+ const response = await this.listAgentsRaw(initOverrides);
490
+ return await response.value();
491
+ }
492
+ /**
493
+ * List recent calls newest-first (30-day retention)
494
+ */
495
+ async listCallsRaw(requestParameters, initOverrides) {
496
+ const queryParameters = {};
497
+ if (requestParameters['agentId'] != null) {
498
+ queryParameters['agentId'] = requestParameters['agentId'];
499
+ }
500
+ if (requestParameters['limit'] != null) {
501
+ queryParameters['limit'] = requestParameters['limit'];
502
+ }
503
+ if (requestParameters['cursor'] != null) {
504
+ queryParameters['cursor'] = requestParameters['cursor'];
505
+ }
506
+ const headerParameters = {};
507
+ if (this.configuration &&
508
+ (this.configuration.username !== undefined ||
509
+ this.configuration.password !== undefined)) {
510
+ headerParameters['Authorization'] =
511
+ 'Basic ' +
512
+ btoa(this.configuration.username + ':' + this.configuration.password);
513
+ }
514
+ if (this.configuration &&
515
+ (this.configuration.username !== undefined ||
516
+ this.configuration.password !== undefined)) {
517
+ headerParameters['Authorization'] =
518
+ 'Basic ' +
519
+ btoa(this.configuration.username + ':' + this.configuration.password);
520
+ }
521
+ if (this.configuration && this.configuration.accessToken) {
522
+ const token = this.configuration.accessToken;
523
+ const tokenString = await token('apiKey', []);
524
+ if (tokenString) {
525
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
526
+ }
527
+ }
528
+ if (this.configuration &&
529
+ (this.configuration.username !== undefined ||
530
+ this.configuration.password !== undefined)) {
531
+ headerParameters['Authorization'] =
532
+ 'Basic ' +
533
+ btoa(this.configuration.username + ':' + this.configuration.password);
534
+ }
535
+ let urlPath = `/voice/calls`;
536
+ const response = await this.request({
537
+ path: urlPath,
538
+ method: 'GET',
539
+ headers: headerParameters,
540
+ query: queryParameters
541
+ }, initOverrides);
542
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ListVoiceCallsResponseFromJSON)(jsonValue));
543
+ }
544
+ /**
545
+ * List recent calls newest-first (30-day retention)
546
+ */
547
+ async listCalls(agentId, limit, cursor, initOverrides) {
548
+ const response = await this.listCallsRaw({ agentId: agentId, limit: limit, cursor: cursor }, initOverrides);
549
+ return await response.value();
550
+ }
551
+ /**
552
+ * Unbind a phone number from a deployed agent
553
+ */
554
+ async unbindNumberRaw(requestParameters, initOverrides) {
555
+ if (requestParameters['agentId'] == null) {
556
+ throw new runtime.RequiredError('agentId', 'Required parameter "agentId" was null or undefined when calling unbindNumber().');
557
+ }
558
+ if (requestParameters['phoneNumber'] == null) {
559
+ throw new runtime.RequiredError('phoneNumber', 'Required parameter "phoneNumber" was null or undefined when calling unbindNumber().');
560
+ }
561
+ const queryParameters = {};
562
+ const headerParameters = {};
563
+ if (this.configuration &&
564
+ (this.configuration.username !== undefined ||
565
+ this.configuration.password !== undefined)) {
566
+ headerParameters['Authorization'] =
567
+ 'Basic ' +
568
+ btoa(this.configuration.username + ':' + this.configuration.password);
569
+ }
570
+ if (this.configuration &&
571
+ (this.configuration.username !== undefined ||
572
+ this.configuration.password !== undefined)) {
573
+ headerParameters['Authorization'] =
574
+ 'Basic ' +
575
+ btoa(this.configuration.username + ':' + this.configuration.password);
576
+ }
577
+ if (this.configuration && this.configuration.accessToken) {
578
+ const token = this.configuration.accessToken;
579
+ const tokenString = await token('apiKey', []);
580
+ if (tokenString) {
581
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
582
+ }
583
+ }
584
+ if (this.configuration &&
585
+ (this.configuration.username !== undefined ||
586
+ this.configuration.password !== undefined)) {
587
+ headerParameters['Authorization'] =
588
+ 'Basic ' +
589
+ btoa(this.configuration.username + ':' + this.configuration.password);
590
+ }
591
+ let urlPath = `/voice/agents/{agentId}/numbers/{phoneNumber}`;
592
+ urlPath = urlPath.replace(`{${'agentId'}}`, encodeURIComponent(String(requestParameters['agentId'])));
593
+ urlPath = urlPath.replace(`{${'phoneNumber'}}`, encodeURIComponent(String(requestParameters['phoneNumber'])));
594
+ const response = await this.request({
595
+ path: urlPath,
596
+ method: 'DELETE',
597
+ headers: headerParameters,
598
+ query: queryParameters
599
+ }, initOverrides);
600
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UnbindNumberResponseFromJSON)(jsonValue));
601
+ }
602
+ /**
603
+ * Unbind a phone number from a deployed agent
604
+ */
605
+ async unbindNumber(agentId, phoneNumber, initOverrides) {
606
+ const response = await this.unbindNumberRaw({ agentId: agentId, phoneNumber: phoneNumber }, initOverrides);
607
+ return await response.value();
608
+ }
609
+ /**
610
+ * Publish changes to a deployed voice agent
611
+ */
612
+ async updateAgentRaw(requestParameters, initOverrides) {
613
+ if (requestParameters['agentId'] == null) {
614
+ throw new runtime.RequiredError('agentId', 'Required parameter "agentId" was null or undefined when calling updateAgent().');
615
+ }
616
+ if (requestParameters['updateVoiceAgentRequest'] == null) {
617
+ throw new runtime.RequiredError('updateVoiceAgentRequest', 'Required parameter "updateVoiceAgentRequest" was null or undefined when calling updateAgent().');
618
+ }
619
+ const queryParameters = {};
620
+ const headerParameters = {};
621
+ headerParameters['Content-Type'] = 'application/json';
622
+ if (this.configuration &&
623
+ (this.configuration.username !== undefined ||
624
+ this.configuration.password !== undefined)) {
625
+ headerParameters['Authorization'] =
626
+ 'Basic ' +
627
+ btoa(this.configuration.username + ':' + this.configuration.password);
628
+ }
629
+ if (this.configuration &&
630
+ (this.configuration.username !== undefined ||
631
+ this.configuration.password !== undefined)) {
632
+ headerParameters['Authorization'] =
633
+ 'Basic ' +
634
+ btoa(this.configuration.username + ':' + this.configuration.password);
635
+ }
636
+ if (this.configuration && this.configuration.accessToken) {
637
+ const token = this.configuration.accessToken;
638
+ const tokenString = await token('apiKey', []);
639
+ if (tokenString) {
640
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
641
+ }
642
+ }
643
+ if (this.configuration &&
644
+ (this.configuration.username !== undefined ||
645
+ this.configuration.password !== undefined)) {
646
+ headerParameters['Authorization'] =
647
+ 'Basic ' +
648
+ btoa(this.configuration.username + ':' + this.configuration.password);
649
+ }
650
+ let urlPath = `/voice/agents/{agentId}`;
651
+ urlPath = urlPath.replace(`{${'agentId'}}`, encodeURIComponent(String(requestParameters['agentId'])));
652
+ const response = await this.request({
653
+ path: urlPath,
654
+ method: 'PUT',
655
+ headers: headerParameters,
656
+ query: queryParameters,
657
+ body: (0, index_1.UpdateVoiceAgentRequestToJSON)(requestParameters['updateVoiceAgentRequest'])
658
+ }, initOverrides);
659
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UpdateVoiceAgentResponseFromJSON)(jsonValue));
660
+ }
661
+ /**
662
+ * Publish changes to a deployed voice agent
663
+ */
664
+ async updateAgent(agentId, updateVoiceAgentRequest, initOverrides) {
665
+ const response = await this.updateAgentRaw({ agentId: agentId, updateVoiceAgentRequest: updateVoiceAgentRequest }, initOverrides);
666
+ return await response.value();
667
+ }
668
+ }
669
+ exports.VoiceApi = VoiceApi;