twilio 5.2.3 → 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 (52) 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/Iam.d.ts +4 -0
  6. package/lib/rest/Iam.js +8 -0
  7. package/lib/rest/IamBase.d.ts +13 -0
  8. package/lib/rest/IamBase.js +31 -0
  9. package/lib/rest/Twilio.d.ts +10 -0
  10. package/lib/rest/Twilio.js +11 -0
  11. package/lib/rest/assistants/V1.d.ts +35 -0
  12. package/lib/rest/assistants/V1.js +60 -0
  13. package/lib/rest/assistants/v1/assistant/feedback.d.ts +231 -0
  14. package/lib/rest/assistants/v1/assistant/feedback.js +161 -0
  15. package/lib/rest/assistants/v1/assistant.d.ts +466 -0
  16. package/lib/rest/assistants/v1/assistant.js +284 -0
  17. package/lib/rest/assistants/v1/knowledge/chunk.d.ts +167 -0
  18. package/lib/rest/assistants/v1/knowledge/chunk.js +130 -0
  19. package/lib/rest/assistants/v1/knowledge.d.ts +385 -0
  20. package/lib/rest/assistants/v1/knowledge.js +273 -0
  21. package/lib/rest/assistants/v1/policy.d.ts +202 -0
  22. package/lib/rest/assistants/v1/policy.js +138 -0
  23. package/lib/rest/assistants/v1/session/message.d.ts +197 -0
  24. package/lib/rest/assistants/v1/session/message.js +140 -0
  25. package/lib/rest/assistants/v1/session.d.ts +231 -0
  26. package/lib/rest/assistants/v1/session.js +194 -0
  27. package/lib/rest/assistants/v1/tool.d.ts +378 -0
  28. package/lib/rest/assistants/v1/tool.js +242 -0
  29. package/lib/rest/content/v1/content/approvalFetch.d.ts +5 -5
  30. package/lib/rest/content/v1/content/approvalFetch.js +14 -14
  31. package/lib/rest/content/v1/content.d.ts +33 -3
  32. package/lib/rest/content/v1/content.js +16 -1
  33. package/lib/rest/iam/V1.d.ts +25 -0
  34. package/lib/rest/iam/V1.js +48 -0
  35. package/lib/rest/iam/v1/apiKey.d.ts +167 -0
  36. package/lib/rest/iam/v1/apiKey.js +161 -0
  37. package/lib/rest/iam/v1/getApiKeys.d.ts +163 -0
  38. package/lib/rest/iam/v1/getApiKeys.js +124 -0
  39. package/lib/rest/iam/v1/newApiKey.d.ts +90 -0
  40. package/lib/rest/iam/v1/newApiKey.js +90 -0
  41. package/lib/rest/intelligence/v2/operatorType.d.ts +1 -1
  42. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.d.ts +12 -18
  43. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.js +3 -6
  44. package/lib/rest/marketplace/v1/moduleDataManagement.d.ts +14 -6
  45. package/lib/rest/marketplace/v1/moduleDataManagement.js +4 -0
  46. package/lib/rest/numbers/v1/portingPortIn.js +1 -1
  47. package/lib/rest/numbers/v2/bundleClone.d.ts +1 -1
  48. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +4 -4
  49. package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts +6 -0
  50. package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +2 -0
  51. package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.d.ts +1 -1
  52. package/package.json +2 -2
@@ -0,0 +1,231 @@
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 { MessageListInstance } from "./session/message";
7
+ /**
8
+ * Options to pass to each
9
+ */
10
+ export interface SessionListInstanceEachOptions {
11
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
12
+ pageSize?: number;
13
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
14
+ callback?: (item: SessionInstance, done: (err?: Error) => void) => void;
15
+ /** Function to be called upon completion of streaming */
16
+ done?: Function;
17
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
18
+ limit?: number;
19
+ }
20
+ /**
21
+ * Options to pass to list
22
+ */
23
+ export interface SessionListInstanceOptions {
24
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
25
+ pageSize?: number;
26
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
27
+ limit?: number;
28
+ }
29
+ /**
30
+ * Options to pass to page
31
+ */
32
+ export interface SessionListInstancePageOptions {
33
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
34
+ pageSize?: number;
35
+ /** Page Number, this value is simply for client state */
36
+ pageNumber?: number;
37
+ /** PageToken provided by the API */
38
+ pageToken?: string;
39
+ }
40
+ export interface SessionContext {
41
+ messages: MessageListInstance;
42
+ /**
43
+ * Fetch a SessionInstance
44
+ *
45
+ * @param callback - Callback to handle processed record
46
+ *
47
+ * @returns Resolves to processed SessionInstance
48
+ */
49
+ fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>;
50
+ /**
51
+ * Provide a user-friendly representation
52
+ */
53
+ toJSON(): any;
54
+ [inspect.custom](_depth: any, options: InspectOptions): any;
55
+ }
56
+ export interface SessionContextSolution {
57
+ id: string;
58
+ }
59
+ export declare class SessionContextImpl implements SessionContext {
60
+ protected _version: V1;
61
+ protected _solution: SessionContextSolution;
62
+ protected _uri: string;
63
+ protected _messages?: MessageListInstance;
64
+ constructor(_version: V1, id: string);
65
+ get messages(): MessageListInstance;
66
+ fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>;
67
+ /**
68
+ * Provide a user-friendly representation
69
+ *
70
+ * @returns Object
71
+ */
72
+ toJSON(): SessionContextSolution;
73
+ [inspect.custom](_depth: any, options: InspectOptions): string;
74
+ }
75
+ interface SessionPayload extends TwilioResponsePayload {
76
+ sessions: SessionResource[];
77
+ }
78
+ interface SessionResource {
79
+ id: string;
80
+ account_sid: string;
81
+ assistant_id: string;
82
+ verified: boolean;
83
+ identity: string;
84
+ date_created: Date;
85
+ date_updated: Date;
86
+ }
87
+ export declare class SessionInstance {
88
+ protected _version: V1;
89
+ protected _solution: SessionContextSolution;
90
+ protected _context?: SessionContext;
91
+ constructor(_version: V1, payload: SessionResource, id?: string);
92
+ /**
93
+ * The Session ID.
94
+ */
95
+ id: string;
96
+ /**
97
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource.
98
+ */
99
+ accountSid: string;
100
+ /**
101
+ * The Assistant ID.
102
+ */
103
+ assistantId: string;
104
+ /**
105
+ * True if the session is verified.
106
+ */
107
+ verified: boolean;
108
+ /**
109
+ * The unique identity of user for the session.
110
+ */
111
+ identity: string;
112
+ /**
113
+ * The date and time in GMT when the Session was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
114
+ */
115
+ dateCreated: Date;
116
+ /**
117
+ * The date and time in GMT when the Session was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
118
+ */
119
+ dateUpdated: Date;
120
+ private get _proxy();
121
+ /**
122
+ * Fetch a SessionInstance
123
+ *
124
+ * @param callback - Callback to handle processed record
125
+ *
126
+ * @returns Resolves to processed SessionInstance
127
+ */
128
+ fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>;
129
+ /**
130
+ * Access the messages.
131
+ */
132
+ messages(): MessageListInstance;
133
+ /**
134
+ * Provide a user-friendly representation
135
+ *
136
+ * @returns Object
137
+ */
138
+ toJSON(): {
139
+ id: string;
140
+ accountSid: string;
141
+ assistantId: string;
142
+ verified: boolean;
143
+ identity: string;
144
+ dateCreated: Date;
145
+ dateUpdated: Date;
146
+ };
147
+ [inspect.custom](_depth: any, options: InspectOptions): string;
148
+ }
149
+ export interface SessionSolution {
150
+ }
151
+ export interface SessionListInstance {
152
+ _version: V1;
153
+ _solution: SessionSolution;
154
+ _uri: string;
155
+ (id: string): SessionContext;
156
+ get(id: string): SessionContext;
157
+ /**
158
+ * Streams SessionInstance records from the API.
159
+ *
160
+ * This operation lazily loads records as efficiently as possible until the limit
161
+ * is reached.
162
+ *
163
+ * The results are passed into the callback function, so this operation is memory
164
+ * efficient.
165
+ *
166
+ * If a function is passed as the first argument, it will be used as the callback
167
+ * function.
168
+ *
169
+ * @param { SessionListInstanceEachOptions } [params] - Options for request
170
+ * @param { function } [callback] - Function to process each record
171
+ */
172
+ each(callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void;
173
+ each(params: SessionListInstanceEachOptions, callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void;
174
+ /**
175
+ * Retrieve a single target page of SessionInstance records from the API.
176
+ *
177
+ * The request is executed immediately.
178
+ *
179
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
180
+ * @param { function } [callback] - Callback to handle list of records
181
+ */
182
+ getPage(targetUrl: string, callback?: (error: Error | null, items: SessionPage) => any): Promise<SessionPage>;
183
+ /**
184
+ * Lists SessionInstance records from the API as a list.
185
+ *
186
+ * If a function is passed as the first argument, it will be used as the callback
187
+ * function.
188
+ *
189
+ * @param { SessionListInstanceOptions } [params] - Options for request
190
+ * @param { function } [callback] - Callback to handle list of records
191
+ */
192
+ list(callback?: (error: Error | null, items: SessionInstance[]) => any): Promise<SessionInstance[]>;
193
+ list(params: SessionListInstanceOptions, callback?: (error: Error | null, items: SessionInstance[]) => any): Promise<SessionInstance[]>;
194
+ /**
195
+ * Retrieve a single page of SessionInstance records from the API.
196
+ *
197
+ * The request is executed immediately.
198
+ *
199
+ * If a function is passed as the first argument, it will be used as the callback
200
+ * function.
201
+ *
202
+ * @param { SessionListInstancePageOptions } [params] - Options for request
203
+ * @param { function } [callback] - Callback to handle list of records
204
+ */
205
+ page(callback?: (error: Error | null, items: SessionPage) => any): Promise<SessionPage>;
206
+ page(params: SessionListInstancePageOptions, callback?: (error: Error | null, items: SessionPage) => any): Promise<SessionPage>;
207
+ /**
208
+ * Provide a user-friendly representation
209
+ */
210
+ toJSON(): any;
211
+ [inspect.custom](_depth: any, options: InspectOptions): any;
212
+ }
213
+ export declare function SessionListInstance(version: V1): SessionListInstance;
214
+ export declare class SessionPage extends Page<V1, SessionPayload, SessionResource, SessionInstance> {
215
+ /**
216
+ * Initialize the SessionPage
217
+ *
218
+ * @param version - Version of the resource
219
+ * @param response - Response from the API
220
+ * @param solution - Path solution
221
+ */
222
+ constructor(version: V1, response: Response<string>, solution: SessionSolution);
223
+ /**
224
+ * Build an instance of SessionInstance
225
+ *
226
+ * @param payload - Payload response from the API
227
+ */
228
+ getInstance(payload: SessionResource): SessionInstance;
229
+ [inspect.custom](depth: any, options: InspectOptions): string;
230
+ }
231
+ export {};
@@ -0,0 +1,194 @@
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.SessionPage = exports.SessionListInstance = exports.SessionInstance = exports.SessionContextImpl = 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 message_1 = require("./session/message");
26
+ class SessionContextImpl {
27
+ constructor(_version, id) {
28
+ this._version = _version;
29
+ if (!(0, utility_1.isValidPathParam)(id)) {
30
+ throw new Error("Parameter 'id' is not valid.");
31
+ }
32
+ this._solution = { id };
33
+ this._uri = `/Sessions/${id}`;
34
+ }
35
+ get messages() {
36
+ this._messages =
37
+ this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.id);
38
+ return this._messages;
39
+ }
40
+ fetch(callback) {
41
+ const instance = this;
42
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
43
+ uri: instance._uri,
44
+ method: "get",
45
+ });
46
+ operationPromise = operationPromise.then((payload) => new SessionInstance(operationVersion, payload, instance._solution.id));
47
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
48
+ return operationPromise;
49
+ }
50
+ /**
51
+ * Provide a user-friendly representation
52
+ *
53
+ * @returns Object
54
+ */
55
+ toJSON() {
56
+ return this._solution;
57
+ }
58
+ [util_1.inspect.custom](_depth, options) {
59
+ return (0, util_1.inspect)(this.toJSON(), options);
60
+ }
61
+ }
62
+ exports.SessionContextImpl = SessionContextImpl;
63
+ class SessionInstance {
64
+ constructor(_version, payload, id) {
65
+ this._version = _version;
66
+ this.id = payload.id;
67
+ this.accountSid = payload.account_sid;
68
+ this.assistantId = payload.assistant_id;
69
+ this.verified = payload.verified;
70
+ this.identity = payload.identity;
71
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
72
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
73
+ this._solution = { id: id || this.id };
74
+ }
75
+ get _proxy() {
76
+ this._context =
77
+ this._context || new SessionContextImpl(this._version, this._solution.id);
78
+ return this._context;
79
+ }
80
+ /**
81
+ * Fetch a SessionInstance
82
+ *
83
+ * @param callback - Callback to handle processed record
84
+ *
85
+ * @returns Resolves to processed SessionInstance
86
+ */
87
+ fetch(callback) {
88
+ return this._proxy.fetch(callback);
89
+ }
90
+ /**
91
+ * Access the messages.
92
+ */
93
+ messages() {
94
+ return this._proxy.messages;
95
+ }
96
+ /**
97
+ * Provide a user-friendly representation
98
+ *
99
+ * @returns Object
100
+ */
101
+ toJSON() {
102
+ return {
103
+ id: this.id,
104
+ accountSid: this.accountSid,
105
+ assistantId: this.assistantId,
106
+ verified: this.verified,
107
+ identity: this.identity,
108
+ dateCreated: this.dateCreated,
109
+ dateUpdated: this.dateUpdated,
110
+ };
111
+ }
112
+ [util_1.inspect.custom](_depth, options) {
113
+ return (0, util_1.inspect)(this.toJSON(), options);
114
+ }
115
+ }
116
+ exports.SessionInstance = SessionInstance;
117
+ function SessionListInstance(version) {
118
+ const instance = ((id) => instance.get(id));
119
+ instance.get = function get(id) {
120
+ return new SessionContextImpl(version, id);
121
+ };
122
+ instance._version = version;
123
+ instance._solution = {};
124
+ instance._uri = `/Sessions`;
125
+ instance.page = function page(params, callback) {
126
+ if (params instanceof Function) {
127
+ callback = params;
128
+ params = {};
129
+ }
130
+ else {
131
+ params = params || {};
132
+ }
133
+ let data = {};
134
+ if (params["pageSize"] !== undefined)
135
+ data["PageSize"] = params["pageSize"];
136
+ if (params.pageNumber !== undefined)
137
+ data["Page"] = params.pageNumber;
138
+ if (params.pageToken !== undefined)
139
+ data["PageToken"] = params.pageToken;
140
+ const headers = {};
141
+ let operationVersion = version, operationPromise = operationVersion.page({
142
+ uri: instance._uri,
143
+ method: "get",
144
+ params: data,
145
+ headers,
146
+ });
147
+ operationPromise = operationPromise.then((payload) => new SessionPage(operationVersion, payload, instance._solution));
148
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
149
+ return operationPromise;
150
+ };
151
+ instance.each = instance._version.each;
152
+ instance.list = instance._version.list;
153
+ instance.getPage = function getPage(targetUrl, callback) {
154
+ const operationPromise = instance._version._domain.twilio.request({
155
+ method: "get",
156
+ uri: targetUrl,
157
+ });
158
+ let pagePromise = operationPromise.then((payload) => new SessionPage(instance._version, payload, instance._solution));
159
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
160
+ return pagePromise;
161
+ };
162
+ instance.toJSON = function toJSON() {
163
+ return instance._solution;
164
+ };
165
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
166
+ return (0, util_1.inspect)(instance.toJSON(), options);
167
+ };
168
+ return instance;
169
+ }
170
+ exports.SessionListInstance = SessionListInstance;
171
+ class SessionPage extends Page_1.default {
172
+ /**
173
+ * Initialize the SessionPage
174
+ *
175
+ * @param version - Version of the resource
176
+ * @param response - Response from the API
177
+ * @param solution - Path solution
178
+ */
179
+ constructor(version, response, solution) {
180
+ super(version, response, solution);
181
+ }
182
+ /**
183
+ * Build an instance of SessionInstance
184
+ *
185
+ * @param payload - Payload response from the API
186
+ */
187
+ getInstance(payload) {
188
+ return new SessionInstance(this._version, payload);
189
+ }
190
+ [util_1.inspect.custom](depth, options) {
191
+ return (0, util_1.inspect)(this.toJSON(), options);
192
+ }
193
+ }
194
+ exports.SessionPage = SessionPage;