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,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
+ export declare class AssistantsV1ServiceCreateFeedbackRequest {
7
+ /**
8
+ * The message ID.
9
+ */
10
+ "messageId"?: string;
11
+ /**
12
+ * The score to be given(0-1).
13
+ */
14
+ "score"?: number;
15
+ /**
16
+ * The Session ID.
17
+ */
18
+ "sessionId": string;
19
+ /**
20
+ * The text to be given as feedback.
21
+ */
22
+ "text"?: string;
23
+ }
24
+ /**
25
+ * Options to pass to create a FeedbackInstance
26
+ */
27
+ export interface FeedbackListInstanceCreateOptions {
28
+ /** */
29
+ assistantsV1ServiceCreateFeedbackRequest: AssistantsV1ServiceCreateFeedbackRequest;
30
+ }
31
+ /**
32
+ * Options to pass to each
33
+ */
34
+ export interface FeedbackListInstanceEachOptions {
35
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
36
+ pageSize?: number;
37
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
38
+ callback?: (item: FeedbackInstance, done: (err?: Error) => void) => void;
39
+ /** Function to be called upon completion of streaming */
40
+ done?: Function;
41
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
42
+ limit?: number;
43
+ }
44
+ /**
45
+ * Options to pass to list
46
+ */
47
+ export interface FeedbackListInstanceOptions {
48
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
49
+ pageSize?: number;
50
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
51
+ limit?: number;
52
+ }
53
+ /**
54
+ * Options to pass to page
55
+ */
56
+ export interface FeedbackListInstancePageOptions {
57
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
58
+ pageSize?: number;
59
+ /** Page Number, this value is simply for client state */
60
+ pageNumber?: number;
61
+ /** PageToken provided by the API */
62
+ pageToken?: string;
63
+ }
64
+ export interface FeedbackSolution {
65
+ id: string;
66
+ }
67
+ export interface FeedbackListInstance {
68
+ _version: V1;
69
+ _solution: FeedbackSolution;
70
+ _uri: string;
71
+ /**
72
+ * Create a FeedbackInstance
73
+ *
74
+ * @param params - Body for request
75
+ * @param callback - Callback to handle processed record
76
+ *
77
+ * @returns Resolves to processed FeedbackInstance
78
+ */
79
+ create(params: AssistantsV1ServiceCreateFeedbackRequest, callback?: (error: Error | null, item?: FeedbackInstance) => any): Promise<FeedbackInstance>;
80
+ /**
81
+ * Streams FeedbackInstance records from the API.
82
+ *
83
+ * This operation lazily loads records as efficiently as possible until the limit
84
+ * is reached.
85
+ *
86
+ * The results are passed into the callback function, so this operation is memory
87
+ * efficient.
88
+ *
89
+ * If a function is passed as the first argument, it will be used as the callback
90
+ * function.
91
+ *
92
+ * @param { FeedbackListInstanceEachOptions } [params] - Options for request
93
+ * @param { function } [callback] - Function to process each record
94
+ */
95
+ each(callback?: (item: FeedbackInstance, done: (err?: Error) => void) => void): void;
96
+ each(params: FeedbackListInstanceEachOptions, callback?: (item: FeedbackInstance, done: (err?: Error) => void) => void): void;
97
+ /**
98
+ * Retrieve a single target page of FeedbackInstance records from the API.
99
+ *
100
+ * The request is executed immediately.
101
+ *
102
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
103
+ * @param { function } [callback] - Callback to handle list of records
104
+ */
105
+ getPage(targetUrl: string, callback?: (error: Error | null, items: FeedbackPage) => any): Promise<FeedbackPage>;
106
+ /**
107
+ * Lists FeedbackInstance records from the API as a list.
108
+ *
109
+ * If a function is passed as the first argument, it will be used as the callback
110
+ * function.
111
+ *
112
+ * @param { FeedbackListInstanceOptions } [params] - Options for request
113
+ * @param { function } [callback] - Callback to handle list of records
114
+ */
115
+ list(callback?: (error: Error | null, items: FeedbackInstance[]) => any): Promise<FeedbackInstance[]>;
116
+ list(params: FeedbackListInstanceOptions, callback?: (error: Error | null, items: FeedbackInstance[]) => any): Promise<FeedbackInstance[]>;
117
+ /**
118
+ * Retrieve a single page of FeedbackInstance records from the API.
119
+ *
120
+ * The request is executed immediately.
121
+ *
122
+ * If a function is passed as the first argument, it will be used as the callback
123
+ * function.
124
+ *
125
+ * @param { FeedbackListInstancePageOptions } [params] - Options for request
126
+ * @param { function } [callback] - Callback to handle list of records
127
+ */
128
+ page(callback?: (error: Error | null, items: FeedbackPage) => any): Promise<FeedbackPage>;
129
+ page(params: FeedbackListInstancePageOptions, callback?: (error: Error | null, items: FeedbackPage) => any): Promise<FeedbackPage>;
130
+ /**
131
+ * Provide a user-friendly representation
132
+ */
133
+ toJSON(): any;
134
+ [inspect.custom](_depth: any, options: InspectOptions): any;
135
+ }
136
+ export declare function FeedbackListInstance(version: V1, id: string): FeedbackListInstance;
137
+ interface FeedbackPayload extends TwilioResponsePayload {
138
+ feedbacks: FeedbackResource[];
139
+ }
140
+ interface FeedbackResource {
141
+ assistant_id: string;
142
+ id: string;
143
+ account_sid: string;
144
+ user_sid: string;
145
+ message_id: string;
146
+ score: number;
147
+ session_id: string;
148
+ text: string;
149
+ date_created: Date;
150
+ date_updated: Date;
151
+ }
152
+ export declare class FeedbackInstance {
153
+ protected _version: V1;
154
+ constructor(_version: V1, payload: FeedbackResource, id: string);
155
+ /**
156
+ * The Assistant ID.
157
+ */
158
+ assistantId: string;
159
+ /**
160
+ * The Feedback ID.
161
+ */
162
+ id: string;
163
+ /**
164
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Feedback.
165
+ */
166
+ accountSid: string;
167
+ /**
168
+ * The SID of the User created the Feedback.
169
+ */
170
+ userSid: string;
171
+ /**
172
+ * The Message ID.
173
+ */
174
+ messageId: string;
175
+ /**
176
+ * The Score to provide as Feedback (0-1)
177
+ */
178
+ score: number;
179
+ /**
180
+ * The Session ID.
181
+ */
182
+ sessionId: string;
183
+ /**
184
+ * The text to be given as feedback.
185
+ */
186
+ text: string;
187
+ /**
188
+ * The date and time in GMT when the Feedback was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
189
+ */
190
+ dateCreated: Date;
191
+ /**
192
+ * The date and time in GMT when the Feedback was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
193
+ */
194
+ dateUpdated: Date;
195
+ /**
196
+ * Provide a user-friendly representation
197
+ *
198
+ * @returns Object
199
+ */
200
+ toJSON(): {
201
+ assistantId: string;
202
+ id: string;
203
+ accountSid: string;
204
+ userSid: string;
205
+ messageId: string;
206
+ score: number;
207
+ sessionId: string;
208
+ text: string;
209
+ dateCreated: Date;
210
+ dateUpdated: Date;
211
+ };
212
+ [inspect.custom](_depth: any, options: InspectOptions): string;
213
+ }
214
+ export declare class FeedbackPage extends Page<V1, FeedbackPayload, FeedbackResource, FeedbackInstance> {
215
+ /**
216
+ * Initialize the FeedbackPage
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: FeedbackSolution);
223
+ /**
224
+ * Build an instance of FeedbackInstance
225
+ *
226
+ * @param payload - Payload response from the API
227
+ */
228
+ getInstance(payload: FeedbackResource): FeedbackInstance;
229
+ [inspect.custom](depth: any, options: InspectOptions): string;
230
+ }
231
+ export {};
@@ -0,0 +1,161 @@
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.FeedbackPage = exports.FeedbackInstance = exports.FeedbackListInstance = exports.AssistantsV1ServiceCreateFeedbackRequest = 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 AssistantsV1ServiceCreateFeedbackRequest {
26
+ }
27
+ exports.AssistantsV1ServiceCreateFeedbackRequest = AssistantsV1ServiceCreateFeedbackRequest;
28
+ function FeedbackListInstance(version, id) {
29
+ if (!(0, utility_1.isValidPathParam)(id)) {
30
+ throw new Error("Parameter 'id' is not valid.");
31
+ }
32
+ const instance = {};
33
+ instance._version = version;
34
+ instance._solution = { id };
35
+ instance._uri = `/Assistants/${id}/Feedbacks`;
36
+ instance.create = function create(params, callback) {
37
+ if (params === null || params === undefined) {
38
+ throw new Error('Required parameter "params" missing.');
39
+ }
40
+ let data = {};
41
+ data = params;
42
+ const headers = {};
43
+ headers["Content-Type"] = "application/json";
44
+ let operationVersion = version, operationPromise = operationVersion.create({
45
+ uri: instance._uri,
46
+ method: "post",
47
+ data,
48
+ headers,
49
+ });
50
+ operationPromise = operationPromise.then((payload) => new FeedbackInstance(operationVersion, payload, instance._solution.id));
51
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
52
+ return operationPromise;
53
+ };
54
+ instance.page = function page(params, callback) {
55
+ if (params instanceof Function) {
56
+ callback = params;
57
+ params = {};
58
+ }
59
+ else {
60
+ params = params || {};
61
+ }
62
+ let data = {};
63
+ if (params["pageSize"] !== undefined)
64
+ data["PageSize"] = params["pageSize"];
65
+ if (params.pageNumber !== undefined)
66
+ data["Page"] = params.pageNumber;
67
+ if (params.pageToken !== undefined)
68
+ data["PageToken"] = params.pageToken;
69
+ const headers = {};
70
+ let operationVersion = version, operationPromise = operationVersion.page({
71
+ uri: instance._uri,
72
+ method: "get",
73
+ params: data,
74
+ headers,
75
+ });
76
+ operationPromise = operationPromise.then((payload) => new FeedbackPage(operationVersion, payload, instance._solution));
77
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
78
+ return operationPromise;
79
+ };
80
+ instance.each = instance._version.each;
81
+ instance.list = instance._version.list;
82
+ instance.getPage = function getPage(targetUrl, callback) {
83
+ const operationPromise = instance._version._domain.twilio.request({
84
+ method: "get",
85
+ uri: targetUrl,
86
+ });
87
+ let pagePromise = operationPromise.then((payload) => new FeedbackPage(instance._version, payload, instance._solution));
88
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
89
+ return pagePromise;
90
+ };
91
+ instance.toJSON = function toJSON() {
92
+ return instance._solution;
93
+ };
94
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
95
+ return (0, util_1.inspect)(instance.toJSON(), options);
96
+ };
97
+ return instance;
98
+ }
99
+ exports.FeedbackListInstance = FeedbackListInstance;
100
+ class FeedbackInstance {
101
+ constructor(_version, payload, id) {
102
+ this._version = _version;
103
+ this.assistantId = payload.assistant_id;
104
+ this.id = payload.id;
105
+ this.accountSid = payload.account_sid;
106
+ this.userSid = payload.user_sid;
107
+ this.messageId = payload.message_id;
108
+ this.score = payload.score;
109
+ this.sessionId = payload.session_id;
110
+ this.text = payload.text;
111
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
112
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
113
+ }
114
+ /**
115
+ * Provide a user-friendly representation
116
+ *
117
+ * @returns Object
118
+ */
119
+ toJSON() {
120
+ return {
121
+ assistantId: this.assistantId,
122
+ id: this.id,
123
+ accountSid: this.accountSid,
124
+ userSid: this.userSid,
125
+ messageId: this.messageId,
126
+ score: this.score,
127
+ sessionId: this.sessionId,
128
+ text: this.text,
129
+ dateCreated: this.dateCreated,
130
+ dateUpdated: this.dateUpdated,
131
+ };
132
+ }
133
+ [util_1.inspect.custom](_depth, options) {
134
+ return (0, util_1.inspect)(this.toJSON(), options);
135
+ }
136
+ }
137
+ exports.FeedbackInstance = FeedbackInstance;
138
+ class FeedbackPage extends Page_1.default {
139
+ /**
140
+ * Initialize the FeedbackPage
141
+ *
142
+ * @param version - Version of the resource
143
+ * @param response - Response from the API
144
+ * @param solution - Path solution
145
+ */
146
+ constructor(version, response, solution) {
147
+ super(version, response, solution);
148
+ }
149
+ /**
150
+ * Build an instance of FeedbackInstance
151
+ *
152
+ * @param payload - Payload response from the API
153
+ */
154
+ getInstance(payload) {
155
+ return new FeedbackInstance(this._version, payload, this._solution.id);
156
+ }
157
+ [util_1.inspect.custom](depth, options) {
158
+ return (0, util_1.inspect)(this.toJSON(), options);
159
+ }
160
+ }
161
+ exports.FeedbackPage = FeedbackPage;
@@ -0,0 +1,112 @@
1
+ /// <reference types="node" />
2
+ import { inspect, InspectOptions } from "util";
3
+ import V1 from "../../V1";
4
+ export declare class AssistantsV1ServiceAssistantSendMessageRequest {
5
+ /**
6
+ * The unique identity of user for the session.
7
+ */
8
+ "identity": string;
9
+ /**
10
+ * The unique name for the session.
11
+ */
12
+ "sessionId"?: string;
13
+ /**
14
+ * The query to ask the assistant.
15
+ */
16
+ "body": string;
17
+ /**
18
+ * The webhook url to call after the assistant has generated a response or report an error.
19
+ */
20
+ "webhook"?: string;
21
+ /**
22
+ * one of the modes \'chat\', \'email\' or \'voice\'
23
+ */
24
+ "mode"?: string;
25
+ }
26
+ /**
27
+ * Options to pass to create a MessageInstance
28
+ */
29
+ export interface MessageListInstanceCreateOptions {
30
+ /** */
31
+ assistantsV1ServiceAssistantSendMessageRequest: AssistantsV1ServiceAssistantSendMessageRequest;
32
+ }
33
+ export interface MessageSolution {
34
+ id: string;
35
+ }
36
+ export interface MessageListInstance {
37
+ _version: V1;
38
+ _solution: MessageSolution;
39
+ _uri: string;
40
+ /**
41
+ * Create a MessageInstance
42
+ *
43
+ * @param params - Body for request
44
+ * @param callback - Callback to handle processed record
45
+ *
46
+ * @returns Resolves to processed MessageInstance
47
+ */
48
+ create(params: AssistantsV1ServiceAssistantSendMessageRequest, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>;
49
+ /**
50
+ * Provide a user-friendly representation
51
+ */
52
+ toJSON(): any;
53
+ [inspect.custom](_depth: any, options: InspectOptions): any;
54
+ }
55
+ export declare function MessageListInstance(version: V1, id: string): MessageListInstance;
56
+ interface MessageResource {
57
+ status: string;
58
+ flagged: boolean;
59
+ aborted: boolean;
60
+ session_id: string;
61
+ account_sid: string;
62
+ body: string;
63
+ error: string;
64
+ }
65
+ export declare class MessageInstance {
66
+ protected _version: V1;
67
+ constructor(_version: V1, payload: MessageResource, id: string);
68
+ /**
69
+ * success or failure based on whether the request successfully generated a response.
70
+ */
71
+ status: string;
72
+ /**
73
+ * If successful, this property will denote whether the response was flagged or not.
74
+ */
75
+ flagged: boolean;
76
+ /**
77
+ * This property will denote whether the request was aborted or not.
78
+ */
79
+ aborted: boolean;
80
+ /**
81
+ * The unique name for the session.
82
+ */
83
+ sessionId: string;
84
+ /**
85
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that sent the Message.
86
+ */
87
+ accountSid: string;
88
+ /**
89
+ * If successful, the body of the generated response
90
+ */
91
+ body: string;
92
+ /**
93
+ * The error message if generation was not successful
94
+ */
95
+ error: string;
96
+ /**
97
+ * Provide a user-friendly representation
98
+ *
99
+ * @returns Object
100
+ */
101
+ toJSON(): {
102
+ status: string;
103
+ flagged: boolean;
104
+ aborted: boolean;
105
+ sessionId: string;
106
+ accountSid: string;
107
+ body: string;
108
+ error: string;
109
+ };
110
+ [inspect.custom](_depth: any, options: InspectOptions): string;
111
+ }
112
+ export {};
@@ -0,0 +1,90 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.MessageInstance = exports.MessageListInstance = exports.AssistantsV1ServiceAssistantSendMessageRequest = void 0;
17
+ const util_1 = require("util");
18
+ const deserialize = require("../../../../base/deserialize");
19
+ const serialize = require("../../../../base/serialize");
20
+ const utility_1 = require("../../../../base/utility");
21
+ class AssistantsV1ServiceAssistantSendMessageRequest {
22
+ }
23
+ exports.AssistantsV1ServiceAssistantSendMessageRequest = AssistantsV1ServiceAssistantSendMessageRequest;
24
+ function MessageListInstance(version, id) {
25
+ if (!(0, utility_1.isValidPathParam)(id)) {
26
+ throw new Error("Parameter 'id' is not valid.");
27
+ }
28
+ const instance = {};
29
+ instance._version = version;
30
+ instance._solution = { id };
31
+ instance._uri = `/Assistants/${id}/Messages`;
32
+ instance.create = function create(params, callback) {
33
+ if (params === null || params === undefined) {
34
+ throw new Error('Required parameter "params" missing.');
35
+ }
36
+ let data = {};
37
+ data = params;
38
+ const headers = {};
39
+ headers["Content-Type"] = "application/json";
40
+ let operationVersion = version, operationPromise = operationVersion.create({
41
+ uri: instance._uri,
42
+ method: "post",
43
+ data,
44
+ headers,
45
+ });
46
+ operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.id));
47
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
48
+ return operationPromise;
49
+ };
50
+ instance.toJSON = function toJSON() {
51
+ return instance._solution;
52
+ };
53
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
54
+ return (0, util_1.inspect)(instance.toJSON(), options);
55
+ };
56
+ return instance;
57
+ }
58
+ exports.MessageListInstance = MessageListInstance;
59
+ class MessageInstance {
60
+ constructor(_version, payload, id) {
61
+ this._version = _version;
62
+ this.status = payload.status;
63
+ this.flagged = payload.flagged;
64
+ this.aborted = payload.aborted;
65
+ this.sessionId = payload.session_id;
66
+ this.accountSid = payload.account_sid;
67
+ this.body = payload.body;
68
+ this.error = payload.error;
69
+ }
70
+ /**
71
+ * Provide a user-friendly representation
72
+ *
73
+ * @returns Object
74
+ */
75
+ toJSON() {
76
+ return {
77
+ status: this.status,
78
+ flagged: this.flagged,
79
+ aborted: this.aborted,
80
+ sessionId: this.sessionId,
81
+ accountSid: this.accountSid,
82
+ body: this.body,
83
+ error: this.error,
84
+ };
85
+ }
86
+ [util_1.inspect.custom](_depth, options) {
87
+ return (0, util_1.inspect)(this.toJSON(), options);
88
+ }
89
+ }
90
+ exports.MessageInstance = MessageInstance;