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,477 @@
|
|
|
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.ObservationPage = exports.ObservationInstance = exports.ObservationContextImpl = exports.ObservationCore = exports.CreateObservationsRequest = void 0;
|
|
20
|
+
exports.ObservationListInstance = ObservationListInstance;
|
|
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
|
+
* Request payload for creating one or more observations. Supports creation of up to 10 observations.
|
|
28
|
+
*/
|
|
29
|
+
class CreateObservationsRequest {
|
|
30
|
+
constructor(payload) {
|
|
31
|
+
this.observations = payload["observations"];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.CreateObservationsRequest = CreateObservationsRequest;
|
|
35
|
+
/**
|
|
36
|
+
* Core mutable properties for creating observation objects.
|
|
37
|
+
*/
|
|
38
|
+
class ObservationCore {
|
|
39
|
+
constructor(payload) {
|
|
40
|
+
this.content = payload["content"];
|
|
41
|
+
this.occurredAt = payload["occurredAt"];
|
|
42
|
+
this.source = payload["source"];
|
|
43
|
+
this.conversationIds = payload["conversationIds"];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ObservationCore = ObservationCore;
|
|
47
|
+
class ObservationContextImpl {
|
|
48
|
+
constructor(_version, storeId, profileId, observationId) {
|
|
49
|
+
this._version = _version;
|
|
50
|
+
if (!(0, utility_1.isValidPathParam)(storeId)) {
|
|
51
|
+
throw new Error("Parameter 'storeId' is not valid.");
|
|
52
|
+
}
|
|
53
|
+
if (!(0, utility_1.isValidPathParam)(profileId)) {
|
|
54
|
+
throw new Error("Parameter 'profileId' is not valid.");
|
|
55
|
+
}
|
|
56
|
+
if (!(0, utility_1.isValidPathParam)(observationId)) {
|
|
57
|
+
throw new Error("Parameter 'observationId' is not valid.");
|
|
58
|
+
}
|
|
59
|
+
this._solution = { storeId, profileId, observationId };
|
|
60
|
+
this._uri = `/Stores/${storeId}/Profiles/${profileId}/Observations/${observationId}`;
|
|
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 ObservationInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId, instance._solution.observationId));
|
|
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 ObservationInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId, instance._solution.observationId),
|
|
90
|
+
}));
|
|
91
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
92
|
+
return operationPromise;
|
|
93
|
+
}
|
|
94
|
+
fetch(callback) {
|
|
95
|
+
const headers = {};
|
|
96
|
+
headers["Accept"] = "application/json";
|
|
97
|
+
const instance = this;
|
|
98
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
99
|
+
uri: instance._uri,
|
|
100
|
+
method: "get",
|
|
101
|
+
headers,
|
|
102
|
+
});
|
|
103
|
+
operationPromise = operationPromise.then((payload) => new ObservationInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId, instance._solution.observationId));
|
|
104
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
105
|
+
return operationPromise;
|
|
106
|
+
}
|
|
107
|
+
fetchWithHttpInfo(callback) {
|
|
108
|
+
const headers = {};
|
|
109
|
+
headers["Accept"] = "application/json";
|
|
110
|
+
const instance = this;
|
|
111
|
+
let operationVersion = instance._version;
|
|
112
|
+
// CREATE, FETCH, UPDATE operations
|
|
113
|
+
let operationPromise = operationVersion
|
|
114
|
+
.fetchWithResponseInfo({
|
|
115
|
+
uri: instance._uri,
|
|
116
|
+
method: "get",
|
|
117
|
+
headers,
|
|
118
|
+
})
|
|
119
|
+
.then((response) => ({
|
|
120
|
+
...response,
|
|
121
|
+
body: new ObservationInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId, instance._solution.observationId),
|
|
122
|
+
}));
|
|
123
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
124
|
+
return operationPromise;
|
|
125
|
+
}
|
|
126
|
+
patch(params, headers, callback) {
|
|
127
|
+
if (params === null || params === undefined) {
|
|
128
|
+
throw new Error('Required parameter "params" missing.');
|
|
129
|
+
}
|
|
130
|
+
let data = {};
|
|
131
|
+
data = params;
|
|
132
|
+
if (headers === null || headers === undefined) {
|
|
133
|
+
headers = {};
|
|
134
|
+
}
|
|
135
|
+
headers["Content-Type"] = "application/json";
|
|
136
|
+
headers["Accept"] = "application/json";
|
|
137
|
+
const instance = this;
|
|
138
|
+
let operationVersion = instance._version, operationPromise = operationVersion.patch({
|
|
139
|
+
uri: instance._uri,
|
|
140
|
+
method: "patch",
|
|
141
|
+
data,
|
|
142
|
+
headers,
|
|
143
|
+
});
|
|
144
|
+
operationPromise = operationPromise.then((payload) => new ObservationInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId, instance._solution.observationId));
|
|
145
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
146
|
+
return operationPromise;
|
|
147
|
+
}
|
|
148
|
+
patchWithHttpInfo(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;
|
|
161
|
+
// CREATE, FETCH, UPDATE operations
|
|
162
|
+
let operationPromise = operationVersion
|
|
163
|
+
.patchWithResponseInfo({
|
|
164
|
+
uri: instance._uri,
|
|
165
|
+
method: "patch",
|
|
166
|
+
data,
|
|
167
|
+
headers,
|
|
168
|
+
})
|
|
169
|
+
.then((response) => ({
|
|
170
|
+
...response,
|
|
171
|
+
body: new ObservationInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId, instance._solution.observationId),
|
|
172
|
+
}));
|
|
173
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
174
|
+
return operationPromise;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Provide a user-friendly representation
|
|
178
|
+
*
|
|
179
|
+
* @returns Object
|
|
180
|
+
*/
|
|
181
|
+
toJSON() {
|
|
182
|
+
return this._solution;
|
|
183
|
+
}
|
|
184
|
+
[util_1.inspect.custom](_depth, options) {
|
|
185
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.ObservationContextImpl = ObservationContextImpl;
|
|
189
|
+
/**
|
|
190
|
+
* Response for batch observation creation.
|
|
191
|
+
*/
|
|
192
|
+
class ObservationInstance {
|
|
193
|
+
constructor(_version, _payload, storeId, profileId, observationId) {
|
|
194
|
+
this._version = _version;
|
|
195
|
+
const payload = _payload;
|
|
196
|
+
this.message = payload.message;
|
|
197
|
+
this.content = payload.content;
|
|
198
|
+
this.occurredAt = deserialize.iso8601DateTime(payload.occurredAt);
|
|
199
|
+
this.source = payload.source;
|
|
200
|
+
this.conversationIds = payload.conversationIds;
|
|
201
|
+
this.id = payload.id;
|
|
202
|
+
this.createdAt = deserialize.iso8601DateTime(payload.createdAt);
|
|
203
|
+
this.updatedAt = deserialize.iso8601DateTime(payload.updatedAt);
|
|
204
|
+
this._solution = { storeId, profileId, observationId: observationId };
|
|
205
|
+
}
|
|
206
|
+
get _proxy() {
|
|
207
|
+
this._context =
|
|
208
|
+
this._context ||
|
|
209
|
+
new ObservationContextImpl(this._version, this._solution.storeId, this._solution.profileId, this._solution.observationId);
|
|
210
|
+
return this._context;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Remove a ObservationInstance
|
|
214
|
+
*
|
|
215
|
+
* @param callback - Callback to handle processed record
|
|
216
|
+
*
|
|
217
|
+
* @returns Resolves to processed ObservationInstance
|
|
218
|
+
*/
|
|
219
|
+
remove(callback) {
|
|
220
|
+
return this._proxy.remove(callback);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Remove a ObservationInstance and return HTTP info
|
|
224
|
+
*
|
|
225
|
+
* @param callback - Callback to handle processed record
|
|
226
|
+
*
|
|
227
|
+
* @returns Resolves to processed ObservationInstance with HTTP metadata
|
|
228
|
+
*/
|
|
229
|
+
removeWithHttpInfo(callback) {
|
|
230
|
+
return this._proxy.removeWithHttpInfo(callback);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Fetch a ObservationInstance
|
|
234
|
+
*
|
|
235
|
+
* @param callback - Callback to handle processed record
|
|
236
|
+
*
|
|
237
|
+
* @returns Resolves to processed ObservationInstance
|
|
238
|
+
*/
|
|
239
|
+
fetch(callback) {
|
|
240
|
+
return this._proxy.fetch(callback);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Fetch a ObservationInstance and return HTTP info
|
|
244
|
+
*
|
|
245
|
+
* @param callback - Callback to handle processed record
|
|
246
|
+
*
|
|
247
|
+
* @returns Resolves to processed ObservationInstance with HTTP metadata
|
|
248
|
+
*/
|
|
249
|
+
fetchWithHttpInfo(callback) {
|
|
250
|
+
return this._proxy.fetchWithHttpInfo(callback);
|
|
251
|
+
}
|
|
252
|
+
patch(params, callback) {
|
|
253
|
+
return this._proxy.patch(params, callback);
|
|
254
|
+
}
|
|
255
|
+
patchWithHttpInfo(params, callback) {
|
|
256
|
+
return this._proxy.patchWithHttpInfo(params, callback);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Provide a user-friendly representation
|
|
260
|
+
*
|
|
261
|
+
* @returns Object
|
|
262
|
+
*/
|
|
263
|
+
toJSON() {
|
|
264
|
+
return {
|
|
265
|
+
message: this.message,
|
|
266
|
+
content: this.content,
|
|
267
|
+
occurredAt: this.occurredAt,
|
|
268
|
+
source: this.source,
|
|
269
|
+
conversationIds: this.conversationIds,
|
|
270
|
+
id: this.id,
|
|
271
|
+
createdAt: this.createdAt,
|
|
272
|
+
updatedAt: this.updatedAt,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
[util_1.inspect.custom](_depth, options) {
|
|
276
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
exports.ObservationInstance = ObservationInstance;
|
|
280
|
+
function ObservationListInstance(version, storeId, profileId) {
|
|
281
|
+
if (!(0, utility_1.isValidPathParam)(storeId)) {
|
|
282
|
+
throw new Error("Parameter 'storeId' is not valid.");
|
|
283
|
+
}
|
|
284
|
+
if (!(0, utility_1.isValidPathParam)(profileId)) {
|
|
285
|
+
throw new Error("Parameter 'profileId' is not valid.");
|
|
286
|
+
}
|
|
287
|
+
const instance = ((observationId) => instance.get(observationId));
|
|
288
|
+
instance.get = function get(observationId) {
|
|
289
|
+
return new ObservationContextImpl(version, storeId, profileId, observationId);
|
|
290
|
+
};
|
|
291
|
+
instance._version = version;
|
|
292
|
+
instance._solution = { storeId, profileId };
|
|
293
|
+
instance._uri = `/Stores/${storeId}/Profiles/${profileId}/Observations`;
|
|
294
|
+
instance.create = function create(params, headers, callback) {
|
|
295
|
+
if (params === null || params === undefined) {
|
|
296
|
+
throw new Error('Required parameter "params" missing.');
|
|
297
|
+
}
|
|
298
|
+
let data = {};
|
|
299
|
+
data = params;
|
|
300
|
+
if (headers === null || headers === undefined) {
|
|
301
|
+
headers = {};
|
|
302
|
+
}
|
|
303
|
+
headers["Content-Type"] = "application/json";
|
|
304
|
+
headers["Accept"] = "application/json";
|
|
305
|
+
let operationVersion = version, operationPromise = operationVersion.create({
|
|
306
|
+
uri: instance._uri,
|
|
307
|
+
method: "post",
|
|
308
|
+
data,
|
|
309
|
+
headers,
|
|
310
|
+
});
|
|
311
|
+
operationPromise = operationPromise.then((payload) => new ObservationInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId));
|
|
312
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
313
|
+
return operationPromise;
|
|
314
|
+
};
|
|
315
|
+
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
|
|
316
|
+
if (params === null || params === undefined) {
|
|
317
|
+
throw new Error('Required parameter "params" missing.');
|
|
318
|
+
}
|
|
319
|
+
let data = {};
|
|
320
|
+
data = params;
|
|
321
|
+
if (headers === null || headers === undefined) {
|
|
322
|
+
headers = {};
|
|
323
|
+
}
|
|
324
|
+
headers["Content-Type"] = "application/json";
|
|
325
|
+
headers["Accept"] = "application/json";
|
|
326
|
+
let operationVersion = version;
|
|
327
|
+
// CREATE, FETCH, UPDATE operations
|
|
328
|
+
let operationPromise = operationVersion
|
|
329
|
+
.createWithResponseInfo({
|
|
330
|
+
uri: instance._uri,
|
|
331
|
+
method: "post",
|
|
332
|
+
data,
|
|
333
|
+
headers,
|
|
334
|
+
})
|
|
335
|
+
.then((response) => ({
|
|
336
|
+
...response,
|
|
337
|
+
body: new ObservationInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId),
|
|
338
|
+
}));
|
|
339
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
340
|
+
return operationPromise;
|
|
341
|
+
};
|
|
342
|
+
instance.page = function page(params, callback) {
|
|
343
|
+
if (params instanceof Function) {
|
|
344
|
+
callback = params;
|
|
345
|
+
params = {};
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
params = params || {};
|
|
349
|
+
}
|
|
350
|
+
let data = {};
|
|
351
|
+
if (params["pageSize"] !== undefined)
|
|
352
|
+
data["pageSize"] = params["pageSize"];
|
|
353
|
+
if (params["pageToken"] !== undefined)
|
|
354
|
+
data["pageToken"] = params["pageToken"];
|
|
355
|
+
if (params["orderBy"] !== undefined)
|
|
356
|
+
data["orderBy"] = params["orderBy"];
|
|
357
|
+
if (params["source"] !== undefined)
|
|
358
|
+
data["source"] = params["source"];
|
|
359
|
+
if (params["createdAfter"] !== undefined)
|
|
360
|
+
data["createdAfter"] = serialize.iso8601DateTime(params["createdAfter"]);
|
|
361
|
+
if (params["createdBefore"] !== undefined)
|
|
362
|
+
data["createdBefore"] = serialize.iso8601DateTime(params["createdBefore"]);
|
|
363
|
+
const headers = {};
|
|
364
|
+
headers["Accept"] = "application/json";
|
|
365
|
+
if (params["acceptEncoding"] !== undefined)
|
|
366
|
+
headers["Accept-Encoding"] = params["acceptEncoding"];
|
|
367
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
368
|
+
uri: instance._uri,
|
|
369
|
+
method: "get",
|
|
370
|
+
params: data,
|
|
371
|
+
headers,
|
|
372
|
+
});
|
|
373
|
+
operationPromise = operationPromise.then((payload) => new ObservationPage(operationVersion, payload, instance._uri, data, instance._solution));
|
|
374
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
375
|
+
return operationPromise;
|
|
376
|
+
};
|
|
377
|
+
instance.each = instance._version.each;
|
|
378
|
+
instance.list = instance._version.list;
|
|
379
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
380
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
381
|
+
method: "get",
|
|
382
|
+
uri: targetUrl,
|
|
383
|
+
});
|
|
384
|
+
let pagePromise = operationPromise.then((payload) => new ObservationPage(instance._version, payload, instance._uri, {}, instance._solution));
|
|
385
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
386
|
+
return pagePromise;
|
|
387
|
+
};
|
|
388
|
+
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
|
|
389
|
+
if (params instanceof Function) {
|
|
390
|
+
callback = params;
|
|
391
|
+
params = {};
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
params = params || {};
|
|
395
|
+
}
|
|
396
|
+
let data = {};
|
|
397
|
+
if (params["pageSize"] !== undefined)
|
|
398
|
+
data["pageSize"] = params["pageSize"];
|
|
399
|
+
if (params["pageToken"] !== undefined)
|
|
400
|
+
data["pageToken"] = params["pageToken"];
|
|
401
|
+
if (params["orderBy"] !== undefined)
|
|
402
|
+
data["orderBy"] = params["orderBy"];
|
|
403
|
+
if (params["source"] !== undefined)
|
|
404
|
+
data["source"] = params["source"];
|
|
405
|
+
if (params["createdAfter"] !== undefined)
|
|
406
|
+
data["createdAfter"] = serialize.iso8601DateTime(params["createdAfter"]);
|
|
407
|
+
if (params["createdBefore"] !== undefined)
|
|
408
|
+
data["createdBefore"] = serialize.iso8601DateTime(params["createdBefore"]);
|
|
409
|
+
const headers = {};
|
|
410
|
+
headers["Accept"] = "application/json";
|
|
411
|
+
if (params["acceptEncoding"] !== undefined)
|
|
412
|
+
headers["Accept-Encoding"] = params["acceptEncoding"];
|
|
413
|
+
let operationVersion = version;
|
|
414
|
+
// For page operations, use page() directly as it already returns { statusCode, body, headers }
|
|
415
|
+
// IMPORTANT: Pass full response to Page constructor, not response.body
|
|
416
|
+
let operationPromise = operationVersion
|
|
417
|
+
.page({ uri: instance._uri, method: "get", params: data, headers })
|
|
418
|
+
.then((response) => ({
|
|
419
|
+
statusCode: response.statusCode,
|
|
420
|
+
headers: response.headers,
|
|
421
|
+
body: new ObservationPage(operationVersion, response, instance._uri, data, instance._solution),
|
|
422
|
+
}));
|
|
423
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
424
|
+
return operationPromise;
|
|
425
|
+
};
|
|
426
|
+
instance.each = instance._version.each;
|
|
427
|
+
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
|
|
428
|
+
instance.list = instance._version.list;
|
|
429
|
+
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
|
|
430
|
+
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
|
|
431
|
+
// Use request() directly as it already returns { statusCode, body, headers }
|
|
432
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
433
|
+
method: "get",
|
|
434
|
+
uri: targetUrl,
|
|
435
|
+
});
|
|
436
|
+
let pagePromise = operationPromise.then((response) => ({
|
|
437
|
+
statusCode: response.statusCode,
|
|
438
|
+
headers: response.headers,
|
|
439
|
+
body: new ObservationPage(instance._version, response, instance._uri, {}, instance._solution),
|
|
440
|
+
}));
|
|
441
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
442
|
+
return pagePromise;
|
|
443
|
+
};
|
|
444
|
+
instance.toJSON = function toJSON() {
|
|
445
|
+
return instance._solution;
|
|
446
|
+
};
|
|
447
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
448
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
449
|
+
};
|
|
450
|
+
return instance;
|
|
451
|
+
}
|
|
452
|
+
class ObservationPage extends TokenPage_1.default {
|
|
453
|
+
/**
|
|
454
|
+
* Initialize the ObservationPage
|
|
455
|
+
*
|
|
456
|
+
* @param version - Version of the resource
|
|
457
|
+
* @param response - Response from the API
|
|
458
|
+
* @param uri - URI of the resource
|
|
459
|
+
* @param params - Query parameters
|
|
460
|
+
* @param solution - Path solution
|
|
461
|
+
*/
|
|
462
|
+
constructor(version, response, uri, params, solution) {
|
|
463
|
+
super(version, response, uri, params, solution);
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Build an instance of ObservationInstance
|
|
467
|
+
*
|
|
468
|
+
* @param payload - Payload response from the API
|
|
469
|
+
*/
|
|
470
|
+
getInstance(payload) {
|
|
471
|
+
return new ObservationInstance(this._version, payload, this._solution.storeId, this._solution.profileId);
|
|
472
|
+
}
|
|
473
|
+
[util_1.inspect.custom](depth, options) {
|
|
474
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
exports.ObservationPage = ObservationPage;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { inspect, InspectOptions } from "util";
|
|
2
|
+
import V1 from "../V1";
|
|
3
|
+
import { ApiResponse } from "../../../base/ApiResponse";
|
|
4
|
+
export declare class OperationResultResourceId {
|
|
5
|
+
"type": string;
|
|
6
|
+
/**
|
|
7
|
+
* The identifier of the created or affected resource.
|
|
8
|
+
*/
|
|
9
|
+
"id": string;
|
|
10
|
+
constructor(payload: any);
|
|
11
|
+
}
|
|
12
|
+
export declare class OperationStatusError {
|
|
13
|
+
/**
|
|
14
|
+
* A URI reference identifying the problem type.
|
|
15
|
+
*/
|
|
16
|
+
"type"?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A short, human-readable summary of the problem type.
|
|
19
|
+
*/
|
|
20
|
+
"title"?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The numeric Twilio error code.
|
|
23
|
+
*/
|
|
24
|
+
"code"?: number;
|
|
25
|
+
/**
|
|
26
|
+
* A human-readable explanation specific to this occurrence of the problem.
|
|
27
|
+
*/
|
|
28
|
+
"detail"?: string;
|
|
29
|
+
constructor(payload: any);
|
|
30
|
+
}
|
|
31
|
+
export interface OperationContext {
|
|
32
|
+
/**
|
|
33
|
+
* Fetch a OperationInstance
|
|
34
|
+
*
|
|
35
|
+
* @param callback - Callback to handle processed record
|
|
36
|
+
*
|
|
37
|
+
* @returns Resolves to processed OperationInstance
|
|
38
|
+
*/
|
|
39
|
+
fetch(callback?: (error: Error | null, item?: OperationInstance) => any): Promise<OperationInstance>;
|
|
40
|
+
/**
|
|
41
|
+
* Fetch a OperationInstance and return HTTP info
|
|
42
|
+
*
|
|
43
|
+
* @param callback - Callback to handle processed record
|
|
44
|
+
*
|
|
45
|
+
* @returns Resolves to processed OperationInstance with HTTP metadata
|
|
46
|
+
*/
|
|
47
|
+
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperationInstance>) => any): Promise<ApiResponse<OperationInstance>>;
|
|
48
|
+
/**
|
|
49
|
+
* Provide a user-friendly representation
|
|
50
|
+
*/
|
|
51
|
+
toJSON(): any;
|
|
52
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
53
|
+
}
|
|
54
|
+
export interface OperationContextSolution {
|
|
55
|
+
operationId: string;
|
|
56
|
+
}
|
|
57
|
+
export declare class OperationContextImpl implements OperationContext {
|
|
58
|
+
protected _version: V1;
|
|
59
|
+
protected _solution: OperationContextSolution;
|
|
60
|
+
protected _uri: string;
|
|
61
|
+
constructor(_version: V1, operationId: string);
|
|
62
|
+
fetch(callback?: (error: Error | null, item?: OperationInstance) => any): Promise<OperationInstance>;
|
|
63
|
+
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperationInstance>) => any): Promise<ApiResponse<OperationInstance>>;
|
|
64
|
+
/**
|
|
65
|
+
* Provide a user-friendly representation
|
|
66
|
+
*
|
|
67
|
+
* @returns Object
|
|
68
|
+
*/
|
|
69
|
+
toJSON(): OperationContextSolution;
|
|
70
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
71
|
+
}
|
|
72
|
+
interface OperationResource {
|
|
73
|
+
operationId: string;
|
|
74
|
+
status: string;
|
|
75
|
+
createdAt: Date;
|
|
76
|
+
statusUrl: string;
|
|
77
|
+
completedAt: Date;
|
|
78
|
+
result: OperationResultResourceId;
|
|
79
|
+
error: OperationStatusError;
|
|
80
|
+
resultUrl: string;
|
|
81
|
+
}
|
|
82
|
+
export declare class OperationInstance {
|
|
83
|
+
protected _version: V1;
|
|
84
|
+
protected _solution: OperationContextSolution;
|
|
85
|
+
protected _context?: OperationContext;
|
|
86
|
+
constructor(_version: V1, _payload: OperationResource, operationId?: string);
|
|
87
|
+
/**
|
|
88
|
+
* The unique identifier for this operation.
|
|
89
|
+
*/
|
|
90
|
+
operationId: string;
|
|
91
|
+
/**
|
|
92
|
+
* The current status of the operation.
|
|
93
|
+
*/
|
|
94
|
+
status: string;
|
|
95
|
+
/**
|
|
96
|
+
* When the operation was created.
|
|
97
|
+
*/
|
|
98
|
+
createdAt: Date;
|
|
99
|
+
/**
|
|
100
|
+
* URI to check operation status.
|
|
101
|
+
*/
|
|
102
|
+
statusUrl: string;
|
|
103
|
+
/**
|
|
104
|
+
* When the operation completed or failed.
|
|
105
|
+
*/
|
|
106
|
+
completedAt: Date;
|
|
107
|
+
result: OperationResultResourceId;
|
|
108
|
+
error: OperationStatusError;
|
|
109
|
+
/**
|
|
110
|
+
* URL to fetch the resulting resource.
|
|
111
|
+
*/
|
|
112
|
+
resultUrl: string;
|
|
113
|
+
private get _proxy();
|
|
114
|
+
/**
|
|
115
|
+
* Fetch a OperationInstance
|
|
116
|
+
*
|
|
117
|
+
* @param callback - Callback to handle processed record
|
|
118
|
+
*
|
|
119
|
+
* @returns Resolves to processed OperationInstance
|
|
120
|
+
*/
|
|
121
|
+
fetch(callback?: (error: Error | null, item?: OperationInstance) => any): Promise<OperationInstance>;
|
|
122
|
+
/**
|
|
123
|
+
* Fetch a OperationInstance and return HTTP info
|
|
124
|
+
*
|
|
125
|
+
* @param callback - Callback to handle processed record
|
|
126
|
+
*
|
|
127
|
+
* @returns Resolves to processed OperationInstance with HTTP metadata
|
|
128
|
+
*/
|
|
129
|
+
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperationInstance>) => any): Promise<ApiResponse<OperationInstance>>;
|
|
130
|
+
/**
|
|
131
|
+
* Provide a user-friendly representation
|
|
132
|
+
*
|
|
133
|
+
* @returns Object
|
|
134
|
+
*/
|
|
135
|
+
toJSON(): {
|
|
136
|
+
operationId: string;
|
|
137
|
+
status: string;
|
|
138
|
+
createdAt: Date;
|
|
139
|
+
statusUrl: string;
|
|
140
|
+
completedAt: Date;
|
|
141
|
+
result: OperationResultResourceId;
|
|
142
|
+
error: OperationStatusError;
|
|
143
|
+
resultUrl: string;
|
|
144
|
+
};
|
|
145
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
146
|
+
}
|
|
147
|
+
export interface OperationSolution {
|
|
148
|
+
}
|
|
149
|
+
export interface OperationListInstance {
|
|
150
|
+
_version: V1;
|
|
151
|
+
_solution: OperationSolution;
|
|
152
|
+
_uri: string;
|
|
153
|
+
(operationId: string): OperationContext;
|
|
154
|
+
get(operationId: string): OperationContext;
|
|
155
|
+
/**
|
|
156
|
+
* Provide a user-friendly representation
|
|
157
|
+
*/
|
|
158
|
+
toJSON(): any;
|
|
159
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
160
|
+
}
|
|
161
|
+
export declare function OperationListInstance(version: V1): OperationListInstance;
|
|
162
|
+
export {};
|