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,664 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Conversation Orchestrator
9
+ * Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications.
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.ConversationPage = exports.ConversationInstance = exports.ConversationContextImpl = exports.UpdateConversationByIdRequest = exports.PatchConversationByIdRequestConfiguration = exports.PatchConversationByIdRequest = exports.ListConversationByAccount200ResponseConversationsConfiguration = exports.CreateConversationWithConfigRequestParticipantsAddresses = exports.CreateConversationWithConfigRequestParticipants = exports.CreateConversationWithConfigRequestConfiguration = exports.CreateConversationWithConfigRequest = exports.ConversationsV2StatusCallbackConfig = exports.ConversationsV2Participant = exports.ConversationsV2ConversationsV1Bridge = exports.ConversationsV2Address = void 0;
20
+ exports.ConversationListInstance = ConversationListInstance;
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
+ class ConversationsV2Address {
27
+ constructor(payload) {
28
+ this.channel = payload["channel"];
29
+ this.address = payload["address"];
30
+ this.channelId = payload["channelId"];
31
+ }
32
+ }
33
+ exports.ConversationsV2Address = ConversationsV2Address;
34
+ /**
35
+ * Configuration for Conversations V1 bridge. When set, messaging channels route through Conversations V1. Use this to integrate with existing Conversations V1 applications.
36
+ */
37
+ class ConversationsV2ConversationsV1Bridge {
38
+ constructor(payload) {
39
+ this.serviceId = payload["serviceId"];
40
+ }
41
+ }
42
+ exports.ConversationsV2ConversationsV1Bridge = ConversationsV2ConversationsV1Bridge;
43
+ class ConversationsV2Participant {
44
+ constructor(payload) {
45
+ this.id = payload["id"];
46
+ this.conversationId = payload["conversationId"];
47
+ this.accountId = payload["accountId"];
48
+ this.name = payload["name"];
49
+ this.type = payload["type"];
50
+ this.profileId = payload["profileId"];
51
+ this.addresses = payload["addresses"];
52
+ this.createdAt = payload["createdAt"];
53
+ this.updatedAt = payload["updatedAt"];
54
+ }
55
+ }
56
+ exports.ConversationsV2Participant = ConversationsV2Participant;
57
+ /**
58
+ * Default webhook configuration for Conversation-level events under this Configuration.
59
+ */
60
+ class ConversationsV2StatusCallbackConfig {
61
+ constructor(payload) {
62
+ this.url = payload["url"];
63
+ this.method = payload["method"];
64
+ }
65
+ }
66
+ exports.ConversationsV2StatusCallbackConfig = ConversationsV2StatusCallbackConfig;
67
+ class CreateConversationWithConfigRequest {
68
+ constructor(payload) {
69
+ this.configurationId = payload["configurationId"];
70
+ this.name = payload["name"];
71
+ this.configuration = payload["configuration"];
72
+ this.participants = payload["participants"];
73
+ }
74
+ }
75
+ exports.CreateConversationWithConfigRequest = CreateConversationWithConfigRequest;
76
+ /**
77
+ * Conversation configuration settings.
78
+ */
79
+ class CreateConversationWithConfigRequestConfiguration {
80
+ constructor(payload) {
81
+ this.intelligenceConfigurationIds = payload["intelligenceConfigurationIds"];
82
+ }
83
+ }
84
+ exports.CreateConversationWithConfigRequestConfiguration = CreateConversationWithConfigRequestConfiguration;
85
+ class CreateConversationWithConfigRequestParticipants {
86
+ constructor(payload) {
87
+ this.name = payload["name"];
88
+ this.type = payload["type"];
89
+ this.profileId = payload["profileId"];
90
+ this.addresses = payload["addresses"];
91
+ }
92
+ }
93
+ exports.CreateConversationWithConfigRequestParticipants = CreateConversationWithConfigRequestParticipants;
94
+ class CreateConversationWithConfigRequestParticipantsAddresses {
95
+ constructor(payload) {
96
+ this.channel = payload["channel"];
97
+ this.address = payload["address"];
98
+ this.channelId = payload["channelId"];
99
+ }
100
+ }
101
+ exports.CreateConversationWithConfigRequestParticipantsAddresses = CreateConversationWithConfigRequestParticipantsAddresses;
102
+ /**
103
+ * Full configuration settings for this Conversation.
104
+ */
105
+ class ListConversationByAccount200ResponseConversationsConfiguration {
106
+ constructor(payload) {
107
+ this.displayName = payload["displayName"];
108
+ this.description = payload["description"];
109
+ this.conversationGroupingType = payload["conversationGroupingType"];
110
+ this.memoryStoreId = payload["memoryStoreId"];
111
+ this.channelSettings = payload["channelSettings"];
112
+ this.statusCallbacks = payload["statusCallbacks"];
113
+ this.intelligenceConfigurationIds = payload["intelligenceConfigurationIds"];
114
+ this.memoryExtractionEnabled = payload["memoryExtractionEnabled"];
115
+ this.conversationsV1Bridge = payload["conversationsV1Bridge"];
116
+ }
117
+ }
118
+ exports.ListConversationByAccount200ResponseConversationsConfiguration = ListConversationByAccount200ResponseConversationsConfiguration;
119
+ class PatchConversationByIdRequest {
120
+ constructor(payload) {
121
+ this.name = payload["name"];
122
+ this.status = payload["status"];
123
+ this.configuration = payload["configuration"];
124
+ }
125
+ }
126
+ exports.PatchConversationByIdRequest = PatchConversationByIdRequest;
127
+ /**
128
+ * Partial configuration update for an existing conversation. Only statusCallbacks can be modified.
129
+ */
130
+ class PatchConversationByIdRequestConfiguration {
131
+ constructor(payload) {
132
+ this.statusCallbacks = payload["statusCallbacks"];
133
+ }
134
+ }
135
+ exports.PatchConversationByIdRequestConfiguration = PatchConversationByIdRequestConfiguration;
136
+ class UpdateConversationByIdRequest {
137
+ constructor(payload) {
138
+ this.name = payload["name"];
139
+ this.status = payload["status"];
140
+ }
141
+ }
142
+ exports.UpdateConversationByIdRequest = UpdateConversationByIdRequest;
143
+ class ConversationContextImpl {
144
+ constructor(_version, sid) {
145
+ this._version = _version;
146
+ if (!(0, utility_1.isValidPathParam)(sid)) {
147
+ throw new Error("Parameter 'sid' is not valid.");
148
+ }
149
+ this._solution = { sid };
150
+ this._uri = `/Conversations/${sid}`;
151
+ }
152
+ remove(params, callback) {
153
+ if (params instanceof Function) {
154
+ callback = params;
155
+ params = {};
156
+ }
157
+ else {
158
+ params = params || {};
159
+ }
160
+ let data = {};
161
+ const headers = {};
162
+ headers["Accept"] = "application/json";
163
+ if (params["idempotencyKey"] !== undefined)
164
+ headers["Idempotency-Key"] = params["idempotencyKey"];
165
+ const instance = this;
166
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
167
+ uri: instance._uri,
168
+ method: "delete",
169
+ params: data,
170
+ headers,
171
+ });
172
+ operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.sid));
173
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
174
+ return operationPromise;
175
+ }
176
+ removeWithHttpInfo(params, callback) {
177
+ if (params instanceof Function) {
178
+ callback = params;
179
+ params = {};
180
+ }
181
+ else {
182
+ params = params || {};
183
+ }
184
+ let data = {};
185
+ const headers = {};
186
+ headers["Accept"] = "application/json";
187
+ if (params["idempotencyKey"] !== undefined)
188
+ headers["Idempotency-Key"] = params["idempotencyKey"];
189
+ const instance = this;
190
+ let operationVersion = instance._version;
191
+ // DELETE operation that returns a response model
192
+ let operationPromise = operationVersion
193
+ .fetchWithResponseInfo({
194
+ uri: instance._uri,
195
+ method: "delete",
196
+ params: data,
197
+ headers,
198
+ })
199
+ .then((response) => ({
200
+ ...response,
201
+ body: new ConversationInstance(operationVersion, response.body, instance._solution.sid),
202
+ }));
203
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
204
+ return operationPromise;
205
+ }
206
+ fetch(callback) {
207
+ const headers = {};
208
+ headers["Accept"] = "application/json";
209
+ const instance = this;
210
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
211
+ uri: instance._uri,
212
+ method: "get",
213
+ headers,
214
+ });
215
+ operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.sid));
216
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
217
+ return operationPromise;
218
+ }
219
+ fetchWithHttpInfo(callback) {
220
+ const headers = {};
221
+ headers["Accept"] = "application/json";
222
+ const instance = this;
223
+ let operationVersion = instance._version;
224
+ // CREATE, FETCH, UPDATE operations
225
+ let operationPromise = operationVersion
226
+ .fetchWithResponseInfo({
227
+ uri: instance._uri,
228
+ method: "get",
229
+ headers,
230
+ })
231
+ .then((response) => ({
232
+ ...response,
233
+ body: new ConversationInstance(operationVersion, response.body, instance._solution.sid),
234
+ }));
235
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
236
+ return operationPromise;
237
+ }
238
+ patch(params, headers, callback) {
239
+ if (params instanceof Function) {
240
+ callback = params;
241
+ params =
242
+ {};
243
+ }
244
+ else {
245
+ params =
246
+ params ||
247
+ {};
248
+ }
249
+ let data = {};
250
+ data = params;
251
+ if (headers === null || headers === undefined) {
252
+ headers = {};
253
+ }
254
+ headers["Content-Type"] = "application/json";
255
+ headers["Accept"] = "application/json";
256
+ const instance = this;
257
+ let operationVersion = instance._version, operationPromise = operationVersion.patch({
258
+ uri: instance._uri,
259
+ method: "patch",
260
+ data,
261
+ headers,
262
+ });
263
+ operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.sid));
264
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
265
+ return operationPromise;
266
+ }
267
+ patchWithHttpInfo(params, headers, callback) {
268
+ if (params instanceof Function) {
269
+ callback = params;
270
+ params =
271
+ {};
272
+ }
273
+ else {
274
+ params =
275
+ params ||
276
+ {};
277
+ }
278
+ let data = {};
279
+ data = params;
280
+ if (headers === null || headers === undefined) {
281
+ headers = {};
282
+ }
283
+ headers["Content-Type"] = "application/json";
284
+ headers["Accept"] = "application/json";
285
+ const instance = this;
286
+ let operationVersion = instance._version;
287
+ // CREATE, FETCH, UPDATE operations
288
+ let operationPromise = operationVersion
289
+ .patchWithResponseInfo({
290
+ uri: instance._uri,
291
+ method: "patch",
292
+ data,
293
+ headers,
294
+ })
295
+ .then((response) => ({
296
+ ...response,
297
+ body: new ConversationInstance(operationVersion, response.body, instance._solution.sid),
298
+ }));
299
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
300
+ return operationPromise;
301
+ }
302
+ update(params, headers, callback) {
303
+ if (params instanceof Function) {
304
+ callback = params;
305
+ params =
306
+ {};
307
+ }
308
+ else {
309
+ params =
310
+ params ||
311
+ {};
312
+ }
313
+ let data = {};
314
+ data = params;
315
+ if (headers === null || headers === undefined) {
316
+ headers = {};
317
+ }
318
+ headers["Content-Type"] = "application/json";
319
+ headers["Accept"] = "application/json";
320
+ const instance = this;
321
+ let operationVersion = instance._version, operationPromise = operationVersion.update({
322
+ uri: instance._uri,
323
+ method: "put",
324
+ data,
325
+ headers,
326
+ });
327
+ operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.sid));
328
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
329
+ return operationPromise;
330
+ }
331
+ updateWithHttpInfo(params, headers, callback) {
332
+ if (params instanceof Function) {
333
+ callback = params;
334
+ params =
335
+ {};
336
+ }
337
+ else {
338
+ params =
339
+ params ||
340
+ {};
341
+ }
342
+ let data = {};
343
+ data = params;
344
+ if (headers === null || headers === undefined) {
345
+ headers = {};
346
+ }
347
+ headers["Content-Type"] = "application/json";
348
+ headers["Accept"] = "application/json";
349
+ const instance = this;
350
+ let operationVersion = instance._version;
351
+ // CREATE, FETCH, UPDATE operations
352
+ let operationPromise = operationVersion
353
+ .updateWithResponseInfo({
354
+ uri: instance._uri,
355
+ method: "put",
356
+ data,
357
+ headers,
358
+ })
359
+ .then((response) => ({
360
+ ...response,
361
+ body: new ConversationInstance(operationVersion, response.body, instance._solution.sid),
362
+ }));
363
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
364
+ return operationPromise;
365
+ }
366
+ /**
367
+ * Provide a user-friendly representation
368
+ *
369
+ * @returns Object
370
+ */
371
+ toJSON() {
372
+ return this._solution;
373
+ }
374
+ [util_1.inspect.custom](_depth, options) {
375
+ return (0, util_1.inspect)(this.toJSON(), options);
376
+ }
377
+ }
378
+ exports.ConversationContextImpl = ConversationContextImpl;
379
+ class ConversationInstance {
380
+ constructor(_version, _payload, sid) {
381
+ this._version = _version;
382
+ const payload = _payload;
383
+ this.statusUrl = payload.statusUrl;
384
+ this.related = payload.related;
385
+ this.id = payload.id;
386
+ this.accountId = payload.accountId;
387
+ this.configurationId = payload.configurationId;
388
+ this.status = payload.status;
389
+ this.name = payload.name;
390
+ this.createdAt = deserialize.iso8601DateTime(payload.createdAt);
391
+ this.updatedAt = deserialize.iso8601DateTime(payload.updatedAt);
392
+ this.configuration =
393
+ payload.configuration !== null && payload.configuration !== undefined
394
+ ? new ListConversationByAccount200ResponseConversationsConfiguration(payload.configuration)
395
+ : null;
396
+ this.participants =
397
+ payload.participants !== null && payload.participants !== undefined
398
+ ? payload.participants.map((payload) => new ConversationsV2Participant(payload))
399
+ : null;
400
+ this._solution = { sid: sid };
401
+ }
402
+ get _proxy() {
403
+ this._context =
404
+ this._context ||
405
+ new ConversationContextImpl(this._version, this._solution.sid);
406
+ return this._context;
407
+ }
408
+ remove(params, callback) {
409
+ return this._proxy.remove(params, callback);
410
+ }
411
+ removeWithHttpInfo(params, callback) {
412
+ return this._proxy.removeWithHttpInfo(params, callback);
413
+ }
414
+ /**
415
+ * Fetch a ConversationInstance
416
+ *
417
+ * @param callback - Callback to handle processed record
418
+ *
419
+ * @returns Resolves to processed ConversationInstance
420
+ */
421
+ fetch(callback) {
422
+ return this._proxy.fetch(callback);
423
+ }
424
+ /**
425
+ * Fetch a ConversationInstance and return HTTP info
426
+ *
427
+ * @param callback - Callback to handle processed record
428
+ *
429
+ * @returns Resolves to processed ConversationInstance with HTTP metadata
430
+ */
431
+ fetchWithHttpInfo(callback) {
432
+ return this._proxy.fetchWithHttpInfo(callback);
433
+ }
434
+ patch(params, callback) {
435
+ return this._proxy.patch(params, callback);
436
+ }
437
+ patchWithHttpInfo(params, callback) {
438
+ return this._proxy.patchWithHttpInfo(params, callback);
439
+ }
440
+ update(params, callback) {
441
+ return this._proxy.update(params, callback);
442
+ }
443
+ updateWithHttpInfo(params, callback) {
444
+ return this._proxy.updateWithHttpInfo(params, callback);
445
+ }
446
+ /**
447
+ * Provide a user-friendly representation
448
+ *
449
+ * @returns Object
450
+ */
451
+ toJSON() {
452
+ return {
453
+ statusUrl: this.statusUrl,
454
+ related: this.related,
455
+ id: this.id,
456
+ accountId: this.accountId,
457
+ configurationId: this.configurationId,
458
+ status: this.status,
459
+ name: this.name,
460
+ createdAt: this.createdAt,
461
+ updatedAt: this.updatedAt,
462
+ configuration: this.configuration,
463
+ participants: this.participants,
464
+ };
465
+ }
466
+ [util_1.inspect.custom](_depth, options) {
467
+ return (0, util_1.inspect)(this.toJSON(), options);
468
+ }
469
+ }
470
+ exports.ConversationInstance = ConversationInstance;
471
+ function ConversationListInstance(version) {
472
+ const instance = ((sid) => instance.get(sid));
473
+ instance.get = function get(sid) {
474
+ return new ConversationContextImpl(version, sid);
475
+ };
476
+ instance._version = version;
477
+ instance._solution = {};
478
+ instance._uri = `/Conversations`;
479
+ instance.create = function create(params, headers, callback) {
480
+ if (params instanceof Function) {
481
+ callback = params;
482
+ params =
483
+ {};
484
+ }
485
+ else {
486
+ params =
487
+ params ||
488
+ {};
489
+ }
490
+ let data = {};
491
+ data = params;
492
+ if (headers === null || headers === undefined) {
493
+ headers = {};
494
+ }
495
+ headers["Content-Type"] = "application/json";
496
+ headers["Accept"] = "application/json";
497
+ let operationVersion = version, operationPromise = operationVersion.create({
498
+ uri: instance._uri,
499
+ method: "post",
500
+ data,
501
+ headers,
502
+ });
503
+ operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload));
504
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
505
+ return operationPromise;
506
+ };
507
+ instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
508
+ if (params instanceof Function) {
509
+ callback = params;
510
+ params =
511
+ {};
512
+ }
513
+ else {
514
+ params =
515
+ params ||
516
+ {};
517
+ }
518
+ let data = {};
519
+ data = params;
520
+ if (headers === null || headers === undefined) {
521
+ headers = {};
522
+ }
523
+ headers["Content-Type"] = "application/json";
524
+ headers["Accept"] = "application/json";
525
+ let operationVersion = version;
526
+ // CREATE, FETCH, UPDATE operations
527
+ let operationPromise = operationVersion
528
+ .createWithResponseInfo({
529
+ uri: instance._uri,
530
+ method: "post",
531
+ data,
532
+ headers,
533
+ })
534
+ .then((response) => ({
535
+ ...response,
536
+ body: new ConversationInstance(operationVersion, response.body),
537
+ }));
538
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
539
+ return operationPromise;
540
+ };
541
+ instance.page = function page(params, callback) {
542
+ if (params instanceof Function) {
543
+ callback = params;
544
+ params = {};
545
+ }
546
+ else {
547
+ params = params || {};
548
+ }
549
+ let data = {};
550
+ if (params["status"] !== undefined)
551
+ data["status"] = serialize.map(params["status"], (e) => e);
552
+ if (params["channelId"] !== undefined)
553
+ data["channelId"] = params["channelId"];
554
+ if (params["pageSize"] !== undefined)
555
+ data["pageSize"] = params["pageSize"];
556
+ if (params["pageToken"] !== undefined)
557
+ data["pageToken"] = params["pageToken"];
558
+ const headers = {};
559
+ headers["Accept"] = "application/json";
560
+ let operationVersion = version, operationPromise = operationVersion.page({
561
+ uri: instance._uri,
562
+ method: "get",
563
+ params: data,
564
+ headers,
565
+ });
566
+ operationPromise = operationPromise.then((payload) => new ConversationPage(operationVersion, payload, instance._uri, data, instance._solution));
567
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
568
+ return operationPromise;
569
+ };
570
+ instance.each = instance._version.each;
571
+ instance.list = instance._version.list;
572
+ instance.getPage = function getPage(targetUrl, callback) {
573
+ const operationPromise = instance._version._domain.twilio.request({
574
+ method: "get",
575
+ uri: targetUrl,
576
+ });
577
+ let pagePromise = operationPromise.then((payload) => new ConversationPage(instance._version, payload, instance._uri, {}, instance._solution));
578
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
579
+ return pagePromise;
580
+ };
581
+ instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
582
+ if (params instanceof Function) {
583
+ callback = params;
584
+ params = {};
585
+ }
586
+ else {
587
+ params = params || {};
588
+ }
589
+ let data = {};
590
+ if (params["status"] !== undefined)
591
+ data["status"] = serialize.map(params["status"], (e) => e);
592
+ if (params["channelId"] !== undefined)
593
+ data["channelId"] = params["channelId"];
594
+ if (params["pageSize"] !== undefined)
595
+ data["pageSize"] = params["pageSize"];
596
+ if (params["pageToken"] !== undefined)
597
+ data["pageToken"] = params["pageToken"];
598
+ const headers = {};
599
+ headers["Accept"] = "application/json";
600
+ let operationVersion = version;
601
+ // For page operations, use page() directly as it already returns { statusCode, body, headers }
602
+ // IMPORTANT: Pass full response to Page constructor, not response.body
603
+ let operationPromise = operationVersion
604
+ .page({ uri: instance._uri, method: "get", params: data, headers })
605
+ .then((response) => ({
606
+ statusCode: response.statusCode,
607
+ headers: response.headers,
608
+ body: new ConversationPage(operationVersion, response, instance._uri, data, instance._solution),
609
+ }));
610
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
611
+ return operationPromise;
612
+ };
613
+ instance.each = instance._version.each;
614
+ instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
615
+ instance.list = instance._version.list;
616
+ instance.listWithHttpInfo = instance._version.listWithHttpInfo;
617
+ instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
618
+ // Use request() directly as it already returns { statusCode, body, headers }
619
+ const operationPromise = instance._version._domain.twilio.request({
620
+ method: "get",
621
+ uri: targetUrl,
622
+ });
623
+ let pagePromise = operationPromise.then((response) => ({
624
+ statusCode: response.statusCode,
625
+ headers: response.headers,
626
+ body: new ConversationPage(instance._version, response, instance._uri, {}, instance._solution),
627
+ }));
628
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
629
+ return pagePromise;
630
+ };
631
+ instance.toJSON = function toJSON() {
632
+ return instance._solution;
633
+ };
634
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
635
+ return (0, util_1.inspect)(instance.toJSON(), options);
636
+ };
637
+ return instance;
638
+ }
639
+ class ConversationPage extends TokenPage_1.default {
640
+ /**
641
+ * Initialize the ConversationPage
642
+ *
643
+ * @param version - Version of the resource
644
+ * @param response - Response from the API
645
+ * @param uri - URI of the resource
646
+ * @param params - Query parameters
647
+ * @param solution - Path solution
648
+ */
649
+ constructor(version, response, uri, params, solution) {
650
+ super(version, response, uri, params, solution);
651
+ }
652
+ /**
653
+ * Build an instance of ConversationInstance
654
+ *
655
+ * @param payload - Payload response from the API
656
+ */
657
+ getInstance(payload) {
658
+ return new ConversationInstance(this._version, payload);
659
+ }
660
+ [util_1.inspect.custom](depth, options) {
661
+ return (0, util_1.inspect)(this.toJSON(), options);
662
+ }
663
+ }
664
+ exports.ConversationPage = ConversationPage;