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