twilio 5.3.0 → 5.3.1
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/Assistants.d.ts +4 -0
- package/lib/rest/Assistants.js +8 -0
- package/lib/rest/AssistantsBase.d.ts +13 -0
- package/lib/rest/AssistantsBase.js +31 -0
- package/lib/rest/Twilio.d.ts +5 -0
- package/lib/rest/Twilio.js +6 -0
- package/lib/rest/assistants/V1.d.ts +35 -0
- package/lib/rest/assistants/V1.js +60 -0
- package/lib/rest/assistants/v1/assistant/feedback.d.ts +231 -0
- package/lib/rest/assistants/v1/assistant/feedback.js +161 -0
- package/lib/rest/assistants/v1/assistant.d.ts +466 -0
- package/lib/rest/assistants/v1/assistant.js +284 -0
- package/lib/rest/assistants/v1/knowledge/chunk.d.ts +167 -0
- package/lib/rest/assistants/v1/knowledge/chunk.js +130 -0
- package/lib/rest/assistants/v1/knowledge.d.ts +385 -0
- package/lib/rest/assistants/v1/knowledge.js +273 -0
- package/lib/rest/assistants/v1/policy.d.ts +202 -0
- package/lib/rest/assistants/v1/policy.js +138 -0
- package/lib/rest/assistants/v1/session/message.d.ts +197 -0
- package/lib/rest/assistants/v1/session/message.js +140 -0
- package/lib/rest/assistants/v1/session.d.ts +231 -0
- package/lib/rest/assistants/v1/session.js +194 -0
- package/lib/rest/assistants/v1/tool.d.ts +378 -0
- package/lib/rest/assistants/v1/tool.js +242 -0
- package/lib/rest/content/v1/content/approvalFetch.d.ts +5 -5
- package/lib/rest/content/v1/content/approvalFetch.js +14 -14
- package/lib/rest/intelligence/v2/operatorType.d.ts +1 -1
- package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.d.ts +12 -18
- package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.js +3 -6
- package/lib/rest/marketplace/v1/moduleDataManagement.d.ts +14 -6
- package/lib/rest/marketplace/v1/moduleDataManagement.js +4 -0
- package/lib/rest/numbers/v2/bundleClone.d.ts +1 -1
- package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio - Assistants
|
|
9
|
+
* This is the public Twilio REST API.
|
|
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.AssistantPage = exports.AssistantListInstance = exports.AssistantInstance = exports.AssistantContextImpl = exports.AssistantsV1ServiceUpdateAssistantRequest = exports.AssistantsV1ServiceTool = exports.AssistantsV1ServiceSegmentCredential = exports.AssistantsV1ServiceKnowledge = exports.AssistantsV1ServiceCustomerAi = exports.AssistantsV1ServiceCreateAssistantRequest = void 0;
|
|
20
|
+
const util_1 = require("util");
|
|
21
|
+
const Page_1 = __importDefault(require("../../../base/Page"));
|
|
22
|
+
const deserialize = require("../../../base/deserialize");
|
|
23
|
+
const serialize = require("../../../base/serialize");
|
|
24
|
+
const utility_1 = require("../../../base/utility");
|
|
25
|
+
const feedback_1 = require("./assistant/feedback");
|
|
26
|
+
class AssistantsV1ServiceCreateAssistantRequest {
|
|
27
|
+
}
|
|
28
|
+
exports.AssistantsV1ServiceCreateAssistantRequest = AssistantsV1ServiceCreateAssistantRequest;
|
|
29
|
+
class AssistantsV1ServiceCustomerAi {
|
|
30
|
+
}
|
|
31
|
+
exports.AssistantsV1ServiceCustomerAi = AssistantsV1ServiceCustomerAi;
|
|
32
|
+
class AssistantsV1ServiceKnowledge {
|
|
33
|
+
}
|
|
34
|
+
exports.AssistantsV1ServiceKnowledge = AssistantsV1ServiceKnowledge;
|
|
35
|
+
class AssistantsV1ServiceSegmentCredential {
|
|
36
|
+
}
|
|
37
|
+
exports.AssistantsV1ServiceSegmentCredential = AssistantsV1ServiceSegmentCredential;
|
|
38
|
+
class AssistantsV1ServiceTool {
|
|
39
|
+
}
|
|
40
|
+
exports.AssistantsV1ServiceTool = AssistantsV1ServiceTool;
|
|
41
|
+
class AssistantsV1ServiceUpdateAssistantRequest {
|
|
42
|
+
}
|
|
43
|
+
exports.AssistantsV1ServiceUpdateAssistantRequest = AssistantsV1ServiceUpdateAssistantRequest;
|
|
44
|
+
class AssistantContextImpl {
|
|
45
|
+
constructor(_version, id) {
|
|
46
|
+
this._version = _version;
|
|
47
|
+
if (!(0, utility_1.isValidPathParam)(id)) {
|
|
48
|
+
throw new Error("Parameter 'id' is not valid.");
|
|
49
|
+
}
|
|
50
|
+
this._solution = { id };
|
|
51
|
+
this._uri = `/Assistants/${id}`;
|
|
52
|
+
}
|
|
53
|
+
get feedbacks() {
|
|
54
|
+
this._feedbacks =
|
|
55
|
+
this._feedbacks || (0, feedback_1.FeedbackListInstance)(this._version, this._solution.id);
|
|
56
|
+
return this._feedbacks;
|
|
57
|
+
}
|
|
58
|
+
remove(callback) {
|
|
59
|
+
const instance = this;
|
|
60
|
+
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
|
61
|
+
uri: instance._uri,
|
|
62
|
+
method: "delete",
|
|
63
|
+
});
|
|
64
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
65
|
+
return operationPromise;
|
|
66
|
+
}
|
|
67
|
+
fetch(callback) {
|
|
68
|
+
const instance = this;
|
|
69
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
70
|
+
uri: instance._uri,
|
|
71
|
+
method: "get",
|
|
72
|
+
});
|
|
73
|
+
operationPromise = operationPromise.then((payload) => new AssistantInstance(operationVersion, payload, instance._solution.id));
|
|
74
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
75
|
+
return operationPromise;
|
|
76
|
+
}
|
|
77
|
+
update(params, callback) {
|
|
78
|
+
if (params instanceof Function) {
|
|
79
|
+
callback = params;
|
|
80
|
+
params = {};
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
params = params || {};
|
|
84
|
+
}
|
|
85
|
+
let data = {};
|
|
86
|
+
data = params;
|
|
87
|
+
const headers = {};
|
|
88
|
+
headers["Content-Type"] = "application/json";
|
|
89
|
+
const instance = this;
|
|
90
|
+
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
|
91
|
+
uri: instance._uri,
|
|
92
|
+
method: "put",
|
|
93
|
+
data,
|
|
94
|
+
headers,
|
|
95
|
+
});
|
|
96
|
+
operationPromise = operationPromise.then((payload) => new AssistantInstance(operationVersion, payload, instance._solution.id));
|
|
97
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
98
|
+
return operationPromise;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Provide a user-friendly representation
|
|
102
|
+
*
|
|
103
|
+
* @returns Object
|
|
104
|
+
*/
|
|
105
|
+
toJSON() {
|
|
106
|
+
return this._solution;
|
|
107
|
+
}
|
|
108
|
+
[util_1.inspect.custom](_depth, options) {
|
|
109
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.AssistantContextImpl = AssistantContextImpl;
|
|
113
|
+
class AssistantInstance {
|
|
114
|
+
constructor(_version, payload, id) {
|
|
115
|
+
this._version = _version;
|
|
116
|
+
this.accountSid = payload.account_sid;
|
|
117
|
+
this.customerAi = payload.customer_ai;
|
|
118
|
+
this.id = payload.id;
|
|
119
|
+
this.model = payload.model;
|
|
120
|
+
this.name = payload.name;
|
|
121
|
+
this.owner = payload.owner;
|
|
122
|
+
this.personalityPrompt = payload.personality_prompt;
|
|
123
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
|
124
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
|
125
|
+
this.knowledge = payload.knowledge;
|
|
126
|
+
this.tools = payload.tools;
|
|
127
|
+
this._solution = { id: id || this.id };
|
|
128
|
+
}
|
|
129
|
+
get _proxy() {
|
|
130
|
+
this._context =
|
|
131
|
+
this._context ||
|
|
132
|
+
new AssistantContextImpl(this._version, this._solution.id);
|
|
133
|
+
return this._context;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Remove a AssistantInstance
|
|
137
|
+
*
|
|
138
|
+
* @param callback - Callback to handle processed record
|
|
139
|
+
*
|
|
140
|
+
* @returns Resolves to processed boolean
|
|
141
|
+
*/
|
|
142
|
+
remove(callback) {
|
|
143
|
+
return this._proxy.remove(callback);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Fetch a AssistantInstance
|
|
147
|
+
*
|
|
148
|
+
* @param callback - Callback to handle processed record
|
|
149
|
+
*
|
|
150
|
+
* @returns Resolves to processed AssistantInstance
|
|
151
|
+
*/
|
|
152
|
+
fetch(callback) {
|
|
153
|
+
return this._proxy.fetch(callback);
|
|
154
|
+
}
|
|
155
|
+
update(params, callback) {
|
|
156
|
+
return this._proxy.update(params, callback);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Access the feedbacks.
|
|
160
|
+
*/
|
|
161
|
+
feedbacks() {
|
|
162
|
+
return this._proxy.feedbacks;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Provide a user-friendly representation
|
|
166
|
+
*
|
|
167
|
+
* @returns Object
|
|
168
|
+
*/
|
|
169
|
+
toJSON() {
|
|
170
|
+
return {
|
|
171
|
+
accountSid: this.accountSid,
|
|
172
|
+
customerAi: this.customerAi,
|
|
173
|
+
id: this.id,
|
|
174
|
+
model: this.model,
|
|
175
|
+
name: this.name,
|
|
176
|
+
owner: this.owner,
|
|
177
|
+
personalityPrompt: this.personalityPrompt,
|
|
178
|
+
dateCreated: this.dateCreated,
|
|
179
|
+
dateUpdated: this.dateUpdated,
|
|
180
|
+
knowledge: this.knowledge,
|
|
181
|
+
tools: this.tools,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
[util_1.inspect.custom](_depth, options) {
|
|
185
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.AssistantInstance = AssistantInstance;
|
|
189
|
+
function AssistantListInstance(version) {
|
|
190
|
+
const instance = ((id) => instance.get(id));
|
|
191
|
+
instance.get = function get(id) {
|
|
192
|
+
return new AssistantContextImpl(version, id);
|
|
193
|
+
};
|
|
194
|
+
instance._version = version;
|
|
195
|
+
instance._solution = {};
|
|
196
|
+
instance._uri = `/Assistants`;
|
|
197
|
+
instance.create = function create(params, callback) {
|
|
198
|
+
if (params === null || params === undefined) {
|
|
199
|
+
throw new Error('Required parameter "params" missing.');
|
|
200
|
+
}
|
|
201
|
+
let data = {};
|
|
202
|
+
data = params;
|
|
203
|
+
const headers = {};
|
|
204
|
+
headers["Content-Type"] = "application/json";
|
|
205
|
+
let operationVersion = version, operationPromise = operationVersion.create({
|
|
206
|
+
uri: instance._uri,
|
|
207
|
+
method: "post",
|
|
208
|
+
data,
|
|
209
|
+
headers,
|
|
210
|
+
});
|
|
211
|
+
operationPromise = operationPromise.then((payload) => new AssistantInstance(operationVersion, payload));
|
|
212
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
213
|
+
return operationPromise;
|
|
214
|
+
};
|
|
215
|
+
instance.page = function page(params, callback) {
|
|
216
|
+
if (params instanceof Function) {
|
|
217
|
+
callback = params;
|
|
218
|
+
params = {};
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
params = params || {};
|
|
222
|
+
}
|
|
223
|
+
let data = {};
|
|
224
|
+
if (params["pageSize"] !== undefined)
|
|
225
|
+
data["PageSize"] = params["pageSize"];
|
|
226
|
+
if (params.pageNumber !== undefined)
|
|
227
|
+
data["Page"] = params.pageNumber;
|
|
228
|
+
if (params.pageToken !== undefined)
|
|
229
|
+
data["PageToken"] = params.pageToken;
|
|
230
|
+
const headers = {};
|
|
231
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
232
|
+
uri: instance._uri,
|
|
233
|
+
method: "get",
|
|
234
|
+
params: data,
|
|
235
|
+
headers,
|
|
236
|
+
});
|
|
237
|
+
operationPromise = operationPromise.then((payload) => new AssistantPage(operationVersion, payload, instance._solution));
|
|
238
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
239
|
+
return operationPromise;
|
|
240
|
+
};
|
|
241
|
+
instance.each = instance._version.each;
|
|
242
|
+
instance.list = instance._version.list;
|
|
243
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
244
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
245
|
+
method: "get",
|
|
246
|
+
uri: targetUrl,
|
|
247
|
+
});
|
|
248
|
+
let pagePromise = operationPromise.then((payload) => new AssistantPage(instance._version, payload, instance._solution));
|
|
249
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
250
|
+
return pagePromise;
|
|
251
|
+
};
|
|
252
|
+
instance.toJSON = function toJSON() {
|
|
253
|
+
return instance._solution;
|
|
254
|
+
};
|
|
255
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
256
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
257
|
+
};
|
|
258
|
+
return instance;
|
|
259
|
+
}
|
|
260
|
+
exports.AssistantListInstance = AssistantListInstance;
|
|
261
|
+
class AssistantPage extends Page_1.default {
|
|
262
|
+
/**
|
|
263
|
+
* Initialize the AssistantPage
|
|
264
|
+
*
|
|
265
|
+
* @param version - Version of the resource
|
|
266
|
+
* @param response - Response from the API
|
|
267
|
+
* @param solution - Path solution
|
|
268
|
+
*/
|
|
269
|
+
constructor(version, response, solution) {
|
|
270
|
+
super(version, response, solution);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Build an instance of AssistantInstance
|
|
274
|
+
*
|
|
275
|
+
* @param payload - Payload response from the API
|
|
276
|
+
*/
|
|
277
|
+
getInstance(payload) {
|
|
278
|
+
return new AssistantInstance(this._version, payload);
|
|
279
|
+
}
|
|
280
|
+
[util_1.inspect.custom](depth, options) {
|
|
281
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.AssistantPage = AssistantPage;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { inspect, InspectOptions } from "util";
|
|
3
|
+
import Page, { TwilioResponsePayload } from "../../../../base/Page";
|
|
4
|
+
import Response from "../../../../http/response";
|
|
5
|
+
import V1 from "../../V1";
|
|
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
|
+
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
|
13
|
+
callback?: (item: ChunkInstance, done: (err?: Error) => void) => void;
|
|
14
|
+
/** Function to be called upon completion of streaming */
|
|
15
|
+
done?: Function;
|
|
16
|
+
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
|
|
17
|
+
limit?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options to pass to list
|
|
21
|
+
*/
|
|
22
|
+
export interface ChunkListInstanceOptions {
|
|
23
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
|
26
|
+
limit?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options to pass to page
|
|
30
|
+
*/
|
|
31
|
+
export interface ChunkListInstancePageOptions {
|
|
32
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
33
|
+
pageSize?: number;
|
|
34
|
+
/** Page Number, this value is simply for client state */
|
|
35
|
+
pageNumber?: number;
|
|
36
|
+
/** PageToken provided by the API */
|
|
37
|
+
pageToken?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ChunkSolution {
|
|
40
|
+
id: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ChunkListInstance {
|
|
43
|
+
_version: V1;
|
|
44
|
+
_solution: ChunkSolution;
|
|
45
|
+
_uri: string;
|
|
46
|
+
/**
|
|
47
|
+
* Streams ChunkInstance records from the API.
|
|
48
|
+
*
|
|
49
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
50
|
+
* is reached.
|
|
51
|
+
*
|
|
52
|
+
* The results are passed into the callback function, so this operation is memory
|
|
53
|
+
* efficient.
|
|
54
|
+
*
|
|
55
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
56
|
+
* function.
|
|
57
|
+
*
|
|
58
|
+
* @param { ChunkListInstanceEachOptions } [params] - Options for request
|
|
59
|
+
* @param { function } [callback] - Function to process each record
|
|
60
|
+
*/
|
|
61
|
+
each(callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
|
|
62
|
+
each(params: ChunkListInstanceEachOptions, callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieve a single target page of ChunkInstance records from the API.
|
|
65
|
+
*
|
|
66
|
+
* The request is executed immediately.
|
|
67
|
+
*
|
|
68
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
69
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
70
|
+
*/
|
|
71
|
+
getPage(targetUrl: string, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
|
|
72
|
+
/**
|
|
73
|
+
* Lists ChunkInstance records from the API as a list.
|
|
74
|
+
*
|
|
75
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
76
|
+
* function.
|
|
77
|
+
*
|
|
78
|
+
* @param { ChunkListInstanceOptions } [params] - Options for request
|
|
79
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
80
|
+
*/
|
|
81
|
+
list(callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
|
|
82
|
+
list(params: ChunkListInstanceOptions, callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Retrieve a single page of ChunkInstance records from the API.
|
|
85
|
+
*
|
|
86
|
+
* The request is executed immediately.
|
|
87
|
+
*
|
|
88
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
89
|
+
* function.
|
|
90
|
+
*
|
|
91
|
+
* @param { ChunkListInstancePageOptions } [params] - Options for request
|
|
92
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
93
|
+
*/
|
|
94
|
+
page(callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
|
|
95
|
+
page(params: ChunkListInstancePageOptions, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
|
|
96
|
+
/**
|
|
97
|
+
* Provide a user-friendly representation
|
|
98
|
+
*/
|
|
99
|
+
toJSON(): any;
|
|
100
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
101
|
+
}
|
|
102
|
+
export declare function ChunkListInstance(version: V1, id: string): ChunkListInstance;
|
|
103
|
+
interface ChunkPayload extends TwilioResponsePayload {
|
|
104
|
+
chunks: ChunkResource[];
|
|
105
|
+
}
|
|
106
|
+
interface ChunkResource {
|
|
107
|
+
account_sid: string;
|
|
108
|
+
content: string;
|
|
109
|
+
metadata: Record<string, object>;
|
|
110
|
+
date_created: Date;
|
|
111
|
+
date_updated: Date;
|
|
112
|
+
}
|
|
113
|
+
export declare class ChunkInstance {
|
|
114
|
+
protected _version: V1;
|
|
115
|
+
constructor(_version: V1, payload: ChunkResource, id: string);
|
|
116
|
+
/**
|
|
117
|
+
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
|
|
118
|
+
*/
|
|
119
|
+
accountSid: string;
|
|
120
|
+
/**
|
|
121
|
+
* The chunk content.
|
|
122
|
+
*/
|
|
123
|
+
content: string;
|
|
124
|
+
/**
|
|
125
|
+
* The metadata of the chunk.
|
|
126
|
+
*/
|
|
127
|
+
metadata: Record<string, object>;
|
|
128
|
+
/**
|
|
129
|
+
* The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
130
|
+
*/
|
|
131
|
+
dateCreated: Date;
|
|
132
|
+
/**
|
|
133
|
+
* The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
134
|
+
*/
|
|
135
|
+
dateUpdated: Date;
|
|
136
|
+
/**
|
|
137
|
+
* Provide a user-friendly representation
|
|
138
|
+
*
|
|
139
|
+
* @returns Object
|
|
140
|
+
*/
|
|
141
|
+
toJSON(): {
|
|
142
|
+
accountSid: string;
|
|
143
|
+
content: string;
|
|
144
|
+
metadata: Record<string, object>;
|
|
145
|
+
dateCreated: Date;
|
|
146
|
+
dateUpdated: Date;
|
|
147
|
+
};
|
|
148
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
149
|
+
}
|
|
150
|
+
export declare class ChunkPage extends Page<V1, ChunkPayload, ChunkResource, ChunkInstance> {
|
|
151
|
+
/**
|
|
152
|
+
* Initialize the ChunkPage
|
|
153
|
+
*
|
|
154
|
+
* @param version - Version of the resource
|
|
155
|
+
* @param response - Response from the API
|
|
156
|
+
* @param solution - Path solution
|
|
157
|
+
*/
|
|
158
|
+
constructor(version: V1, response: Response<string>, solution: ChunkSolution);
|
|
159
|
+
/**
|
|
160
|
+
* Build an instance of ChunkInstance
|
|
161
|
+
*
|
|
162
|
+
* @param payload - Payload response from the API
|
|
163
|
+
*/
|
|
164
|
+
getInstance(payload: ChunkResource): ChunkInstance;
|
|
165
|
+
[inspect.custom](depth: any, options: InspectOptions): string;
|
|
166
|
+
}
|
|
167
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio - Assistants
|
|
9
|
+
* This is the public Twilio REST API.
|
|
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.ChunkPage = exports.ChunkInstance = exports.ChunkListInstance = void 0;
|
|
20
|
+
const util_1 = require("util");
|
|
21
|
+
const Page_1 = __importDefault(require("../../../../base/Page"));
|
|
22
|
+
const deserialize = require("../../../../base/deserialize");
|
|
23
|
+
const serialize = require("../../../../base/serialize");
|
|
24
|
+
const utility_1 = require("../../../../base/utility");
|
|
25
|
+
function ChunkListInstance(version, id) {
|
|
26
|
+
if (!(0, utility_1.isValidPathParam)(id)) {
|
|
27
|
+
throw new Error("Parameter 'id' is not valid.");
|
|
28
|
+
}
|
|
29
|
+
const instance = {};
|
|
30
|
+
instance._version = version;
|
|
31
|
+
instance._solution = { id };
|
|
32
|
+
instance._uri = `/Knowledge/${id}/Chunks`;
|
|
33
|
+
instance.page = function page(params, callback) {
|
|
34
|
+
if (params instanceof Function) {
|
|
35
|
+
callback = params;
|
|
36
|
+
params = {};
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
params = params || {};
|
|
40
|
+
}
|
|
41
|
+
let data = {};
|
|
42
|
+
if (params["pageSize"] !== undefined)
|
|
43
|
+
data["PageSize"] = params["pageSize"];
|
|
44
|
+
if (params.pageNumber !== undefined)
|
|
45
|
+
data["Page"] = params.pageNumber;
|
|
46
|
+
if (params.pageToken !== undefined)
|
|
47
|
+
data["PageToken"] = params.pageToken;
|
|
48
|
+
const headers = {};
|
|
49
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
50
|
+
uri: instance._uri,
|
|
51
|
+
method: "get",
|
|
52
|
+
params: data,
|
|
53
|
+
headers,
|
|
54
|
+
});
|
|
55
|
+
operationPromise = operationPromise.then((payload) => new ChunkPage(operationVersion, payload, instance._solution));
|
|
56
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
57
|
+
return operationPromise;
|
|
58
|
+
};
|
|
59
|
+
instance.each = instance._version.each;
|
|
60
|
+
instance.list = instance._version.list;
|
|
61
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
62
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
63
|
+
method: "get",
|
|
64
|
+
uri: targetUrl,
|
|
65
|
+
});
|
|
66
|
+
let pagePromise = operationPromise.then((payload) => new ChunkPage(instance._version, payload, instance._solution));
|
|
67
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
68
|
+
return pagePromise;
|
|
69
|
+
};
|
|
70
|
+
instance.toJSON = function toJSON() {
|
|
71
|
+
return instance._solution;
|
|
72
|
+
};
|
|
73
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
74
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
75
|
+
};
|
|
76
|
+
return instance;
|
|
77
|
+
}
|
|
78
|
+
exports.ChunkListInstance = ChunkListInstance;
|
|
79
|
+
class ChunkInstance {
|
|
80
|
+
constructor(_version, payload, id) {
|
|
81
|
+
this._version = _version;
|
|
82
|
+
this.accountSid = payload.account_sid;
|
|
83
|
+
this.content = payload.content;
|
|
84
|
+
this.metadata = payload.metadata;
|
|
85
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
|
86
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Provide a user-friendly representation
|
|
90
|
+
*
|
|
91
|
+
* @returns Object
|
|
92
|
+
*/
|
|
93
|
+
toJSON() {
|
|
94
|
+
return {
|
|
95
|
+
accountSid: this.accountSid,
|
|
96
|
+
content: this.content,
|
|
97
|
+
metadata: this.metadata,
|
|
98
|
+
dateCreated: this.dateCreated,
|
|
99
|
+
dateUpdated: this.dateUpdated,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
[util_1.inspect.custom](_depth, options) {
|
|
103
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.ChunkInstance = ChunkInstance;
|
|
107
|
+
class ChunkPage extends Page_1.default {
|
|
108
|
+
/**
|
|
109
|
+
* Initialize the ChunkPage
|
|
110
|
+
*
|
|
111
|
+
* @param version - Version of the resource
|
|
112
|
+
* @param response - Response from the API
|
|
113
|
+
* @param solution - Path solution
|
|
114
|
+
*/
|
|
115
|
+
constructor(version, response, solution) {
|
|
116
|
+
super(version, response, solution);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Build an instance of ChunkInstance
|
|
120
|
+
*
|
|
121
|
+
* @param payload - Payload response from the API
|
|
122
|
+
*/
|
|
123
|
+
getInstance(payload) {
|
|
124
|
+
return new ChunkInstance(this._version, payload, this._solution.id);
|
|
125
|
+
}
|
|
126
|
+
[util_1.inspect.custom](depth, options) {
|
|
127
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.ChunkPage = ChunkPage;
|