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,531 @@
|
|
|
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
|
+
fetch(params, callback) {
|
|
95
|
+
if (params instanceof Function) {
|
|
96
|
+
callback = params;
|
|
97
|
+
params = {};
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
params = params || {};
|
|
101
|
+
}
|
|
102
|
+
let data = {};
|
|
103
|
+
if (params["traitGroups"] !== undefined)
|
|
104
|
+
data["traitGroups"] = params["traitGroups"];
|
|
105
|
+
const headers = {};
|
|
106
|
+
headers["Accept"] = "application/json";
|
|
107
|
+
const instance = this;
|
|
108
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
109
|
+
uri: instance._uri,
|
|
110
|
+
method: "get",
|
|
111
|
+
params: data,
|
|
112
|
+
headers,
|
|
113
|
+
});
|
|
114
|
+
operationPromise = operationPromise.then((payload) => new ProfileInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId));
|
|
115
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
116
|
+
return operationPromise;
|
|
117
|
+
}
|
|
118
|
+
fetchWithHttpInfo(params, callback) {
|
|
119
|
+
if (params instanceof Function) {
|
|
120
|
+
callback = params;
|
|
121
|
+
params = {};
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
params = params || {};
|
|
125
|
+
}
|
|
126
|
+
let data = {};
|
|
127
|
+
if (params["traitGroups"] !== undefined)
|
|
128
|
+
data["traitGroups"] = params["traitGroups"];
|
|
129
|
+
const headers = {};
|
|
130
|
+
headers["Accept"] = "application/json";
|
|
131
|
+
const instance = this;
|
|
132
|
+
let operationVersion = instance._version;
|
|
133
|
+
// CREATE, FETCH, UPDATE operations
|
|
134
|
+
let operationPromise = operationVersion
|
|
135
|
+
.fetchWithResponseInfo({
|
|
136
|
+
uri: instance._uri,
|
|
137
|
+
method: "get",
|
|
138
|
+
params: data,
|
|
139
|
+
headers,
|
|
140
|
+
})
|
|
141
|
+
.then((response) => ({
|
|
142
|
+
...response,
|
|
143
|
+
body: new ProfileInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId),
|
|
144
|
+
}));
|
|
145
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
146
|
+
return operationPromise;
|
|
147
|
+
}
|
|
148
|
+
patch(params, headers, callback) {
|
|
149
|
+
if (params === null || params === undefined) {
|
|
150
|
+
throw new Error('Required parameter "params" missing.');
|
|
151
|
+
}
|
|
152
|
+
let data = {};
|
|
153
|
+
data = params;
|
|
154
|
+
if (headers === null || headers === undefined) {
|
|
155
|
+
headers = {};
|
|
156
|
+
}
|
|
157
|
+
headers["Content-Type"] = "application/json";
|
|
158
|
+
headers["Accept"] = "application/json";
|
|
159
|
+
const instance = this;
|
|
160
|
+
let operationVersion = instance._version, operationPromise = operationVersion.patch({
|
|
161
|
+
uri: instance._uri,
|
|
162
|
+
method: "patch",
|
|
163
|
+
data,
|
|
164
|
+
headers,
|
|
165
|
+
});
|
|
166
|
+
operationPromise = operationPromise.then((payload) => new ProfileInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId));
|
|
167
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
168
|
+
return operationPromise;
|
|
169
|
+
}
|
|
170
|
+
patchWithHttpInfo(params, headers, callback) {
|
|
171
|
+
if (params === null || params === undefined) {
|
|
172
|
+
throw new Error('Required parameter "params" missing.');
|
|
173
|
+
}
|
|
174
|
+
let data = {};
|
|
175
|
+
data = params;
|
|
176
|
+
if (headers === null || headers === undefined) {
|
|
177
|
+
headers = {};
|
|
178
|
+
}
|
|
179
|
+
headers["Content-Type"] = "application/json";
|
|
180
|
+
headers["Accept"] = "application/json";
|
|
181
|
+
const instance = this;
|
|
182
|
+
let operationVersion = instance._version;
|
|
183
|
+
// CREATE, FETCH, UPDATE operations
|
|
184
|
+
let operationPromise = operationVersion
|
|
185
|
+
.patchWithResponseInfo({
|
|
186
|
+
uri: instance._uri,
|
|
187
|
+
method: "patch",
|
|
188
|
+
data,
|
|
189
|
+
headers,
|
|
190
|
+
})
|
|
191
|
+
.then((response) => ({
|
|
192
|
+
...response,
|
|
193
|
+
body: new ProfileInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId),
|
|
194
|
+
}));
|
|
195
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
196
|
+
return operationPromise;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Provide a user-friendly representation
|
|
200
|
+
*
|
|
201
|
+
* @returns Object
|
|
202
|
+
*/
|
|
203
|
+
toJSON() {
|
|
204
|
+
return this._solution;
|
|
205
|
+
}
|
|
206
|
+
[util_1.inspect.custom](_depth, options) {
|
|
207
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.ProfileContextImpl = ProfileContextImpl;
|
|
211
|
+
class ProfileInstance {
|
|
212
|
+
constructor(_version, _payload, storeId, profileId) {
|
|
213
|
+
this._version = _version;
|
|
214
|
+
const payload = _payload;
|
|
215
|
+
this.id = payload.id;
|
|
216
|
+
this.message = payload.message;
|
|
217
|
+
this.profiles = payload.profiles;
|
|
218
|
+
this.meta =
|
|
219
|
+
payload.meta !== null && payload.meta !== undefined
|
|
220
|
+
? new ProfilesMeta(payload.meta)
|
|
221
|
+
: null;
|
|
222
|
+
this.createdAt = deserialize.iso8601DateTime(payload.createdAt);
|
|
223
|
+
this.traits = payload.traits;
|
|
224
|
+
this._solution = { storeId, profileId: profileId };
|
|
225
|
+
}
|
|
226
|
+
get _proxy() {
|
|
227
|
+
this._context =
|
|
228
|
+
this._context ||
|
|
229
|
+
new ProfileContextImpl(this._version, this._solution.storeId, this._solution.profileId);
|
|
230
|
+
return this._context;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Remove a ProfileInstance
|
|
234
|
+
*
|
|
235
|
+
* @param callback - Callback to handle processed record
|
|
236
|
+
*
|
|
237
|
+
* @returns Resolves to processed ProfileInstance
|
|
238
|
+
*/
|
|
239
|
+
remove(callback) {
|
|
240
|
+
return this._proxy.remove(callback);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Remove a ProfileInstance and return HTTP info
|
|
244
|
+
*
|
|
245
|
+
* @param callback - Callback to handle processed record
|
|
246
|
+
*
|
|
247
|
+
* @returns Resolves to processed ProfileInstance with HTTP metadata
|
|
248
|
+
*/
|
|
249
|
+
removeWithHttpInfo(callback) {
|
|
250
|
+
return this._proxy.removeWithHttpInfo(callback);
|
|
251
|
+
}
|
|
252
|
+
fetch(params, callback) {
|
|
253
|
+
return this._proxy.fetch(params, callback);
|
|
254
|
+
}
|
|
255
|
+
fetchWithHttpInfo(params, callback) {
|
|
256
|
+
return this._proxy.fetchWithHttpInfo(params, callback);
|
|
257
|
+
}
|
|
258
|
+
patch(params, callback) {
|
|
259
|
+
return this._proxy.patch(params, callback);
|
|
260
|
+
}
|
|
261
|
+
patchWithHttpInfo(params, callback) {
|
|
262
|
+
return this._proxy.patchWithHttpInfo(params, callback);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Provide a user-friendly representation
|
|
266
|
+
*
|
|
267
|
+
* @returns Object
|
|
268
|
+
*/
|
|
269
|
+
toJSON() {
|
|
270
|
+
return {
|
|
271
|
+
id: this.id,
|
|
272
|
+
message: this.message,
|
|
273
|
+
profiles: this.profiles,
|
|
274
|
+
meta: this.meta,
|
|
275
|
+
createdAt: this.createdAt,
|
|
276
|
+
traits: this.traits,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
[util_1.inspect.custom](_depth, options) {
|
|
280
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.ProfileInstance = ProfileInstance;
|
|
284
|
+
function ProfileListInstance(version, storeId) {
|
|
285
|
+
if (!(0, utility_1.isValidPathParam)(storeId)) {
|
|
286
|
+
throw new Error("Parameter 'storeId' is not valid.");
|
|
287
|
+
}
|
|
288
|
+
const instance = ((profileId) => instance.get(profileId));
|
|
289
|
+
instance.get = function get(profileId) {
|
|
290
|
+
return new ProfileContextImpl(version, storeId, profileId);
|
|
291
|
+
};
|
|
292
|
+
instance._version = version;
|
|
293
|
+
instance._solution = { storeId };
|
|
294
|
+
instance._uri = `/Stores/${storeId}/Profiles`;
|
|
295
|
+
instance.create = function create(params, headers, callback) {
|
|
296
|
+
if (params === null || params === undefined) {
|
|
297
|
+
throw new Error('Required parameter "params" missing.');
|
|
298
|
+
}
|
|
299
|
+
let data = {};
|
|
300
|
+
data = params;
|
|
301
|
+
if (headers === null || headers === undefined) {
|
|
302
|
+
headers = {};
|
|
303
|
+
}
|
|
304
|
+
headers["Content-Type"] = "application/json";
|
|
305
|
+
headers["Accept"] = "application/json";
|
|
306
|
+
let operationVersion = version, operationPromise = operationVersion.create({
|
|
307
|
+
uri: instance._uri,
|
|
308
|
+
method: "post",
|
|
309
|
+
data,
|
|
310
|
+
headers,
|
|
311
|
+
});
|
|
312
|
+
operationPromise = operationPromise.then((payload) => new ProfileInstance(operationVersion, payload, instance._solution.storeId));
|
|
313
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
314
|
+
return operationPromise;
|
|
315
|
+
};
|
|
316
|
+
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
|
|
317
|
+
if (params === null || params === undefined) {
|
|
318
|
+
throw new Error('Required parameter "params" missing.');
|
|
319
|
+
}
|
|
320
|
+
let data = {};
|
|
321
|
+
data = params;
|
|
322
|
+
if (headers === null || headers === undefined) {
|
|
323
|
+
headers = {};
|
|
324
|
+
}
|
|
325
|
+
headers["Content-Type"] = "application/json";
|
|
326
|
+
headers["Accept"] = "application/json";
|
|
327
|
+
let operationVersion = version;
|
|
328
|
+
// CREATE, FETCH, UPDATE operations
|
|
329
|
+
let operationPromise = operationVersion
|
|
330
|
+
.createWithResponseInfo({
|
|
331
|
+
uri: instance._uri,
|
|
332
|
+
method: "post",
|
|
333
|
+
data,
|
|
334
|
+
headers,
|
|
335
|
+
})
|
|
336
|
+
.then((response) => ({
|
|
337
|
+
...response,
|
|
338
|
+
body: new ProfileInstance(operationVersion, response.body, instance._solution.storeId),
|
|
339
|
+
}));
|
|
340
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
341
|
+
return operationPromise;
|
|
342
|
+
};
|
|
343
|
+
instance.page = function page(params, callback) {
|
|
344
|
+
if (params instanceof Function) {
|
|
345
|
+
callback = params;
|
|
346
|
+
params = {};
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
params = params || {};
|
|
350
|
+
}
|
|
351
|
+
let data = {};
|
|
352
|
+
if (params["pageSize"] !== undefined)
|
|
353
|
+
data["pageSize"] = params["pageSize"];
|
|
354
|
+
if (params["pageToken"] !== undefined)
|
|
355
|
+
data["pageToken"] = params["pageToken"];
|
|
356
|
+
if (params["orderBy"] !== undefined)
|
|
357
|
+
data["orderBy"] = params["orderBy"];
|
|
358
|
+
const headers = {};
|
|
359
|
+
headers["Accept"] = "application/json";
|
|
360
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
361
|
+
uri: instance._uri,
|
|
362
|
+
method: "get",
|
|
363
|
+
params: data,
|
|
364
|
+
headers,
|
|
365
|
+
});
|
|
366
|
+
operationPromise = operationPromise.then((payload) => new ProfilePage(operationVersion, payload, instance._uri, data, instance._solution));
|
|
367
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
368
|
+
return operationPromise;
|
|
369
|
+
};
|
|
370
|
+
instance.each = instance._version.each;
|
|
371
|
+
instance.list = function list(params, callback) {
|
|
372
|
+
if (params instanceof Function) {
|
|
373
|
+
callback = params;
|
|
374
|
+
params = {};
|
|
375
|
+
}
|
|
376
|
+
params = params || {};
|
|
377
|
+
let allRecords = [];
|
|
378
|
+
function fetchNextPage(nextPageParams) {
|
|
379
|
+
return instance.page(nextPageParams).then((page) => {
|
|
380
|
+
const payload = page["_payload"];
|
|
381
|
+
const records = payload && payload["profiles"] ? payload["profiles"] : [];
|
|
382
|
+
allRecords = allRecords.concat(records);
|
|
383
|
+
if (params.limit && allRecords.length >= params.limit) {
|
|
384
|
+
allRecords = allRecords.slice(0, params.limit);
|
|
385
|
+
return allRecords;
|
|
386
|
+
}
|
|
387
|
+
const nextToken = page.nextPageUrl
|
|
388
|
+
? new URL(page.nextPageUrl).searchParams.get("PageToken")
|
|
389
|
+
: null;
|
|
390
|
+
if (nextToken) {
|
|
391
|
+
return fetchNextPage({ ...nextPageParams, pageToken: nextToken });
|
|
392
|
+
}
|
|
393
|
+
return allRecords;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
const promise = fetchNextPage(params);
|
|
397
|
+
return instance._version.setPromiseCallback(promise, callback);
|
|
398
|
+
};
|
|
399
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
400
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
401
|
+
method: "get",
|
|
402
|
+
uri: targetUrl,
|
|
403
|
+
});
|
|
404
|
+
let pagePromise = operationPromise.then((payload) => new ProfilePage(instance._version, payload, instance._uri, {}, instance._solution));
|
|
405
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
406
|
+
return pagePromise;
|
|
407
|
+
};
|
|
408
|
+
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
|
|
409
|
+
if (params instanceof Function) {
|
|
410
|
+
callback = params;
|
|
411
|
+
params = {};
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
params = params || {};
|
|
415
|
+
}
|
|
416
|
+
let data = {};
|
|
417
|
+
if (params["pageSize"] !== undefined)
|
|
418
|
+
data["pageSize"] = params["pageSize"];
|
|
419
|
+
if (params["pageToken"] !== undefined)
|
|
420
|
+
data["pageToken"] = params["pageToken"];
|
|
421
|
+
if (params["orderBy"] !== undefined)
|
|
422
|
+
data["orderBy"] = params["orderBy"];
|
|
423
|
+
const headers = {};
|
|
424
|
+
headers["Accept"] = "application/json";
|
|
425
|
+
let operationVersion = version;
|
|
426
|
+
// For page operations, use page() directly as it already returns { statusCode, body, headers }
|
|
427
|
+
// IMPORTANT: Pass full response to Page constructor, not response.body
|
|
428
|
+
let operationPromise = operationVersion
|
|
429
|
+
.page({ uri: instance._uri, method: "get", params: data, headers })
|
|
430
|
+
.then((response) => ({
|
|
431
|
+
statusCode: response.statusCode,
|
|
432
|
+
headers: response.headers,
|
|
433
|
+
body: new ProfilePage(operationVersion, response, instance._uri, data, instance._solution),
|
|
434
|
+
}));
|
|
435
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
436
|
+
return operationPromise;
|
|
437
|
+
};
|
|
438
|
+
instance.each = instance._version.each;
|
|
439
|
+
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
|
|
440
|
+
instance.listWithHttpInfo = function listWithHttpInfo(params, callback) {
|
|
441
|
+
if (params instanceof Function) {
|
|
442
|
+
callback = params;
|
|
443
|
+
params = {};
|
|
444
|
+
}
|
|
445
|
+
params = params || {};
|
|
446
|
+
let allRecords = [];
|
|
447
|
+
let lastResponse;
|
|
448
|
+
function fetchNextPage(nextPageParams) {
|
|
449
|
+
return instance
|
|
450
|
+
.pageWithHttpInfo(nextPageParams)
|
|
451
|
+
.then((response) => {
|
|
452
|
+
lastResponse = response;
|
|
453
|
+
const page = response.body;
|
|
454
|
+
// For primitive arrays, directly access the records array from the payload
|
|
455
|
+
// Access _payload using bracket notation to bypass TypeScript protected access
|
|
456
|
+
const payload = page["_payload"];
|
|
457
|
+
const records = payload && payload["profiles"] ? payload["profiles"] : [];
|
|
458
|
+
allRecords = allRecords.concat(records);
|
|
459
|
+
if (params.limit && allRecords.length >= params.limit) {
|
|
460
|
+
allRecords = allRecords.slice(0, params.limit);
|
|
461
|
+
return {
|
|
462
|
+
statusCode: lastResponse.statusCode,
|
|
463
|
+
headers: lastResponse.headers,
|
|
464
|
+
body: allRecords,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
const nextToken = page.nextPageUrl
|
|
468
|
+
? new URL(page.nextPageUrl).searchParams.get("PageToken")
|
|
469
|
+
: null;
|
|
470
|
+
if (nextToken) {
|
|
471
|
+
return fetchNextPage({ ...nextPageParams, pageToken: nextToken });
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
statusCode: lastResponse.statusCode,
|
|
475
|
+
headers: lastResponse.headers,
|
|
476
|
+
body: allRecords,
|
|
477
|
+
};
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
const promise = fetchNextPage(params);
|
|
481
|
+
return instance._version.setPromiseCallback(promise, callback);
|
|
482
|
+
};
|
|
483
|
+
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
|
|
484
|
+
// Use request() directly as it already returns { statusCode, body, headers }
|
|
485
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
486
|
+
method: "get",
|
|
487
|
+
uri: targetUrl,
|
|
488
|
+
});
|
|
489
|
+
let pagePromise = operationPromise.then((response) => ({
|
|
490
|
+
statusCode: response.statusCode,
|
|
491
|
+
headers: response.headers,
|
|
492
|
+
body: new ProfilePage(instance._version, response, instance._uri, {}, instance._solution),
|
|
493
|
+
}));
|
|
494
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
495
|
+
return pagePromise;
|
|
496
|
+
};
|
|
497
|
+
instance.toJSON = function toJSON() {
|
|
498
|
+
return instance._solution;
|
|
499
|
+
};
|
|
500
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
501
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
502
|
+
};
|
|
503
|
+
return instance;
|
|
504
|
+
}
|
|
505
|
+
class ProfilePage extends TokenPage_1.default {
|
|
506
|
+
/**
|
|
507
|
+
* Initialize the ProfilePage
|
|
508
|
+
*
|
|
509
|
+
* @param version - Version of the resource
|
|
510
|
+
* @param response - Response from the API
|
|
511
|
+
* @param uri - URI of the resource
|
|
512
|
+
* @param params - Query parameters
|
|
513
|
+
* @param solution - Path solution
|
|
514
|
+
*/
|
|
515
|
+
constructor(version, response, uri, params, solution) {
|
|
516
|
+
super(version, response, uri, params, solution);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Build an instance of ProfileInstance
|
|
520
|
+
*
|
|
521
|
+
* @param payload - Payload response from the API
|
|
522
|
+
*/
|
|
523
|
+
getInstance(payload) {
|
|
524
|
+
// Array items are primitives (strings, numbers), return directly
|
|
525
|
+
return payload;
|
|
526
|
+
}
|
|
527
|
+
[util_1.inspect.custom](depth, options) {
|
|
528
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
exports.ProfilePage = ProfilePage;
|