twilio 5.13.0 → 6.0.0

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 (57) hide show
  1. package/README.md +2 -4
  2. package/lib/rest/InsightsBase.d.ts +3 -0
  3. package/lib/rest/InsightsBase.js +5 -0
  4. package/lib/rest/MessagingBase.d.ts +3 -0
  5. package/lib/rest/MessagingBase.js +5 -0
  6. package/lib/rest/api/v2010/account/call/transcription.d.ts +2 -0
  7. package/lib/rest/api/v2010/account/call/transcription.js +4 -0
  8. package/lib/rest/api/v2010/account/message.d.ts +2 -0
  9. package/lib/rest/api/v2010/account/message.js +4 -0
  10. package/lib/rest/flexApi/V1.d.ts +0 -5
  11. package/lib/rest/flexApi/V1.js +0 -7
  12. package/lib/rest/iam/V1.d.ts +3 -0
  13. package/lib/rest/iam/V1.js +5 -0
  14. package/lib/rest/iam/v1/rolePermission.d.ts +225 -0
  15. package/lib/rest/iam/v1/rolePermission.js +181 -0
  16. package/lib/rest/insights/V2.d.ts +21 -0
  17. package/lib/rest/insights/V2.js +46 -0
  18. package/lib/rest/insights/v2/inbound.d.ts +436 -0
  19. package/lib/rest/insights/v2/inbound.js +342 -0
  20. package/lib/rest/insights/v2/outbound.d.ts +529 -0
  21. package/lib/rest/insights/v2/outbound.js +392 -0
  22. package/lib/rest/insights/v2/report.d.ts +783 -0
  23. package/lib/rest/insights/v2/report.js +550 -0
  24. package/lib/rest/messaging/V3.d.ts +15 -0
  25. package/lib/rest/messaging/V3.js +37 -0
  26. package/lib/rest/messaging/v2/channelsSender.d.ts +4 -0
  27. package/lib/rest/messaging/v2/channelsSender.js +1 -0
  28. package/lib/rest/messaging/v3/typingIndicator.d.ts +90 -0
  29. package/lib/rest/messaging/v3/typingIndicator.js +114 -0
  30. package/lib/rest/numbers/V1.d.ts +8 -0
  31. package/lib/rest/numbers/V1.js +12 -0
  32. package/lib/rest/numbers/v1/embeddedSession.d.ts +84 -0
  33. package/lib/rest/numbers/v1/embeddedSession.js +115 -0
  34. package/lib/rest/numbers/v1/senderIdRegistration.d.ts +181 -0
  35. package/lib/rest/numbers/v1/senderIdRegistration.js +146 -0
  36. package/lib/rest/numbers/v2/application.d.ts +191 -4
  37. package/lib/rest/numbers/v2/application.js +176 -3
  38. package/lib/rest/numbers/v3/hostedNumberOrder.d.ts +1 -1
  39. package/lib/rest/numbers/v3/hostedNumberOrder.js +2 -1
  40. package/lib/rest/previewIam/versionless/organization/user.d.ts +65 -0
  41. package/lib/rest/previewIam/versionless/organization/user.js +72 -1
  42. package/lib/rest/studio/v2/flow/execution.d.ts +24 -0
  43. package/lib/rest/studio/v2/flow/execution.js +10 -0
  44. package/lib/rest/studio/v2/flow/flowRevision.d.ts +6 -0
  45. package/lib/rest/studio/v2/flow/flowRevision.js +2 -0
  46. package/lib/rest/studio/v2/flow.d.ts +6 -0
  47. package/lib/rest/studio/v2/flow.js +2 -0
  48. package/lib/rest/verify/v2/service/approveChallenge.d.ts +6 -6
  49. package/lib/rest/verify/v2/service/approveChallenge.js +2 -2
  50. package/lib/rest/verify/v2/service/newChallenge.d.ts +6 -6
  51. package/lib/rest/verify/v2/service/newChallenge.js +2 -2
  52. package/lib/rest/verify/v2/service/verification.d.ts +2 -2
  53. package/lib/rest/video/v1/room.d.ts +4 -1
  54. package/lib/twiml/VoiceResponse.d.ts +10 -0
  55. package/package.json +2 -2
  56. package/lib/rest/flexApi/v1/createFlexInstance.d.ts +0 -165
  57. package/lib/rest/flexApi/v1/createFlexInstance.js +0 -165
@@ -0,0 +1,392 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Sample/reference Twilio API.
9
+ * This is the reference API for the rest-proxy server.
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator.
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.OutboundPage = exports.OutboundInstance = exports.OutboundContextImpl = exports.ReportMetadata = exports.ReportFilter = exports.PhoneNumberReportFilter = exports.InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection = exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = exports.InsightsV2CreatePhoneNumbersReportRequest = exports.CountyCarrierValueCarriers = exports.CountyCarrierValue = void 0;
20
+ exports.OutboundListInstance = OutboundListInstance;
21
+ const util_1 = require("util");
22
+ const Page_1 = __importDefault(require("../../../base/Page"));
23
+ const deserialize = require("../../../base/deserialize");
24
+ const serialize = require("../../../base/serialize");
25
+ const utility_1 = require("../../../base/utility");
26
+ class CountyCarrierValue {
27
+ constructor(payload) {
28
+ this.country = payload["country"];
29
+ this.carriers = payload["carriers"];
30
+ }
31
+ }
32
+ exports.CountyCarrierValue = CountyCarrierValue;
33
+ class CountyCarrierValueCarriers {
34
+ constructor(payload) {
35
+ this.carrier = payload["carrier"];
36
+ this.totalCalls = payload["total_calls"];
37
+ this.blockedCalls = payload["blocked_calls"];
38
+ this.blockedCallsPercentage = payload["blocked_calls_percentage"];
39
+ }
40
+ }
41
+ exports.CountyCarrierValueCarriers = CountyCarrierValueCarriers;
42
+ class InsightsV2CreatePhoneNumbersReportRequest {
43
+ constructor(payload) {
44
+ this.timeRange = payload["time_range"];
45
+ this.filters = payload["filters"];
46
+ this.size = payload["size"];
47
+ }
48
+ }
49
+ exports.InsightsV2CreatePhoneNumbersReportRequest = InsightsV2CreatePhoneNumbersReportRequest;
50
+ class InsightsV2CreatePhoneNumbersReportRequestTimeRange {
51
+ constructor(payload) {
52
+ this.startDatetime = payload["start_datetime"];
53
+ this.endDatetime = payload["end_datetime"];
54
+ }
55
+ }
56
+ exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = InsightsV2CreatePhoneNumbersReportRequestTimeRange;
57
+ /**
58
+ * Percentage of calls made in each state.
59
+ */
60
+ class InsightsV2InboundPhoneNumberReportCallStatePercentage {
61
+ constructor(payload) {
62
+ this.completed = payload["completed"];
63
+ this.fail = payload["fail"];
64
+ this.busy = payload["busy"];
65
+ this.noanswer = payload["noanswer"];
66
+ this.canceled = payload["canceled"];
67
+ }
68
+ }
69
+ exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = InsightsV2InboundPhoneNumberReportCallStatePercentage;
70
+ /**
71
+ * Number of calls made in answering machine detection (AMD) enabled.
72
+ */
73
+ class InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection {
74
+ constructor(payload) {
75
+ this.totalCalls = payload["total_calls"];
76
+ this.answeredByHumanPercentage = payload["answered_by_human_percentage"];
77
+ this.answeredByMachinePercentage =
78
+ payload["answered_by_machine_percentage"];
79
+ }
80
+ }
81
+ exports.InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection = InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
82
+ class PhoneNumberReportFilter {
83
+ constructor(payload) {
84
+ this.key = payload["key"];
85
+ this.values = payload["values"];
86
+ }
87
+ }
88
+ exports.PhoneNumberReportFilter = PhoneNumberReportFilter;
89
+ class ReportFilter {
90
+ constructor(payload) {
91
+ this.key = payload["key"];
92
+ this.values = payload["values"];
93
+ }
94
+ }
95
+ exports.ReportFilter = ReportFilter;
96
+ class ReportMetadata {
97
+ constructor(payload) {
98
+ this.startDatetime = payload["start_datetime"];
99
+ this.endDatetime = payload["end_datetime"];
100
+ this.filters = payload["filters"];
101
+ }
102
+ }
103
+ exports.ReportMetadata = ReportMetadata;
104
+ class OutboundContextImpl {
105
+ constructor(_version, reportId) {
106
+ this._version = _version;
107
+ if (!(0, utility_1.isValidPathParam)(reportId)) {
108
+ throw new Error("Parameter 'reportId' is not valid.");
109
+ }
110
+ this._solution = { reportId };
111
+ this._uri = `/Voice/Reports/PhoneNumbers/Outbound`;
112
+ }
113
+ create(params, headers, callback) {
114
+ if (params instanceof Function) {
115
+ callback = params;
116
+ params = {};
117
+ }
118
+ else {
119
+ params = params || {};
120
+ }
121
+ let data = {};
122
+ data = params;
123
+ if (headers === null || headers === undefined) {
124
+ headers = {};
125
+ }
126
+ headers["Content-Type"] = "application/json";
127
+ headers["Accept"] = "application/json";
128
+ const instance = this;
129
+ let operationVersion = instance._version, operationPromise = operationVersion.create({
130
+ uri: instance._uri,
131
+ method: "post",
132
+ data,
133
+ headers,
134
+ });
135
+ operationPromise = operationPromise.then((payload) => new OutboundInstance(operationVersion, payload, instance._solution.reportId));
136
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
137
+ return operationPromise;
138
+ }
139
+ createWithHttpInfo(params, headers, callback) {
140
+ if (params instanceof Function) {
141
+ callback = params;
142
+ params = {};
143
+ }
144
+ else {
145
+ params = params || {};
146
+ }
147
+ let data = {};
148
+ data = params;
149
+ if (headers === null || headers === undefined) {
150
+ headers = {};
151
+ }
152
+ headers["Content-Type"] = "application/json";
153
+ headers["Accept"] = "application/json";
154
+ const instance = this;
155
+ let operationVersion = instance._version;
156
+ // CREATE, FETCH, UPDATE operations
157
+ let operationPromise = operationVersion
158
+ .createWithResponseInfo({
159
+ uri: instance._uri,
160
+ method: "post",
161
+ data,
162
+ headers,
163
+ })
164
+ .then((response) => ({
165
+ ...response,
166
+ body: new OutboundInstance(operationVersion, response.body, instance._solution.reportId),
167
+ }));
168
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
169
+ return operationPromise;
170
+ }
171
+ /**
172
+ * Provide a user-friendly representation
173
+ *
174
+ * @returns Object
175
+ */
176
+ toJSON() {
177
+ return this._solution;
178
+ }
179
+ [util_1.inspect.custom](_depth, options) {
180
+ return (0, util_1.inspect)(this.toJSON(), options);
181
+ }
182
+ }
183
+ exports.OutboundContextImpl = OutboundContextImpl;
184
+ class OutboundInstance {
185
+ constructor(_version, payload, reportId) {
186
+ this._version = _version;
187
+ this.accountSid = payload.account_sid;
188
+ this.reportId = payload.report_id;
189
+ this.status = payload.status;
190
+ this.requestMeta =
191
+ payload.request_meta !== null && payload.request_meta !== undefined
192
+ ? new ReportMetadata(payload.request_meta)
193
+ : null;
194
+ this.url = payload.url;
195
+ this.handle = payload.handle;
196
+ this.totalCalls = deserialize.integer(payload.total_calls);
197
+ this.callAnswerScore = payload.call_answer_score;
198
+ this.callStatePercentage =
199
+ payload.call_state_percentage !== null &&
200
+ payload.call_state_percentage !== undefined
201
+ ? new InsightsV2InboundPhoneNumberReportCallStatePercentage(payload.call_state_percentage)
202
+ : null;
203
+ this.silentCallsPercentage = payload.silent_calls_percentage;
204
+ this.callsByDeviceType = payload.calls_by_device_type;
205
+ this.answerRateDeviceType = payload.answer_rate_device_type;
206
+ this.blockedCallsByCarrier =
207
+ payload.blocked_calls_by_carrier !== null &&
208
+ payload.blocked_calls_by_carrier !== undefined
209
+ ? payload.blocked_calls_by_carrier.map((payload) => new CountyCarrierValue(payload))
210
+ : null;
211
+ this.shortDurationCallsPercentage = payload.short_duration_calls_percentage;
212
+ this.longDurationCallsPercentage = payload.long_duration_calls_percentage;
213
+ this.potentialRobocallsPercentage = payload.potential_robocalls_percentage;
214
+ this.answeringMachineDetection =
215
+ payload.answering_machine_detection !== null &&
216
+ payload.answering_machine_detection !== undefined
217
+ ? new InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection(payload.answering_machine_detection)
218
+ : null;
219
+ this._solution = { reportId: reportId || this.reportId };
220
+ }
221
+ get _proxy() {
222
+ this._context =
223
+ this._context ||
224
+ new OutboundContextImpl(this._version, this._solution.reportId);
225
+ return this._context;
226
+ }
227
+ create(params, callback) {
228
+ return this._proxy.create(params, callback);
229
+ }
230
+ createWithHttpInfo(params, callback) {
231
+ return this._proxy.createWithHttpInfo(params, callback);
232
+ }
233
+ /**
234
+ * Provide a user-friendly representation
235
+ *
236
+ * @returns Object
237
+ */
238
+ toJSON() {
239
+ return {
240
+ accountSid: this.accountSid,
241
+ reportId: this.reportId,
242
+ status: this.status,
243
+ requestMeta: this.requestMeta,
244
+ url: this.url,
245
+ handle: this.handle,
246
+ totalCalls: this.totalCalls,
247
+ callAnswerScore: this.callAnswerScore,
248
+ callStatePercentage: this.callStatePercentage,
249
+ silentCallsPercentage: this.silentCallsPercentage,
250
+ callsByDeviceType: this.callsByDeviceType,
251
+ answerRateDeviceType: this.answerRateDeviceType,
252
+ blockedCallsByCarrier: this.blockedCallsByCarrier,
253
+ shortDurationCallsPercentage: this.shortDurationCallsPercentage,
254
+ longDurationCallsPercentage: this.longDurationCallsPercentage,
255
+ potentialRobocallsPercentage: this.potentialRobocallsPercentage,
256
+ answeringMachineDetection: this.answeringMachineDetection,
257
+ };
258
+ }
259
+ [util_1.inspect.custom](_depth, options) {
260
+ return (0, util_1.inspect)(this.toJSON(), options);
261
+ }
262
+ }
263
+ exports.OutboundInstance = OutboundInstance;
264
+ function OutboundListInstance(version, reportId) {
265
+ if (!(0, utility_1.isValidPathParam)(reportId)) {
266
+ throw new Error("Parameter 'reportId' is not valid.");
267
+ }
268
+ const instance = ((reportId) => instance.get(reportId));
269
+ instance.get = function get(reportId) {
270
+ return new OutboundContextImpl(version, reportId);
271
+ };
272
+ instance._version = version;
273
+ instance._solution = { reportId };
274
+ instance._uri = `/Voice/Reports/PhoneNumbers/Outbound/${reportId}`;
275
+ instance.page = function page(params, callback) {
276
+ if (params instanceof Function) {
277
+ callback = params;
278
+ params = {};
279
+ }
280
+ else {
281
+ params = params || {};
282
+ }
283
+ let data = {};
284
+ if (params["pageSize"] !== undefined)
285
+ data["PageSize"] = params["pageSize"];
286
+ if (params.pageNumber !== undefined)
287
+ data["Page"] = params.pageNumber;
288
+ if (params.pageToken !== undefined)
289
+ data["PageToken"] = params.pageToken;
290
+ const headers = {};
291
+ headers["Accept"] = "application/json";
292
+ let operationVersion = version, operationPromise = operationVersion.page({
293
+ uri: instance._uri,
294
+ method: "get",
295
+ params: data,
296
+ headers,
297
+ });
298
+ operationPromise = operationPromise.then((payload) => new OutboundPage(operationVersion, payload, instance._solution));
299
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
300
+ return operationPromise;
301
+ };
302
+ instance.each = instance._version.each;
303
+ instance.list = instance._version.list;
304
+ instance.getPage = function getPage(targetUrl, callback) {
305
+ const operationPromise = instance._version._domain.twilio.request({
306
+ method: "get",
307
+ uri: targetUrl,
308
+ });
309
+ let pagePromise = operationPromise.then((payload) => new OutboundPage(instance._version, payload, instance._solution));
310
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
311
+ return pagePromise;
312
+ };
313
+ instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
314
+ if (params instanceof Function) {
315
+ callback = params;
316
+ params = {};
317
+ }
318
+ else {
319
+ params = params || {};
320
+ }
321
+ let data = {};
322
+ if (params["pageSize"] !== undefined)
323
+ data["PageSize"] = params["pageSize"];
324
+ if (params.pageNumber !== undefined)
325
+ data["Page"] = params.pageNumber;
326
+ if (params.pageToken !== undefined)
327
+ data["PageToken"] = params.pageToken;
328
+ const headers = {};
329
+ headers["Accept"] = "application/json";
330
+ let operationVersion = version;
331
+ // For page operations, use page() directly as it already returns { statusCode, body, headers }
332
+ // IMPORTANT: Pass full response to Page constructor, not response.body
333
+ let operationPromise = operationVersion
334
+ .page({ uri: instance._uri, method: "get", params: data, headers })
335
+ .then((response) => ({
336
+ statusCode: response.statusCode,
337
+ headers: response.headers,
338
+ body: new OutboundPage(operationVersion, response, instance._solution),
339
+ }));
340
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
341
+ return operationPromise;
342
+ };
343
+ instance.each = instance._version.each;
344
+ instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
345
+ instance.list = instance._version.list;
346
+ instance.listWithHttpInfo = instance._version.listWithHttpInfo;
347
+ instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
348
+ // Use request() directly as it already returns { statusCode, body, headers }
349
+ const operationPromise = instance._version._domain.twilio.request({
350
+ method: "get",
351
+ uri: targetUrl,
352
+ });
353
+ let pagePromise = operationPromise.then((response) => ({
354
+ statusCode: response.statusCode,
355
+ headers: response.headers,
356
+ body: new OutboundPage(instance._version, response, instance._solution),
357
+ }));
358
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
359
+ return pagePromise;
360
+ };
361
+ instance.toJSON = function toJSON() {
362
+ return instance._solution;
363
+ };
364
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
365
+ return (0, util_1.inspect)(instance.toJSON(), options);
366
+ };
367
+ return instance;
368
+ }
369
+ class OutboundPage extends Page_1.default {
370
+ /**
371
+ * Initialize the OutboundPage
372
+ *
373
+ * @param version - Version of the resource
374
+ * @param response - Response from the API
375
+ * @param solution - Path solution
376
+ */
377
+ constructor(version, response, solution) {
378
+ super(version, response, solution);
379
+ }
380
+ /**
381
+ * Build an instance of OutboundInstance
382
+ *
383
+ * @param payload - Payload response from the API
384
+ */
385
+ getInstance(payload) {
386
+ return new OutboundInstance(this._version, payload, this._solution.reportId);
387
+ }
388
+ [util_1.inspect.custom](depth, options) {
389
+ return (0, util_1.inspect)(this.toJSON(), options);
390
+ }
391
+ }
392
+ exports.OutboundPage = OutboundPage;