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,219 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Microvisor
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.AccountSecretPage = exports.AccountSecretListInstance = exports.AccountSecretInstance = exports.AccountSecretContextImpl = 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 AccountSecretContextImpl {
26
+ constructor(_version, key) {
27
+ this._version = _version;
28
+ if (!(0, utility_1.isValidPathParam)(key)) {
29
+ throw new Error("Parameter 'key' is not valid.");
30
+ }
31
+ this._solution = { key };
32
+ this._uri = `/Secrets/${key}`;
33
+ }
34
+ remove(callback) {
35
+ const instance = this;
36
+ let operationVersion = instance._version, operationPromise = operationVersion.remove({
37
+ uri: instance._uri,
38
+ method: "delete",
39
+ });
40
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
41
+ return operationPromise;
42
+ }
43
+ fetch(callback) {
44
+ const instance = this;
45
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
46
+ uri: instance._uri,
47
+ method: "get",
48
+ });
49
+ operationPromise = operationPromise.then((payload) => new AccountSecretInstance(operationVersion, payload, instance._solution.key));
50
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
51
+ return operationPromise;
52
+ }
53
+ /**
54
+ * Provide a user-friendly representation
55
+ *
56
+ * @returns Object
57
+ */
58
+ toJSON() {
59
+ return this._solution;
60
+ }
61
+ [util_1.inspect.custom](_depth, options) {
62
+ return (0, util_1.inspect)(this.toJSON(), options);
63
+ }
64
+ }
65
+ exports.AccountSecretContextImpl = AccountSecretContextImpl;
66
+ class AccountSecretInstance {
67
+ constructor(_version, payload, key) {
68
+ this._version = _version;
69
+ this.key = payload.key;
70
+ this.dateRotated = deserialize.iso8601DateTime(payload.date_rotated);
71
+ this.url = payload.url;
72
+ this._solution = { key: key || this.key };
73
+ }
74
+ get _proxy() {
75
+ this._context =
76
+ this._context ||
77
+ new AccountSecretContextImpl(this._version, this._solution.key);
78
+ return this._context;
79
+ }
80
+ /**
81
+ * Remove a AccountSecretInstance
82
+ *
83
+ * @param callback - Callback to handle processed record
84
+ *
85
+ * @returns Resolves to processed boolean
86
+ */
87
+ remove(callback) {
88
+ return this._proxy.remove(callback);
89
+ }
90
+ /**
91
+ * Fetch a AccountSecretInstance
92
+ *
93
+ * @param callback - Callback to handle processed record
94
+ *
95
+ * @returns Resolves to processed AccountSecretInstance
96
+ */
97
+ fetch(callback) {
98
+ return this._proxy.fetch(callback);
99
+ }
100
+ /**
101
+ * Provide a user-friendly representation
102
+ *
103
+ * @returns Object
104
+ */
105
+ toJSON() {
106
+ return {
107
+ key: this.key,
108
+ dateRotated: this.dateRotated,
109
+ url: this.url,
110
+ };
111
+ }
112
+ [util_1.inspect.custom](_depth, options) {
113
+ return (0, util_1.inspect)(this.toJSON(), options);
114
+ }
115
+ }
116
+ exports.AccountSecretInstance = AccountSecretInstance;
117
+ function AccountSecretListInstance(version) {
118
+ const instance = ((key) => instance.get(key));
119
+ instance.get = function get(key) {
120
+ return new AccountSecretContextImpl(version, key);
121
+ };
122
+ instance._version = version;
123
+ instance._solution = {};
124
+ instance._uri = `/Secrets`;
125
+ instance.create = function create(params, callback) {
126
+ if (params === null || params === undefined) {
127
+ throw new Error('Required parameter "params" missing.');
128
+ }
129
+ if (params["key"] === null || params["key"] === undefined) {
130
+ throw new Error("Required parameter \"params['key']\" missing.");
131
+ }
132
+ if (params["value"] === null || params["value"] === undefined) {
133
+ throw new Error("Required parameter \"params['value']\" missing.");
134
+ }
135
+ let data = {};
136
+ data["Key"] = params["key"];
137
+ data["Value"] = params["value"];
138
+ const headers = {};
139
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
140
+ let operationVersion = version, operationPromise = operationVersion.create({
141
+ uri: instance._uri,
142
+ method: "post",
143
+ data,
144
+ headers,
145
+ });
146
+ operationPromise = operationPromise.then((payload) => new AccountSecretInstance(operationVersion, payload));
147
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
148
+ return operationPromise;
149
+ };
150
+ instance.page = function page(params, callback) {
151
+ if (params instanceof Function) {
152
+ callback = params;
153
+ params = {};
154
+ }
155
+ else {
156
+ params = params || {};
157
+ }
158
+ let data = {};
159
+ if (params["pageSize"] !== undefined)
160
+ data["PageSize"] = params["pageSize"];
161
+ if (params.pageNumber !== undefined)
162
+ data["Page"] = params.pageNumber;
163
+ if (params.pageToken !== undefined)
164
+ data["PageToken"] = params.pageToken;
165
+ const headers = {};
166
+ let operationVersion = version, operationPromise = operationVersion.page({
167
+ uri: instance._uri,
168
+ method: "get",
169
+ params: data,
170
+ headers,
171
+ });
172
+ operationPromise = operationPromise.then((payload) => new AccountSecretPage(operationVersion, payload, instance._solution));
173
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
174
+ return operationPromise;
175
+ };
176
+ instance.each = instance._version.each;
177
+ instance.list = instance._version.list;
178
+ instance.getPage = function getPage(targetUrl, callback) {
179
+ const operationPromise = instance._version._domain.twilio.request({
180
+ method: "get",
181
+ uri: targetUrl,
182
+ });
183
+ let pagePromise = operationPromise.then((payload) => new AccountSecretPage(instance._version, payload, instance._solution));
184
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
185
+ return pagePromise;
186
+ };
187
+ instance.toJSON = function toJSON() {
188
+ return instance._solution;
189
+ };
190
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
191
+ return (0, util_1.inspect)(instance.toJSON(), options);
192
+ };
193
+ return instance;
194
+ }
195
+ exports.AccountSecretListInstance = AccountSecretListInstance;
196
+ class AccountSecretPage extends Page_1.default {
197
+ /**
198
+ * Initialize the AccountSecretPage
199
+ *
200
+ * @param version - Version of the resource
201
+ * @param response - Response from the API
202
+ * @param solution - Path solution
203
+ */
204
+ constructor(version, response, solution) {
205
+ super(version, response, solution);
206
+ }
207
+ /**
208
+ * Build an instance of AccountSecretInstance
209
+ *
210
+ * @param payload - Payload response from the API
211
+ */
212
+ getInstance(payload) {
213
+ return new AccountSecretInstance(this._version, payload);
214
+ }
215
+ [util_1.inspect.custom](depth, options) {
216
+ return (0, util_1.inspect)(this.toJSON(), options);
217
+ }
218
+ }
219
+ exports.AccountSecretPage = AccountSecretPage;
@@ -0,0 +1,245 @@
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 create a DeviceConfigInstance
8
+ */
9
+ export interface DeviceConfigListInstanceCreateOptions {
10
+ /** The config key; up to 100 characters. */
11
+ key: string;
12
+ /** The config value; up to 4096 characters. */
13
+ value: string;
14
+ }
15
+ /**
16
+ * Options to pass to each
17
+ */
18
+ export interface DeviceConfigListInstanceEachOptions {
19
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
20
+ pageSize?: number;
21
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
22
+ callback?: (item: DeviceConfigInstance, done: (err?: Error) => void) => void;
23
+ /** Function to be called upon completion of streaming */
24
+ done?: Function;
25
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
26
+ limit?: number;
27
+ }
28
+ /**
29
+ * Options to pass to list
30
+ */
31
+ export interface DeviceConfigListInstanceOptions {
32
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
33
+ pageSize?: number;
34
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
35
+ limit?: number;
36
+ }
37
+ /**
38
+ * Options to pass to page
39
+ */
40
+ export interface DeviceConfigListInstancePageOptions {
41
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
42
+ pageSize?: number;
43
+ /** Page Number, this value is simply for client state */
44
+ pageNumber?: number;
45
+ /** PageToken provided by the API */
46
+ pageToken?: string;
47
+ }
48
+ export interface DeviceConfigContext {
49
+ /**
50
+ * Remove a DeviceConfigInstance
51
+ *
52
+ * @param callback - Callback to handle processed record
53
+ *
54
+ * @returns Resolves to processed boolean
55
+ */
56
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
57
+ /**
58
+ * Fetch a DeviceConfigInstance
59
+ *
60
+ * @param callback - Callback to handle processed record
61
+ *
62
+ * @returns Resolves to processed DeviceConfigInstance
63
+ */
64
+ fetch(callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>;
65
+ /**
66
+ * Provide a user-friendly representation
67
+ */
68
+ toJSON(): any;
69
+ [inspect.custom](_depth: any, options: InspectOptions): any;
70
+ }
71
+ export interface DeviceConfigContextSolution {
72
+ deviceSid: string;
73
+ key: string;
74
+ }
75
+ export declare class DeviceConfigContextImpl implements DeviceConfigContext {
76
+ protected _version: V1;
77
+ protected _solution: DeviceConfigContextSolution;
78
+ protected _uri: string;
79
+ constructor(_version: V1, deviceSid: string, key: string);
80
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
81
+ fetch(callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>;
82
+ /**
83
+ * Provide a user-friendly representation
84
+ *
85
+ * @returns Object
86
+ */
87
+ toJSON(): DeviceConfigContextSolution;
88
+ [inspect.custom](_depth: any, options: InspectOptions): string;
89
+ }
90
+ interface DeviceConfigPayload extends TwilioResponsePayload {
91
+ configs: DeviceConfigResource[];
92
+ }
93
+ interface DeviceConfigResource {
94
+ device_sid: string;
95
+ key: string;
96
+ value: string;
97
+ date_updated: Date;
98
+ url: string;
99
+ }
100
+ export declare class DeviceConfigInstance {
101
+ protected _version: V1;
102
+ protected _solution: DeviceConfigContextSolution;
103
+ protected _context?: DeviceConfigContext;
104
+ constructor(_version: V1, payload: DeviceConfigResource, deviceSid: string, key?: string);
105
+ /**
106
+ * A 34-character string that uniquely identifies the parent Device.
107
+ */
108
+ deviceSid: string;
109
+ /**
110
+ * The config key; up to 100 characters.
111
+ */
112
+ key: string;
113
+ /**
114
+ * The config value; up to 4096 characters.
115
+ */
116
+ value: string;
117
+ dateUpdated: Date;
118
+ /**
119
+ * The absolute URL of the Config.
120
+ */
121
+ url: string;
122
+ private get _proxy();
123
+ /**
124
+ * Remove a DeviceConfigInstance
125
+ *
126
+ * @param callback - Callback to handle processed record
127
+ *
128
+ * @returns Resolves to processed boolean
129
+ */
130
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
131
+ /**
132
+ * Fetch a DeviceConfigInstance
133
+ *
134
+ * @param callback - Callback to handle processed record
135
+ *
136
+ * @returns Resolves to processed DeviceConfigInstance
137
+ */
138
+ fetch(callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>;
139
+ /**
140
+ * Provide a user-friendly representation
141
+ *
142
+ * @returns Object
143
+ */
144
+ toJSON(): {
145
+ deviceSid: string;
146
+ key: string;
147
+ value: string;
148
+ dateUpdated: Date;
149
+ url: string;
150
+ };
151
+ [inspect.custom](_depth: any, options: InspectOptions): string;
152
+ }
153
+ export interface DeviceConfigSolution {
154
+ deviceSid: string;
155
+ }
156
+ export interface DeviceConfigListInstance {
157
+ _version: V1;
158
+ _solution: DeviceConfigSolution;
159
+ _uri: string;
160
+ (key: string): DeviceConfigContext;
161
+ get(key: string): DeviceConfigContext;
162
+ /**
163
+ * Create a DeviceConfigInstance
164
+ *
165
+ * @param params - Parameter for request
166
+ * @param callback - Callback to handle processed record
167
+ *
168
+ * @returns Resolves to processed DeviceConfigInstance
169
+ */
170
+ create(params: DeviceConfigListInstanceCreateOptions, callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>;
171
+ /**
172
+ * Streams DeviceConfigInstance records from the API.
173
+ *
174
+ * This operation lazily loads records as efficiently as possible until the limit
175
+ * is reached.
176
+ *
177
+ * The results are passed into the callback function, so this operation is memory
178
+ * efficient.
179
+ *
180
+ * If a function is passed as the first argument, it will be used as the callback
181
+ * function.
182
+ *
183
+ * @param { DeviceConfigListInstanceEachOptions } [params] - Options for request
184
+ * @param { function } [callback] - Function to process each record
185
+ */
186
+ each(callback?: (item: DeviceConfigInstance, done: (err?: Error) => void) => void): void;
187
+ each(params: DeviceConfigListInstanceEachOptions, callback?: (item: DeviceConfigInstance, done: (err?: Error) => void) => void): void;
188
+ /**
189
+ * Retrieve a single target page of DeviceConfigInstance records from the API.
190
+ *
191
+ * The request is executed immediately.
192
+ *
193
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
194
+ * @param { function } [callback] - Callback to handle list of records
195
+ */
196
+ getPage(targetUrl: string, callback?: (error: Error | null, items: DeviceConfigPage) => any): Promise<DeviceConfigPage>;
197
+ /**
198
+ * Lists DeviceConfigInstance records from the API as a list.
199
+ *
200
+ * If a function is passed as the first argument, it will be used as the callback
201
+ * function.
202
+ *
203
+ * @param { DeviceConfigListInstanceOptions } [params] - Options for request
204
+ * @param { function } [callback] - Callback to handle list of records
205
+ */
206
+ list(callback?: (error: Error | null, items: DeviceConfigInstance[]) => any): Promise<DeviceConfigInstance[]>;
207
+ list(params: DeviceConfigListInstanceOptions, callback?: (error: Error | null, items: DeviceConfigInstance[]) => any): Promise<DeviceConfigInstance[]>;
208
+ /**
209
+ * Retrieve a single page of DeviceConfigInstance records from the API.
210
+ *
211
+ * The request is executed immediately.
212
+ *
213
+ * If a function is passed as the first argument, it will be used as the callback
214
+ * function.
215
+ *
216
+ * @param { DeviceConfigListInstancePageOptions } [params] - Options for request
217
+ * @param { function } [callback] - Callback to handle list of records
218
+ */
219
+ page(callback?: (error: Error | null, items: DeviceConfigPage) => any): Promise<DeviceConfigPage>;
220
+ page(params: DeviceConfigListInstancePageOptions, callback?: (error: Error | null, items: DeviceConfigPage) => any): Promise<DeviceConfigPage>;
221
+ /**
222
+ * Provide a user-friendly representation
223
+ */
224
+ toJSON(): any;
225
+ [inspect.custom](_depth: any, options: InspectOptions): any;
226
+ }
227
+ export declare function DeviceConfigListInstance(version: V1, deviceSid: string): DeviceConfigListInstance;
228
+ export declare class DeviceConfigPage extends Page<V1, DeviceConfigPayload, DeviceConfigResource, DeviceConfigInstance> {
229
+ /**
230
+ * Initialize the DeviceConfigPage
231
+ *
232
+ * @param version - Version of the resource
233
+ * @param response - Response from the API
234
+ * @param solution - Path solution
235
+ */
236
+ constructor(version: V1, response: Response<string>, solution: DeviceConfigSolution);
237
+ /**
238
+ * Build an instance of DeviceConfigInstance
239
+ *
240
+ * @param payload - Payload response from the API
241
+ */
242
+ getInstance(payload: DeviceConfigResource): DeviceConfigInstance;
243
+ [inspect.custom](depth: any, options: InspectOptions): string;
244
+ }
245
+ export {};
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Microvisor
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.DeviceConfigPage = exports.DeviceConfigListInstance = exports.DeviceConfigInstance = exports.DeviceConfigContextImpl = 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 DeviceConfigContextImpl {
26
+ constructor(_version, deviceSid, key) {
27
+ this._version = _version;
28
+ if (!(0, utility_1.isValidPathParam)(deviceSid)) {
29
+ throw new Error("Parameter 'deviceSid' is not valid.");
30
+ }
31
+ if (!(0, utility_1.isValidPathParam)(key)) {
32
+ throw new Error("Parameter 'key' is not valid.");
33
+ }
34
+ this._solution = { deviceSid, key };
35
+ this._uri = `/Devices/${deviceSid}/Configs/${key}`;
36
+ }
37
+ remove(callback) {
38
+ const instance = this;
39
+ let operationVersion = instance._version, operationPromise = operationVersion.remove({
40
+ uri: instance._uri,
41
+ method: "delete",
42
+ });
43
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
44
+ return operationPromise;
45
+ }
46
+ fetch(callback) {
47
+ const instance = this;
48
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
49
+ uri: instance._uri,
50
+ method: "get",
51
+ });
52
+ operationPromise = operationPromise.then((payload) => new DeviceConfigInstance(operationVersion, payload, instance._solution.deviceSid, instance._solution.key));
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.DeviceConfigContextImpl = DeviceConfigContextImpl;
69
+ class DeviceConfigInstance {
70
+ constructor(_version, payload, deviceSid, key) {
71
+ this._version = _version;
72
+ this.deviceSid = payload.device_sid;
73
+ this.key = payload.key;
74
+ this.value = payload.value;
75
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
76
+ this.url = payload.url;
77
+ this._solution = { deviceSid, key: key || this.key };
78
+ }
79
+ get _proxy() {
80
+ this._context =
81
+ this._context ||
82
+ new DeviceConfigContextImpl(this._version, this._solution.deviceSid, this._solution.key);
83
+ return this._context;
84
+ }
85
+ /**
86
+ * Remove a DeviceConfigInstance
87
+ *
88
+ * @param callback - Callback to handle processed record
89
+ *
90
+ * @returns Resolves to processed boolean
91
+ */
92
+ remove(callback) {
93
+ return this._proxy.remove(callback);
94
+ }
95
+ /**
96
+ * Fetch a DeviceConfigInstance
97
+ *
98
+ * @param callback - Callback to handle processed record
99
+ *
100
+ * @returns Resolves to processed DeviceConfigInstance
101
+ */
102
+ fetch(callback) {
103
+ return this._proxy.fetch(callback);
104
+ }
105
+ /**
106
+ * Provide a user-friendly representation
107
+ *
108
+ * @returns Object
109
+ */
110
+ toJSON() {
111
+ return {
112
+ deviceSid: this.deviceSid,
113
+ key: this.key,
114
+ value: this.value,
115
+ dateUpdated: this.dateUpdated,
116
+ url: this.url,
117
+ };
118
+ }
119
+ [util_1.inspect.custom](_depth, options) {
120
+ return (0, util_1.inspect)(this.toJSON(), options);
121
+ }
122
+ }
123
+ exports.DeviceConfigInstance = DeviceConfigInstance;
124
+ function DeviceConfigListInstance(version, deviceSid) {
125
+ if (!(0, utility_1.isValidPathParam)(deviceSid)) {
126
+ throw new Error("Parameter 'deviceSid' is not valid.");
127
+ }
128
+ const instance = ((key) => instance.get(key));
129
+ instance.get = function get(key) {
130
+ return new DeviceConfigContextImpl(version, deviceSid, key);
131
+ };
132
+ instance._version = version;
133
+ instance._solution = { deviceSid };
134
+ instance._uri = `/Devices/${deviceSid}/Configs`;
135
+ instance.create = function create(params, callback) {
136
+ if (params === null || params === undefined) {
137
+ throw new Error('Required parameter "params" missing.');
138
+ }
139
+ if (params["key"] === null || params["key"] === undefined) {
140
+ throw new Error("Required parameter \"params['key']\" missing.");
141
+ }
142
+ if (params["value"] === null || params["value"] === undefined) {
143
+ throw new Error("Required parameter \"params['value']\" missing.");
144
+ }
145
+ let data = {};
146
+ data["Key"] = params["key"];
147
+ data["Value"] = params["value"];
148
+ const headers = {};
149
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
150
+ let operationVersion = version, operationPromise = operationVersion.create({
151
+ uri: instance._uri,
152
+ method: "post",
153
+ data,
154
+ headers,
155
+ });
156
+ operationPromise = operationPromise.then((payload) => new DeviceConfigInstance(operationVersion, payload, instance._solution.deviceSid));
157
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
158
+ return operationPromise;
159
+ };
160
+ instance.page = function page(params, callback) {
161
+ if (params instanceof Function) {
162
+ callback = params;
163
+ params = {};
164
+ }
165
+ else {
166
+ params = params || {};
167
+ }
168
+ let data = {};
169
+ if (params["pageSize"] !== undefined)
170
+ data["PageSize"] = params["pageSize"];
171
+ if (params.pageNumber !== undefined)
172
+ data["Page"] = params.pageNumber;
173
+ if (params.pageToken !== undefined)
174
+ data["PageToken"] = params.pageToken;
175
+ const headers = {};
176
+ let operationVersion = version, operationPromise = operationVersion.page({
177
+ uri: instance._uri,
178
+ method: "get",
179
+ params: data,
180
+ headers,
181
+ });
182
+ operationPromise = operationPromise.then((payload) => new DeviceConfigPage(operationVersion, payload, instance._solution));
183
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
184
+ return operationPromise;
185
+ };
186
+ instance.each = instance._version.each;
187
+ instance.list = instance._version.list;
188
+ instance.getPage = function getPage(targetUrl, callback) {
189
+ const operationPromise = instance._version._domain.twilio.request({
190
+ method: "get",
191
+ uri: targetUrl,
192
+ });
193
+ let pagePromise = operationPromise.then((payload) => new DeviceConfigPage(instance._version, payload, instance._solution));
194
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
195
+ return pagePromise;
196
+ };
197
+ instance.toJSON = function toJSON() {
198
+ return instance._solution;
199
+ };
200
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
201
+ return (0, util_1.inspect)(instance.toJSON(), options);
202
+ };
203
+ return instance;
204
+ }
205
+ exports.DeviceConfigListInstance = DeviceConfigListInstance;
206
+ class DeviceConfigPage extends Page_1.default {
207
+ /**
208
+ * Initialize the DeviceConfigPage
209
+ *
210
+ * @param version - Version of the resource
211
+ * @param response - Response from the API
212
+ * @param solution - Path solution
213
+ */
214
+ constructor(version, response, solution) {
215
+ super(version, response, solution);
216
+ }
217
+ /**
218
+ * Build an instance of DeviceConfigInstance
219
+ *
220
+ * @param payload - Payload response from the API
221
+ */
222
+ getInstance(payload) {
223
+ return new DeviceConfigInstance(this._version, payload, this._solution.deviceSid);
224
+ }
225
+ [util_1.inspect.custom](depth, options) {
226
+ return (0, util_1.inspect)(this.toJSON(), options);
227
+ }
228
+ }
229
+ exports.DeviceConfigPage = DeviceConfigPage;