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,441 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio Knowledge API
|
|
9
|
+
* APIs for managing knowledge bases and knowledge content for AI-powered applications.
|
|
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.KnowledgeBasisPage = exports.KnowledgeBasisInstance = exports.KnowledgeBasisContextImpl = exports.UpdateKnowledgeBaseRequest = exports.KnowledgeBaseCore = void 0;
|
|
20
|
+
exports.KnowledgeBasisListInstance = KnowledgeBasisListInstance;
|
|
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 KnowledgeBaseCore {
|
|
27
|
+
constructor(payload) {
|
|
28
|
+
this.displayName = payload["displayName"];
|
|
29
|
+
this.description = payload["description"];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.KnowledgeBaseCore = KnowledgeBaseCore;
|
|
33
|
+
class UpdateKnowledgeBaseRequest {
|
|
34
|
+
constructor(payload) {
|
|
35
|
+
this.displayName = payload["displayName"];
|
|
36
|
+
this.description = payload["description"];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.UpdateKnowledgeBaseRequest = UpdateKnowledgeBaseRequest;
|
|
40
|
+
class KnowledgeBasisContextImpl {
|
|
41
|
+
constructor(_version, kbId) {
|
|
42
|
+
this._version = _version;
|
|
43
|
+
if (!(0, utility_1.isValidPathParam)(kbId)) {
|
|
44
|
+
throw new Error("Parameter 'kbId' is not valid.");
|
|
45
|
+
}
|
|
46
|
+
this._solution = { kbId };
|
|
47
|
+
this._uri = `/ControlPlane/KnowledgeBases/${kbId}`;
|
|
48
|
+
}
|
|
49
|
+
remove(callback) {
|
|
50
|
+
const headers = {};
|
|
51
|
+
headers["Accept"] = "application/json";
|
|
52
|
+
const instance = this;
|
|
53
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
54
|
+
uri: instance._uri,
|
|
55
|
+
method: "delete",
|
|
56
|
+
headers,
|
|
57
|
+
});
|
|
58
|
+
operationPromise = operationPromise.then((payload) => new KnowledgeBasisInstance(operationVersion, payload, instance._solution.kbId));
|
|
59
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
60
|
+
return operationPromise;
|
|
61
|
+
}
|
|
62
|
+
removeWithHttpInfo(callback) {
|
|
63
|
+
const headers = {};
|
|
64
|
+
headers["Accept"] = "application/json";
|
|
65
|
+
const instance = this;
|
|
66
|
+
let operationVersion = instance._version;
|
|
67
|
+
// DELETE operation that returns a response model
|
|
68
|
+
let operationPromise = operationVersion
|
|
69
|
+
.fetchWithResponseInfo({
|
|
70
|
+
uri: instance._uri,
|
|
71
|
+
method: "delete",
|
|
72
|
+
headers,
|
|
73
|
+
})
|
|
74
|
+
.then((response) => ({
|
|
75
|
+
...response,
|
|
76
|
+
body: new KnowledgeBasisInstance(operationVersion, response.body, instance._solution.kbId),
|
|
77
|
+
}));
|
|
78
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
79
|
+
return operationPromise;
|
|
80
|
+
}
|
|
81
|
+
fetch(callback) {
|
|
82
|
+
const headers = {};
|
|
83
|
+
headers["Accept"] = "application/json";
|
|
84
|
+
const instance = this;
|
|
85
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
86
|
+
uri: instance._uri,
|
|
87
|
+
method: "get",
|
|
88
|
+
headers,
|
|
89
|
+
});
|
|
90
|
+
operationPromise = operationPromise.then((payload) => new KnowledgeBasisInstance(operationVersion, payload, instance._solution.kbId));
|
|
91
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
92
|
+
return operationPromise;
|
|
93
|
+
}
|
|
94
|
+
fetchWithHttpInfo(callback) {
|
|
95
|
+
const headers = {};
|
|
96
|
+
headers["Accept"] = "application/json";
|
|
97
|
+
const instance = this;
|
|
98
|
+
let operationVersion = instance._version;
|
|
99
|
+
// CREATE, FETCH, UPDATE operations
|
|
100
|
+
let operationPromise = operationVersion
|
|
101
|
+
.fetchWithResponseInfo({
|
|
102
|
+
uri: instance._uri,
|
|
103
|
+
method: "get",
|
|
104
|
+
headers,
|
|
105
|
+
})
|
|
106
|
+
.then((response) => ({
|
|
107
|
+
...response,
|
|
108
|
+
body: new KnowledgeBasisInstance(operationVersion, response.body, instance._solution.kbId),
|
|
109
|
+
}));
|
|
110
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
111
|
+
return operationPromise;
|
|
112
|
+
}
|
|
113
|
+
update(params, headers, callback) {
|
|
114
|
+
if (params === null || params === undefined) {
|
|
115
|
+
throw new Error('Required parameter "params" missing.');
|
|
116
|
+
}
|
|
117
|
+
let data = {};
|
|
118
|
+
data = params;
|
|
119
|
+
if (headers === null || headers === undefined) {
|
|
120
|
+
headers = {};
|
|
121
|
+
}
|
|
122
|
+
headers["Content-Type"] = "application/json";
|
|
123
|
+
headers["Accept"] = "application/json";
|
|
124
|
+
const instance = this;
|
|
125
|
+
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
|
126
|
+
uri: instance._uri,
|
|
127
|
+
method: "patch",
|
|
128
|
+
data,
|
|
129
|
+
headers,
|
|
130
|
+
});
|
|
131
|
+
operationPromise = operationPromise.then((payload) => new KnowledgeBasisInstance(operationVersion, payload, instance._solution.kbId));
|
|
132
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
133
|
+
return operationPromise;
|
|
134
|
+
}
|
|
135
|
+
updateWithHttpInfo(params, headers, callback) {
|
|
136
|
+
if (params === null || params === undefined) {
|
|
137
|
+
throw new Error('Required parameter "params" missing.');
|
|
138
|
+
}
|
|
139
|
+
let data = {};
|
|
140
|
+
data = params;
|
|
141
|
+
if (headers === null || headers === undefined) {
|
|
142
|
+
headers = {};
|
|
143
|
+
}
|
|
144
|
+
headers["Content-Type"] = "application/json";
|
|
145
|
+
headers["Accept"] = "application/json";
|
|
146
|
+
const instance = this;
|
|
147
|
+
let operationVersion = instance._version;
|
|
148
|
+
// CREATE, FETCH, UPDATE operations
|
|
149
|
+
let operationPromise = operationVersion
|
|
150
|
+
.updateWithResponseInfo({
|
|
151
|
+
uri: instance._uri,
|
|
152
|
+
method: "patch",
|
|
153
|
+
data,
|
|
154
|
+
headers,
|
|
155
|
+
})
|
|
156
|
+
.then((response) => ({
|
|
157
|
+
...response,
|
|
158
|
+
body: new KnowledgeBasisInstance(operationVersion, response.body, instance._solution.kbId),
|
|
159
|
+
}));
|
|
160
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
161
|
+
return operationPromise;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Provide a user-friendly representation
|
|
165
|
+
*
|
|
166
|
+
* @returns Object
|
|
167
|
+
*/
|
|
168
|
+
toJSON() {
|
|
169
|
+
return this._solution;
|
|
170
|
+
}
|
|
171
|
+
[util_1.inspect.custom](_depth, options) {
|
|
172
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.KnowledgeBasisContextImpl = KnowledgeBasisContextImpl;
|
|
176
|
+
class KnowledgeBasisInstance {
|
|
177
|
+
constructor(_version, _payload, kbId) {
|
|
178
|
+
this._version = _version;
|
|
179
|
+
const payload = _payload;
|
|
180
|
+
this.message = payload.message;
|
|
181
|
+
this.displayName = payload.displayName;
|
|
182
|
+
this.description = payload.description;
|
|
183
|
+
this.id = payload.id;
|
|
184
|
+
this.status = payload.status;
|
|
185
|
+
this.createdAt = deserialize.iso8601DateTime(payload.createdAt);
|
|
186
|
+
this.updatedAt = deserialize.iso8601DateTime(payload.updatedAt);
|
|
187
|
+
this.version = deserialize.integer(payload.version);
|
|
188
|
+
this.statusUrl = payload.statusUrl;
|
|
189
|
+
this._solution = { kbId: kbId };
|
|
190
|
+
}
|
|
191
|
+
get _proxy() {
|
|
192
|
+
this._context =
|
|
193
|
+
this._context ||
|
|
194
|
+
new KnowledgeBasisContextImpl(this._version, this._solution.kbId);
|
|
195
|
+
return this._context;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Remove a KnowledgeBasisInstance
|
|
199
|
+
*
|
|
200
|
+
* @param callback - Callback to handle processed record
|
|
201
|
+
*
|
|
202
|
+
* @returns Resolves to processed KnowledgeBasisInstance
|
|
203
|
+
*/
|
|
204
|
+
remove(callback) {
|
|
205
|
+
return this._proxy.remove(callback);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Remove a KnowledgeBasisInstance and return HTTP info
|
|
209
|
+
*
|
|
210
|
+
* @param callback - Callback to handle processed record
|
|
211
|
+
*
|
|
212
|
+
* @returns Resolves to processed KnowledgeBasisInstance with HTTP metadata
|
|
213
|
+
*/
|
|
214
|
+
removeWithHttpInfo(callback) {
|
|
215
|
+
return this._proxy.removeWithHttpInfo(callback);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Fetch a KnowledgeBasisInstance
|
|
219
|
+
*
|
|
220
|
+
* @param callback - Callback to handle processed record
|
|
221
|
+
*
|
|
222
|
+
* @returns Resolves to processed KnowledgeBasisInstance
|
|
223
|
+
*/
|
|
224
|
+
fetch(callback) {
|
|
225
|
+
return this._proxy.fetch(callback);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Fetch a KnowledgeBasisInstance and return HTTP info
|
|
229
|
+
*
|
|
230
|
+
* @param callback - Callback to handle processed record
|
|
231
|
+
*
|
|
232
|
+
* @returns Resolves to processed KnowledgeBasisInstance with HTTP metadata
|
|
233
|
+
*/
|
|
234
|
+
fetchWithHttpInfo(callback) {
|
|
235
|
+
return this._proxy.fetchWithHttpInfo(callback);
|
|
236
|
+
}
|
|
237
|
+
update(params, callback) {
|
|
238
|
+
return this._proxy.update(params, callback);
|
|
239
|
+
}
|
|
240
|
+
updateWithHttpInfo(params, callback) {
|
|
241
|
+
return this._proxy.updateWithHttpInfo(params, callback);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Provide a user-friendly representation
|
|
245
|
+
*
|
|
246
|
+
* @returns Object
|
|
247
|
+
*/
|
|
248
|
+
toJSON() {
|
|
249
|
+
return {
|
|
250
|
+
message: this.message,
|
|
251
|
+
displayName: this.displayName,
|
|
252
|
+
description: this.description,
|
|
253
|
+
id: this.id,
|
|
254
|
+
status: this.status,
|
|
255
|
+
createdAt: this.createdAt,
|
|
256
|
+
updatedAt: this.updatedAt,
|
|
257
|
+
version: this.version,
|
|
258
|
+
statusUrl: this.statusUrl,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
[util_1.inspect.custom](_depth, options) {
|
|
262
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.KnowledgeBasisInstance = KnowledgeBasisInstance;
|
|
266
|
+
function KnowledgeBasisListInstance(version) {
|
|
267
|
+
const instance = ((kbId) => instance.get(kbId));
|
|
268
|
+
instance.get = function get(kbId) {
|
|
269
|
+
return new KnowledgeBasisContextImpl(version, kbId);
|
|
270
|
+
};
|
|
271
|
+
instance._version = version;
|
|
272
|
+
instance._solution = {};
|
|
273
|
+
instance._uri = `/ControlPlane/KnowledgeBases`;
|
|
274
|
+
instance.create = function create(params, headers, callback) {
|
|
275
|
+
if (params === null || params === undefined) {
|
|
276
|
+
throw new Error('Required parameter "params" missing.');
|
|
277
|
+
}
|
|
278
|
+
let data = {};
|
|
279
|
+
data = params;
|
|
280
|
+
if (headers === null || headers === undefined) {
|
|
281
|
+
headers = {};
|
|
282
|
+
}
|
|
283
|
+
headers["Content-Type"] = "application/json";
|
|
284
|
+
headers["Accept"] = "application/json";
|
|
285
|
+
let operationVersion = version, operationPromise = operationVersion.create({
|
|
286
|
+
uri: instance._uri,
|
|
287
|
+
method: "post",
|
|
288
|
+
data,
|
|
289
|
+
headers,
|
|
290
|
+
});
|
|
291
|
+
operationPromise = operationPromise.then((payload) => new KnowledgeBasisInstance(operationVersion, payload));
|
|
292
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
293
|
+
return operationPromise;
|
|
294
|
+
};
|
|
295
|
+
instance.createWithHttpInfo = function createWithHttpInfo(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;
|
|
307
|
+
// CREATE, FETCH, UPDATE operations
|
|
308
|
+
let operationPromise = operationVersion
|
|
309
|
+
.createWithResponseInfo({
|
|
310
|
+
uri: instance._uri,
|
|
311
|
+
method: "post",
|
|
312
|
+
data,
|
|
313
|
+
headers,
|
|
314
|
+
})
|
|
315
|
+
.then((response) => ({
|
|
316
|
+
...response,
|
|
317
|
+
body: new KnowledgeBasisInstance(operationVersion, response.body),
|
|
318
|
+
}));
|
|
319
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
320
|
+
return operationPromise;
|
|
321
|
+
};
|
|
322
|
+
instance.page = function page(params, callback) {
|
|
323
|
+
if (params instanceof Function) {
|
|
324
|
+
callback = params;
|
|
325
|
+
params = {};
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
params = params || {};
|
|
329
|
+
}
|
|
330
|
+
let data = {};
|
|
331
|
+
if (params["pageSize"] !== undefined)
|
|
332
|
+
data["pageSize"] = params["pageSize"];
|
|
333
|
+
if (params["pageToken"] !== undefined)
|
|
334
|
+
data["pageToken"] = params["pageToken"];
|
|
335
|
+
if (params["orderBy"] !== undefined)
|
|
336
|
+
data["orderBy"] = params["orderBy"];
|
|
337
|
+
const headers = {};
|
|
338
|
+
headers["Accept"] = "application/json";
|
|
339
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
340
|
+
uri: instance._uri,
|
|
341
|
+
method: "get",
|
|
342
|
+
params: data,
|
|
343
|
+
headers,
|
|
344
|
+
});
|
|
345
|
+
operationPromise = operationPromise.then((payload) => new KnowledgeBasisPage(operationVersion, payload, instance._uri, data, instance._solution));
|
|
346
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
347
|
+
return operationPromise;
|
|
348
|
+
};
|
|
349
|
+
instance.each = instance._version.each;
|
|
350
|
+
instance.list = instance._version.list;
|
|
351
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
352
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
353
|
+
method: "get",
|
|
354
|
+
uri: targetUrl,
|
|
355
|
+
});
|
|
356
|
+
let pagePromise = operationPromise.then((payload) => new KnowledgeBasisPage(instance._version, payload, instance._uri, {}, instance._solution));
|
|
357
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
358
|
+
return pagePromise;
|
|
359
|
+
};
|
|
360
|
+
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
|
|
361
|
+
if (params instanceof Function) {
|
|
362
|
+
callback = params;
|
|
363
|
+
params = {};
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
params = params || {};
|
|
367
|
+
}
|
|
368
|
+
let data = {};
|
|
369
|
+
if (params["pageSize"] !== undefined)
|
|
370
|
+
data["pageSize"] = params["pageSize"];
|
|
371
|
+
if (params["pageToken"] !== undefined)
|
|
372
|
+
data["pageToken"] = params["pageToken"];
|
|
373
|
+
if (params["orderBy"] !== undefined)
|
|
374
|
+
data["orderBy"] = params["orderBy"];
|
|
375
|
+
const headers = {};
|
|
376
|
+
headers["Accept"] = "application/json";
|
|
377
|
+
let operationVersion = version;
|
|
378
|
+
// For page operations, use page() directly as it already returns { statusCode, body, headers }
|
|
379
|
+
// IMPORTANT: Pass full response to Page constructor, not response.body
|
|
380
|
+
let operationPromise = operationVersion
|
|
381
|
+
.page({ uri: instance._uri, method: "get", params: data, headers })
|
|
382
|
+
.then((response) => ({
|
|
383
|
+
statusCode: response.statusCode,
|
|
384
|
+
headers: response.headers,
|
|
385
|
+
body: new KnowledgeBasisPage(operationVersion, response, instance._uri, data, instance._solution),
|
|
386
|
+
}));
|
|
387
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
388
|
+
return operationPromise;
|
|
389
|
+
};
|
|
390
|
+
instance.each = instance._version.each;
|
|
391
|
+
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
|
|
392
|
+
instance.list = instance._version.list;
|
|
393
|
+
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
|
|
394
|
+
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
|
|
395
|
+
// Use request() directly as it already returns { statusCode, body, headers }
|
|
396
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
397
|
+
method: "get",
|
|
398
|
+
uri: targetUrl,
|
|
399
|
+
});
|
|
400
|
+
let pagePromise = operationPromise.then((response) => ({
|
|
401
|
+
statusCode: response.statusCode,
|
|
402
|
+
headers: response.headers,
|
|
403
|
+
body: new KnowledgeBasisPage(instance._version, response, instance._uri, {}, instance._solution),
|
|
404
|
+
}));
|
|
405
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
406
|
+
return pagePromise;
|
|
407
|
+
};
|
|
408
|
+
instance.toJSON = function toJSON() {
|
|
409
|
+
return instance._solution;
|
|
410
|
+
};
|
|
411
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
412
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
413
|
+
};
|
|
414
|
+
return instance;
|
|
415
|
+
}
|
|
416
|
+
class KnowledgeBasisPage extends TokenPage_1.default {
|
|
417
|
+
/**
|
|
418
|
+
* Initialize the KnowledgeBasisPage
|
|
419
|
+
*
|
|
420
|
+
* @param version - Version of the resource
|
|
421
|
+
* @param response - Response from the API
|
|
422
|
+
* @param uri - URI of the resource
|
|
423
|
+
* @param params - Query parameters
|
|
424
|
+
* @param solution - Path solution
|
|
425
|
+
*/
|
|
426
|
+
constructor(version, response, uri, params, solution) {
|
|
427
|
+
super(version, response, uri, params, solution);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Build an instance of KnowledgeBasisInstance
|
|
431
|
+
*
|
|
432
|
+
* @param payload - Payload response from the API
|
|
433
|
+
*/
|
|
434
|
+
getInstance(payload) {
|
|
435
|
+
return new KnowledgeBasisInstance(this._version, payload);
|
|
436
|
+
}
|
|
437
|
+
[util_1.inspect.custom](depth, options) {
|
|
438
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
exports.KnowledgeBasisPage = KnowledgeBasisPage;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { inspect, InspectOptions } from "util";
|
|
2
|
+
import V2 from "../V2";
|
|
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: V2;
|
|
59
|
+
protected _solution: OperationContextSolution;
|
|
60
|
+
protected _uri: string;
|
|
61
|
+
constructor(_version: V2, 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: V2;
|
|
84
|
+
protected _solution: OperationContextSolution;
|
|
85
|
+
protected _context?: OperationContext;
|
|
86
|
+
constructor(_version: V2, _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: V2;
|
|
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: V2): OperationListInstance;
|
|
162
|
+
export {};
|