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.
Files changed (34) hide show
  1. package/lib/rest/Assistants.d.ts +4 -0
  2. package/lib/rest/Assistants.js +8 -0
  3. package/lib/rest/AssistantsBase.d.ts +13 -0
  4. package/lib/rest/AssistantsBase.js +31 -0
  5. package/lib/rest/Twilio.d.ts +5 -0
  6. package/lib/rest/Twilio.js +6 -0
  7. package/lib/rest/assistants/V1.d.ts +35 -0
  8. package/lib/rest/assistants/V1.js +60 -0
  9. package/lib/rest/assistants/v1/assistant/feedback.d.ts +231 -0
  10. package/lib/rest/assistants/v1/assistant/feedback.js +161 -0
  11. package/lib/rest/assistants/v1/assistant.d.ts +466 -0
  12. package/lib/rest/assistants/v1/assistant.js +284 -0
  13. package/lib/rest/assistants/v1/knowledge/chunk.d.ts +167 -0
  14. package/lib/rest/assistants/v1/knowledge/chunk.js +130 -0
  15. package/lib/rest/assistants/v1/knowledge.d.ts +385 -0
  16. package/lib/rest/assistants/v1/knowledge.js +273 -0
  17. package/lib/rest/assistants/v1/policy.d.ts +202 -0
  18. package/lib/rest/assistants/v1/policy.js +138 -0
  19. package/lib/rest/assistants/v1/session/message.d.ts +197 -0
  20. package/lib/rest/assistants/v1/session/message.js +140 -0
  21. package/lib/rest/assistants/v1/session.d.ts +231 -0
  22. package/lib/rest/assistants/v1/session.js +194 -0
  23. package/lib/rest/assistants/v1/tool.d.ts +378 -0
  24. package/lib/rest/assistants/v1/tool.js +242 -0
  25. package/lib/rest/content/v1/content/approvalFetch.d.ts +5 -5
  26. package/lib/rest/content/v1/content/approvalFetch.js +14 -14
  27. package/lib/rest/intelligence/v2/operatorType.d.ts +1 -1
  28. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.d.ts +12 -18
  29. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.js +3 -6
  30. package/lib/rest/marketplace/v1/moduleDataManagement.d.ts +14 -6
  31. package/lib/rest/marketplace/v1/moduleDataManagement.js +4 -0
  32. package/lib/rest/numbers/v2/bundleClone.d.ts +1 -1
  33. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +4 -4
  34. package/package.json +1 -1
@@ -0,0 +1,385 @@
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
+ import { ChunkListInstance } from "./knowledge/chunk";
7
+ export declare class AssistantsV1ServiceCreateKnowledgeRequest {
8
+ /**
9
+ * The Assistant ID.
10
+ */
11
+ "assistantId"?: string;
12
+ /**
13
+ * The description of the knowledge source.
14
+ */
15
+ "description"?: string;
16
+ /**
17
+ * The details of the knowledge source based on the type.
18
+ */
19
+ "knowledgeSourceDetails"?: Record<string, object>;
20
+ /**
21
+ * The name of the tool.
22
+ */
23
+ "name": string;
24
+ "policy"?: AssistantsV1ServiceCreatePolicyRequest;
25
+ /**
26
+ * The type of the knowledge source.
27
+ */
28
+ "type": string;
29
+ }
30
+ export declare class AssistantsV1ServiceCreatePolicyRequest {
31
+ /**
32
+ * The description of the policy.
33
+ */
34
+ "description"?: string;
35
+ /**
36
+ * The Policy ID.
37
+ */
38
+ "id"?: string;
39
+ /**
40
+ * The name of the policy.
41
+ */
42
+ "name"?: string;
43
+ "policyDetails": any | null;
44
+ /**
45
+ * The description of the policy.
46
+ */
47
+ "type"?: string;
48
+ }
49
+ export declare class AssistantsV1ServiceUpdateKnowledgeRequest {
50
+ /**
51
+ * The description of the knowledge source.
52
+ */
53
+ "description"?: string;
54
+ /**
55
+ * The details of the knowledge source based on the type.
56
+ */
57
+ "knowledgeSourceDetails"?: Record<string, object>;
58
+ /**
59
+ * The name of the knowledge source.
60
+ */
61
+ "name"?: string;
62
+ "policy"?: AssistantsV1ServiceCreatePolicyRequest;
63
+ /**
64
+ * The description of the knowledge source.
65
+ */
66
+ "type"?: string;
67
+ }
68
+ /**
69
+ * Options to pass to update a KnowledgeInstance
70
+ */
71
+ export interface KnowledgeContextUpdateOptions {
72
+ /** */
73
+ assistantsV1ServiceUpdateKnowledgeRequest?: AssistantsV1ServiceUpdateKnowledgeRequest;
74
+ }
75
+ /**
76
+ * Options to pass to create a KnowledgeInstance
77
+ */
78
+ export interface KnowledgeListInstanceCreateOptions {
79
+ /** */
80
+ assistantsV1ServiceCreateKnowledgeRequest: AssistantsV1ServiceCreateKnowledgeRequest;
81
+ }
82
+ /**
83
+ * Options to pass to each
84
+ */
85
+ export interface KnowledgeListInstanceEachOptions {
86
+ /** */
87
+ assistantId?: string;
88
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
89
+ pageSize?: number;
90
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
91
+ callback?: (item: KnowledgeInstance, done: (err?: Error) => void) => void;
92
+ /** Function to be called upon completion of streaming */
93
+ done?: Function;
94
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
95
+ limit?: number;
96
+ }
97
+ /**
98
+ * Options to pass to list
99
+ */
100
+ export interface KnowledgeListInstanceOptions {
101
+ /** */
102
+ assistantId?: string;
103
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
104
+ pageSize?: number;
105
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
106
+ limit?: number;
107
+ }
108
+ /**
109
+ * Options to pass to page
110
+ */
111
+ export interface KnowledgeListInstancePageOptions {
112
+ /** */
113
+ assistantId?: string;
114
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
115
+ pageSize?: number;
116
+ /** Page Number, this value is simply for client state */
117
+ pageNumber?: number;
118
+ /** PageToken provided by the API */
119
+ pageToken?: string;
120
+ }
121
+ export interface KnowledgeContext {
122
+ chunks: ChunkListInstance;
123
+ /**
124
+ * Remove a KnowledgeInstance
125
+ *
126
+ * @param callback - Callback to handle processed record
127
+ *
128
+ * @returns Resolves to processed boolean
129
+ */
130
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
131
+ /**
132
+ * Fetch a KnowledgeInstance
133
+ *
134
+ * @param callback - Callback to handle processed record
135
+ *
136
+ * @returns Resolves to processed KnowledgeInstance
137
+ */
138
+ fetch(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
139
+ /**
140
+ * Update a KnowledgeInstance
141
+ *
142
+ * @param callback - Callback to handle processed record
143
+ *
144
+ * @returns Resolves to processed KnowledgeInstance
145
+ */
146
+ update(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
147
+ /**
148
+ * Update a KnowledgeInstance
149
+ *
150
+ * @param params - Body for request
151
+ * @param callback - Callback to handle processed record
152
+ *
153
+ * @returns Resolves to processed KnowledgeInstance
154
+ */
155
+ update(params: AssistantsV1ServiceUpdateKnowledgeRequest, callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
156
+ /**
157
+ * Provide a user-friendly representation
158
+ */
159
+ toJSON(): any;
160
+ [inspect.custom](_depth: any, options: InspectOptions): any;
161
+ }
162
+ export interface KnowledgeContextSolution {
163
+ id: string;
164
+ }
165
+ export declare class KnowledgeContextImpl implements KnowledgeContext {
166
+ protected _version: V1;
167
+ protected _solution: KnowledgeContextSolution;
168
+ protected _uri: string;
169
+ protected _chunks?: ChunkListInstance;
170
+ constructor(_version: V1, id: string);
171
+ get chunks(): ChunkListInstance;
172
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
173
+ fetch(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
174
+ update(params?: AssistantsV1ServiceUpdateKnowledgeRequest | ((error: Error | null, item?: KnowledgeInstance) => any), callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
175
+ /**
176
+ * Provide a user-friendly representation
177
+ *
178
+ * @returns Object
179
+ */
180
+ toJSON(): KnowledgeContextSolution;
181
+ [inspect.custom](_depth: any, options: InspectOptions): string;
182
+ }
183
+ interface KnowledgePayload extends TwilioResponsePayload {
184
+ knowledge: KnowledgeResource[];
185
+ }
186
+ interface KnowledgeResource {
187
+ description: string;
188
+ id: string;
189
+ account_sid: string;
190
+ knowledge_source_details: Record<string, object>;
191
+ name: string;
192
+ status: string;
193
+ type: string;
194
+ date_created: Date;
195
+ date_updated: Date;
196
+ }
197
+ export declare class KnowledgeInstance {
198
+ protected _version: V1;
199
+ protected _solution: KnowledgeContextSolution;
200
+ protected _context?: KnowledgeContext;
201
+ constructor(_version: V1, payload: KnowledgeResource, id?: string);
202
+ /**
203
+ * The type of knowledge source.
204
+ */
205
+ description: string;
206
+ /**
207
+ * The description of knowledge.
208
+ */
209
+ id: string;
210
+ /**
211
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
212
+ */
213
+ accountSid: string;
214
+ /**
215
+ * The details of the knowledge source based on the type.
216
+ */
217
+ knowledgeSourceDetails: Record<string, object>;
218
+ /**
219
+ * The name of the knowledge source.
220
+ */
221
+ name: string;
222
+ /**
223
+ * The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
224
+ */
225
+ status: string;
226
+ /**
227
+ * The type of knowledge source (\'Web\', \'Database\', \'Text\', \'File\')
228
+ */
229
+ type: string;
230
+ /**
231
+ * The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
232
+ */
233
+ dateCreated: Date;
234
+ /**
235
+ * The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
236
+ */
237
+ dateUpdated: Date;
238
+ private get _proxy();
239
+ /**
240
+ * Remove a KnowledgeInstance
241
+ *
242
+ * @param callback - Callback to handle processed record
243
+ *
244
+ * @returns Resolves to processed boolean
245
+ */
246
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
247
+ /**
248
+ * Fetch a KnowledgeInstance
249
+ *
250
+ * @param callback - Callback to handle processed record
251
+ *
252
+ * @returns Resolves to processed KnowledgeInstance
253
+ */
254
+ fetch(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
255
+ /**
256
+ * Update a KnowledgeInstance
257
+ *
258
+ * @param callback - Callback to handle processed record
259
+ *
260
+ * @returns Resolves to processed KnowledgeInstance
261
+ */
262
+ update(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
263
+ /**
264
+ * Update a KnowledgeInstance
265
+ *
266
+ * @param params - Body for request
267
+ * @param callback - Callback to handle processed record
268
+ *
269
+ * @returns Resolves to processed KnowledgeInstance
270
+ */
271
+ update(params: AssistantsV1ServiceUpdateKnowledgeRequest, callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
272
+ /**
273
+ * Access the chunks.
274
+ */
275
+ chunks(): ChunkListInstance;
276
+ /**
277
+ * Provide a user-friendly representation
278
+ *
279
+ * @returns Object
280
+ */
281
+ toJSON(): {
282
+ description: string;
283
+ id: string;
284
+ accountSid: string;
285
+ knowledgeSourceDetails: Record<string, object>;
286
+ name: string;
287
+ status: string;
288
+ type: string;
289
+ dateCreated: Date;
290
+ dateUpdated: Date;
291
+ };
292
+ [inspect.custom](_depth: any, options: InspectOptions): string;
293
+ }
294
+ export interface KnowledgeSolution {
295
+ }
296
+ export interface KnowledgeListInstance {
297
+ _version: V1;
298
+ _solution: KnowledgeSolution;
299
+ _uri: string;
300
+ (id: string): KnowledgeContext;
301
+ get(id: string): KnowledgeContext;
302
+ /**
303
+ * Create a KnowledgeInstance
304
+ *
305
+ * @param params - Body for request
306
+ * @param callback - Callback to handle processed record
307
+ *
308
+ * @returns Resolves to processed KnowledgeInstance
309
+ */
310
+ create(params: AssistantsV1ServiceCreateKnowledgeRequest, callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
311
+ /**
312
+ * Streams KnowledgeInstance records from the API.
313
+ *
314
+ * This operation lazily loads records as efficiently as possible until the limit
315
+ * is reached.
316
+ *
317
+ * The results are passed into the callback function, so this operation is memory
318
+ * efficient.
319
+ *
320
+ * If a function is passed as the first argument, it will be used as the callback
321
+ * function.
322
+ *
323
+ * @param { KnowledgeListInstanceEachOptions } [params] - Options for request
324
+ * @param { function } [callback] - Function to process each record
325
+ */
326
+ each(callback?: (item: KnowledgeInstance, done: (err?: Error) => void) => void): void;
327
+ each(params: KnowledgeListInstanceEachOptions, callback?: (item: KnowledgeInstance, done: (err?: Error) => void) => void): void;
328
+ /**
329
+ * Retrieve a single target page of KnowledgeInstance records from the API.
330
+ *
331
+ * The request is executed immediately.
332
+ *
333
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
334
+ * @param { function } [callback] - Callback to handle list of records
335
+ */
336
+ getPage(targetUrl: string, callback?: (error: Error | null, items: KnowledgePage) => any): Promise<KnowledgePage>;
337
+ /**
338
+ * Lists KnowledgeInstance records from the API as a list.
339
+ *
340
+ * If a function is passed as the first argument, it will be used as the callback
341
+ * function.
342
+ *
343
+ * @param { KnowledgeListInstanceOptions } [params] - Options for request
344
+ * @param { function } [callback] - Callback to handle list of records
345
+ */
346
+ list(callback?: (error: Error | null, items: KnowledgeInstance[]) => any): Promise<KnowledgeInstance[]>;
347
+ list(params: KnowledgeListInstanceOptions, callback?: (error: Error | null, items: KnowledgeInstance[]) => any): Promise<KnowledgeInstance[]>;
348
+ /**
349
+ * Retrieve a single page of KnowledgeInstance records from the API.
350
+ *
351
+ * The request is executed immediately.
352
+ *
353
+ * If a function is passed as the first argument, it will be used as the callback
354
+ * function.
355
+ *
356
+ * @param { KnowledgeListInstancePageOptions } [params] - Options for request
357
+ * @param { function } [callback] - Callback to handle list of records
358
+ */
359
+ page(callback?: (error: Error | null, items: KnowledgePage) => any): Promise<KnowledgePage>;
360
+ page(params: KnowledgeListInstancePageOptions, callback?: (error: Error | null, items: KnowledgePage) => any): Promise<KnowledgePage>;
361
+ /**
362
+ * Provide a user-friendly representation
363
+ */
364
+ toJSON(): any;
365
+ [inspect.custom](_depth: any, options: InspectOptions): any;
366
+ }
367
+ export declare function KnowledgeListInstance(version: V1): KnowledgeListInstance;
368
+ export declare class KnowledgePage extends Page<V1, KnowledgePayload, KnowledgeResource, KnowledgeInstance> {
369
+ /**
370
+ * Initialize the KnowledgePage
371
+ *
372
+ * @param version - Version of the resource
373
+ * @param response - Response from the API
374
+ * @param solution - Path solution
375
+ */
376
+ constructor(version: V1, response: Response<string>, solution: KnowledgeSolution);
377
+ /**
378
+ * Build an instance of KnowledgeInstance
379
+ *
380
+ * @param payload - Payload response from the API
381
+ */
382
+ getInstance(payload: KnowledgeResource): KnowledgeInstance;
383
+ [inspect.custom](depth: any, options: InspectOptions): string;
384
+ }
385
+ export {};
@@ -0,0 +1,273 @@
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.KnowledgePage = exports.KnowledgeListInstance = exports.KnowledgeInstance = exports.KnowledgeContextImpl = exports.AssistantsV1ServiceUpdateKnowledgeRequest = exports.AssistantsV1ServiceCreatePolicyRequest = exports.AssistantsV1ServiceCreateKnowledgeRequest = 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 chunk_1 = require("./knowledge/chunk");
26
+ class AssistantsV1ServiceCreateKnowledgeRequest {
27
+ }
28
+ exports.AssistantsV1ServiceCreateKnowledgeRequest = AssistantsV1ServiceCreateKnowledgeRequest;
29
+ class AssistantsV1ServiceCreatePolicyRequest {
30
+ }
31
+ exports.AssistantsV1ServiceCreatePolicyRequest = AssistantsV1ServiceCreatePolicyRequest;
32
+ class AssistantsV1ServiceUpdateKnowledgeRequest {
33
+ }
34
+ exports.AssistantsV1ServiceUpdateKnowledgeRequest = AssistantsV1ServiceUpdateKnowledgeRequest;
35
+ class KnowledgeContextImpl {
36
+ constructor(_version, id) {
37
+ this._version = _version;
38
+ if (!(0, utility_1.isValidPathParam)(id)) {
39
+ throw new Error("Parameter 'id' is not valid.");
40
+ }
41
+ this._solution = { id };
42
+ this._uri = `/Knowledge/${id}`;
43
+ }
44
+ get chunks() {
45
+ this._chunks =
46
+ this._chunks || (0, chunk_1.ChunkListInstance)(this._version, this._solution.id);
47
+ return this._chunks;
48
+ }
49
+ remove(callback) {
50
+ const instance = this;
51
+ let operationVersion = instance._version, operationPromise = operationVersion.remove({
52
+ uri: instance._uri,
53
+ method: "delete",
54
+ });
55
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
56
+ return operationPromise;
57
+ }
58
+ fetch(callback) {
59
+ const instance = this;
60
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
61
+ uri: instance._uri,
62
+ method: "get",
63
+ });
64
+ operationPromise = operationPromise.then((payload) => new KnowledgeInstance(operationVersion, payload, instance._solution.id));
65
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
66
+ return operationPromise;
67
+ }
68
+ update(params, callback) {
69
+ if (params instanceof Function) {
70
+ callback = params;
71
+ params = {};
72
+ }
73
+ else {
74
+ params = params || {};
75
+ }
76
+ let data = {};
77
+ data = params;
78
+ const headers = {};
79
+ headers["Content-Type"] = "application/json";
80
+ const instance = this;
81
+ let operationVersion = instance._version, operationPromise = operationVersion.update({
82
+ uri: instance._uri,
83
+ method: "put",
84
+ data,
85
+ headers,
86
+ });
87
+ operationPromise = operationPromise.then((payload) => new KnowledgeInstance(operationVersion, payload, instance._solution.id));
88
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
89
+ return operationPromise;
90
+ }
91
+ /**
92
+ * Provide a user-friendly representation
93
+ *
94
+ * @returns Object
95
+ */
96
+ toJSON() {
97
+ return this._solution;
98
+ }
99
+ [util_1.inspect.custom](_depth, options) {
100
+ return (0, util_1.inspect)(this.toJSON(), options);
101
+ }
102
+ }
103
+ exports.KnowledgeContextImpl = KnowledgeContextImpl;
104
+ class KnowledgeInstance {
105
+ constructor(_version, payload, id) {
106
+ this._version = _version;
107
+ this.description = payload.description;
108
+ this.id = payload.id;
109
+ this.accountSid = payload.account_sid;
110
+ this.knowledgeSourceDetails = payload.knowledge_source_details;
111
+ this.name = payload.name;
112
+ this.status = payload.status;
113
+ this.type = payload.type;
114
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
115
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
116
+ this._solution = { id: id || this.id };
117
+ }
118
+ get _proxy() {
119
+ this._context =
120
+ this._context ||
121
+ new KnowledgeContextImpl(this._version, this._solution.id);
122
+ return this._context;
123
+ }
124
+ /**
125
+ * Remove a KnowledgeInstance
126
+ *
127
+ * @param callback - Callback to handle processed record
128
+ *
129
+ * @returns Resolves to processed boolean
130
+ */
131
+ remove(callback) {
132
+ return this._proxy.remove(callback);
133
+ }
134
+ /**
135
+ * Fetch a KnowledgeInstance
136
+ *
137
+ * @param callback - Callback to handle processed record
138
+ *
139
+ * @returns Resolves to processed KnowledgeInstance
140
+ */
141
+ fetch(callback) {
142
+ return this._proxy.fetch(callback);
143
+ }
144
+ update(params, callback) {
145
+ return this._proxy.update(params, callback);
146
+ }
147
+ /**
148
+ * Access the chunks.
149
+ */
150
+ chunks() {
151
+ return this._proxy.chunks;
152
+ }
153
+ /**
154
+ * Provide a user-friendly representation
155
+ *
156
+ * @returns Object
157
+ */
158
+ toJSON() {
159
+ return {
160
+ description: this.description,
161
+ id: this.id,
162
+ accountSid: this.accountSid,
163
+ knowledgeSourceDetails: this.knowledgeSourceDetails,
164
+ name: this.name,
165
+ status: this.status,
166
+ type: this.type,
167
+ dateCreated: this.dateCreated,
168
+ dateUpdated: this.dateUpdated,
169
+ };
170
+ }
171
+ [util_1.inspect.custom](_depth, options) {
172
+ return (0, util_1.inspect)(this.toJSON(), options);
173
+ }
174
+ }
175
+ exports.KnowledgeInstance = KnowledgeInstance;
176
+ function KnowledgeListInstance(version) {
177
+ const instance = ((id) => instance.get(id));
178
+ instance.get = function get(id) {
179
+ return new KnowledgeContextImpl(version, id);
180
+ };
181
+ instance._version = version;
182
+ instance._solution = {};
183
+ instance._uri = `/Knowledge`;
184
+ instance.create = function create(params, callback) {
185
+ if (params === null || params === undefined) {
186
+ throw new Error('Required parameter "params" missing.');
187
+ }
188
+ let data = {};
189
+ data = params;
190
+ const headers = {};
191
+ headers["Content-Type"] = "application/json";
192
+ let operationVersion = version, operationPromise = operationVersion.create({
193
+ uri: instance._uri,
194
+ method: "post",
195
+ data,
196
+ headers,
197
+ });
198
+ operationPromise = operationPromise.then((payload) => new KnowledgeInstance(operationVersion, payload));
199
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
200
+ return operationPromise;
201
+ };
202
+ instance.page = function page(params, callback) {
203
+ if (params instanceof Function) {
204
+ callback = params;
205
+ params = {};
206
+ }
207
+ else {
208
+ params = params || {};
209
+ }
210
+ let data = {};
211
+ if (params["assistantId"] !== undefined)
212
+ data["AssistantId"] = params["assistantId"];
213
+ if (params["pageSize"] !== undefined)
214
+ data["PageSize"] = params["pageSize"];
215
+ if (params.pageNumber !== undefined)
216
+ data["Page"] = params.pageNumber;
217
+ if (params.pageToken !== undefined)
218
+ data["PageToken"] = params.pageToken;
219
+ const headers = {};
220
+ let operationVersion = version, operationPromise = operationVersion.page({
221
+ uri: instance._uri,
222
+ method: "get",
223
+ params: data,
224
+ headers,
225
+ });
226
+ operationPromise = operationPromise.then((payload) => new KnowledgePage(operationVersion, payload, instance._solution));
227
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
228
+ return operationPromise;
229
+ };
230
+ instance.each = instance._version.each;
231
+ instance.list = instance._version.list;
232
+ instance.getPage = function getPage(targetUrl, callback) {
233
+ const operationPromise = instance._version._domain.twilio.request({
234
+ method: "get",
235
+ uri: targetUrl,
236
+ });
237
+ let pagePromise = operationPromise.then((payload) => new KnowledgePage(instance._version, payload, instance._solution));
238
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
239
+ return pagePromise;
240
+ };
241
+ instance.toJSON = function toJSON() {
242
+ return instance._solution;
243
+ };
244
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
245
+ return (0, util_1.inspect)(instance.toJSON(), options);
246
+ };
247
+ return instance;
248
+ }
249
+ exports.KnowledgeListInstance = KnowledgeListInstance;
250
+ class KnowledgePage extends Page_1.default {
251
+ /**
252
+ * Initialize the KnowledgePage
253
+ *
254
+ * @param version - Version of the resource
255
+ * @param response - Response from the API
256
+ * @param solution - Path solution
257
+ */
258
+ constructor(version, response, solution) {
259
+ super(version, response, solution);
260
+ }
261
+ /**
262
+ * Build an instance of KnowledgeInstance
263
+ *
264
+ * @param payload - Payload response from the API
265
+ */
266
+ getInstance(payload) {
267
+ return new KnowledgeInstance(this._version, payload);
268
+ }
269
+ [util_1.inspect.custom](depth, options) {
270
+ return (0, util_1.inspect)(this.toJSON(), options);
271
+ }
272
+ }
273
+ exports.KnowledgePage = KnowledgePage;