twilio 5.3.0 → 5.3.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.
Files changed (56) 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/Preview.d.ts +0 -5
  6. package/lib/rest/Preview.js +0 -7
  7. package/lib/rest/Twilio.d.ts +5 -0
  8. package/lib/rest/Twilio.js +6 -0
  9. package/lib/rest/accounts/V1.d.ts +10 -0
  10. package/lib/rest/accounts/V1.js +12 -0
  11. package/lib/rest/accounts/v1/bulkConsents.d.ts +53 -0
  12. package/lib/rest/accounts/v1/bulkConsents.js +74 -0
  13. package/lib/rest/accounts/v1/bulkContacts.d.ts +53 -0
  14. package/lib/rest/accounts/v1/bulkContacts.js +74 -0
  15. package/lib/rest/assistants/V1.d.ts +35 -0
  16. package/lib/rest/assistants/V1.js +60 -0
  17. package/lib/rest/assistants/v1/assistant/assistantsKnowledge.d.ts +260 -0
  18. package/lib/rest/assistants/v1/assistant/assistantsKnowledge.js +214 -0
  19. package/lib/rest/assistants/v1/assistant/assistantsTool.d.ts +266 -0
  20. package/lib/rest/assistants/v1/assistant/assistantsTool.js +216 -0
  21. package/lib/rest/assistants/v1/assistant/feedback.d.ts +231 -0
  22. package/lib/rest/assistants/v1/assistant/feedback.js +161 -0
  23. package/lib/rest/assistants/v1/assistant/message.d.ts +112 -0
  24. package/lib/rest/assistants/v1/assistant/message.js +90 -0
  25. package/lib/rest/assistants/v1/assistant.d.ts +504 -0
  26. package/lib/rest/assistants/v1/assistant.js +324 -0
  27. package/lib/rest/assistants/v1/knowledge/chunk.d.ts +167 -0
  28. package/lib/rest/assistants/v1/knowledge/chunk.js +130 -0
  29. package/lib/rest/assistants/v1/knowledge/knowledgeStatus.d.ts +101 -0
  30. package/lib/rest/assistants/v1/knowledge/knowledgeStatus.js +115 -0
  31. package/lib/rest/assistants/v1/knowledge.d.ts +399 -0
  32. package/lib/rest/assistants/v1/knowledge.js +288 -0
  33. package/lib/rest/assistants/v1/policy.d.ts +202 -0
  34. package/lib/rest/assistants/v1/policy.js +138 -0
  35. package/lib/rest/assistants/v1/session/message.d.ts +197 -0
  36. package/lib/rest/assistants/v1/session/message.js +140 -0
  37. package/lib/rest/assistants/v1/session.d.ts +231 -0
  38. package/lib/rest/assistants/v1/session.js +194 -0
  39. package/lib/rest/assistants/v1/tool.d.ts +445 -0
  40. package/lib/rest/assistants/v1/tool.js +269 -0
  41. package/lib/rest/content/v1/content/approvalFetch.d.ts +5 -5
  42. package/lib/rest/content/v1/content/approvalFetch.js +14 -14
  43. package/lib/rest/intelligence/v2/operatorType.d.ts +1 -1
  44. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.d.ts +12 -18
  45. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.js +3 -6
  46. package/lib/rest/marketplace/v1/moduleDataManagement.d.ts +14 -6
  47. package/lib/rest/marketplace/v1/moduleDataManagement.js +4 -0
  48. package/lib/rest/numbers/V1.d.ts +5 -5
  49. package/lib/rest/numbers/V1.js +6 -8
  50. package/lib/rest/numbers/v1/{portingWebhookConfigurationFetch.d.ts → webhook.d.ts} +10 -10
  51. package/lib/rest/numbers/v1/{portingWebhookConfigurationFetch.js → webhook.js} +6 -6
  52. package/lib/rest/numbers/v2/bundleClone.d.ts +1 -1
  53. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +4 -4
  54. package/lib/rest/serverless/v1/service/environment/deployment.d.ts +2 -0
  55. package/lib/rest/serverless/v1/service/environment/deployment.js +2 -0
  56. package/package.json +1 -1
@@ -0,0 +1,266 @@
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 AssistantsToolListInstanceEachOptions {
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: AssistantsToolInstance, 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 AssistantsToolListInstanceOptions {
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 AssistantsToolListInstancePageOptions {
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 AssistantsToolContext {
40
+ /**
41
+ * Create a AssistantsToolInstance
42
+ *
43
+ * @param callback - Callback to handle processed record
44
+ *
45
+ * @returns Resolves to processed AssistantsToolInstance
46
+ */
47
+ create(callback?: (error: Error | null, item?: AssistantsToolInstance) => any): Promise<AssistantsToolInstance>;
48
+ /**
49
+ * Remove a AssistantsToolInstance
50
+ *
51
+ * @param callback - Callback to handle processed record
52
+ *
53
+ * @returns Resolves to processed boolean
54
+ */
55
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
56
+ /**
57
+ * Provide a user-friendly representation
58
+ */
59
+ toJSON(): any;
60
+ [inspect.custom](_depth: any, options: InspectOptions): any;
61
+ }
62
+ export interface AssistantsToolContextSolution {
63
+ assistantId: string;
64
+ id: string;
65
+ }
66
+ export declare class AssistantsToolContextImpl implements AssistantsToolContext {
67
+ protected _version: V1;
68
+ protected _solution: AssistantsToolContextSolution;
69
+ protected _uri: string;
70
+ constructor(_version: V1, assistantId: string, id: string);
71
+ create(callback?: (error: Error | null, item?: AssistantsToolInstance) => any): Promise<AssistantsToolInstance>;
72
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
73
+ /**
74
+ * Provide a user-friendly representation
75
+ *
76
+ * @returns Object
77
+ */
78
+ toJSON(): AssistantsToolContextSolution;
79
+ [inspect.custom](_depth: any, options: InspectOptions): string;
80
+ }
81
+ interface AssistantsToolPayload extends TwilioResponsePayload {
82
+ tools: AssistantsToolResource[];
83
+ }
84
+ interface AssistantsToolResource {
85
+ account_sid: string;
86
+ description: string;
87
+ enabled: boolean;
88
+ id: string;
89
+ meta: Record<string, object>;
90
+ name: string;
91
+ requires_auth: boolean;
92
+ type: string;
93
+ url: string;
94
+ date_created: Date;
95
+ date_updated: Date;
96
+ }
97
+ export declare class AssistantsToolInstance {
98
+ protected _version: V1;
99
+ protected _solution: AssistantsToolContextSolution;
100
+ protected _context?: AssistantsToolContext;
101
+ constructor(_version: V1, payload: AssistantsToolResource, assistantId: string, id?: string);
102
+ /**
103
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource.
104
+ */
105
+ accountSid: string;
106
+ /**
107
+ * The description of the tool.
108
+ */
109
+ description: string;
110
+ /**
111
+ * True if the tool is enabled.
112
+ */
113
+ enabled: boolean;
114
+ /**
115
+ * The tool ID.
116
+ */
117
+ id: string;
118
+ /**
119
+ * The metadata related to method, url, input_schema to used with the Tool.
120
+ */
121
+ meta: Record<string, object>;
122
+ /**
123
+ * The name of the tool.
124
+ */
125
+ name: string;
126
+ /**
127
+ * The authentication requirement for the tool.
128
+ */
129
+ requiresAuth: boolean;
130
+ /**
131
+ * The type of the tool. (\'WEBHOOK\')
132
+ */
133
+ type: string;
134
+ /**
135
+ * The url of the tool resource.
136
+ */
137
+ url: string;
138
+ /**
139
+ * The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
140
+ */
141
+ dateCreated: Date;
142
+ /**
143
+ * The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
144
+ */
145
+ dateUpdated: Date;
146
+ private get _proxy();
147
+ /**
148
+ * Create a AssistantsToolInstance
149
+ *
150
+ * @param callback - Callback to handle processed record
151
+ *
152
+ * @returns Resolves to processed AssistantsToolInstance
153
+ */
154
+ create(callback?: (error: Error | null, item?: AssistantsToolInstance) => any): Promise<AssistantsToolInstance>;
155
+ /**
156
+ * Remove a AssistantsToolInstance
157
+ *
158
+ * @param callback - Callback to handle processed record
159
+ *
160
+ * @returns Resolves to processed boolean
161
+ */
162
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
163
+ /**
164
+ * Provide a user-friendly representation
165
+ *
166
+ * @returns Object
167
+ */
168
+ toJSON(): {
169
+ accountSid: string;
170
+ description: string;
171
+ enabled: boolean;
172
+ id: string;
173
+ meta: Record<string, object>;
174
+ name: string;
175
+ requiresAuth: boolean;
176
+ type: string;
177
+ url: string;
178
+ dateCreated: Date;
179
+ dateUpdated: Date;
180
+ };
181
+ [inspect.custom](_depth: any, options: InspectOptions): string;
182
+ }
183
+ export interface AssistantsToolSolution {
184
+ assistantId: string;
185
+ }
186
+ export interface AssistantsToolListInstance {
187
+ _version: V1;
188
+ _solution: AssistantsToolSolution;
189
+ _uri: string;
190
+ (id: string): AssistantsToolContext;
191
+ get(id: string): AssistantsToolContext;
192
+ /**
193
+ * Streams AssistantsToolInstance records from the API.
194
+ *
195
+ * This operation lazily loads records as efficiently as possible until the limit
196
+ * is reached.
197
+ *
198
+ * The results are passed into the callback function, so this operation is memory
199
+ * efficient.
200
+ *
201
+ * If a function is passed as the first argument, it will be used as the callback
202
+ * function.
203
+ *
204
+ * @param { AssistantsToolListInstanceEachOptions } [params] - Options for request
205
+ * @param { function } [callback] - Function to process each record
206
+ */
207
+ each(callback?: (item: AssistantsToolInstance, done: (err?: Error) => void) => void): void;
208
+ each(params: AssistantsToolListInstanceEachOptions, callback?: (item: AssistantsToolInstance, done: (err?: Error) => void) => void): void;
209
+ /**
210
+ * Retrieve a single target page of AssistantsToolInstance records from the API.
211
+ *
212
+ * The request is executed immediately.
213
+ *
214
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
215
+ * @param { function } [callback] - Callback to handle list of records
216
+ */
217
+ getPage(targetUrl: string, callback?: (error: Error | null, items: AssistantsToolPage) => any): Promise<AssistantsToolPage>;
218
+ /**
219
+ * Lists AssistantsToolInstance records from the API as a list.
220
+ *
221
+ * If a function is passed as the first argument, it will be used as the callback
222
+ * function.
223
+ *
224
+ * @param { AssistantsToolListInstanceOptions } [params] - Options for request
225
+ * @param { function } [callback] - Callback to handle list of records
226
+ */
227
+ list(callback?: (error: Error | null, items: AssistantsToolInstance[]) => any): Promise<AssistantsToolInstance[]>;
228
+ list(params: AssistantsToolListInstanceOptions, callback?: (error: Error | null, items: AssistantsToolInstance[]) => any): Promise<AssistantsToolInstance[]>;
229
+ /**
230
+ * Retrieve a single page of AssistantsToolInstance records from the API.
231
+ *
232
+ * The request is executed immediately.
233
+ *
234
+ * If a function is passed as the first argument, it will be used as the callback
235
+ * function.
236
+ *
237
+ * @param { AssistantsToolListInstancePageOptions } [params] - Options for request
238
+ * @param { function } [callback] - Callback to handle list of records
239
+ */
240
+ page(callback?: (error: Error | null, items: AssistantsToolPage) => any): Promise<AssistantsToolPage>;
241
+ page(params: AssistantsToolListInstancePageOptions, callback?: (error: Error | null, items: AssistantsToolPage) => any): Promise<AssistantsToolPage>;
242
+ /**
243
+ * Provide a user-friendly representation
244
+ */
245
+ toJSON(): any;
246
+ [inspect.custom](_depth: any, options: InspectOptions): any;
247
+ }
248
+ export declare function AssistantsToolListInstance(version: V1, assistantId: string): AssistantsToolListInstance;
249
+ export declare class AssistantsToolPage extends Page<V1, AssistantsToolPayload, AssistantsToolResource, AssistantsToolInstance> {
250
+ /**
251
+ * Initialize the AssistantsToolPage
252
+ *
253
+ * @param version - Version of the resource
254
+ * @param response - Response from the API
255
+ * @param solution - Path solution
256
+ */
257
+ constructor(version: V1, response: Response<string>, solution: AssistantsToolSolution);
258
+ /**
259
+ * Build an instance of AssistantsToolInstance
260
+ *
261
+ * @param payload - Payload response from the API
262
+ */
263
+ getInstance(payload: AssistantsToolResource): AssistantsToolInstance;
264
+ [inspect.custom](depth: any, options: InspectOptions): string;
265
+ }
266
+ export {};
@@ -0,0 +1,216 @@
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.AssistantsToolPage = exports.AssistantsToolListInstance = exports.AssistantsToolInstance = exports.AssistantsToolContextImpl = 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
+ class AssistantsToolContextImpl {
26
+ constructor(_version, assistantId, id) {
27
+ this._version = _version;
28
+ if (!(0, utility_1.isValidPathParam)(assistantId)) {
29
+ throw new Error("Parameter 'assistantId' is not valid.");
30
+ }
31
+ if (!(0, utility_1.isValidPathParam)(id)) {
32
+ throw new Error("Parameter 'id' is not valid.");
33
+ }
34
+ this._solution = { assistantId, id };
35
+ this._uri = `/Assistants/${assistantId}/Tools/${id}`;
36
+ }
37
+ create(callback) {
38
+ const instance = this;
39
+ let operationVersion = instance._version, operationPromise = operationVersion.create({
40
+ uri: instance._uri,
41
+ method: "post",
42
+ });
43
+ operationPromise = operationPromise.then((payload) => new AssistantsToolInstance(operationVersion, payload, instance._solution.assistantId, instance._solution.id));
44
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
45
+ return operationPromise;
46
+ }
47
+ remove(callback) {
48
+ const instance = this;
49
+ let operationVersion = instance._version, operationPromise = operationVersion.remove({
50
+ uri: instance._uri,
51
+ method: "delete",
52
+ });
53
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
54
+ return operationPromise;
55
+ }
56
+ /**
57
+ * Provide a user-friendly representation
58
+ *
59
+ * @returns Object
60
+ */
61
+ toJSON() {
62
+ return this._solution;
63
+ }
64
+ [util_1.inspect.custom](_depth, options) {
65
+ return (0, util_1.inspect)(this.toJSON(), options);
66
+ }
67
+ }
68
+ exports.AssistantsToolContextImpl = AssistantsToolContextImpl;
69
+ class AssistantsToolInstance {
70
+ constructor(_version, payload, assistantId, id) {
71
+ this._version = _version;
72
+ this.accountSid = payload.account_sid;
73
+ this.description = payload.description;
74
+ this.enabled = payload.enabled;
75
+ this.id = payload.id;
76
+ this.meta = payload.meta;
77
+ this.name = payload.name;
78
+ this.requiresAuth = payload.requires_auth;
79
+ this.type = payload.type;
80
+ this.url = payload.url;
81
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
82
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
83
+ this._solution = { assistantId, id: id || this.id };
84
+ }
85
+ get _proxy() {
86
+ this._context =
87
+ this._context ||
88
+ new AssistantsToolContextImpl(this._version, this._solution.assistantId, this._solution.id);
89
+ return this._context;
90
+ }
91
+ /**
92
+ * Create a AssistantsToolInstance
93
+ *
94
+ * @param callback - Callback to handle processed record
95
+ *
96
+ * @returns Resolves to processed AssistantsToolInstance
97
+ */
98
+ create(callback) {
99
+ return this._proxy.create(callback);
100
+ }
101
+ /**
102
+ * Remove a AssistantsToolInstance
103
+ *
104
+ * @param callback - Callback to handle processed record
105
+ *
106
+ * @returns Resolves to processed boolean
107
+ */
108
+ remove(callback) {
109
+ return this._proxy.remove(callback);
110
+ }
111
+ /**
112
+ * Provide a user-friendly representation
113
+ *
114
+ * @returns Object
115
+ */
116
+ toJSON() {
117
+ return {
118
+ accountSid: this.accountSid,
119
+ description: this.description,
120
+ enabled: this.enabled,
121
+ id: this.id,
122
+ meta: this.meta,
123
+ name: this.name,
124
+ requiresAuth: this.requiresAuth,
125
+ type: this.type,
126
+ url: this.url,
127
+ dateCreated: this.dateCreated,
128
+ dateUpdated: this.dateUpdated,
129
+ };
130
+ }
131
+ [util_1.inspect.custom](_depth, options) {
132
+ return (0, util_1.inspect)(this.toJSON(), options);
133
+ }
134
+ }
135
+ exports.AssistantsToolInstance = AssistantsToolInstance;
136
+ function AssistantsToolListInstance(version, assistantId) {
137
+ if (!(0, utility_1.isValidPathParam)(assistantId)) {
138
+ throw new Error("Parameter 'assistantId' is not valid.");
139
+ }
140
+ const instance = ((id) => instance.get(id));
141
+ instance.get = function get(id) {
142
+ return new AssistantsToolContextImpl(version, assistantId, id);
143
+ };
144
+ instance._version = version;
145
+ instance._solution = { assistantId };
146
+ instance._uri = `/Assistants/${assistantId}/Tools`;
147
+ instance.page = function page(params, callback) {
148
+ if (params instanceof Function) {
149
+ callback = params;
150
+ params = {};
151
+ }
152
+ else {
153
+ params = params || {};
154
+ }
155
+ let data = {};
156
+ if (params["pageSize"] !== undefined)
157
+ data["PageSize"] = params["pageSize"];
158
+ if (params.pageNumber !== undefined)
159
+ data["Page"] = params.pageNumber;
160
+ if (params.pageToken !== undefined)
161
+ data["PageToken"] = params.pageToken;
162
+ const headers = {};
163
+ let operationVersion = version, operationPromise = operationVersion.page({
164
+ uri: instance._uri,
165
+ method: "get",
166
+ params: data,
167
+ headers,
168
+ });
169
+ operationPromise = operationPromise.then((payload) => new AssistantsToolPage(operationVersion, payload, instance._solution));
170
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
171
+ return operationPromise;
172
+ };
173
+ instance.each = instance._version.each;
174
+ instance.list = instance._version.list;
175
+ instance.getPage = function getPage(targetUrl, callback) {
176
+ const operationPromise = instance._version._domain.twilio.request({
177
+ method: "get",
178
+ uri: targetUrl,
179
+ });
180
+ let pagePromise = operationPromise.then((payload) => new AssistantsToolPage(instance._version, payload, instance._solution));
181
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
182
+ return pagePromise;
183
+ };
184
+ instance.toJSON = function toJSON() {
185
+ return instance._solution;
186
+ };
187
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
188
+ return (0, util_1.inspect)(instance.toJSON(), options);
189
+ };
190
+ return instance;
191
+ }
192
+ exports.AssistantsToolListInstance = AssistantsToolListInstance;
193
+ class AssistantsToolPage extends Page_1.default {
194
+ /**
195
+ * Initialize the AssistantsToolPage
196
+ *
197
+ * @param version - Version of the resource
198
+ * @param response - Response from the API
199
+ * @param solution - Path solution
200
+ */
201
+ constructor(version, response, solution) {
202
+ super(version, response, solution);
203
+ }
204
+ /**
205
+ * Build an instance of AssistantsToolInstance
206
+ *
207
+ * @param payload - Payload response from the API
208
+ */
209
+ getInstance(payload) {
210
+ return new AssistantsToolInstance(this._version, payload, this._solution.assistantId);
211
+ }
212
+ [util_1.inspect.custom](depth, options) {
213
+ return (0, util_1.inspect)(this.toJSON(), options);
214
+ }
215
+ }
216
+ exports.AssistantsToolPage = AssistantsToolPage;