twilio 6.0.0 → 6.0.2
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.
- package/lib/rest/ConversationsBase.d.ts +3 -0
- package/lib/rest/ConversationsBase.js +5 -0
- package/lib/rest/InsightsBase.d.ts +3 -0
- package/lib/rest/InsightsBase.js +5 -0
- package/lib/rest/IntelligenceBase.d.ts +3 -0
- package/lib/rest/IntelligenceBase.js +5 -0
- package/lib/rest/KnowledgeBase.d.ts +3 -0
- package/lib/rest/KnowledgeBase.js +5 -0
- package/lib/rest/Memory.d.ts +4 -0
- package/lib/rest/Memory.js +8 -0
- package/lib/rest/MemoryBase.d.ts +13 -0
- package/lib/rest/MemoryBase.js +31 -0
- package/lib/rest/Twilio.d.ts +5 -0
- package/lib/rest/Twilio.js +5 -0
- package/lib/rest/VoiceBase.d.ts +3 -0
- package/lib/rest/VoiceBase.js +5 -0
- package/lib/rest/api/v2010/account/call/recording.d.ts +2 -0
- package/lib/rest/api/v2010/account/call/recording.js +4 -0
- package/lib/rest/api/v2010/account/call/transcription.d.ts +1 -1
- package/lib/rest/api/v2010/account/call/transcription.js +6 -4
- package/lib/rest/api/v2010/account/call.d.ts +2 -0
- package/lib/rest/api/v2010/account/call.js +4 -0
- package/lib/rest/api/v2010/account/conference/participant.d.ts +2 -0
- package/lib/rest/api/v2010/account/conference/participant.js +4 -0
- package/lib/rest/conversations/V2.d.ts +38 -0
- package/lib/rest/conversations/V2.js +72 -0
- package/lib/rest/conversations/v2/action.d.ts +241 -0
- package/lib/rest/conversations/v2/action.js +246 -0
- package/lib/rest/conversations/v2/communication.d.ts +479 -0
- package/lib/rest/conversations/v2/communication.js +436 -0
- package/lib/rest/conversations/v2/configuration.d.ts +906 -0
- package/lib/rest/conversations/v2/configuration.js +619 -0
- package/lib/rest/conversations/v2/conversation.d.ts +936 -0
- package/lib/rest/conversations/v2/conversation.js +664 -0
- package/lib/rest/conversations/v2/operation.d.ts +167 -0
- package/lib/rest/conversations/v2/operation.js +170 -0
- package/lib/rest/conversations/v2/participant.d.ts +469 -0
- package/lib/rest/conversations/v2/participant.js +442 -0
- package/lib/rest/flexApi/v1/plugin/pluginVersions.d.ts +1 -1
- package/lib/rest/flexApi/v1/plugin/pluginVersions.js +8 -6
- package/lib/rest/insights/V3.d.ts +20 -0
- package/lib/rest/insights/V3.js +42 -0
- package/lib/rest/insights/v1/call/callSummary.d.ts +10 -10
- package/lib/rest/insights/v1/call/event.d.ts +4 -4
- package/lib/rest/insights/v1/callSummaries.d.ts +12 -9
- package/lib/rest/insights/v3/metadata.d.ts +115 -0
- package/lib/rest/insights/v3/metadata.js +118 -0
- package/lib/rest/insights/v3/query.d.ts +180 -0
- package/lib/rest/insights/v3/query.js +214 -0
- package/lib/rest/intelligence/V3.d.ts +35 -0
- package/lib/rest/intelligence/V3.js +65 -0
- package/lib/rest/intelligence/v3/configuration.d.ts +693 -0
- package/lib/rest/intelligence/v3/configuration.js +528 -0
- package/lib/rest/intelligence/v3/conversation.d.ts +478 -0
- package/lib/rest/intelligence/v3/conversation.js +342 -0
- package/lib/rest/intelligence/v3/operator.d.ts +619 -0
- package/lib/rest/intelligence/v3/operator.js +493 -0
- package/lib/rest/intelligence/v3/operatorResult.d.ts +543 -0
- package/lib/rest/intelligence/v3/operatorResult.js +478 -0
- package/lib/rest/intelligence/v3/version.d.ts +469 -0
- package/lib/rest/intelligence/v3/version.js +341 -0
- package/lib/rest/knowledge/V2.d.ts +31 -0
- package/lib/rest/knowledge/V2.js +62 -0
- package/lib/rest/knowledge/v2/chunk.d.ts +209 -0
- package/lib/rest/knowledge/v2/chunk.js +178 -0
- package/lib/rest/knowledge/v2/knowledge.d.ts +507 -0
- package/lib/rest/knowledge/v2/knowledge.js +466 -0
- package/lib/rest/knowledge/v2/knowledgeBasis.d.ts +484 -0
- package/lib/rest/knowledge/v2/knowledgeBasis.js +441 -0
- package/lib/rest/knowledge/v2/operation.d.ts +162 -0
- package/lib/rest/knowledge/v2/operation.js +175 -0
- package/lib/rest/knowledge/v2/search.d.ts +180 -0
- package/lib/rest/knowledge/v2/search.js +174 -0
- package/lib/rest/memory/V1.d.ts +76 -0
- package/lib/rest/memory/V1.js +140 -0
- package/lib/rest/memory/v1/bulk.d.ts +129 -0
- package/lib/rest/memory/v1/bulk.js +158 -0
- package/lib/rest/memory/v1/conversationSummary.d.ts +531 -0
- package/lib/rest/memory/v1/conversationSummary.js +473 -0
- package/lib/rest/memory/v1/dataMapping.d.ts +630 -0
- package/lib/rest/memory/v1/dataMapping.js +512 -0
- package/lib/rest/memory/v1/event.d.ts +153 -0
- package/lib/rest/memory/v1/event.js +159 -0
- package/lib/rest/memory/v1/identifier.d.ts +362 -0
- package/lib/rest/memory/v1/identifier.js +369 -0
- package/lib/rest/memory/v1/identityResolutionSetting.d.ts +247 -0
- package/lib/rest/memory/v1/identityResolutionSetting.js +229 -0
- package/lib/rest/memory/v1/import.d.ts +292 -0
- package/lib/rest/memory/v1/import.js +280 -0
- package/lib/rest/memory/v1/lookup.d.ts +82 -0
- package/lib/rest/memory/v1/lookup.js +118 -0
- package/lib/rest/memory/v1/observation.d.ts +521 -0
- package/lib/rest/memory/v1/observation.js +477 -0
- package/lib/rest/memory/v1/operation.d.ts +162 -0
- package/lib/rest/memory/v1/operation.js +175 -0
- package/lib/rest/memory/v1/profile.d.ts +548 -0
- package/lib/rest/memory/v1/profile.js +531 -0
- package/lib/rest/memory/v1/recall.d.ts +306 -0
- package/lib/rest/memory/v1/recall.js +234 -0
- package/lib/rest/memory/v1/revision.d.ts +246 -0
- package/lib/rest/memory/v1/revision.js +195 -0
- package/lib/rest/memory/v1/store.d.ts +544 -0
- package/lib/rest/memory/v1/store.js +534 -0
- package/lib/rest/memory/v1/trait.d.ts +233 -0
- package/lib/rest/memory/v1/trait.js +190 -0
- package/lib/rest/memory/v1/traitGroup.d.ts +758 -0
- package/lib/rest/memory/v1/traitGroup.js +555 -0
- package/lib/rest/messaging/v2/channelsSender.d.ts +8 -0
- package/lib/rest/messaging/v2/channelsSender.js +2 -0
- package/lib/rest/previewIam/versionless/organization/roleAssignment.d.ts +32 -0
- package/lib/rest/previewIam/versionless/organization/roleAssignment.js +14 -0
- package/lib/rest/studio/v2/flow.d.ts +4 -0
- package/lib/rest/studio/v2/flow.js +8 -0
- package/lib/rest/verify/v2/service/webhook.d.ts +2 -2
- package/lib/rest/verify/v2/service/webhook.js +8 -8
- package/lib/rest/voice/V3.d.ts +15 -0
- package/lib/rest/voice/V3.js +37 -0
- package/lib/rest/voice/v3/transcription.d.ts +378 -0
- package/lib/rest/voice/v3/transcription.js +264 -0
- package/lib/twiml/VoiceResponse.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,436 @@
|
|
|
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.CommunicationPage = exports.CommunicationInstance = exports.CommunicationContextImpl = exports.ListCommunicationByConversation200ResponseCommunicationsRecipients = exports.ListCommunicationByConversation200ResponseCommunicationsContent = exports.CreateCommunicationInConversationRequestContent = exports.CreateCommunicationInConversationRequestAuthor = exports.CreateCommunicationInConversationRequest = exports.ConversationsV2ParticipantAddress = exports.ConversationsV2ContentTranscriptionTranscriptionWords = exports.ConversationsV2ContentTranscriptionTranscription = exports.ContentTranscriptionTranscription = void 0;
|
|
20
|
+
exports.CommunicationListInstance = CommunicationListInstance;
|
|
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 ContentTranscriptionTranscription {
|
|
27
|
+
constructor(payload) {
|
|
28
|
+
this.channel = payload["channel"];
|
|
29
|
+
this.confidence = payload["confidence"];
|
|
30
|
+
this.engine = payload["engine"];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ContentTranscriptionTranscription = ContentTranscriptionTranscription;
|
|
34
|
+
/**
|
|
35
|
+
* Transcription metadata.
|
|
36
|
+
*/
|
|
37
|
+
class ConversationsV2ContentTranscriptionTranscription {
|
|
38
|
+
constructor(payload) {
|
|
39
|
+
this.channel = payload["channel"];
|
|
40
|
+
this.confidence = payload["confidence"];
|
|
41
|
+
this.engine = payload["engine"];
|
|
42
|
+
this.words = payload["words"];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ConversationsV2ContentTranscriptionTranscription = ConversationsV2ContentTranscriptionTranscription;
|
|
46
|
+
class ConversationsV2ContentTranscriptionTranscriptionWords {
|
|
47
|
+
constructor(payload) {
|
|
48
|
+
this.text = payload["text"];
|
|
49
|
+
this.startTime = payload["startTime"];
|
|
50
|
+
this.endTime = payload["endTime"];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ConversationsV2ContentTranscriptionTranscriptionWords = ConversationsV2ContentTranscriptionTranscriptionWords;
|
|
54
|
+
class ConversationsV2ParticipantAddress {
|
|
55
|
+
constructor(payload) {
|
|
56
|
+
this.address = payload["address"];
|
|
57
|
+
this.channel = payload["channel"];
|
|
58
|
+
this.participantId = payload["participantId"];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.ConversationsV2ParticipantAddress = ConversationsV2ParticipantAddress;
|
|
62
|
+
class CreateCommunicationInConversationRequest {
|
|
63
|
+
constructor(payload) {
|
|
64
|
+
this.author = payload["author"];
|
|
65
|
+
this.content = payload["content"];
|
|
66
|
+
this.channelId = payload["channelId"];
|
|
67
|
+
this.recipients = payload["recipients"];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.CreateCommunicationInConversationRequest = CreateCommunicationInConversationRequest;
|
|
71
|
+
class CreateCommunicationInConversationRequestAuthor {
|
|
72
|
+
constructor(payload) {
|
|
73
|
+
this.address = payload["address"];
|
|
74
|
+
this.channel = payload["channel"];
|
|
75
|
+
this.participantId = payload["participantId"];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.CreateCommunicationInConversationRequestAuthor = CreateCommunicationInConversationRequestAuthor;
|
|
79
|
+
/**
|
|
80
|
+
* The content of the Communication.
|
|
81
|
+
*/
|
|
82
|
+
class CreateCommunicationInConversationRequestContent {
|
|
83
|
+
constructor(payload) {
|
|
84
|
+
this.type = payload["type"];
|
|
85
|
+
this.text = payload["text"];
|
|
86
|
+
this.transcription = payload["transcription"];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.CreateCommunicationInConversationRequestContent = CreateCommunicationInConversationRequestContent;
|
|
90
|
+
/**
|
|
91
|
+
* The content of the Communication using type field for discrimination.
|
|
92
|
+
*/
|
|
93
|
+
class ListCommunicationByConversation200ResponseCommunicationsContent {
|
|
94
|
+
constructor(payload) {
|
|
95
|
+
this.type = payload["type"];
|
|
96
|
+
this.text = payload["text"];
|
|
97
|
+
this.transcription = payload["transcription"];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.ListCommunicationByConversation200ResponseCommunicationsContent = ListCommunicationByConversation200ResponseCommunicationsContent;
|
|
101
|
+
class ListCommunicationByConversation200ResponseCommunicationsRecipients {
|
|
102
|
+
constructor(payload) {
|
|
103
|
+
this.address = payload["address"];
|
|
104
|
+
this.channel = payload["channel"];
|
|
105
|
+
this.participantId = payload["participantId"];
|
|
106
|
+
this.deliveryStatus = payload["deliveryStatus"];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.ListCommunicationByConversation200ResponseCommunicationsRecipients = ListCommunicationByConversation200ResponseCommunicationsRecipients;
|
|
110
|
+
class CommunicationContextImpl {
|
|
111
|
+
constructor(_version, conversationSid, sid) {
|
|
112
|
+
this._version = _version;
|
|
113
|
+
if (!(0, utility_1.isValidPathParam)(conversationSid)) {
|
|
114
|
+
throw new Error("Parameter 'conversationSid' is not valid.");
|
|
115
|
+
}
|
|
116
|
+
if (!(0, utility_1.isValidPathParam)(sid)) {
|
|
117
|
+
throw new Error("Parameter 'sid' is not valid.");
|
|
118
|
+
}
|
|
119
|
+
this._solution = { conversationSid, sid };
|
|
120
|
+
this._uri = `/Conversations/${conversationSid}/Communications/${sid}`;
|
|
121
|
+
}
|
|
122
|
+
fetch(callback) {
|
|
123
|
+
const headers = {};
|
|
124
|
+
headers["Accept"] = "application/json";
|
|
125
|
+
const instance = this;
|
|
126
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
127
|
+
uri: instance._uri,
|
|
128
|
+
method: "get",
|
|
129
|
+
headers,
|
|
130
|
+
});
|
|
131
|
+
operationPromise = operationPromise.then((payload) => new CommunicationInstance(operationVersion, payload, instance._solution.conversationSid, instance._solution.sid));
|
|
132
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
133
|
+
return operationPromise;
|
|
134
|
+
}
|
|
135
|
+
fetchWithHttpInfo(callback) {
|
|
136
|
+
const headers = {};
|
|
137
|
+
headers["Accept"] = "application/json";
|
|
138
|
+
const instance = this;
|
|
139
|
+
let operationVersion = instance._version;
|
|
140
|
+
// CREATE, FETCH, UPDATE operations
|
|
141
|
+
let operationPromise = operationVersion
|
|
142
|
+
.fetchWithResponseInfo({
|
|
143
|
+
uri: instance._uri,
|
|
144
|
+
method: "get",
|
|
145
|
+
headers,
|
|
146
|
+
})
|
|
147
|
+
.then((response) => ({
|
|
148
|
+
...response,
|
|
149
|
+
body: new CommunicationInstance(operationVersion, response.body, instance._solution.conversationSid, instance._solution.sid),
|
|
150
|
+
}));
|
|
151
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
152
|
+
return operationPromise;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Provide a user-friendly representation
|
|
156
|
+
*
|
|
157
|
+
* @returns Object
|
|
158
|
+
*/
|
|
159
|
+
toJSON() {
|
|
160
|
+
return this._solution;
|
|
161
|
+
}
|
|
162
|
+
[util_1.inspect.custom](_depth, options) {
|
|
163
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.CommunicationContextImpl = CommunicationContextImpl;
|
|
167
|
+
class CommunicationInstance {
|
|
168
|
+
constructor(_version, _payload, conversationSid, sid) {
|
|
169
|
+
this._version = _version;
|
|
170
|
+
const payload = _payload;
|
|
171
|
+
this.id = payload.id;
|
|
172
|
+
this.conversationId = payload.conversationId;
|
|
173
|
+
this.accountId = payload.accountId;
|
|
174
|
+
this.author =
|
|
175
|
+
payload.author !== null && payload.author !== undefined
|
|
176
|
+
? new ConversationsV2ParticipantAddress(payload.author)
|
|
177
|
+
: null;
|
|
178
|
+
this.content =
|
|
179
|
+
payload.content !== null && payload.content !== undefined
|
|
180
|
+
? new ListCommunicationByConversation200ResponseCommunicationsContent(payload.content)
|
|
181
|
+
: null;
|
|
182
|
+
this.channelId = payload.channelId;
|
|
183
|
+
this.resourceId = payload.resourceId;
|
|
184
|
+
this.recipients =
|
|
185
|
+
payload.recipients !== null && payload.recipients !== undefined
|
|
186
|
+
? payload.recipients.map((payload) => new ListCommunicationByConversation200ResponseCommunicationsRecipients(payload))
|
|
187
|
+
: null;
|
|
188
|
+
this.createdAt = deserialize.iso8601DateTime(payload.createdAt);
|
|
189
|
+
this.updatedAt = deserialize.iso8601DateTime(payload.updatedAt);
|
|
190
|
+
this.occurredAt = deserialize.iso8601DateTime(payload.occurredAt);
|
|
191
|
+
this._solution = { conversationSid, sid: sid };
|
|
192
|
+
}
|
|
193
|
+
get _proxy() {
|
|
194
|
+
this._context =
|
|
195
|
+
this._context ||
|
|
196
|
+
new CommunicationContextImpl(this._version, this._solution.conversationSid, this._solution.sid);
|
|
197
|
+
return this._context;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Fetch a CommunicationInstance
|
|
201
|
+
*
|
|
202
|
+
* @param callback - Callback to handle processed record
|
|
203
|
+
*
|
|
204
|
+
* @returns Resolves to processed CommunicationInstance
|
|
205
|
+
*/
|
|
206
|
+
fetch(callback) {
|
|
207
|
+
return this._proxy.fetch(callback);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Fetch a CommunicationInstance and return HTTP info
|
|
211
|
+
*
|
|
212
|
+
* @param callback - Callback to handle processed record
|
|
213
|
+
*
|
|
214
|
+
* @returns Resolves to processed CommunicationInstance with HTTP metadata
|
|
215
|
+
*/
|
|
216
|
+
fetchWithHttpInfo(callback) {
|
|
217
|
+
return this._proxy.fetchWithHttpInfo(callback);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Provide a user-friendly representation
|
|
221
|
+
*
|
|
222
|
+
* @returns Object
|
|
223
|
+
*/
|
|
224
|
+
toJSON() {
|
|
225
|
+
return {
|
|
226
|
+
id: this.id,
|
|
227
|
+
conversationId: this.conversationId,
|
|
228
|
+
accountId: this.accountId,
|
|
229
|
+
author: this.author,
|
|
230
|
+
content: this.content,
|
|
231
|
+
channelId: this.channelId,
|
|
232
|
+
resourceId: this.resourceId,
|
|
233
|
+
recipients: this.recipients,
|
|
234
|
+
createdAt: this.createdAt,
|
|
235
|
+
updatedAt: this.updatedAt,
|
|
236
|
+
occurredAt: this.occurredAt,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
[util_1.inspect.custom](_depth, options) {
|
|
240
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
exports.CommunicationInstance = CommunicationInstance;
|
|
244
|
+
function CommunicationListInstance(version, conversationSid) {
|
|
245
|
+
if (!(0, utility_1.isValidPathParam)(conversationSid)) {
|
|
246
|
+
throw new Error("Parameter 'conversationSid' is not valid.");
|
|
247
|
+
}
|
|
248
|
+
const instance = ((sid) => instance.get(sid));
|
|
249
|
+
instance.get = function get(sid) {
|
|
250
|
+
return new CommunicationContextImpl(version, conversationSid, sid);
|
|
251
|
+
};
|
|
252
|
+
instance._version = version;
|
|
253
|
+
instance._solution = { conversationSid };
|
|
254
|
+
instance._uri = `/Conversations/${conversationSid}/Communications`;
|
|
255
|
+
instance.create = function create(params, headers, callback) {
|
|
256
|
+
if (params instanceof Function) {
|
|
257
|
+
callback = params;
|
|
258
|
+
params =
|
|
259
|
+
{};
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
params =
|
|
263
|
+
params ||
|
|
264
|
+
{};
|
|
265
|
+
}
|
|
266
|
+
let data = {};
|
|
267
|
+
data = params;
|
|
268
|
+
if (headers === null || headers === undefined) {
|
|
269
|
+
headers = {};
|
|
270
|
+
}
|
|
271
|
+
headers["Content-Type"] = "application/json";
|
|
272
|
+
headers["Accept"] = "application/json";
|
|
273
|
+
let operationVersion = version, operationPromise = operationVersion.create({
|
|
274
|
+
uri: instance._uri,
|
|
275
|
+
method: "post",
|
|
276
|
+
data,
|
|
277
|
+
headers,
|
|
278
|
+
});
|
|
279
|
+
operationPromise = operationPromise.then((payload) => new CommunicationInstance(operationVersion, payload, instance._solution.conversationSid));
|
|
280
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
281
|
+
return operationPromise;
|
|
282
|
+
};
|
|
283
|
+
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
|
|
284
|
+
if (params instanceof Function) {
|
|
285
|
+
callback = params;
|
|
286
|
+
params =
|
|
287
|
+
{};
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
params =
|
|
291
|
+
params ||
|
|
292
|
+
{};
|
|
293
|
+
}
|
|
294
|
+
let data = {};
|
|
295
|
+
data = params;
|
|
296
|
+
if (headers === null || headers === undefined) {
|
|
297
|
+
headers = {};
|
|
298
|
+
}
|
|
299
|
+
headers["Content-Type"] = "application/json";
|
|
300
|
+
headers["Accept"] = "application/json";
|
|
301
|
+
let operationVersion = version;
|
|
302
|
+
// CREATE, FETCH, UPDATE operations
|
|
303
|
+
let operationPromise = operationVersion
|
|
304
|
+
.createWithResponseInfo({
|
|
305
|
+
uri: instance._uri,
|
|
306
|
+
method: "post",
|
|
307
|
+
data,
|
|
308
|
+
headers,
|
|
309
|
+
})
|
|
310
|
+
.then((response) => ({
|
|
311
|
+
...response,
|
|
312
|
+
body: new CommunicationInstance(operationVersion, response.body, instance._solution.conversationSid),
|
|
313
|
+
}));
|
|
314
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
315
|
+
return operationPromise;
|
|
316
|
+
};
|
|
317
|
+
instance.page = function page(params, callback) {
|
|
318
|
+
if (params instanceof Function) {
|
|
319
|
+
callback = params;
|
|
320
|
+
params = {};
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
params = params || {};
|
|
324
|
+
}
|
|
325
|
+
let data = {};
|
|
326
|
+
if (params["channelId"] !== undefined)
|
|
327
|
+
data["channelId"] = params["channelId"];
|
|
328
|
+
if (params["pageSize"] !== undefined)
|
|
329
|
+
data["pageSize"] = params["pageSize"];
|
|
330
|
+
if (params["pageToken"] !== undefined)
|
|
331
|
+
data["pageToken"] = params["pageToken"];
|
|
332
|
+
const headers = {};
|
|
333
|
+
headers["Accept"] = "application/json";
|
|
334
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
335
|
+
uri: instance._uri,
|
|
336
|
+
method: "get",
|
|
337
|
+
params: data,
|
|
338
|
+
headers,
|
|
339
|
+
});
|
|
340
|
+
operationPromise = operationPromise.then((payload) => new CommunicationPage(operationVersion, payload, instance._uri, data, instance._solution));
|
|
341
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
342
|
+
return operationPromise;
|
|
343
|
+
};
|
|
344
|
+
instance.each = instance._version.each;
|
|
345
|
+
instance.list = instance._version.list;
|
|
346
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
347
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
348
|
+
method: "get",
|
|
349
|
+
uri: targetUrl,
|
|
350
|
+
});
|
|
351
|
+
let pagePromise = operationPromise.then((payload) => new CommunicationPage(instance._version, payload, instance._uri, {}, instance._solution));
|
|
352
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
353
|
+
return pagePromise;
|
|
354
|
+
};
|
|
355
|
+
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
|
|
356
|
+
if (params instanceof Function) {
|
|
357
|
+
callback = params;
|
|
358
|
+
params = {};
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
params = params || {};
|
|
362
|
+
}
|
|
363
|
+
let data = {};
|
|
364
|
+
if (params["channelId"] !== undefined)
|
|
365
|
+
data["channelId"] = params["channelId"];
|
|
366
|
+
if (params["pageSize"] !== undefined)
|
|
367
|
+
data["pageSize"] = params["pageSize"];
|
|
368
|
+
if (params["pageToken"] !== undefined)
|
|
369
|
+
data["pageToken"] = params["pageToken"];
|
|
370
|
+
const headers = {};
|
|
371
|
+
headers["Accept"] = "application/json";
|
|
372
|
+
let operationVersion = version;
|
|
373
|
+
// For page operations, use page() directly as it already returns { statusCode, body, headers }
|
|
374
|
+
// IMPORTANT: Pass full response to Page constructor, not response.body
|
|
375
|
+
let operationPromise = operationVersion
|
|
376
|
+
.page({ uri: instance._uri, method: "get", params: data, headers })
|
|
377
|
+
.then((response) => ({
|
|
378
|
+
statusCode: response.statusCode,
|
|
379
|
+
headers: response.headers,
|
|
380
|
+
body: new CommunicationPage(operationVersion, response, instance._uri, data, instance._solution),
|
|
381
|
+
}));
|
|
382
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
383
|
+
return operationPromise;
|
|
384
|
+
};
|
|
385
|
+
instance.each = instance._version.each;
|
|
386
|
+
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
|
|
387
|
+
instance.list = instance._version.list;
|
|
388
|
+
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
|
|
389
|
+
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
|
|
390
|
+
// Use request() directly as it already returns { statusCode, body, headers }
|
|
391
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
392
|
+
method: "get",
|
|
393
|
+
uri: targetUrl,
|
|
394
|
+
});
|
|
395
|
+
let pagePromise = operationPromise.then((response) => ({
|
|
396
|
+
statusCode: response.statusCode,
|
|
397
|
+
headers: response.headers,
|
|
398
|
+
body: new CommunicationPage(instance._version, response, instance._uri, {}, instance._solution),
|
|
399
|
+
}));
|
|
400
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
401
|
+
return pagePromise;
|
|
402
|
+
};
|
|
403
|
+
instance.toJSON = function toJSON() {
|
|
404
|
+
return instance._solution;
|
|
405
|
+
};
|
|
406
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
407
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
408
|
+
};
|
|
409
|
+
return instance;
|
|
410
|
+
}
|
|
411
|
+
class CommunicationPage extends TokenPage_1.default {
|
|
412
|
+
/**
|
|
413
|
+
* Initialize the CommunicationPage
|
|
414
|
+
*
|
|
415
|
+
* @param version - Version of the resource
|
|
416
|
+
* @param response - Response from the API
|
|
417
|
+
* @param uri - URI of the resource
|
|
418
|
+
* @param params - Query parameters
|
|
419
|
+
* @param solution - Path solution
|
|
420
|
+
*/
|
|
421
|
+
constructor(version, response, uri, params, solution) {
|
|
422
|
+
super(version, response, uri, params, solution);
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Build an instance of CommunicationInstance
|
|
426
|
+
*
|
|
427
|
+
* @param payload - Payload response from the API
|
|
428
|
+
*/
|
|
429
|
+
getInstance(payload) {
|
|
430
|
+
return new CommunicationInstance(this._version, payload, this._solution.conversationSid);
|
|
431
|
+
}
|
|
432
|
+
[util_1.inspect.custom](depth, options) {
|
|
433
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
exports.CommunicationPage = CommunicationPage;
|