twilio 6.0.0 → 6.0.1

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 (119) hide show
  1. package/lib/rest/ConversationsBase.d.ts +3 -0
  2. package/lib/rest/ConversationsBase.js +5 -0
  3. package/lib/rest/InsightsBase.d.ts +3 -0
  4. package/lib/rest/InsightsBase.js +5 -0
  5. package/lib/rest/IntelligenceBase.d.ts +3 -0
  6. package/lib/rest/IntelligenceBase.js +5 -0
  7. package/lib/rest/KnowledgeBase.d.ts +3 -0
  8. package/lib/rest/KnowledgeBase.js +5 -0
  9. package/lib/rest/Memory.d.ts +4 -0
  10. package/lib/rest/Memory.js +8 -0
  11. package/lib/rest/MemoryBase.d.ts +13 -0
  12. package/lib/rest/MemoryBase.js +31 -0
  13. package/lib/rest/Twilio.d.ts +5 -0
  14. package/lib/rest/Twilio.js +5 -0
  15. package/lib/rest/VoiceBase.d.ts +3 -0
  16. package/lib/rest/VoiceBase.js +5 -0
  17. package/lib/rest/api/v2010/account/call/recording.d.ts +2 -0
  18. package/lib/rest/api/v2010/account/call/recording.js +4 -0
  19. package/lib/rest/api/v2010/account/call/transcription.d.ts +1 -1
  20. package/lib/rest/api/v2010/account/call/transcription.js +6 -4
  21. package/lib/rest/api/v2010/account/call.d.ts +2 -0
  22. package/lib/rest/api/v2010/account/call.js +4 -0
  23. package/lib/rest/api/v2010/account/conference/participant.d.ts +2 -0
  24. package/lib/rest/api/v2010/account/conference/participant.js +4 -0
  25. package/lib/rest/conversations/V2.d.ts +35 -0
  26. package/lib/rest/conversations/V2.js +67 -0
  27. package/lib/rest/conversations/v2/communication.d.ts +479 -0
  28. package/lib/rest/conversations/v2/communication.js +436 -0
  29. package/lib/rest/conversations/v2/configuration.d.ts +906 -0
  30. package/lib/rest/conversations/v2/configuration.js +619 -0
  31. package/lib/rest/conversations/v2/conversation.d.ts +936 -0
  32. package/lib/rest/conversations/v2/conversation.js +664 -0
  33. package/lib/rest/conversations/v2/operation.d.ts +167 -0
  34. package/lib/rest/conversations/v2/operation.js +170 -0
  35. package/lib/rest/conversations/v2/participant.d.ts +469 -0
  36. package/lib/rest/conversations/v2/participant.js +442 -0
  37. package/lib/rest/flexApi/v1/plugin/pluginVersions.d.ts +1 -1
  38. package/lib/rest/flexApi/v1/plugin/pluginVersions.js +8 -6
  39. package/lib/rest/insights/V3.d.ts +20 -0
  40. package/lib/rest/insights/V3.js +42 -0
  41. package/lib/rest/insights/v1/call/callSummary.d.ts +10 -10
  42. package/lib/rest/insights/v1/call/event.d.ts +4 -4
  43. package/lib/rest/insights/v1/callSummaries.d.ts +12 -9
  44. package/lib/rest/insights/v3/metadata.d.ts +115 -0
  45. package/lib/rest/insights/v3/metadata.js +118 -0
  46. package/lib/rest/insights/v3/query.d.ts +180 -0
  47. package/lib/rest/insights/v3/query.js +214 -0
  48. package/lib/rest/intelligence/V3.d.ts +35 -0
  49. package/lib/rest/intelligence/V3.js +65 -0
  50. package/lib/rest/intelligence/v3/configuration.d.ts +693 -0
  51. package/lib/rest/intelligence/v3/configuration.js +528 -0
  52. package/lib/rest/intelligence/v3/conversation.d.ts +478 -0
  53. package/lib/rest/intelligence/v3/conversation.js +342 -0
  54. package/lib/rest/intelligence/v3/operator.d.ts +619 -0
  55. package/lib/rest/intelligence/v3/operator.js +493 -0
  56. package/lib/rest/intelligence/v3/operatorResult.d.ts +543 -0
  57. package/lib/rest/intelligence/v3/operatorResult.js +478 -0
  58. package/lib/rest/intelligence/v3/version.d.ts +469 -0
  59. package/lib/rest/intelligence/v3/version.js +341 -0
  60. package/lib/rest/knowledge/V2.d.ts +31 -0
  61. package/lib/rest/knowledge/V2.js +62 -0
  62. package/lib/rest/knowledge/v2/chunk.d.ts +209 -0
  63. package/lib/rest/knowledge/v2/chunk.js +178 -0
  64. package/lib/rest/knowledge/v2/knowledge.d.ts +507 -0
  65. package/lib/rest/knowledge/v2/knowledge.js +466 -0
  66. package/lib/rest/knowledge/v2/knowledgeBasis.d.ts +484 -0
  67. package/lib/rest/knowledge/v2/knowledgeBasis.js +441 -0
  68. package/lib/rest/knowledge/v2/operation.d.ts +162 -0
  69. package/lib/rest/knowledge/v2/operation.js +175 -0
  70. package/lib/rest/knowledge/v2/search.d.ts +180 -0
  71. package/lib/rest/knowledge/v2/search.js +174 -0
  72. package/lib/rest/memory/V1.d.ts +76 -0
  73. package/lib/rest/memory/V1.js +140 -0
  74. package/lib/rest/memory/v1/bulk.d.ts +129 -0
  75. package/lib/rest/memory/v1/bulk.js +158 -0
  76. package/lib/rest/memory/v1/conversationSummary.d.ts +531 -0
  77. package/lib/rest/memory/v1/conversationSummary.js +473 -0
  78. package/lib/rest/memory/v1/dataMapping.d.ts +630 -0
  79. package/lib/rest/memory/v1/dataMapping.js +512 -0
  80. package/lib/rest/memory/v1/event.d.ts +153 -0
  81. package/lib/rest/memory/v1/event.js +159 -0
  82. package/lib/rest/memory/v1/identifier.d.ts +362 -0
  83. package/lib/rest/memory/v1/identifier.js +369 -0
  84. package/lib/rest/memory/v1/identityResolutionSetting.d.ts +247 -0
  85. package/lib/rest/memory/v1/identityResolutionSetting.js +229 -0
  86. package/lib/rest/memory/v1/import.d.ts +292 -0
  87. package/lib/rest/memory/v1/import.js +280 -0
  88. package/lib/rest/memory/v1/lookup.d.ts +82 -0
  89. package/lib/rest/memory/v1/lookup.js +118 -0
  90. package/lib/rest/memory/v1/observation.d.ts +521 -0
  91. package/lib/rest/memory/v1/observation.js +477 -0
  92. package/lib/rest/memory/v1/operation.d.ts +162 -0
  93. package/lib/rest/memory/v1/operation.js +175 -0
  94. package/lib/rest/memory/v1/profile.d.ts +441 -0
  95. package/lib/rest/memory/v1/profile.js +467 -0
  96. package/lib/rest/memory/v1/recall.d.ts +306 -0
  97. package/lib/rest/memory/v1/recall.js +234 -0
  98. package/lib/rest/memory/v1/revision.d.ts +246 -0
  99. package/lib/rest/memory/v1/revision.js +195 -0
  100. package/lib/rest/memory/v1/store.d.ts +503 -0
  101. package/lib/rest/memory/v1/store.js +482 -0
  102. package/lib/rest/memory/v1/trait.d.ts +233 -0
  103. package/lib/rest/memory/v1/trait.js +190 -0
  104. package/lib/rest/memory/v1/traitGroup.d.ts +758 -0
  105. package/lib/rest/memory/v1/traitGroup.js +555 -0
  106. package/lib/rest/messaging/v2/channelsSender.d.ts +8 -0
  107. package/lib/rest/messaging/v2/channelsSender.js +2 -0
  108. package/lib/rest/previewIam/versionless/organization/roleAssignment.d.ts +32 -0
  109. package/lib/rest/previewIam/versionless/organization/roleAssignment.js +14 -0
  110. package/lib/rest/studio/v2/flow.d.ts +4 -0
  111. package/lib/rest/studio/v2/flow.js +8 -0
  112. package/lib/rest/verify/v2/service/webhook.d.ts +2 -2
  113. package/lib/rest/verify/v2/service/webhook.js +8 -8
  114. package/lib/rest/voice/V3.d.ts +15 -0
  115. package/lib/rest/voice/V3.js +37 -0
  116. package/lib/rest/voice/v3/transcription.d.ts +378 -0
  117. package/lib/rest/voice/v3/transcription.js +264 -0
  118. package/lib/twiml/VoiceResponse.d.ts +8 -0
  119. package/package.json +1 -1
@@ -0,0 +1,467 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio Memory API
9
+ * APIs for managing memory stores, profiles, events, and conversational intelligence capabilities.
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.ProfilePage = exports.ProfileInstance = exports.ProfileContextImpl = exports.ProfilesMeta = exports.ProfilePatch = exports.ProfileData = void 0;
20
+ exports.ProfileListInstance = ProfileListInstance;
21
+ const util_1 = require("util");
22
+ const TokenPage_1 = __importDefault(require("../../../base/TokenPage"));
23
+ const deserialize = require("../../../base/deserialize");
24
+ const serialize = require("../../../base/serialize");
25
+ const utility_1 = require("../../../base/utility");
26
+ /**
27
+ * Data for creating or updating a profile, including traits.
28
+ */
29
+ class ProfileData {
30
+ constructor(payload) {
31
+ this.traits = payload["traits"];
32
+ }
33
+ }
34
+ exports.ProfileData = ProfileData;
35
+ class ProfilePatch {
36
+ constructor(payload) {
37
+ this.traits = payload["traits"];
38
+ }
39
+ }
40
+ exports.ProfilePatch = ProfilePatch;
41
+ class ProfilesMeta {
42
+ constructor(payload) {
43
+ this.key = payload["key"];
44
+ this.pageSize = payload["pageSize"];
45
+ this.nextToken = payload["nextToken"];
46
+ this.previousToken = payload["previousToken"];
47
+ }
48
+ }
49
+ exports.ProfilesMeta = ProfilesMeta;
50
+ class ProfileContextImpl {
51
+ constructor(_version, storeId, profileId) {
52
+ this._version = _version;
53
+ if (!(0, utility_1.isValidPathParam)(storeId)) {
54
+ throw new Error("Parameter 'storeId' is not valid.");
55
+ }
56
+ if (!(0, utility_1.isValidPathParam)(profileId)) {
57
+ throw new Error("Parameter 'profileId' is not valid.");
58
+ }
59
+ this._solution = { storeId, profileId };
60
+ this._uri = `/Stores/${storeId}/Profiles/${profileId}`;
61
+ }
62
+ remove(callback) {
63
+ const headers = {};
64
+ headers["Accept"] = "application/json";
65
+ const instance = this;
66
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
67
+ uri: instance._uri,
68
+ method: "delete",
69
+ headers,
70
+ });
71
+ operationPromise = operationPromise.then((payload) => new ProfileInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId));
72
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
73
+ return operationPromise;
74
+ }
75
+ removeWithHttpInfo(callback) {
76
+ const headers = {};
77
+ headers["Accept"] = "application/json";
78
+ const instance = this;
79
+ let operationVersion = instance._version;
80
+ // DELETE operation that returns a response model
81
+ let operationPromise = operationVersion
82
+ .fetchWithResponseInfo({
83
+ uri: instance._uri,
84
+ method: "delete",
85
+ headers,
86
+ })
87
+ .then((response) => ({
88
+ ...response,
89
+ body: new ProfileInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId),
90
+ }));
91
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
92
+ return operationPromise;
93
+ }
94
+ patch(params, headers, callback) {
95
+ if (params === null || params === undefined) {
96
+ throw new Error('Required parameter "params" missing.');
97
+ }
98
+ let data = {};
99
+ data = params;
100
+ if (headers === null || headers === undefined) {
101
+ headers = {};
102
+ }
103
+ headers["Content-Type"] = "application/json";
104
+ headers["Accept"] = "application/json";
105
+ const instance = this;
106
+ let operationVersion = instance._version, operationPromise = operationVersion.patch({
107
+ uri: instance._uri,
108
+ method: "patch",
109
+ data,
110
+ headers,
111
+ });
112
+ operationPromise = operationPromise.then((payload) => new ProfileInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId));
113
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
114
+ return operationPromise;
115
+ }
116
+ patchWithHttpInfo(params, headers, callback) {
117
+ if (params === null || params === undefined) {
118
+ throw new Error('Required parameter "params" missing.');
119
+ }
120
+ let data = {};
121
+ data = params;
122
+ if (headers === null || headers === undefined) {
123
+ headers = {};
124
+ }
125
+ headers["Content-Type"] = "application/json";
126
+ headers["Accept"] = "application/json";
127
+ const instance = this;
128
+ let operationVersion = instance._version;
129
+ // CREATE, FETCH, UPDATE operations
130
+ let operationPromise = operationVersion
131
+ .patchWithResponseInfo({
132
+ uri: instance._uri,
133
+ method: "patch",
134
+ data,
135
+ headers,
136
+ })
137
+ .then((response) => ({
138
+ ...response,
139
+ body: new ProfileInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId),
140
+ }));
141
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
142
+ return operationPromise;
143
+ }
144
+ /**
145
+ * Provide a user-friendly representation
146
+ *
147
+ * @returns Object
148
+ */
149
+ toJSON() {
150
+ return this._solution;
151
+ }
152
+ [util_1.inspect.custom](_depth, options) {
153
+ return (0, util_1.inspect)(this.toJSON(), options);
154
+ }
155
+ }
156
+ exports.ProfileContextImpl = ProfileContextImpl;
157
+ class ProfileInstance {
158
+ constructor(_version, _payload, storeId, profileId) {
159
+ this._version = _version;
160
+ const payload = _payload;
161
+ this.id = payload.id;
162
+ this.message = payload.message;
163
+ this.profiles = payload.profiles;
164
+ this.meta =
165
+ payload.meta !== null && payload.meta !== undefined
166
+ ? new ProfilesMeta(payload.meta)
167
+ : null;
168
+ this._solution = { storeId, profileId: profileId };
169
+ }
170
+ get _proxy() {
171
+ this._context =
172
+ this._context ||
173
+ new ProfileContextImpl(this._version, this._solution.storeId, this._solution.profileId);
174
+ return this._context;
175
+ }
176
+ /**
177
+ * Remove a ProfileInstance
178
+ *
179
+ * @param callback - Callback to handle processed record
180
+ *
181
+ * @returns Resolves to processed ProfileInstance
182
+ */
183
+ remove(callback) {
184
+ return this._proxy.remove(callback);
185
+ }
186
+ /**
187
+ * Remove a ProfileInstance and return HTTP info
188
+ *
189
+ * @param callback - Callback to handle processed record
190
+ *
191
+ * @returns Resolves to processed ProfileInstance with HTTP metadata
192
+ */
193
+ removeWithHttpInfo(callback) {
194
+ return this._proxy.removeWithHttpInfo(callback);
195
+ }
196
+ patch(params, callback) {
197
+ return this._proxy.patch(params, callback);
198
+ }
199
+ patchWithHttpInfo(params, callback) {
200
+ return this._proxy.patchWithHttpInfo(params, callback);
201
+ }
202
+ /**
203
+ * Provide a user-friendly representation
204
+ *
205
+ * @returns Object
206
+ */
207
+ toJSON() {
208
+ return {
209
+ id: this.id,
210
+ message: this.message,
211
+ profiles: this.profiles,
212
+ meta: this.meta,
213
+ };
214
+ }
215
+ [util_1.inspect.custom](_depth, options) {
216
+ return (0, util_1.inspect)(this.toJSON(), options);
217
+ }
218
+ }
219
+ exports.ProfileInstance = ProfileInstance;
220
+ function ProfileListInstance(version, storeId) {
221
+ if (!(0, utility_1.isValidPathParam)(storeId)) {
222
+ throw new Error("Parameter 'storeId' is not valid.");
223
+ }
224
+ const instance = ((profileId) => instance.get(profileId));
225
+ instance.get = function get(profileId) {
226
+ return new ProfileContextImpl(version, storeId, profileId);
227
+ };
228
+ instance._version = version;
229
+ instance._solution = { storeId };
230
+ instance._uri = `/Stores/${storeId}/Profiles`;
231
+ instance.create = function create(params, headers, callback) {
232
+ if (params === null || params === undefined) {
233
+ throw new Error('Required parameter "params" missing.');
234
+ }
235
+ let data = {};
236
+ data = params;
237
+ if (headers === null || headers === undefined) {
238
+ headers = {};
239
+ }
240
+ headers["Content-Type"] = "application/json";
241
+ headers["Accept"] = "application/json";
242
+ let operationVersion = version, operationPromise = operationVersion.create({
243
+ uri: instance._uri,
244
+ method: "post",
245
+ data,
246
+ headers,
247
+ });
248
+ operationPromise = operationPromise.then((payload) => new ProfileInstance(operationVersion, payload, instance._solution.storeId));
249
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
250
+ return operationPromise;
251
+ };
252
+ instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
253
+ if (params === null || params === undefined) {
254
+ throw new Error('Required parameter "params" missing.');
255
+ }
256
+ let data = {};
257
+ data = params;
258
+ if (headers === null || headers === undefined) {
259
+ headers = {};
260
+ }
261
+ headers["Content-Type"] = "application/json";
262
+ headers["Accept"] = "application/json";
263
+ let operationVersion = version;
264
+ // CREATE, FETCH, UPDATE operations
265
+ let operationPromise = operationVersion
266
+ .createWithResponseInfo({
267
+ uri: instance._uri,
268
+ method: "post",
269
+ data,
270
+ headers,
271
+ })
272
+ .then((response) => ({
273
+ ...response,
274
+ body: new ProfileInstance(operationVersion, response.body, instance._solution.storeId),
275
+ }));
276
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
277
+ return operationPromise;
278
+ };
279
+ instance.page = function page(params, callback) {
280
+ if (params instanceof Function) {
281
+ callback = params;
282
+ params = {};
283
+ }
284
+ else {
285
+ params = params || {};
286
+ }
287
+ let data = {};
288
+ if (params["pageSize"] !== undefined)
289
+ data["pageSize"] = params["pageSize"];
290
+ if (params["pageToken"] !== undefined)
291
+ data["pageToken"] = params["pageToken"];
292
+ if (params["orderBy"] !== undefined)
293
+ data["orderBy"] = params["orderBy"];
294
+ const headers = {};
295
+ headers["Accept"] = "application/json";
296
+ let operationVersion = version, operationPromise = operationVersion.page({
297
+ uri: instance._uri,
298
+ method: "get",
299
+ params: data,
300
+ headers,
301
+ });
302
+ operationPromise = operationPromise.then((payload) => new ProfilePage(operationVersion, payload, instance._uri, data, instance._solution));
303
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
304
+ return operationPromise;
305
+ };
306
+ instance.each = instance._version.each;
307
+ instance.list = function list(params, callback) {
308
+ if (params instanceof Function) {
309
+ callback = params;
310
+ params = {};
311
+ }
312
+ params = params || {};
313
+ let allRecords = [];
314
+ function fetchNextPage(nextPageParams) {
315
+ return instance.page(nextPageParams).then((page) => {
316
+ const payload = page["_payload"];
317
+ const records = payload && payload["profiles"] ? payload["profiles"] : [];
318
+ allRecords = allRecords.concat(records);
319
+ if (params.limit && allRecords.length >= params.limit) {
320
+ allRecords = allRecords.slice(0, params.limit);
321
+ return allRecords;
322
+ }
323
+ const nextToken = page.nextPageUrl
324
+ ? new URL(page.nextPageUrl).searchParams.get("PageToken")
325
+ : null;
326
+ if (nextToken) {
327
+ return fetchNextPage({ ...nextPageParams, pageToken: nextToken });
328
+ }
329
+ return allRecords;
330
+ });
331
+ }
332
+ const promise = fetchNextPage(params);
333
+ return instance._version.setPromiseCallback(promise, callback);
334
+ };
335
+ instance.getPage = function getPage(targetUrl, callback) {
336
+ const operationPromise = instance._version._domain.twilio.request({
337
+ method: "get",
338
+ uri: targetUrl,
339
+ });
340
+ let pagePromise = operationPromise.then((payload) => new ProfilePage(instance._version, payload, instance._uri, {}, instance._solution));
341
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
342
+ return pagePromise;
343
+ };
344
+ instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
345
+ if (params instanceof Function) {
346
+ callback = params;
347
+ params = {};
348
+ }
349
+ else {
350
+ params = params || {};
351
+ }
352
+ let data = {};
353
+ if (params["pageSize"] !== undefined)
354
+ data["pageSize"] = params["pageSize"];
355
+ if (params["pageToken"] !== undefined)
356
+ data["pageToken"] = params["pageToken"];
357
+ if (params["orderBy"] !== undefined)
358
+ data["orderBy"] = params["orderBy"];
359
+ const headers = {};
360
+ headers["Accept"] = "application/json";
361
+ let operationVersion = version;
362
+ // For page operations, use page() directly as it already returns { statusCode, body, headers }
363
+ // IMPORTANT: Pass full response to Page constructor, not response.body
364
+ let operationPromise = operationVersion
365
+ .page({ uri: instance._uri, method: "get", params: data, headers })
366
+ .then((response) => ({
367
+ statusCode: response.statusCode,
368
+ headers: response.headers,
369
+ body: new ProfilePage(operationVersion, response, instance._uri, data, instance._solution),
370
+ }));
371
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
372
+ return operationPromise;
373
+ };
374
+ instance.each = instance._version.each;
375
+ instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
376
+ instance.listWithHttpInfo = function listWithHttpInfo(params, callback) {
377
+ if (params instanceof Function) {
378
+ callback = params;
379
+ params = {};
380
+ }
381
+ params = params || {};
382
+ let allRecords = [];
383
+ let lastResponse;
384
+ function fetchNextPage(nextPageParams) {
385
+ return instance
386
+ .pageWithHttpInfo(nextPageParams)
387
+ .then((response) => {
388
+ lastResponse = response;
389
+ const page = response.body;
390
+ // For primitive arrays, directly access the records array from the payload
391
+ // Access _payload using bracket notation to bypass TypeScript protected access
392
+ const payload = page["_payload"];
393
+ const records = payload && payload["profiles"] ? payload["profiles"] : [];
394
+ allRecords = allRecords.concat(records);
395
+ if (params.limit && allRecords.length >= params.limit) {
396
+ allRecords = allRecords.slice(0, params.limit);
397
+ return {
398
+ statusCode: lastResponse.statusCode,
399
+ headers: lastResponse.headers,
400
+ body: allRecords,
401
+ };
402
+ }
403
+ const nextToken = page.nextPageUrl
404
+ ? new URL(page.nextPageUrl).searchParams.get("PageToken")
405
+ : null;
406
+ if (nextToken) {
407
+ return fetchNextPage({ ...nextPageParams, pageToken: nextToken });
408
+ }
409
+ return {
410
+ statusCode: lastResponse.statusCode,
411
+ headers: lastResponse.headers,
412
+ body: allRecords,
413
+ };
414
+ });
415
+ }
416
+ const promise = fetchNextPage(params);
417
+ return instance._version.setPromiseCallback(promise, callback);
418
+ };
419
+ instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
420
+ // Use request() directly as it already returns { statusCode, body, headers }
421
+ const operationPromise = instance._version._domain.twilio.request({
422
+ method: "get",
423
+ uri: targetUrl,
424
+ });
425
+ let pagePromise = operationPromise.then((response) => ({
426
+ statusCode: response.statusCode,
427
+ headers: response.headers,
428
+ body: new ProfilePage(instance._version, response, instance._uri, {}, instance._solution),
429
+ }));
430
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
431
+ return pagePromise;
432
+ };
433
+ instance.toJSON = function toJSON() {
434
+ return instance._solution;
435
+ };
436
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
437
+ return (0, util_1.inspect)(instance.toJSON(), options);
438
+ };
439
+ return instance;
440
+ }
441
+ class ProfilePage extends TokenPage_1.default {
442
+ /**
443
+ * Initialize the ProfilePage
444
+ *
445
+ * @param version - Version of the resource
446
+ * @param response - Response from the API
447
+ * @param uri - URI of the resource
448
+ * @param params - Query parameters
449
+ * @param solution - Path solution
450
+ */
451
+ constructor(version, response, uri, params, solution) {
452
+ super(version, response, uri, params, solution);
453
+ }
454
+ /**
455
+ * Build an instance of ProfileInstance
456
+ *
457
+ * @param payload - Payload response from the API
458
+ */
459
+ getInstance(payload) {
460
+ // Array items are primitives (strings, numbers), return directly
461
+ return payload;
462
+ }
463
+ [util_1.inspect.custom](depth, options) {
464
+ return (0, util_1.inspect)(this.toJSON(), options);
465
+ }
466
+ }
467
+ exports.ProfilePage = ProfilePage;