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,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio Conversational Intelligence API
|
|
9
|
+
* The Conversational Intelligence API includes resources to create and manage intelligence configurations, define and run language operators, and retrieve processed conversations and operator results. * Use the Configurations resource to create and manage intelligence configurations and define rules that control how and when language operators analyze and transform conversations. * Use the Operators resource to create custom language operators or retrieve Twilio-author and custom operators. * Use the Conversations resource to retrieve conversations processed with an intelligence configuration, and the OperatorResults resource to retrieve language operator results for those conversations.
|
|
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.VersionPage = exports.VersionInstance = exports.VersionContextImpl = exports.OperatorTrainingExample = exports.OperatorParameter = exports.OperatorContextMemory = exports.OperatorContextKnowledge = exports.OperatorContext = void 0;
|
|
20
|
+
exports.VersionListInstance = VersionListInstance;
|
|
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
|
+
* Optionally specifies which contextual data sources (Memory, Knowledge) the operator can access during execution. Context objects will be passed in by the Intelligence Configuration Rule at runtime. **Note**: this simply gives the LLM access to these context objects – ultimately the LLM will determine whether to actually call for context at runtime.
|
|
28
|
+
*/
|
|
29
|
+
class OperatorContext {
|
|
30
|
+
constructor(payload) {
|
|
31
|
+
this.memory = payload["memory"];
|
|
32
|
+
this.knowledge = payload["knowledge"];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.OperatorContext = OperatorContext;
|
|
36
|
+
/**
|
|
37
|
+
* Defines whether the Operator has access to organizational Knowledge Sources (e.g., policies, FAQs, scripts) at runtime.
|
|
38
|
+
*/
|
|
39
|
+
class OperatorContextKnowledge {
|
|
40
|
+
constructor(payload) {
|
|
41
|
+
this.enabled = payload["enabled"];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.OperatorContextKnowledge = OperatorContextKnowledge;
|
|
45
|
+
/**
|
|
46
|
+
* Defines whether the Operator has access to Memory (past conversational memories and profile traits).
|
|
47
|
+
*/
|
|
48
|
+
class OperatorContextMemory {
|
|
49
|
+
constructor(payload) {
|
|
50
|
+
this.enabled = payload["enabled"];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.OperatorContextMemory = OperatorContextMemory;
|
|
54
|
+
class OperatorParameter {
|
|
55
|
+
constructor(payload) {
|
|
56
|
+
this.type = payload["type"];
|
|
57
|
+
this._default = payload["default"];
|
|
58
|
+
this.required = payload["required"];
|
|
59
|
+
this.description = payload["description"];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.OperatorParameter = OperatorParameter;
|
|
63
|
+
class OperatorTrainingExample {
|
|
64
|
+
constructor(payload) {
|
|
65
|
+
this.input = payload["input"];
|
|
66
|
+
this.output = payload["output"];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.OperatorTrainingExample = OperatorTrainingExample;
|
|
70
|
+
class VersionContextImpl {
|
|
71
|
+
constructor(_version, id, versionParam) {
|
|
72
|
+
this._version = _version;
|
|
73
|
+
if (!(0, utility_1.isValidPathParam)(id)) {
|
|
74
|
+
throw new Error("Parameter 'id' is not valid.");
|
|
75
|
+
}
|
|
76
|
+
if (!(0, utility_1.isValidPathParam)(versionParam)) {
|
|
77
|
+
throw new Error("Parameter 'versionParam' is not valid.");
|
|
78
|
+
}
|
|
79
|
+
this._solution = { id, versionParam };
|
|
80
|
+
this._uri = `/ControlPlane/Operators/${id}/Versions/${versionParam}`;
|
|
81
|
+
}
|
|
82
|
+
fetch(callback) {
|
|
83
|
+
const headers = {};
|
|
84
|
+
headers["Accept"] = "application/json";
|
|
85
|
+
const instance = this;
|
|
86
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
87
|
+
uri: instance._uri,
|
|
88
|
+
method: "get",
|
|
89
|
+
headers,
|
|
90
|
+
});
|
|
91
|
+
operationPromise = operationPromise.then((payload) => new VersionInstance(operationVersion, payload, instance._solution.id, instance._solution.versionParam));
|
|
92
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
93
|
+
return operationPromise;
|
|
94
|
+
}
|
|
95
|
+
fetchWithHttpInfo(callback) {
|
|
96
|
+
const headers = {};
|
|
97
|
+
headers["Accept"] = "application/json";
|
|
98
|
+
const instance = this;
|
|
99
|
+
let operationVersion = instance._version;
|
|
100
|
+
// CREATE, FETCH, UPDATE operations
|
|
101
|
+
let operationPromise = operationVersion
|
|
102
|
+
.fetchWithResponseInfo({
|
|
103
|
+
uri: instance._uri,
|
|
104
|
+
method: "get",
|
|
105
|
+
headers,
|
|
106
|
+
})
|
|
107
|
+
.then((response) => ({
|
|
108
|
+
...response,
|
|
109
|
+
body: new VersionInstance(operationVersion, response.body, instance._solution.id, instance._solution.versionParam),
|
|
110
|
+
}));
|
|
111
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
112
|
+
return operationPromise;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Provide a user-friendly representation
|
|
116
|
+
*
|
|
117
|
+
* @returns Object
|
|
118
|
+
*/
|
|
119
|
+
toJSON() {
|
|
120
|
+
return this._solution;
|
|
121
|
+
}
|
|
122
|
+
[util_1.inspect.custom](_depth, options) {
|
|
123
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.VersionContextImpl = VersionContextImpl;
|
|
127
|
+
/**
|
|
128
|
+
* Full detail of a specific Language Operator version.
|
|
129
|
+
*/
|
|
130
|
+
class VersionInstance {
|
|
131
|
+
constructor(_version, _payload, id, versionParam) {
|
|
132
|
+
this._version = _version;
|
|
133
|
+
const payload = _payload;
|
|
134
|
+
this.id = payload.id;
|
|
135
|
+
this.displayName = payload.displayName;
|
|
136
|
+
this.description = payload.description;
|
|
137
|
+
this.version = deserialize.integer(payload.version);
|
|
138
|
+
this.author = payload.author;
|
|
139
|
+
this.prompt = payload.prompt;
|
|
140
|
+
this.outputFormat = payload.outputFormat;
|
|
141
|
+
this.outputSchema = payload.outputSchema;
|
|
142
|
+
this.trainingExamples =
|
|
143
|
+
payload.trainingExamples !== null &&
|
|
144
|
+
payload.trainingExamples !== undefined
|
|
145
|
+
? payload.trainingExamples.map((payload) => new OperatorTrainingExample(payload))
|
|
146
|
+
: null;
|
|
147
|
+
this.context =
|
|
148
|
+
payload.context !== null && payload.context !== undefined
|
|
149
|
+
? new OperatorContext(payload.context)
|
|
150
|
+
: null;
|
|
151
|
+
this.parameters = payload.parameters;
|
|
152
|
+
this.status = payload.status;
|
|
153
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.dateCreated);
|
|
154
|
+
this.dateDeprecated = deserialize.iso8601DateTime(payload.dateDeprecated);
|
|
155
|
+
this.retirementDate = deserialize.iso8601DateTime(payload.retirementDate);
|
|
156
|
+
this.dateRetired = deserialize.iso8601DateTime(payload.dateRetired);
|
|
157
|
+
this._solution = { id, versionParam: versionParam };
|
|
158
|
+
}
|
|
159
|
+
get _proxy() {
|
|
160
|
+
this._context =
|
|
161
|
+
this._context ||
|
|
162
|
+
new VersionContextImpl(this._version, this._solution.id, this._solution.versionParam);
|
|
163
|
+
return this._context;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Fetch a VersionInstance
|
|
167
|
+
*
|
|
168
|
+
* @param callback - Callback to handle processed record
|
|
169
|
+
*
|
|
170
|
+
* @returns Resolves to processed VersionInstance
|
|
171
|
+
*/
|
|
172
|
+
fetch(callback) {
|
|
173
|
+
return this._proxy.fetch(callback);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Fetch a VersionInstance and return HTTP info
|
|
177
|
+
*
|
|
178
|
+
* @param callback - Callback to handle processed record
|
|
179
|
+
*
|
|
180
|
+
* @returns Resolves to processed VersionInstance with HTTP metadata
|
|
181
|
+
*/
|
|
182
|
+
fetchWithHttpInfo(callback) {
|
|
183
|
+
return this._proxy.fetchWithHttpInfo(callback);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Provide a user-friendly representation
|
|
187
|
+
*
|
|
188
|
+
* @returns Object
|
|
189
|
+
*/
|
|
190
|
+
toJSON() {
|
|
191
|
+
return {
|
|
192
|
+
id: this.id,
|
|
193
|
+
displayName: this.displayName,
|
|
194
|
+
description: this.description,
|
|
195
|
+
version: this.version,
|
|
196
|
+
author: this.author,
|
|
197
|
+
prompt: this.prompt,
|
|
198
|
+
outputFormat: this.outputFormat,
|
|
199
|
+
outputSchema: this.outputSchema,
|
|
200
|
+
trainingExamples: this.trainingExamples,
|
|
201
|
+
context: this.context,
|
|
202
|
+
parameters: this.parameters,
|
|
203
|
+
status: this.status,
|
|
204
|
+
dateCreated: this.dateCreated,
|
|
205
|
+
dateDeprecated: this.dateDeprecated,
|
|
206
|
+
retirementDate: this.retirementDate,
|
|
207
|
+
dateRetired: this.dateRetired,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
[util_1.inspect.custom](_depth, options) {
|
|
211
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.VersionInstance = VersionInstance;
|
|
215
|
+
function VersionListInstance(version, id) {
|
|
216
|
+
if (!(0, utility_1.isValidPathParam)(id)) {
|
|
217
|
+
throw new Error("Parameter 'id' is not valid.");
|
|
218
|
+
}
|
|
219
|
+
const instance = ((versionParam) => instance.get(versionParam));
|
|
220
|
+
instance.get = function get(versionParam) {
|
|
221
|
+
return new VersionContextImpl(version, id, versionParam);
|
|
222
|
+
};
|
|
223
|
+
instance._version = version;
|
|
224
|
+
instance._solution = { id };
|
|
225
|
+
instance._uri = `/ControlPlane/Operators/${id}/Versions`;
|
|
226
|
+
instance.page = function page(params, callback) {
|
|
227
|
+
if (params instanceof Function) {
|
|
228
|
+
callback = params;
|
|
229
|
+
params = {};
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
params = params || {};
|
|
233
|
+
}
|
|
234
|
+
let data = {};
|
|
235
|
+
if (params["pageSize"] !== undefined)
|
|
236
|
+
data["pageSize"] = params["pageSize"];
|
|
237
|
+
if (params["pageToken"] !== undefined)
|
|
238
|
+
data["pageToken"] = params["pageToken"];
|
|
239
|
+
const headers = {};
|
|
240
|
+
headers["Accept"] = "application/json";
|
|
241
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
242
|
+
uri: instance._uri,
|
|
243
|
+
method: "get",
|
|
244
|
+
params: data,
|
|
245
|
+
headers,
|
|
246
|
+
});
|
|
247
|
+
operationPromise = operationPromise.then((payload) => new VersionPage(operationVersion, payload, instance._uri, data, instance._solution));
|
|
248
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
249
|
+
return operationPromise;
|
|
250
|
+
};
|
|
251
|
+
instance.each = instance._version.each;
|
|
252
|
+
instance.list = instance._version.list;
|
|
253
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
254
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
255
|
+
method: "get",
|
|
256
|
+
uri: targetUrl,
|
|
257
|
+
});
|
|
258
|
+
let pagePromise = operationPromise.then((payload) => new VersionPage(instance._version, payload, instance._uri, {}, instance._solution));
|
|
259
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
260
|
+
return pagePromise;
|
|
261
|
+
};
|
|
262
|
+
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
|
|
263
|
+
if (params instanceof Function) {
|
|
264
|
+
callback = params;
|
|
265
|
+
params = {};
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
params = params || {};
|
|
269
|
+
}
|
|
270
|
+
let data = {};
|
|
271
|
+
if (params["pageSize"] !== undefined)
|
|
272
|
+
data["pageSize"] = params["pageSize"];
|
|
273
|
+
if (params["pageToken"] !== undefined)
|
|
274
|
+
data["pageToken"] = params["pageToken"];
|
|
275
|
+
const headers = {};
|
|
276
|
+
headers["Accept"] = "application/json";
|
|
277
|
+
let operationVersion = version;
|
|
278
|
+
// For page operations, use page() directly as it already returns { statusCode, body, headers }
|
|
279
|
+
// IMPORTANT: Pass full response to Page constructor, not response.body
|
|
280
|
+
let operationPromise = operationVersion
|
|
281
|
+
.page({ uri: instance._uri, method: "get", params: data, headers })
|
|
282
|
+
.then((response) => ({
|
|
283
|
+
statusCode: response.statusCode,
|
|
284
|
+
headers: response.headers,
|
|
285
|
+
body: new VersionPage(operationVersion, response, instance._uri, data, instance._solution),
|
|
286
|
+
}));
|
|
287
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
288
|
+
return operationPromise;
|
|
289
|
+
};
|
|
290
|
+
instance.each = instance._version.each;
|
|
291
|
+
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
|
|
292
|
+
instance.list = instance._version.list;
|
|
293
|
+
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
|
|
294
|
+
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
|
|
295
|
+
// Use request() directly as it already returns { statusCode, body, headers }
|
|
296
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
297
|
+
method: "get",
|
|
298
|
+
uri: targetUrl,
|
|
299
|
+
});
|
|
300
|
+
let pagePromise = operationPromise.then((response) => ({
|
|
301
|
+
statusCode: response.statusCode,
|
|
302
|
+
headers: response.headers,
|
|
303
|
+
body: new VersionPage(instance._version, response, instance._uri, {}, instance._solution),
|
|
304
|
+
}));
|
|
305
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
306
|
+
return pagePromise;
|
|
307
|
+
};
|
|
308
|
+
instance.toJSON = function toJSON() {
|
|
309
|
+
return instance._solution;
|
|
310
|
+
};
|
|
311
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
312
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
313
|
+
};
|
|
314
|
+
return instance;
|
|
315
|
+
}
|
|
316
|
+
class VersionPage extends TokenPage_1.default {
|
|
317
|
+
/**
|
|
318
|
+
* Initialize the VersionPage
|
|
319
|
+
*
|
|
320
|
+
* @param version - Version of the resource
|
|
321
|
+
* @param response - Response from the API
|
|
322
|
+
* @param uri - URI of the resource
|
|
323
|
+
* @param params - Query parameters
|
|
324
|
+
* @param solution - Path solution
|
|
325
|
+
*/
|
|
326
|
+
constructor(version, response, uri, params, solution) {
|
|
327
|
+
super(version, response, uri, params, solution);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Build an instance of VersionInstance
|
|
331
|
+
*
|
|
332
|
+
* @param payload - Payload response from the API
|
|
333
|
+
*/
|
|
334
|
+
getInstance(payload) {
|
|
335
|
+
return new VersionInstance(this._version, payload, this._solution.id);
|
|
336
|
+
}
|
|
337
|
+
[util_1.inspect.custom](depth, options) {
|
|
338
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
exports.VersionPage = VersionPage;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import KnowledgeBase from "../KnowledgeBase";
|
|
2
|
+
import Version from "../../base/Version";
|
|
3
|
+
import { ChunkListInstance } from "./v2/chunk";
|
|
4
|
+
import { KnowledgeListInstance, KnowledgeContext } from "./v2/knowledge";
|
|
5
|
+
import { KnowledgeBasisListInstance } from "./v2/knowledgeBasis";
|
|
6
|
+
import { OperationListInstance } from "./v2/operation";
|
|
7
|
+
import { SearchContext } from "./v2/search";
|
|
8
|
+
export default class V2 extends Version {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the V2 version of Knowledge
|
|
11
|
+
*
|
|
12
|
+
* @param domain - The Twilio (Twilio.Knowledge) domain
|
|
13
|
+
*/
|
|
14
|
+
constructor(domain: KnowledgeBase);
|
|
15
|
+
/** knowledgeBases - { Twilio.Knowledge.V2.KnowledgeBasisListInstance } resource */
|
|
16
|
+
protected _knowledgeBases?: KnowledgeBasisListInstance;
|
|
17
|
+
/** operations - { Twilio.Knowledge.V2.OperationListInstance } resource */
|
|
18
|
+
protected _operations?: OperationListInstance;
|
|
19
|
+
/** Accessor for chunks resource */
|
|
20
|
+
chunks(kbId: string, knowledgeId: string): ChunkListInstance;
|
|
21
|
+
/** Accessor for knowledge resource - list operations */
|
|
22
|
+
knowledge(kbId: string): KnowledgeListInstance;
|
|
23
|
+
/** Accessor for knowledge resource - instance operations */
|
|
24
|
+
knowledge(kbId: string, knowledgeId: string): KnowledgeContext;
|
|
25
|
+
/** Getter for knowledgeBases resource */
|
|
26
|
+
get knowledgeBases(): KnowledgeBasisListInstance;
|
|
27
|
+
/** Getter for operations resource */
|
|
28
|
+
get operations(): OperationListInstance;
|
|
29
|
+
/** Accessor for search resource */
|
|
30
|
+
search(kbId: string): SearchContext;
|
|
31
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
const Version_1 = __importDefault(require("../../base/Version"));
|
|
20
|
+
const chunk_1 = require("./v2/chunk");
|
|
21
|
+
const knowledge_1 = require("./v2/knowledge");
|
|
22
|
+
const knowledgeBasis_1 = require("./v2/knowledgeBasis");
|
|
23
|
+
const operation_1 = require("./v2/operation");
|
|
24
|
+
const search_1 = require("./v2/search");
|
|
25
|
+
class V2 extends Version_1.default {
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the V2 version of Knowledge
|
|
28
|
+
*
|
|
29
|
+
* @param domain - The Twilio (Twilio.Knowledge) domain
|
|
30
|
+
*/
|
|
31
|
+
constructor(domain) {
|
|
32
|
+
super(domain, "v2");
|
|
33
|
+
}
|
|
34
|
+
/** Accessor for chunks resource */
|
|
35
|
+
chunks(kbId, knowledgeId) {
|
|
36
|
+
return (0, chunk_1.ChunkListInstance)(this, kbId, knowledgeId);
|
|
37
|
+
}
|
|
38
|
+
/** Implementation */
|
|
39
|
+
knowledge(kbId, knowledgeId) {
|
|
40
|
+
const listInstance = (0, knowledge_1.KnowledgeListInstance)(this, kbId);
|
|
41
|
+
if (knowledgeId !== undefined) {
|
|
42
|
+
return listInstance.get(knowledgeId);
|
|
43
|
+
}
|
|
44
|
+
return listInstance;
|
|
45
|
+
}
|
|
46
|
+
/** Getter for knowledgeBases resource */
|
|
47
|
+
get knowledgeBases() {
|
|
48
|
+
this._knowledgeBases =
|
|
49
|
+
this._knowledgeBases || (0, knowledgeBasis_1.KnowledgeBasisListInstance)(this);
|
|
50
|
+
return this._knowledgeBases;
|
|
51
|
+
}
|
|
52
|
+
/** Getter for operations resource */
|
|
53
|
+
get operations() {
|
|
54
|
+
this._operations = this._operations || (0, operation_1.OperationListInstance)(this);
|
|
55
|
+
return this._operations;
|
|
56
|
+
}
|
|
57
|
+
/** Accessor for search resource */
|
|
58
|
+
search(kbId) {
|
|
59
|
+
return (0, search_1.SearchListInstance)(this)(kbId);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.default = V2;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { inspect, InspectOptions } from "util";
|
|
2
|
+
import TokenPage, { TokenPaginationPayload } from "../../../base/TokenPage";
|
|
3
|
+
import Response from "../../../http/response";
|
|
4
|
+
import V2 from "../V2";
|
|
5
|
+
import { ApiResponse } from "../../../base/ApiResponse";
|
|
6
|
+
/**
|
|
7
|
+
* Options to pass to each
|
|
8
|
+
*/
|
|
9
|
+
export interface ChunkListInstanceEachOptions {
|
|
10
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
11
|
+
pageSize?: number;
|
|
12
|
+
/** The page token. This is provided by the API. */
|
|
13
|
+
pageToken?: string;
|
|
14
|
+
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
|
15
|
+
callback?: (item: ChunkInstance, done: (err?: Error) => void) => void;
|
|
16
|
+
/** Function to be called upon completion of streaming */
|
|
17
|
+
done?: Function;
|
|
18
|
+
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
|
|
19
|
+
limit?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Options to pass to list
|
|
23
|
+
*/
|
|
24
|
+
export interface ChunkListInstanceOptions {
|
|
25
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
/** The page token. This is provided by the API. */
|
|
28
|
+
pageToken?: string;
|
|
29
|
+
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
|
30
|
+
limit?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Options to pass to page
|
|
34
|
+
*/
|
|
35
|
+
export interface ChunkListInstancePageOptions {
|
|
36
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
37
|
+
pageSize?: number;
|
|
38
|
+
/** The page token. This is provided by the API. */
|
|
39
|
+
pageToken?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ChunkSolution {
|
|
42
|
+
kbId: string;
|
|
43
|
+
knowledgeId: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ChunkListInstance {
|
|
46
|
+
_version: V2;
|
|
47
|
+
_solution: ChunkSolution;
|
|
48
|
+
_uri: string;
|
|
49
|
+
/**
|
|
50
|
+
* Streams ChunkInstance records from the API.
|
|
51
|
+
*
|
|
52
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
53
|
+
* is reached.
|
|
54
|
+
*
|
|
55
|
+
* The results are passed into the callback function, so this operation is memory
|
|
56
|
+
* efficient.
|
|
57
|
+
*
|
|
58
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
59
|
+
* function.
|
|
60
|
+
*
|
|
61
|
+
* @param { ChunkListInstanceEachOptions } [params] - Options for request
|
|
62
|
+
* @param { function } [callback] - Function to process each record
|
|
63
|
+
*/
|
|
64
|
+
each(callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
|
|
65
|
+
each(params: ChunkListInstanceEachOptions, callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
|
|
66
|
+
/**
|
|
67
|
+
* Streams ChunkInstance records from the API with HTTP metadata captured per page.
|
|
68
|
+
*
|
|
69
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
70
|
+
* is reached. HTTP metadata (status code, headers) is captured for each page request.
|
|
71
|
+
*
|
|
72
|
+
* The results are passed into the callback function, so this operation is memory
|
|
73
|
+
* efficient.
|
|
74
|
+
*
|
|
75
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
76
|
+
* function.
|
|
77
|
+
*
|
|
78
|
+
* @param { ChunkListInstanceEachOptions } [params] - Options for request
|
|
79
|
+
* @param { function } [callback] - Function to process each record
|
|
80
|
+
*/
|
|
81
|
+
eachWithHttpInfo(callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
|
|
82
|
+
eachWithHttpInfo(params: ChunkListInstanceEachOptions, callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
|
|
83
|
+
/**
|
|
84
|
+
* Retrieve a single target page of ChunkInstance records from the API.
|
|
85
|
+
*
|
|
86
|
+
* The request is executed immediately.
|
|
87
|
+
*
|
|
88
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
89
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
90
|
+
*/
|
|
91
|
+
getPage(targetUrl: string, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
|
|
92
|
+
/**
|
|
93
|
+
* Retrieve a single target page of ChunkInstance records from the API with HTTP metadata.
|
|
94
|
+
*
|
|
95
|
+
* The request is executed immediately.
|
|
96
|
+
*
|
|
97
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
98
|
+
* @param { function } [callback] - Callback to handle list of records with metadata
|
|
99
|
+
*/
|
|
100
|
+
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ChunkPage>) => any): Promise<ApiResponse<ChunkPage>>;
|
|
101
|
+
/**
|
|
102
|
+
* Lists ChunkInstance records from the API as a list.
|
|
103
|
+
*
|
|
104
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
105
|
+
* function.
|
|
106
|
+
*
|
|
107
|
+
* @param { ChunkListInstanceOptions } [params] - Options for request
|
|
108
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
109
|
+
*/
|
|
110
|
+
list(callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
|
|
111
|
+
list(params: ChunkListInstanceOptions, callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Lists ChunkInstance records from the API as a list with HTTP metadata.
|
|
114
|
+
*
|
|
115
|
+
* Returns all records along with HTTP metadata from the first page fetched.
|
|
116
|
+
*
|
|
117
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
118
|
+
* function.
|
|
119
|
+
*
|
|
120
|
+
* @param { ChunkListInstanceOptions } [params] - Options for request
|
|
121
|
+
* @param { function } [callback] - Callback to handle list of records with metadata
|
|
122
|
+
*/
|
|
123
|
+
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ChunkInstance[]>) => any): Promise<ApiResponse<ChunkInstance[]>>;
|
|
124
|
+
listWithHttpInfo(params: ChunkListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ChunkInstance[]>) => any): Promise<ApiResponse<ChunkInstance[]>>;
|
|
125
|
+
/**
|
|
126
|
+
* Retrieve a single page of ChunkInstance records from the API.
|
|
127
|
+
*
|
|
128
|
+
* The request is executed immediately.
|
|
129
|
+
*
|
|
130
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
131
|
+
* function.
|
|
132
|
+
*
|
|
133
|
+
* @param { ChunkListInstancePageOptions } [params] - Options for request
|
|
134
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
135
|
+
*/
|
|
136
|
+
page(callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
|
|
137
|
+
page(params: ChunkListInstancePageOptions, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
|
|
138
|
+
/**
|
|
139
|
+
* Retrieve a single page of ChunkInstance records from the API with HTTP metadata.
|
|
140
|
+
*
|
|
141
|
+
* The request is executed immediately.
|
|
142
|
+
*
|
|
143
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
144
|
+
* function.
|
|
145
|
+
*
|
|
146
|
+
* @param { ChunkListInstancePageOptions } [params] - Options for request
|
|
147
|
+
* @param { function } [callback] - Callback to handle list of records with metadata
|
|
148
|
+
*/
|
|
149
|
+
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ChunkPage>) => any): Promise<ApiResponse<ChunkPage>>;
|
|
150
|
+
pageWithHttpInfo(params: ChunkListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ChunkPage>) => any): Promise<ApiResponse<ChunkPage>>;
|
|
151
|
+
/**
|
|
152
|
+
* Provide a user-friendly representation
|
|
153
|
+
*/
|
|
154
|
+
toJSON(): any;
|
|
155
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
156
|
+
}
|
|
157
|
+
export declare function ChunkListInstance(version: V2, kbId: string, knowledgeId: string): ChunkListInstance;
|
|
158
|
+
interface ChunkPayload extends TokenPaginationPayload {
|
|
159
|
+
chunks: ChunkResource[];
|
|
160
|
+
}
|
|
161
|
+
interface ChunkResource {
|
|
162
|
+
content: string;
|
|
163
|
+
createdAt: Date;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Represents a processed content chunk extracted from knowledge source. Chunks are smaller segments of content that have been parsed and indexed for semantic search operations, containing the original text content.
|
|
167
|
+
*/
|
|
168
|
+
export declare class ChunkInstance {
|
|
169
|
+
protected _version: V2;
|
|
170
|
+
constructor(_version: V2, _payload: ChunkResource, kbId: string, knowledgeId: string);
|
|
171
|
+
/**
|
|
172
|
+
* The chunk content.
|
|
173
|
+
*/
|
|
174
|
+
content: string;
|
|
175
|
+
/**
|
|
176
|
+
* The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
177
|
+
*/
|
|
178
|
+
createdAt: Date;
|
|
179
|
+
/**
|
|
180
|
+
* Provide a user-friendly representation
|
|
181
|
+
*
|
|
182
|
+
* @returns Object
|
|
183
|
+
*/
|
|
184
|
+
toJSON(): {
|
|
185
|
+
content: string;
|
|
186
|
+
createdAt: Date;
|
|
187
|
+
};
|
|
188
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
189
|
+
}
|
|
190
|
+
export declare class ChunkPage extends TokenPage<V2, ChunkPayload, ChunkResource, ChunkInstance> {
|
|
191
|
+
/**
|
|
192
|
+
* Initialize the ChunkPage
|
|
193
|
+
*
|
|
194
|
+
* @param version - Version of the resource
|
|
195
|
+
* @param response - Response from the API
|
|
196
|
+
* @param uri - URI of the resource
|
|
197
|
+
* @param params - Query parameters
|
|
198
|
+
* @param solution - Path solution
|
|
199
|
+
*/
|
|
200
|
+
constructor(version: V2, response: Response<string>, uri: string, params: any, solution: ChunkSolution);
|
|
201
|
+
/**
|
|
202
|
+
* Build an instance of ChunkInstance
|
|
203
|
+
*
|
|
204
|
+
* @param payload - Payload response from the API
|
|
205
|
+
*/
|
|
206
|
+
getInstance(payload: ChunkResource): ChunkInstance;
|
|
207
|
+
[inspect.custom](depth: any, options: InspectOptions): string;
|
|
208
|
+
}
|
|
209
|
+
export {};
|