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