twilio 5.3.2 → 5.3.3

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 (28) hide show
  1. package/lib/base/RequestClient.d.ts +1 -0
  2. package/lib/rest/PreviewBase.d.ts +0 -3
  3. package/lib/rest/PreviewBase.js +0 -6
  4. package/lib/rest/iam/V1.d.ts +5 -5
  5. package/lib/rest/iam/V1.js +5 -5
  6. package/lib/rest/iam/v1/{newApiKey.d.ts → key.d.ts} +14 -14
  7. package/lib/rest/iam/v1/{newApiKey.js → key.js} +6 -6
  8. package/lib/rest/numbers/v1/portingPortability.d.ts +2 -0
  9. package/lib/rest/numbers/v1/portingPortability.js +2 -0
  10. package/lib/rest/taskrouter/v1/workspace/task.d.ts +2 -2
  11. package/lib/rest/verify/v2/service/verification.d.ts +2 -0
  12. package/lib/rest/verify/v2/service/verification.js +2 -0
  13. package/lib/rest/verify/v2/service/verificationCheck.d.ts +2 -0
  14. package/lib/rest/verify/v2/service/verificationCheck.js +2 -0
  15. package/lib/webhooks/webhooks.d.ts +1 -0
  16. package/package.json +1 -1
  17. package/lib/rest/preview/DeployedDevices.d.ts +0 -15
  18. package/lib/rest/preview/DeployedDevices.js +0 -36
  19. package/lib/rest/preview/deployed_devices/fleet/certificate.d.ts +0 -324
  20. package/lib/rest/preview/deployed_devices/fleet/certificate.js +0 -269
  21. package/lib/rest/preview/deployed_devices/fleet/deployment.d.ts +0 -318
  22. package/lib/rest/preview/deployed_devices/fleet/deployment.js +0 -264
  23. package/lib/rest/preview/deployed_devices/fleet/device.d.ts +0 -358
  24. package/lib/rest/preview/deployed_devices/fleet/device.js +0 -284
  25. package/lib/rest/preview/deployed_devices/fleet/key.d.ts +0 -330
  26. package/lib/rest/preview/deployed_devices/fleet/key.js +0 -268
  27. package/lib/rest/preview/deployed_devices/fleet.d.ts +0 -352
  28. package/lib/rest/preview/deployed_devices/fleet.js +0 -307
@@ -1,358 +0,0 @@
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 DeployedDevices from "../../DeployedDevices";
6
- /**
7
- * Options to pass to update a DeviceInstance
8
- */
9
- export interface DeviceContextUpdateOptions {
10
- /** Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. */
11
- friendlyName?: string;
12
- /** Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. */
13
- identity?: string;
14
- /** Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. */
15
- deploymentSid?: string;
16
- /** */
17
- enabled?: boolean;
18
- }
19
- /**
20
- * Options to pass to create a DeviceInstance
21
- */
22
- export interface DeviceListInstanceCreateOptions {
23
- /** Provides a unique and addressable name to be assigned to this Device, to be used in addition to SID, up to 128 characters long. */
24
- uniqueName?: string;
25
- /** Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. */
26
- friendlyName?: string;
27
- /** Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. */
28
- identity?: string;
29
- /** Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. */
30
- deploymentSid?: string;
31
- /** */
32
- enabled?: boolean;
33
- }
34
- /**
35
- * Options to pass to each
36
- */
37
- export interface DeviceListInstanceEachOptions {
38
- /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */
39
- deploymentSid?: string;
40
- /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
41
- pageSize?: number;
42
- /** Function to process each record. If this and a positional callback are passed, this one will be used */
43
- callback?: (item: DeviceInstance, done: (err?: Error) => void) => void;
44
- /** Function to be called upon completion of streaming */
45
- done?: Function;
46
- /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
47
- limit?: number;
48
- }
49
- /**
50
- * Options to pass to list
51
- */
52
- export interface DeviceListInstanceOptions {
53
- /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */
54
- deploymentSid?: string;
55
- /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
56
- pageSize?: number;
57
- /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
58
- limit?: number;
59
- }
60
- /**
61
- * Options to pass to page
62
- */
63
- export interface DeviceListInstancePageOptions {
64
- /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */
65
- deploymentSid?: string;
66
- /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
67
- pageSize?: number;
68
- /** Page Number, this value is simply for client state */
69
- pageNumber?: number;
70
- /** PageToken provided by the API */
71
- pageToken?: string;
72
- }
73
- export interface DeviceContext {
74
- /**
75
- * Remove a DeviceInstance
76
- *
77
- * @param callback - Callback to handle processed record
78
- *
79
- * @returns Resolves to processed boolean
80
- */
81
- remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
82
- /**
83
- * Fetch a DeviceInstance
84
- *
85
- * @param callback - Callback to handle processed record
86
- *
87
- * @returns Resolves to processed DeviceInstance
88
- */
89
- fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
90
- /**
91
- * Update a DeviceInstance
92
- *
93
- * @param callback - Callback to handle processed record
94
- *
95
- * @returns Resolves to processed DeviceInstance
96
- */
97
- update(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
98
- /**
99
- * Update a DeviceInstance
100
- *
101
- * @param params - Parameter for request
102
- * @param callback - Callback to handle processed record
103
- *
104
- * @returns Resolves to processed DeviceInstance
105
- */
106
- update(params: DeviceContextUpdateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
107
- /**
108
- * Provide a user-friendly representation
109
- */
110
- toJSON(): any;
111
- [inspect.custom](_depth: any, options: InspectOptions): any;
112
- }
113
- export interface DeviceContextSolution {
114
- fleetSid: string;
115
- sid: string;
116
- }
117
- export declare class DeviceContextImpl implements DeviceContext {
118
- protected _version: DeployedDevices;
119
- protected _solution: DeviceContextSolution;
120
- protected _uri: string;
121
- constructor(_version: DeployedDevices, fleetSid: string, sid: string);
122
- remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
123
- fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
124
- update(params?: DeviceContextUpdateOptions | ((error: Error | null, item?: DeviceInstance) => any), callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
125
- /**
126
- * Provide a user-friendly representation
127
- *
128
- * @returns Object
129
- */
130
- toJSON(): DeviceContextSolution;
131
- [inspect.custom](_depth: any, options: InspectOptions): string;
132
- }
133
- interface DevicePayload extends TwilioResponsePayload {
134
- devices: DeviceResource[];
135
- }
136
- interface DeviceResource {
137
- sid: string;
138
- url: string;
139
- unique_name: string;
140
- friendly_name: string;
141
- fleet_sid: string;
142
- enabled: boolean;
143
- account_sid: string;
144
- identity: string;
145
- deployment_sid: string;
146
- date_created: Date;
147
- date_updated: Date;
148
- date_authenticated: Date;
149
- }
150
- export declare class DeviceInstance {
151
- protected _version: DeployedDevices;
152
- protected _solution: DeviceContextSolution;
153
- protected _context?: DeviceContext;
154
- constructor(_version: DeployedDevices, payload: DeviceResource, fleetSid: string, sid?: string);
155
- /**
156
- * Contains a 34 character string that uniquely identifies this Device resource.
157
- */
158
- sid: string;
159
- /**
160
- * Contains an absolute URL for this Device resource.
161
- */
162
- url: string;
163
- /**
164
- * Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long.
165
- */
166
- uniqueName: string;
167
- /**
168
- * Contains a human readable descriptive text for this Device, up to 256 characters long
169
- */
170
- friendlyName: string;
171
- /**
172
- * Specifies the unique string identifier of the Fleet that the given Device belongs to.
173
- */
174
- fleetSid: string;
175
- /**
176
- * Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false.
177
- */
178
- enabled: boolean;
179
- /**
180
- * Specifies the unique string identifier of the Account responsible for this Device.
181
- */
182
- accountSid: string;
183
- /**
184
- * Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long.
185
- */
186
- identity: string;
187
- /**
188
- * Specifies the unique string identifier of the Deployment group that this Device is associated with.
189
- */
190
- deploymentSid: string;
191
- /**
192
- * Specifies the date this Device was created, given in UTC ISO 8601 format.
193
- */
194
- dateCreated: Date;
195
- /**
196
- * Specifies the date this Device was last updated, given in UTC ISO 8601 format.
197
- */
198
- dateUpdated: Date;
199
- /**
200
- * Specifies the date this Device was last authenticated, given in UTC ISO 8601 format.
201
- */
202
- dateAuthenticated: Date;
203
- private get _proxy();
204
- /**
205
- * Remove a DeviceInstance
206
- *
207
- * @param callback - Callback to handle processed record
208
- *
209
- * @returns Resolves to processed boolean
210
- */
211
- remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
212
- /**
213
- * Fetch a DeviceInstance
214
- *
215
- * @param callback - Callback to handle processed record
216
- *
217
- * @returns Resolves to processed DeviceInstance
218
- */
219
- fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
220
- /**
221
- * Update a DeviceInstance
222
- *
223
- * @param callback - Callback to handle processed record
224
- *
225
- * @returns Resolves to processed DeviceInstance
226
- */
227
- update(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
228
- /**
229
- * Update a DeviceInstance
230
- *
231
- * @param params - Parameter for request
232
- * @param callback - Callback to handle processed record
233
- *
234
- * @returns Resolves to processed DeviceInstance
235
- */
236
- update(params: DeviceContextUpdateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
237
- /**
238
- * Provide a user-friendly representation
239
- *
240
- * @returns Object
241
- */
242
- toJSON(): {
243
- sid: string;
244
- url: string;
245
- uniqueName: string;
246
- friendlyName: string;
247
- fleetSid: string;
248
- enabled: boolean;
249
- accountSid: string;
250
- identity: string;
251
- deploymentSid: string;
252
- dateCreated: Date;
253
- dateUpdated: Date;
254
- dateAuthenticated: Date;
255
- };
256
- [inspect.custom](_depth: any, options: InspectOptions): string;
257
- }
258
- export interface DeviceSolution {
259
- fleetSid: string;
260
- }
261
- export interface DeviceListInstance {
262
- _version: DeployedDevices;
263
- _solution: DeviceSolution;
264
- _uri: string;
265
- (sid: string): DeviceContext;
266
- get(sid: string): DeviceContext;
267
- /**
268
- * Create a DeviceInstance
269
- *
270
- * @param callback - Callback to handle processed record
271
- *
272
- * @returns Resolves to processed DeviceInstance
273
- */
274
- create(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
275
- /**
276
- * Create a DeviceInstance
277
- *
278
- * @param params - Parameter for request
279
- * @param callback - Callback to handle processed record
280
- *
281
- * @returns Resolves to processed DeviceInstance
282
- */
283
- create(params: DeviceListInstanceCreateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>;
284
- /**
285
- * Streams DeviceInstance records from the API.
286
- *
287
- * This operation lazily loads records as efficiently as possible until the limit
288
- * is reached.
289
- *
290
- * The results are passed into the callback function, so this operation is memory
291
- * efficient.
292
- *
293
- * If a function is passed as the first argument, it will be used as the callback
294
- * function.
295
- *
296
- * @param { DeviceListInstanceEachOptions } [params] - Options for request
297
- * @param { function } [callback] - Function to process each record
298
- */
299
- each(callback?: (item: DeviceInstance, done: (err?: Error) => void) => void): void;
300
- each(params: DeviceListInstanceEachOptions, callback?: (item: DeviceInstance, done: (err?: Error) => void) => void): void;
301
- /**
302
- * Retrieve a single target page of DeviceInstance records from the API.
303
- *
304
- * The request is executed immediately.
305
- *
306
- * @param { string } [targetUrl] - API-generated URL for the requested results page
307
- * @param { function } [callback] - Callback to handle list of records
308
- */
309
- getPage(targetUrl: string, callback?: (error: Error | null, items: DevicePage) => any): Promise<DevicePage>;
310
- /**
311
- * Lists DeviceInstance records from the API as a list.
312
- *
313
- * If a function is passed as the first argument, it will be used as the callback
314
- * function.
315
- *
316
- * @param { DeviceListInstanceOptions } [params] - Options for request
317
- * @param { function } [callback] - Callback to handle list of records
318
- */
319
- list(callback?: (error: Error | null, items: DeviceInstance[]) => any): Promise<DeviceInstance[]>;
320
- list(params: DeviceListInstanceOptions, callback?: (error: Error | null, items: DeviceInstance[]) => any): Promise<DeviceInstance[]>;
321
- /**
322
- * Retrieve a single page of DeviceInstance records from the API.
323
- *
324
- * The request is executed immediately.
325
- *
326
- * If a function is passed as the first argument, it will be used as the callback
327
- * function.
328
- *
329
- * @param { DeviceListInstancePageOptions } [params] - Options for request
330
- * @param { function } [callback] - Callback to handle list of records
331
- */
332
- page(callback?: (error: Error | null, items: DevicePage) => any): Promise<DevicePage>;
333
- page(params: DeviceListInstancePageOptions, callback?: (error: Error | null, items: DevicePage) => any): Promise<DevicePage>;
334
- /**
335
- * Provide a user-friendly representation
336
- */
337
- toJSON(): any;
338
- [inspect.custom](_depth: any, options: InspectOptions): any;
339
- }
340
- export declare function DeviceListInstance(version: DeployedDevices, fleetSid: string): DeviceListInstance;
341
- export declare class DevicePage extends Page<DeployedDevices, DevicePayload, DeviceResource, DeviceInstance> {
342
- /**
343
- * Initialize the DevicePage
344
- *
345
- * @param version - Version of the resource
346
- * @param response - Response from the API
347
- * @param solution - Path solution
348
- */
349
- constructor(version: DeployedDevices, response: Response<string>, solution: DeviceSolution);
350
- /**
351
- * Build an instance of DeviceInstance
352
- *
353
- * @param payload - Payload response from the API
354
- */
355
- getInstance(payload: DeviceResource): DeviceInstance;
356
- [inspect.custom](depth: any, options: InspectOptions): string;
357
- }
358
- export {};
@@ -1,284 +0,0 @@
1
- "use strict";
2
- /*
3
- * This code was generated by
4
- * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
- * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
- * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
- *
8
- * Twilio - Preview
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.DevicePage = exports.DeviceListInstance = exports.DeviceInstance = exports.DeviceContextImpl = 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 DeviceContextImpl {
26
- constructor(_version, fleetSid, sid) {
27
- this._version = _version;
28
- if (!(0, utility_1.isValidPathParam)(fleetSid)) {
29
- throw new Error("Parameter 'fleetSid' is not valid.");
30
- }
31
- if (!(0, utility_1.isValidPathParam)(sid)) {
32
- throw new Error("Parameter 'sid' is not valid.");
33
- }
34
- this._solution = { fleetSid, sid };
35
- this._uri = `/Fleets/${fleetSid}/Devices/${sid}`;
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 DeviceInstance(operationVersion, payload, instance._solution.fleetSid, instance._solution.sid));
53
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
54
- return operationPromise;
55
- }
56
- update(params, callback) {
57
- if (params instanceof Function) {
58
- callback = params;
59
- params = {};
60
- }
61
- else {
62
- params = params || {};
63
- }
64
- let data = {};
65
- if (params["friendlyName"] !== undefined)
66
- data["FriendlyName"] = params["friendlyName"];
67
- if (params["identity"] !== undefined)
68
- data["Identity"] = params["identity"];
69
- if (params["deploymentSid"] !== undefined)
70
- data["DeploymentSid"] = params["deploymentSid"];
71
- if (params["enabled"] !== undefined)
72
- data["Enabled"] = serialize.bool(params["enabled"]);
73
- const headers = {};
74
- headers["Content-Type"] = "application/x-www-form-urlencoded";
75
- const instance = this;
76
- let operationVersion = instance._version, operationPromise = operationVersion.update({
77
- uri: instance._uri,
78
- method: "post",
79
- data,
80
- headers,
81
- });
82
- operationPromise = operationPromise.then((payload) => new DeviceInstance(operationVersion, payload, instance._solution.fleetSid, instance._solution.sid));
83
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
84
- return operationPromise;
85
- }
86
- /**
87
- * Provide a user-friendly representation
88
- *
89
- * @returns Object
90
- */
91
- toJSON() {
92
- return this._solution;
93
- }
94
- [util_1.inspect.custom](_depth, options) {
95
- return (0, util_1.inspect)(this.toJSON(), options);
96
- }
97
- }
98
- exports.DeviceContextImpl = DeviceContextImpl;
99
- class DeviceInstance {
100
- constructor(_version, payload, fleetSid, sid) {
101
- this._version = _version;
102
- this.sid = payload.sid;
103
- this.url = payload.url;
104
- this.uniqueName = payload.unique_name;
105
- this.friendlyName = payload.friendly_name;
106
- this.fleetSid = payload.fleet_sid;
107
- this.enabled = payload.enabled;
108
- this.accountSid = payload.account_sid;
109
- this.identity = payload.identity;
110
- this.deploymentSid = payload.deployment_sid;
111
- this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
112
- this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
113
- this.dateAuthenticated = deserialize.iso8601DateTime(payload.date_authenticated);
114
- this._solution = { fleetSid, sid: sid || this.sid };
115
- }
116
- get _proxy() {
117
- this._context =
118
- this._context ||
119
- new DeviceContextImpl(this._version, this._solution.fleetSid, this._solution.sid);
120
- return this._context;
121
- }
122
- /**
123
- * Remove a DeviceInstance
124
- *
125
- * @param callback - Callback to handle processed record
126
- *
127
- * @returns Resolves to processed boolean
128
- */
129
- remove(callback) {
130
- return this._proxy.remove(callback);
131
- }
132
- /**
133
- * Fetch a DeviceInstance
134
- *
135
- * @param callback - Callback to handle processed record
136
- *
137
- * @returns Resolves to processed DeviceInstance
138
- */
139
- fetch(callback) {
140
- return this._proxy.fetch(callback);
141
- }
142
- update(params, callback) {
143
- return this._proxy.update(params, callback);
144
- }
145
- /**
146
- * Provide a user-friendly representation
147
- *
148
- * @returns Object
149
- */
150
- toJSON() {
151
- return {
152
- sid: this.sid,
153
- url: this.url,
154
- uniqueName: this.uniqueName,
155
- friendlyName: this.friendlyName,
156
- fleetSid: this.fleetSid,
157
- enabled: this.enabled,
158
- accountSid: this.accountSid,
159
- identity: this.identity,
160
- deploymentSid: this.deploymentSid,
161
- dateCreated: this.dateCreated,
162
- dateUpdated: this.dateUpdated,
163
- dateAuthenticated: this.dateAuthenticated,
164
- };
165
- }
166
- [util_1.inspect.custom](_depth, options) {
167
- return (0, util_1.inspect)(this.toJSON(), options);
168
- }
169
- }
170
- exports.DeviceInstance = DeviceInstance;
171
- function DeviceListInstance(version, fleetSid) {
172
- if (!(0, utility_1.isValidPathParam)(fleetSid)) {
173
- throw new Error("Parameter 'fleetSid' is not valid.");
174
- }
175
- const instance = ((sid) => instance.get(sid));
176
- instance.get = function get(sid) {
177
- return new DeviceContextImpl(version, fleetSid, sid);
178
- };
179
- instance._version = version;
180
- instance._solution = { fleetSid };
181
- instance._uri = `/Fleets/${fleetSid}/Devices`;
182
- instance.create = function create(params, callback) {
183
- if (params instanceof Function) {
184
- callback = params;
185
- params = {};
186
- }
187
- else {
188
- params = params || {};
189
- }
190
- let data = {};
191
- if (params["uniqueName"] !== undefined)
192
- data["UniqueName"] = params["uniqueName"];
193
- if (params["friendlyName"] !== undefined)
194
- data["FriendlyName"] = params["friendlyName"];
195
- if (params["identity"] !== undefined)
196
- data["Identity"] = params["identity"];
197
- if (params["deploymentSid"] !== undefined)
198
- data["DeploymentSid"] = params["deploymentSid"];
199
- if (params["enabled"] !== undefined)
200
- data["Enabled"] = serialize.bool(params["enabled"]);
201
- const headers = {};
202
- headers["Content-Type"] = "application/x-www-form-urlencoded";
203
- let operationVersion = version, operationPromise = operationVersion.create({
204
- uri: instance._uri,
205
- method: "post",
206
- data,
207
- headers,
208
- });
209
- operationPromise = operationPromise.then((payload) => new DeviceInstance(operationVersion, payload, instance._solution.fleetSid));
210
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
211
- return operationPromise;
212
- };
213
- instance.page = function page(params, callback) {
214
- if (params instanceof Function) {
215
- callback = params;
216
- params = {};
217
- }
218
- else {
219
- params = params || {};
220
- }
221
- let data = {};
222
- if (params["deploymentSid"] !== undefined)
223
- data["DeploymentSid"] = params["deploymentSid"];
224
- if (params["pageSize"] !== undefined)
225
- data["PageSize"] = params["pageSize"];
226
- if (params.pageNumber !== undefined)
227
- data["Page"] = params.pageNumber;
228
- if (params.pageToken !== undefined)
229
- data["PageToken"] = params.pageToken;
230
- const headers = {};
231
- let operationVersion = version, operationPromise = operationVersion.page({
232
- uri: instance._uri,
233
- method: "get",
234
- params: data,
235
- headers,
236
- });
237
- operationPromise = operationPromise.then((payload) => new DevicePage(operationVersion, payload, instance._solution));
238
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
239
- return operationPromise;
240
- };
241
- instance.each = instance._version.each;
242
- instance.list = instance._version.list;
243
- instance.getPage = function getPage(targetUrl, callback) {
244
- const operationPromise = instance._version._domain.twilio.request({
245
- method: "get",
246
- uri: targetUrl,
247
- });
248
- let pagePromise = operationPromise.then((payload) => new DevicePage(instance._version, payload, instance._solution));
249
- pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
250
- return pagePromise;
251
- };
252
- instance.toJSON = function toJSON() {
253
- return instance._solution;
254
- };
255
- instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
256
- return (0, util_1.inspect)(instance.toJSON(), options);
257
- };
258
- return instance;
259
- }
260
- exports.DeviceListInstance = DeviceListInstance;
261
- class DevicePage extends Page_1.default {
262
- /**
263
- * Initialize the DevicePage
264
- *
265
- * @param version - Version of the resource
266
- * @param response - Response from the API
267
- * @param solution - Path solution
268
- */
269
- constructor(version, response, solution) {
270
- super(version, response, solution);
271
- }
272
- /**
273
- * Build an instance of DeviceInstance
274
- *
275
- * @param payload - Payload response from the API
276
- */
277
- getInstance(payload) {
278
- return new DeviceInstance(this._version, payload, this._solution.fleetSid);
279
- }
280
- [util_1.inspect.custom](depth, options) {
281
- return (0, util_1.inspect)(this.toJSON(), options);
282
- }
283
- }
284
- exports.DevicePage = DevicePage;