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,342 @@
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.InboundPage = exports.InboundInstance = exports.InboundContextImpl = exports.ReportMetadata = exports.ReportFilter = exports.PhoneNumberReportFilter = exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = exports.InsightsV2CreatePhoneNumbersReportRequest = void 0;
20
+ exports.InboundListInstance = InboundListInstance;
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 InsightsV2CreatePhoneNumbersReportRequest {
27
+ constructor(payload) {
28
+ this.timeRange = payload["time_range"];
29
+ this.filters = payload["filters"];
30
+ this.size = payload["size"];
31
+ }
32
+ }
33
+ exports.InsightsV2CreatePhoneNumbersReportRequest = InsightsV2CreatePhoneNumbersReportRequest;
34
+ class InsightsV2CreatePhoneNumbersReportRequestTimeRange {
35
+ constructor(payload) {
36
+ this.startDatetime = payload["start_datetime"];
37
+ this.endDatetime = payload["end_datetime"];
38
+ }
39
+ }
40
+ exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = InsightsV2CreatePhoneNumbersReportRequestTimeRange;
41
+ /**
42
+ * Percentage of calls made in each state.
43
+ */
44
+ class InsightsV2InboundPhoneNumberReportCallStatePercentage {
45
+ constructor(payload) {
46
+ this.completed = payload["completed"];
47
+ this.fail = payload["fail"];
48
+ this.busy = payload["busy"];
49
+ this.noanswer = payload["noanswer"];
50
+ this.canceled = payload["canceled"];
51
+ }
52
+ }
53
+ exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = InsightsV2InboundPhoneNumberReportCallStatePercentage;
54
+ class PhoneNumberReportFilter {
55
+ constructor(payload) {
56
+ this.key = payload["key"];
57
+ this.values = payload["values"];
58
+ }
59
+ }
60
+ exports.PhoneNumberReportFilter = PhoneNumberReportFilter;
61
+ class ReportFilter {
62
+ constructor(payload) {
63
+ this.key = payload["key"];
64
+ this.values = payload["values"];
65
+ }
66
+ }
67
+ exports.ReportFilter = ReportFilter;
68
+ class ReportMetadata {
69
+ constructor(payload) {
70
+ this.startDatetime = payload["start_datetime"];
71
+ this.endDatetime = payload["end_datetime"];
72
+ this.filters = payload["filters"];
73
+ }
74
+ }
75
+ exports.ReportMetadata = ReportMetadata;
76
+ class InboundContextImpl {
77
+ constructor(_version, reportId) {
78
+ this._version = _version;
79
+ if (!(0, utility_1.isValidPathParam)(reportId)) {
80
+ throw new Error("Parameter 'reportId' is not valid.");
81
+ }
82
+ this._solution = { reportId };
83
+ this._uri = `/Voice/Reports/PhoneNumbers/Inbound`;
84
+ }
85
+ create(params, headers, callback) {
86
+ if (params instanceof Function) {
87
+ callback = params;
88
+ params = {};
89
+ }
90
+ else {
91
+ params = params || {};
92
+ }
93
+ let data = {};
94
+ data = params;
95
+ if (headers === null || headers === undefined) {
96
+ headers = {};
97
+ }
98
+ headers["Content-Type"] = "application/json";
99
+ headers["Accept"] = "application/json";
100
+ const instance = this;
101
+ let operationVersion = instance._version, operationPromise = operationVersion.create({
102
+ uri: instance._uri,
103
+ method: "post",
104
+ data,
105
+ headers,
106
+ });
107
+ operationPromise = operationPromise.then((payload) => new InboundInstance(operationVersion, payload, instance._solution.reportId));
108
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
109
+ return operationPromise;
110
+ }
111
+ createWithHttpInfo(params, headers, callback) {
112
+ if (params instanceof Function) {
113
+ callback = params;
114
+ params = {};
115
+ }
116
+ else {
117
+ params = params || {};
118
+ }
119
+ let data = {};
120
+ data = params;
121
+ if (headers === null || headers === undefined) {
122
+ headers = {};
123
+ }
124
+ headers["Content-Type"] = "application/json";
125
+ headers["Accept"] = "application/json";
126
+ const instance = this;
127
+ let operationVersion = instance._version;
128
+ // CREATE, FETCH, UPDATE operations
129
+ let operationPromise = operationVersion
130
+ .createWithResponseInfo({
131
+ uri: instance._uri,
132
+ method: "post",
133
+ data,
134
+ headers,
135
+ })
136
+ .then((response) => ({
137
+ ...response,
138
+ body: new InboundInstance(operationVersion, response.body, instance._solution.reportId),
139
+ }));
140
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
141
+ return operationPromise;
142
+ }
143
+ /**
144
+ * Provide a user-friendly representation
145
+ *
146
+ * @returns Object
147
+ */
148
+ toJSON() {
149
+ return this._solution;
150
+ }
151
+ [util_1.inspect.custom](_depth, options) {
152
+ return (0, util_1.inspect)(this.toJSON(), options);
153
+ }
154
+ }
155
+ exports.InboundContextImpl = InboundContextImpl;
156
+ class InboundInstance {
157
+ constructor(_version, payload, reportId) {
158
+ this._version = _version;
159
+ this.accountSid = payload.account_sid;
160
+ this.reportId = payload.report_id;
161
+ this.status = payload.status;
162
+ this.requestMeta =
163
+ payload.request_meta !== null && payload.request_meta !== undefined
164
+ ? new ReportMetadata(payload.request_meta)
165
+ : null;
166
+ this.url = payload.url;
167
+ this.handle = payload.handle;
168
+ this.totalCalls = deserialize.integer(payload.total_calls);
169
+ this.callAnswerScore = payload.call_answer_score;
170
+ this.callStatePercentage =
171
+ payload.call_state_percentage !== null &&
172
+ payload.call_state_percentage !== undefined
173
+ ? new InsightsV2InboundPhoneNumberReportCallStatePercentage(payload.call_state_percentage)
174
+ : null;
175
+ this.silentCallsPercentage = payload.silent_calls_percentage;
176
+ this._solution = { reportId: reportId || this.reportId };
177
+ }
178
+ get _proxy() {
179
+ this._context =
180
+ this._context ||
181
+ new InboundContextImpl(this._version, this._solution.reportId);
182
+ return this._context;
183
+ }
184
+ create(params, callback) {
185
+ return this._proxy.create(params, callback);
186
+ }
187
+ createWithHttpInfo(params, callback) {
188
+ return this._proxy.createWithHttpInfo(params, callback);
189
+ }
190
+ /**
191
+ * Provide a user-friendly representation
192
+ *
193
+ * @returns Object
194
+ */
195
+ toJSON() {
196
+ return {
197
+ accountSid: this.accountSid,
198
+ reportId: this.reportId,
199
+ status: this.status,
200
+ requestMeta: this.requestMeta,
201
+ url: this.url,
202
+ handle: this.handle,
203
+ totalCalls: this.totalCalls,
204
+ callAnswerScore: this.callAnswerScore,
205
+ callStatePercentage: this.callStatePercentage,
206
+ silentCallsPercentage: this.silentCallsPercentage,
207
+ };
208
+ }
209
+ [util_1.inspect.custom](_depth, options) {
210
+ return (0, util_1.inspect)(this.toJSON(), options);
211
+ }
212
+ }
213
+ exports.InboundInstance = InboundInstance;
214
+ function InboundListInstance(version, reportId) {
215
+ if (!(0, utility_1.isValidPathParam)(reportId)) {
216
+ throw new Error("Parameter 'reportId' is not valid.");
217
+ }
218
+ const instance = ((reportId) => instance.get(reportId));
219
+ instance.get = function get(reportId) {
220
+ return new InboundContextImpl(version, reportId);
221
+ };
222
+ instance._version = version;
223
+ instance._solution = { reportId };
224
+ instance._uri = `/Voice/Reports/PhoneNumbers/Inbound/${reportId}`;
225
+ instance.page = function page(params, callback) {
226
+ if (params instanceof Function) {
227
+ callback = params;
228
+ params = {};
229
+ }
230
+ else {
231
+ params = params || {};
232
+ }
233
+ let data = {};
234
+ if (params["pageSize"] !== undefined)
235
+ data["PageSize"] = params["pageSize"];
236
+ if (params.pageNumber !== undefined)
237
+ data["Page"] = params.pageNumber;
238
+ if (params.pageToken !== undefined)
239
+ data["PageToken"] = params.pageToken;
240
+ const headers = {};
241
+ headers["Accept"] = "application/json";
242
+ let operationVersion = version, operationPromise = operationVersion.page({
243
+ uri: instance._uri,
244
+ method: "get",
245
+ params: data,
246
+ headers,
247
+ });
248
+ operationPromise = operationPromise.then((payload) => new InboundPage(operationVersion, payload, instance._solution));
249
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
250
+ return operationPromise;
251
+ };
252
+ instance.each = instance._version.each;
253
+ instance.list = instance._version.list;
254
+ instance.getPage = function getPage(targetUrl, callback) {
255
+ const operationPromise = instance._version._domain.twilio.request({
256
+ method: "get",
257
+ uri: targetUrl,
258
+ });
259
+ let pagePromise = operationPromise.then((payload) => new InboundPage(instance._version, payload, instance._solution));
260
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
261
+ return pagePromise;
262
+ };
263
+ instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
264
+ if (params instanceof Function) {
265
+ callback = params;
266
+ params = {};
267
+ }
268
+ else {
269
+ params = params || {};
270
+ }
271
+ let data = {};
272
+ if (params["pageSize"] !== undefined)
273
+ data["PageSize"] = params["pageSize"];
274
+ if (params.pageNumber !== undefined)
275
+ data["Page"] = params.pageNumber;
276
+ if (params.pageToken !== undefined)
277
+ data["PageToken"] = params.pageToken;
278
+ const headers = {};
279
+ headers["Accept"] = "application/json";
280
+ let operationVersion = version;
281
+ // For page operations, use page() directly as it already returns { statusCode, body, headers }
282
+ // IMPORTANT: Pass full response to Page constructor, not response.body
283
+ let operationPromise = operationVersion
284
+ .page({ uri: instance._uri, method: "get", params: data, headers })
285
+ .then((response) => ({
286
+ statusCode: response.statusCode,
287
+ headers: response.headers,
288
+ body: new InboundPage(operationVersion, response, instance._solution),
289
+ }));
290
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
291
+ return operationPromise;
292
+ };
293
+ instance.each = instance._version.each;
294
+ instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
295
+ instance.list = instance._version.list;
296
+ instance.listWithHttpInfo = instance._version.listWithHttpInfo;
297
+ instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
298
+ // Use request() directly as it already returns { statusCode, body, headers }
299
+ const operationPromise = instance._version._domain.twilio.request({
300
+ method: "get",
301
+ uri: targetUrl,
302
+ });
303
+ let pagePromise = operationPromise.then((response) => ({
304
+ statusCode: response.statusCode,
305
+ headers: response.headers,
306
+ body: new InboundPage(instance._version, response, instance._solution),
307
+ }));
308
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
309
+ return pagePromise;
310
+ };
311
+ instance.toJSON = function toJSON() {
312
+ return instance._solution;
313
+ };
314
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
315
+ return (0, util_1.inspect)(instance.toJSON(), options);
316
+ };
317
+ return instance;
318
+ }
319
+ class InboundPage extends Page_1.default {
320
+ /**
321
+ * Initialize the InboundPage
322
+ *
323
+ * @param version - Version of the resource
324
+ * @param response - Response from the API
325
+ * @param solution - Path solution
326
+ */
327
+ constructor(version, response, solution) {
328
+ super(version, response, solution);
329
+ }
330
+ /**
331
+ * Build an instance of InboundInstance
332
+ *
333
+ * @param payload - Payload response from the API
334
+ */
335
+ getInstance(payload) {
336
+ return new InboundInstance(this._version, payload, this._solution.reportId);
337
+ }
338
+ [util_1.inspect.custom](depth, options) {
339
+ return (0, util_1.inspect)(this.toJSON(), options);
340
+ }
341
+ }
342
+ exports.InboundPage = InboundPage;