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