twilio 4.7.1 → 4.7.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 (36) hide show
  1. package/lib/rest/content/V1.d.ts +5 -0
  2. package/lib/rest/content/V1.js +7 -0
  3. package/lib/rest/content/v1/legacyContent.d.ts +202 -0
  4. package/lib/rest/content/v1/legacyContent.js +138 -0
  5. package/lib/rest/flexApi/V1.d.ts +15 -0
  6. package/lib/rest/flexApi/V1.js +22 -0
  7. package/lib/rest/flexApi/v1/insightsAssessmentsComment.d.ts +255 -0
  8. package/lib/rest/flexApi/v1/insightsAssessmentsComment.js +198 -0
  9. package/lib/rest/flexApi/v1/insightsQuestionnaires.d.ts +357 -0
  10. package/lib/rest/flexApi/v1/insightsQuestionnaires.js +280 -0
  11. package/lib/rest/flexApi/v1/insightsQuestionnairesCategory.d.ts +111 -0
  12. package/lib/rest/flexApi/v1/insightsQuestionnairesCategory.js +68 -1
  13. package/lib/rest/flexApi/v1/insightsQuestionnairesQuestion.d.ts +129 -6
  14. package/lib/rest/flexApi/v1/insightsQuestionnairesQuestion.js +78 -13
  15. package/lib/rest/flexApi/v1/insightsSegments.d.ts +224 -0
  16. package/lib/rest/flexApi/v1/insightsSegments.js +154 -0
  17. package/lib/rest/flexApi/v1/insightsSession.d.ts +2 -2
  18. package/lib/rest/flexApi/v1/insightsSession.js +2 -2
  19. package/lib/rest/flexApi/v1/insightsUserRoles.d.ts +2 -2
  20. package/lib/rest/flexApi/v1/insightsUserRoles.js +2 -2
  21. package/lib/rest/lookups/v2/phoneNumber.d.ts +12 -0
  22. package/lib/rest/lookups/v2/phoneNumber.js +4 -0
  23. package/lib/rest/microvisor/V1.d.ts +10 -0
  24. package/lib/rest/microvisor/V1.js +14 -0
  25. package/lib/rest/microvisor/v1/accountConfig.d.ts +237 -0
  26. package/lib/rest/microvisor/v1/accountConfig.js +221 -0
  27. package/lib/rest/microvisor/v1/accountSecret.d.ts +231 -0
  28. package/lib/rest/microvisor/v1/accountSecret.js +219 -0
  29. package/lib/rest/microvisor/v1/device/deviceConfig.d.ts +245 -0
  30. package/lib/rest/microvisor/v1/device/deviceConfig.js +229 -0
  31. package/lib/rest/microvisor/v1/device/deviceSecret.d.ts +239 -0
  32. package/lib/rest/microvisor/v1/device/deviceSecret.js +227 -0
  33. package/lib/rest/microvisor/v1/device.d.ts +16 -0
  34. package/lib/rest/microvisor/v1/device.js +26 -0
  35. package/lib/rest/supersim/v1/smsCommand.d.ts +3 -3
  36. package/package.json +1 -1
@@ -0,0 +1,357 @@
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 remove a InsightsQuestionnairesInstance
8
+ */
9
+ export interface InsightsQuestionnairesContextRemoveOptions {
10
+ /** The Token HTTP request header */
11
+ token?: string;
12
+ }
13
+ /**
14
+ * Options to pass to fetch a InsightsQuestionnairesInstance
15
+ */
16
+ export interface InsightsQuestionnairesContextFetchOptions {
17
+ /** The Token HTTP request header */
18
+ token?: string;
19
+ }
20
+ /**
21
+ * Options to pass to update a InsightsQuestionnairesInstance
22
+ */
23
+ export interface InsightsQuestionnairesContextUpdateOptions {
24
+ /** The flag to enable or disable questionnaire */
25
+ active: boolean;
26
+ /** The Token HTTP request header */
27
+ token?: string;
28
+ /** The name of this questionnaire */
29
+ name?: string;
30
+ /** The description of this questionnaire */
31
+ description?: string;
32
+ /** The list of questions ids under a questionnaire */
33
+ questionIds?: Array<string>;
34
+ }
35
+ /**
36
+ * Options to pass to create a InsightsQuestionnairesInstance
37
+ */
38
+ export interface InsightsQuestionnairesListInstanceCreateOptions {
39
+ /** The name of this questionnaire */
40
+ name: string;
41
+ /** The Token HTTP request header */
42
+ token?: string;
43
+ /** The description of this questionnaire */
44
+ description?: string;
45
+ /** The flag to enable or disable questionnaire */
46
+ active?: boolean;
47
+ /** The list of questions ids under a questionnaire */
48
+ questionIds?: Array<string>;
49
+ }
50
+ /**
51
+ * Options to pass to each
52
+ */
53
+ export interface InsightsQuestionnairesListInstanceEachOptions {
54
+ /** The Token HTTP request header */
55
+ token?: string;
56
+ /** Flag indicating whether to include inactive questionnaires or not */
57
+ includeInactive?: boolean;
58
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
59
+ pageSize?: number;
60
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
61
+ callback?: (item: InsightsQuestionnairesInstance, done: (err?: Error) => void) => void;
62
+ /** Function to be called upon completion of streaming */
63
+ done?: Function;
64
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
65
+ limit?: number;
66
+ }
67
+ /**
68
+ * Options to pass to list
69
+ */
70
+ export interface InsightsQuestionnairesListInstanceOptions {
71
+ /** The Token HTTP request header */
72
+ token?: string;
73
+ /** Flag indicating whether to include inactive questionnaires or not */
74
+ includeInactive?: boolean;
75
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
76
+ pageSize?: number;
77
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
78
+ limit?: number;
79
+ }
80
+ /**
81
+ * Options to pass to page
82
+ */
83
+ export interface InsightsQuestionnairesListInstancePageOptions {
84
+ /** The Token HTTP request header */
85
+ token?: string;
86
+ /** Flag indicating whether to include inactive questionnaires or not */
87
+ includeInactive?: boolean;
88
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
89
+ pageSize?: number;
90
+ /** Page Number, this value is simply for client state */
91
+ pageNumber?: number;
92
+ /** PageToken provided by the API */
93
+ pageToken?: string;
94
+ }
95
+ export interface InsightsQuestionnairesContext {
96
+ /**
97
+ * Remove a InsightsQuestionnairesInstance
98
+ *
99
+ * @param callback - Callback to handle processed record
100
+ *
101
+ * @returns Resolves to processed boolean
102
+ */
103
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
104
+ /**
105
+ * Remove a InsightsQuestionnairesInstance
106
+ *
107
+ * @param params - Parameter for request
108
+ * @param callback - Callback to handle processed record
109
+ *
110
+ * @returns Resolves to processed InsightsQuestionnairesInstance
111
+ */
112
+ remove(params: InsightsQuestionnairesContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
113
+ /**
114
+ * Fetch a InsightsQuestionnairesInstance
115
+ *
116
+ * @param callback - Callback to handle processed record
117
+ *
118
+ * @returns Resolves to processed InsightsQuestionnairesInstance
119
+ */
120
+ fetch(callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
121
+ /**
122
+ * Fetch a InsightsQuestionnairesInstance
123
+ *
124
+ * @param params - Parameter for request
125
+ * @param callback - Callback to handle processed record
126
+ *
127
+ * @returns Resolves to processed InsightsQuestionnairesInstance
128
+ */
129
+ fetch(params: InsightsQuestionnairesContextFetchOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
130
+ /**
131
+ * Update a InsightsQuestionnairesInstance
132
+ *
133
+ * @param params - Parameter for request
134
+ * @param callback - Callback to handle processed record
135
+ *
136
+ * @returns Resolves to processed InsightsQuestionnairesInstance
137
+ */
138
+ update(params: InsightsQuestionnairesContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
139
+ /**
140
+ * Provide a user-friendly representation
141
+ */
142
+ toJSON(): any;
143
+ [inspect.custom](_depth: any, options: InspectOptions): any;
144
+ }
145
+ export interface InsightsQuestionnairesContextSolution {
146
+ id: string;
147
+ }
148
+ export declare class InsightsQuestionnairesContextImpl implements InsightsQuestionnairesContext {
149
+ protected _version: V1;
150
+ protected _solution: InsightsQuestionnairesContextSolution;
151
+ protected _uri: string;
152
+ constructor(_version: V1, id: string);
153
+ remove(params?: InsightsQuestionnairesContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
154
+ fetch(params?: InsightsQuestionnairesContextFetchOptions | ((error: Error | null, item?: InsightsQuestionnairesInstance) => any), callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
155
+ update(params: InsightsQuestionnairesContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
156
+ /**
157
+ * Provide a user-friendly representation
158
+ *
159
+ * @returns Object
160
+ */
161
+ toJSON(): InsightsQuestionnairesContextSolution;
162
+ [inspect.custom](_depth: any, options: InspectOptions): string;
163
+ }
164
+ interface InsightsQuestionnairesPayload extends TwilioResponsePayload {
165
+ questionnaires: InsightsQuestionnairesResource[];
166
+ }
167
+ interface InsightsQuestionnairesResource {
168
+ account_sid: string;
169
+ id: string;
170
+ name: string;
171
+ description: string;
172
+ active: boolean;
173
+ questions: Array<any>;
174
+ url: string;
175
+ }
176
+ export declare class InsightsQuestionnairesInstance {
177
+ protected _version: V1;
178
+ protected _solution: InsightsQuestionnairesContextSolution;
179
+ protected _context?: InsightsQuestionnairesContext;
180
+ constructor(_version: V1, payload: InsightsQuestionnairesResource, id?: string);
181
+ /**
182
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource.
183
+ */
184
+ accountSid: string;
185
+ /**
186
+ * The unique id of this questionnaire
187
+ */
188
+ id: string;
189
+ /**
190
+ * The name of this category.
191
+ */
192
+ name: string;
193
+ /**
194
+ * The description of this questionnaire
195
+ */
196
+ description: string;
197
+ /**
198
+ * The flag to enable or disable questionnaire
199
+ */
200
+ active: boolean;
201
+ /**
202
+ * The list of questions with category for a questionnaire
203
+ */
204
+ questions: Array<any>;
205
+ url: string;
206
+ private get _proxy();
207
+ /**
208
+ * Remove a InsightsQuestionnairesInstance
209
+ *
210
+ * @param callback - Callback to handle processed record
211
+ *
212
+ * @returns Resolves to processed boolean
213
+ */
214
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
215
+ /**
216
+ * Remove a InsightsQuestionnairesInstance
217
+ *
218
+ * @param params - Parameter for request
219
+ * @param callback - Callback to handle processed record
220
+ *
221
+ * @returns Resolves to processed InsightsQuestionnairesInstance
222
+ */
223
+ remove(params: InsightsQuestionnairesContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
224
+ /**
225
+ * Fetch a InsightsQuestionnairesInstance
226
+ *
227
+ * @param callback - Callback to handle processed record
228
+ *
229
+ * @returns Resolves to processed InsightsQuestionnairesInstance
230
+ */
231
+ fetch(callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
232
+ /**
233
+ * Fetch a InsightsQuestionnairesInstance
234
+ *
235
+ * @param params - Parameter for request
236
+ * @param callback - Callback to handle processed record
237
+ *
238
+ * @returns Resolves to processed InsightsQuestionnairesInstance
239
+ */
240
+ fetch(params: InsightsQuestionnairesContextFetchOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
241
+ /**
242
+ * Update a InsightsQuestionnairesInstance
243
+ *
244
+ * @param params - Parameter for request
245
+ * @param callback - Callback to handle processed record
246
+ *
247
+ * @returns Resolves to processed InsightsQuestionnairesInstance
248
+ */
249
+ update(params: InsightsQuestionnairesContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
250
+ /**
251
+ * Provide a user-friendly representation
252
+ *
253
+ * @returns Object
254
+ */
255
+ toJSON(): {
256
+ accountSid: string;
257
+ id: string;
258
+ name: string;
259
+ description: string;
260
+ active: boolean;
261
+ questions: any[];
262
+ url: string;
263
+ };
264
+ [inspect.custom](_depth: any, options: InspectOptions): string;
265
+ }
266
+ export interface InsightsQuestionnairesSolution {
267
+ }
268
+ export interface InsightsQuestionnairesListInstance {
269
+ _version: V1;
270
+ _solution: InsightsQuestionnairesSolution;
271
+ _uri: string;
272
+ (id: string): InsightsQuestionnairesContext;
273
+ get(id: string): InsightsQuestionnairesContext;
274
+ /**
275
+ * Create a InsightsQuestionnairesInstance
276
+ *
277
+ * @param params - Parameter for request
278
+ * @param callback - Callback to handle processed record
279
+ *
280
+ * @returns Resolves to processed InsightsQuestionnairesInstance
281
+ */
282
+ create(params: InsightsQuestionnairesListInstanceCreateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
283
+ /**
284
+ * Streams InsightsQuestionnairesInstance records from the API.
285
+ *
286
+ * This operation lazily loads records as efficiently as possible until the limit
287
+ * is reached.
288
+ *
289
+ * The results are passed into the callback function, so this operation is memory
290
+ * efficient.
291
+ *
292
+ * If a function is passed as the first argument, it will be used as the callback
293
+ * function.
294
+ *
295
+ * @param { InsightsQuestionnairesListInstanceEachOptions } [params] - Options for request
296
+ * @param { function } [callback] - Function to process each record
297
+ */
298
+ each(callback?: (item: InsightsQuestionnairesInstance, done: (err?: Error) => void) => void): void;
299
+ each(params: InsightsQuestionnairesListInstanceEachOptions, callback?: (item: InsightsQuestionnairesInstance, done: (err?: Error) => void) => void): void;
300
+ /**
301
+ * Retrieve a single target page of InsightsQuestionnairesInstance records from the API.
302
+ *
303
+ * The request is executed immediately.
304
+ *
305
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
306
+ * @param { function } [callback] - Callback to handle list of records
307
+ */
308
+ getPage(targetUrl: string, callback?: (error: Error | null, items: InsightsQuestionnairesPage) => any): Promise<InsightsQuestionnairesPage>;
309
+ /**
310
+ * Lists InsightsQuestionnairesInstance records from the API as a list.
311
+ *
312
+ * If a function is passed as the first argument, it will be used as the callback
313
+ * function.
314
+ *
315
+ * @param { InsightsQuestionnairesListInstanceOptions } [params] - Options for request
316
+ * @param { function } [callback] - Callback to handle list of records
317
+ */
318
+ list(callback?: (error: Error | null, items: InsightsQuestionnairesInstance[]) => any): Promise<InsightsQuestionnairesInstance[]>;
319
+ list(params: InsightsQuestionnairesListInstanceOptions, callback?: (error: Error | null, items: InsightsQuestionnairesInstance[]) => any): Promise<InsightsQuestionnairesInstance[]>;
320
+ /**
321
+ * Retrieve a single page of InsightsQuestionnairesInstance records from the API.
322
+ *
323
+ * The request is executed immediately.
324
+ *
325
+ * If a function is passed as the first argument, it will be used as the callback
326
+ * function.
327
+ *
328
+ * @param { InsightsQuestionnairesListInstancePageOptions } [params] - Options for request
329
+ * @param { function } [callback] - Callback to handle list of records
330
+ */
331
+ page(callback?: (error: Error | null, items: InsightsQuestionnairesPage) => any): Promise<InsightsQuestionnairesPage>;
332
+ page(params: InsightsQuestionnairesListInstancePageOptions, callback?: (error: Error | null, items: InsightsQuestionnairesPage) => any): Promise<InsightsQuestionnairesPage>;
333
+ /**
334
+ * Provide a user-friendly representation
335
+ */
336
+ toJSON(): any;
337
+ [inspect.custom](_depth: any, options: InspectOptions): any;
338
+ }
339
+ export declare function InsightsQuestionnairesListInstance(version: V1): InsightsQuestionnairesListInstance;
340
+ export declare class InsightsQuestionnairesPage extends Page<V1, InsightsQuestionnairesPayload, InsightsQuestionnairesResource, InsightsQuestionnairesInstance> {
341
+ /**
342
+ * Initialize the InsightsQuestionnairesPage
343
+ *
344
+ * @param version - Version of the resource
345
+ * @param response - Response from the API
346
+ * @param solution - Path solution
347
+ */
348
+ constructor(version: V1, response: Response<string>, solution: InsightsQuestionnairesSolution);
349
+ /**
350
+ * Build an instance of InsightsQuestionnairesInstance
351
+ *
352
+ * @param payload - Payload response from the API
353
+ */
354
+ getInstance(payload: InsightsQuestionnairesResource): InsightsQuestionnairesInstance;
355
+ [inspect.custom](depth: any, options: InspectOptions): string;
356
+ }
357
+ export {};
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Flex
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.InsightsQuestionnairesPage = exports.InsightsQuestionnairesListInstance = exports.InsightsQuestionnairesInstance = exports.InsightsQuestionnairesContextImpl = 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 InsightsQuestionnairesContextImpl {
26
+ constructor(_version, id) {
27
+ this._version = _version;
28
+ if (!(0, utility_1.isValidPathParam)(id)) {
29
+ throw new Error("Parameter 'id' is not valid.");
30
+ }
31
+ this._solution = { id };
32
+ this._uri = `/Insights/QM/Questionnaires/${id}`;
33
+ }
34
+ remove(params, callback) {
35
+ if (params instanceof Function) {
36
+ callback = params;
37
+ params = {};
38
+ }
39
+ else {
40
+ params = params || {};
41
+ }
42
+ let data = {};
43
+ const headers = {};
44
+ if (params["token"] !== undefined)
45
+ headers["Token"] = params["token"];
46
+ const instance = this;
47
+ let operationVersion = instance._version, operationPromise = operationVersion.remove({
48
+ uri: instance._uri,
49
+ method: "delete",
50
+ params: data,
51
+ headers,
52
+ });
53
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
54
+ return operationPromise;
55
+ }
56
+ fetch(params, callback) {
57
+ if (params instanceof Function) {
58
+ callback = params;
59
+ params = {};
60
+ }
61
+ else {
62
+ params = params || {};
63
+ }
64
+ let data = {};
65
+ const headers = {};
66
+ if (params["token"] !== undefined)
67
+ headers["Token"] = params["token"];
68
+ const instance = this;
69
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
70
+ uri: instance._uri,
71
+ method: "get",
72
+ params: data,
73
+ headers,
74
+ });
75
+ operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesInstance(operationVersion, payload, instance._solution.id));
76
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
77
+ return operationPromise;
78
+ }
79
+ update(params, callback) {
80
+ if (params === null || params === undefined) {
81
+ throw new Error('Required parameter "params" missing.');
82
+ }
83
+ if (params["active"] === null || params["active"] === undefined) {
84
+ throw new Error("Required parameter \"params['active']\" missing.");
85
+ }
86
+ let data = {};
87
+ data["Active"] = serialize.bool(params["active"]);
88
+ if (params["name"] !== undefined)
89
+ data["Name"] = params["name"];
90
+ if (params["description"] !== undefined)
91
+ data["Description"] = params["description"];
92
+ if (params["questionIds"] !== undefined)
93
+ data["QuestionIds"] = serialize.map(params["questionIds"], (e) => e);
94
+ const headers = {};
95
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
96
+ if (params["token"] !== undefined)
97
+ headers["Token"] = params["token"];
98
+ const instance = this;
99
+ let operationVersion = instance._version, operationPromise = operationVersion.update({
100
+ uri: instance._uri,
101
+ method: "post",
102
+ data,
103
+ headers,
104
+ });
105
+ operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesInstance(operationVersion, payload, instance._solution.id));
106
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
107
+ return operationPromise;
108
+ }
109
+ /**
110
+ * Provide a user-friendly representation
111
+ *
112
+ * @returns Object
113
+ */
114
+ toJSON() {
115
+ return this._solution;
116
+ }
117
+ [util_1.inspect.custom](_depth, options) {
118
+ return (0, util_1.inspect)(this.toJSON(), options);
119
+ }
120
+ }
121
+ exports.InsightsQuestionnairesContextImpl = InsightsQuestionnairesContextImpl;
122
+ class InsightsQuestionnairesInstance {
123
+ constructor(_version, payload, id) {
124
+ this._version = _version;
125
+ this.accountSid = payload.account_sid;
126
+ this.id = payload.id;
127
+ this.name = payload.name;
128
+ this.description = payload.description;
129
+ this.active = payload.active;
130
+ this.questions = payload.questions;
131
+ this.url = payload.url;
132
+ this._solution = { id: id || this.id };
133
+ }
134
+ get _proxy() {
135
+ this._context =
136
+ this._context ||
137
+ new InsightsQuestionnairesContextImpl(this._version, this._solution.id);
138
+ return this._context;
139
+ }
140
+ remove(params, callback) {
141
+ return this._proxy.remove(params, callback);
142
+ }
143
+ fetch(params, callback) {
144
+ return this._proxy.fetch(params, callback);
145
+ }
146
+ update(params, callback) {
147
+ return this._proxy.update(params, callback);
148
+ }
149
+ /**
150
+ * Provide a user-friendly representation
151
+ *
152
+ * @returns Object
153
+ */
154
+ toJSON() {
155
+ return {
156
+ accountSid: this.accountSid,
157
+ id: this.id,
158
+ name: this.name,
159
+ description: this.description,
160
+ active: this.active,
161
+ questions: this.questions,
162
+ url: this.url,
163
+ };
164
+ }
165
+ [util_1.inspect.custom](_depth, options) {
166
+ return (0, util_1.inspect)(this.toJSON(), options);
167
+ }
168
+ }
169
+ exports.InsightsQuestionnairesInstance = InsightsQuestionnairesInstance;
170
+ function InsightsQuestionnairesListInstance(version) {
171
+ const instance = ((id) => instance.get(id));
172
+ instance.get = function get(id) {
173
+ return new InsightsQuestionnairesContextImpl(version, id);
174
+ };
175
+ instance._version = version;
176
+ instance._solution = {};
177
+ instance._uri = `/Insights/QM/Questionnaires`;
178
+ instance.create = function create(params, callback) {
179
+ if (params === null || params === undefined) {
180
+ throw new Error('Required parameter "params" missing.');
181
+ }
182
+ if (params["name"] === null || params["name"] === undefined) {
183
+ throw new Error("Required parameter \"params['name']\" missing.");
184
+ }
185
+ let data = {};
186
+ data["Name"] = params["name"];
187
+ if (params["description"] !== undefined)
188
+ data["Description"] = params["description"];
189
+ if (params["active"] !== undefined)
190
+ data["Active"] = serialize.bool(params["active"]);
191
+ if (params["questionIds"] !== undefined)
192
+ data["QuestionIds"] = serialize.map(params["questionIds"], (e) => e);
193
+ const headers = {};
194
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
195
+ if (params["token"] !== undefined)
196
+ headers["Token"] = params["token"];
197
+ let operationVersion = version, operationPromise = operationVersion.create({
198
+ uri: instance._uri,
199
+ method: "post",
200
+ data,
201
+ headers,
202
+ });
203
+ operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesInstance(operationVersion, payload));
204
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
205
+ return operationPromise;
206
+ };
207
+ instance.page = function page(params, callback) {
208
+ if (params instanceof Function) {
209
+ callback = params;
210
+ params = {};
211
+ }
212
+ else {
213
+ params = params || {};
214
+ }
215
+ let data = {};
216
+ if (params["includeInactive"] !== undefined)
217
+ data["IncludeInactive"] = serialize.bool(params["includeInactive"]);
218
+ if (params["pageSize"] !== undefined)
219
+ data["PageSize"] = params["pageSize"];
220
+ if (params.pageNumber !== undefined)
221
+ data["Page"] = params.pageNumber;
222
+ if (params.pageToken !== undefined)
223
+ data["PageToken"] = params.pageToken;
224
+ const headers = {};
225
+ if (params["token"] !== undefined)
226
+ headers["Token"] = params["token"];
227
+ let operationVersion = version, operationPromise = operationVersion.page({
228
+ uri: instance._uri,
229
+ method: "get",
230
+ params: data,
231
+ headers,
232
+ });
233
+ operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesPage(operationVersion, payload, instance._solution));
234
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
235
+ return operationPromise;
236
+ };
237
+ instance.each = instance._version.each;
238
+ instance.list = instance._version.list;
239
+ instance.getPage = function getPage(targetUrl, callback) {
240
+ const operationPromise = instance._version._domain.twilio.request({
241
+ method: "get",
242
+ uri: targetUrl,
243
+ });
244
+ let pagePromise = operationPromise.then((payload) => new InsightsQuestionnairesPage(instance._version, payload, instance._solution));
245
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
246
+ return pagePromise;
247
+ };
248
+ instance.toJSON = function toJSON() {
249
+ return instance._solution;
250
+ };
251
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
252
+ return (0, util_1.inspect)(instance.toJSON(), options);
253
+ };
254
+ return instance;
255
+ }
256
+ exports.InsightsQuestionnairesListInstance = InsightsQuestionnairesListInstance;
257
+ class InsightsQuestionnairesPage extends Page_1.default {
258
+ /**
259
+ * Initialize the InsightsQuestionnairesPage
260
+ *
261
+ * @param version - Version of the resource
262
+ * @param response - Response from the API
263
+ * @param solution - Path solution
264
+ */
265
+ constructor(version, response, solution) {
266
+ super(version, response, solution);
267
+ }
268
+ /**
269
+ * Build an instance of InsightsQuestionnairesInstance
270
+ *
271
+ * @param payload - Payload response from the API
272
+ */
273
+ getInstance(payload) {
274
+ return new InsightsQuestionnairesInstance(this._version, payload);
275
+ }
276
+ [util_1.inspect.custom](depth, options) {
277
+ return (0, util_1.inspect)(this.toJSON(), options);
278
+ }
279
+ }
280
+ exports.InsightsQuestionnairesPage = InsightsQuestionnairesPage;