particle-api-js 12.0.0 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/particle.min.js +1 -1
- package/dist/particle.min.js.map +1 -1
- package/lib/package.json +2 -1
- package/lib/src/Agent.d.ts +4 -2
- package/lib/src/Agent.d.ts.map +1 -1
- package/lib/src/Agent.js +7 -2
- package/lib/src/Agent.js.map +1 -1
- package/lib/src/EventStream.d.ts +3 -1
- package/lib/src/EventStream.d.ts.map +1 -1
- package/lib/src/EventStream.js +8 -3
- package/lib/src/EventStream.js.map +1 -1
- package/lib/src/Particle.d.ts +272 -552
- package/lib/src/Particle.d.ts.map +1 -1
- package/lib/src/Particle.js +120 -336
- package/lib/src/Particle.js.map +1 -1
- package/lib/src/types/common.d.ts +2 -0
- package/lib/src/types/common.d.ts.map +1 -1
- package/lib/src/types/requests.d.ts +0 -99
- package/lib/src/types/requests.d.ts.map +1 -1
- package/lib/src/types/responses.d.ts +0 -23
- package/lib/src/types/responses.d.ts.map +1 -1
- package/package.json +2 -1
package/lib/src/Particle.js
CHANGED
|
@@ -25,6 +25,7 @@ class Particle {
|
|
|
25
25
|
* @param {string} [options.clientId]
|
|
26
26
|
* @param {number} [options.tokenDuration]
|
|
27
27
|
* @param {string} [options.auth] The access token. If not specified here, will have to be added to every request
|
|
28
|
+
* @param {HttpAgent} [options.httpAgent] The http.Agent to use for requests (e.g. an https-proxy-agent instance for corporate proxies)
|
|
28
29
|
*/
|
|
29
30
|
constructor(options = {}) {
|
|
30
31
|
if (options.auth) {
|
|
@@ -32,19 +33,20 @@ class Particle {
|
|
|
32
33
|
}
|
|
33
34
|
Object.assign(this, Defaults, options);
|
|
34
35
|
this.context = {};
|
|
35
|
-
this.agent = new Agent(this.baseUrl);
|
|
36
|
+
this.agent = new Agent(this.baseUrl, options.httpAgent);
|
|
37
|
+
this.httpAgent = options.httpAgent;
|
|
36
38
|
}
|
|
37
39
|
_isValidContext(name, context) {
|
|
38
40
|
return (name === 'tool' || name === 'project') && context !== undefined;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
|
-
* @typedef {Object} ToolContext
|
|
43
|
+
* @typedef {Object} T.ToolContext
|
|
42
44
|
* @property {string} name
|
|
43
45
|
* @property {string | number} [version]
|
|
44
|
-
* @property {Omit<ToolContext, 'components'>[]} [components]
|
|
46
|
+
* @property {Omit<T.ToolContext, 'components'>[]} [components]
|
|
45
47
|
*/
|
|
46
48
|
/**
|
|
47
|
-
* @typedef {Record<string, string | number>} ProjectContext
|
|
49
|
+
* @typedef {Record<string, string | number>} T.ProjectContext
|
|
48
50
|
* @property {string} name
|
|
49
51
|
*/
|
|
50
52
|
/** @internal */
|
|
@@ -74,7 +76,7 @@ class Particle {
|
|
|
74
76
|
* @param {Number} options.tokenDuration How long the access token should last in seconds
|
|
75
77
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
76
78
|
* @param {Number} [options.context] Request context
|
|
77
|
-
* @returns {Promise<JSONResponse<LoginResponse>>} A promise that resolves with the response data
|
|
79
|
+
* @returns {Promise<T.JSONResponse<T.LoginResponse>>} A promise that resolves with the response data
|
|
78
80
|
*/
|
|
79
81
|
login({ username, password, tokenDuration = this.tokenDuration, headers, context }) {
|
|
80
82
|
return this.request({
|
|
@@ -99,7 +101,7 @@ class Particle {
|
|
|
99
101
|
* @param {String} options.otp Current one-time-password generated from the authentication application
|
|
100
102
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
101
103
|
* @param {Number} [options.context] Request context
|
|
102
|
-
* @returns {Promise<JSONResponse<LoginResponse>>} A promise that resolves with the response data
|
|
104
|
+
* @returns {Promise<T.JSONResponse<T.LoginResponse>>} A promise that resolves with the response data
|
|
103
105
|
*/
|
|
104
106
|
sendOtp({ mfaToken, otp, headers, context }) {
|
|
105
107
|
return this.request({
|
|
@@ -122,7 +124,7 @@ class Particle {
|
|
|
122
124
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
123
125
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
124
126
|
* @param {Object} [options.context] Request context
|
|
125
|
-
* @returns {Promise<JSONResponse<EnableMfaResponse>>} A promise that resolves with the response data
|
|
127
|
+
* @returns {Promise<T.JSONResponse<T.EnableMfaResponse>>} A promise that resolves with the response data
|
|
126
128
|
*/
|
|
127
129
|
enableMfa({ auth, headers, context }) {
|
|
128
130
|
return this.get({ uri: '/v1/user/mfa-enable', auth, headers, context });
|
|
@@ -136,7 +138,7 @@ class Particle {
|
|
|
136
138
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
137
139
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
138
140
|
* @param {Object} [options.context] Request context
|
|
139
|
-
* @returns {Promise<JSONResponse<ConfirmMfaResponse>>} A promise that resolves with the response data
|
|
141
|
+
* @returns {Promise<T.JSONResponse<T.ConfirmMfaResponse>>} A promise that resolves with the response data
|
|
140
142
|
*/
|
|
141
143
|
confirmMfa({ mfaToken, otp, invalidateTokens = false, auth, headers, context }) {
|
|
142
144
|
const data = { mfa_token: mfaToken, otp };
|
|
@@ -158,7 +160,7 @@ class Particle {
|
|
|
158
160
|
* @param {Object} options.currentPassword User's current password
|
|
159
161
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
160
162
|
* @param {Object} [options.context] Request context
|
|
161
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
163
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
162
164
|
*/
|
|
163
165
|
disableMfa({ currentPassword, auth, headers, context }) {
|
|
164
166
|
return this.put({
|
|
@@ -177,7 +179,7 @@ class Particle {
|
|
|
177
179
|
* @param {String} options.product Create the customer in this product ID or slug
|
|
178
180
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
179
181
|
* @param {Object} [options.context] Request context
|
|
180
|
-
* @returns {Promise<JSONResponse<CreateCustomerResponse>>} A promise that resolves with the response data
|
|
182
|
+
* @returns {Promise<T.JSONResponse<T.CreateCustomerResponse>>} A promise that resolves with the response data
|
|
181
183
|
*/
|
|
182
184
|
createCustomer({ email, password, product, headers, context }) {
|
|
183
185
|
return this.request({
|
|
@@ -199,7 +201,7 @@ class Particle {
|
|
|
199
201
|
* @param {Object} options Options for this API call
|
|
200
202
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
201
203
|
* @param {Object} [options.context] Request context
|
|
202
|
-
* @returns {Promise<JSONResponse<LoginResponse>>} A promise that resolves with the response data
|
|
204
|
+
* @returns {Promise<T.JSONResponse<T.LoginResponse>>} A promise that resolves with the response data
|
|
203
205
|
*/
|
|
204
206
|
loginAsClientOwner({ headers, context } = {}) {
|
|
205
207
|
return this.request({
|
|
@@ -223,7 +225,7 @@ class Particle {
|
|
|
223
225
|
* @param {Object} [options.utm] Object that contains info about the campaign that lead to this user creation
|
|
224
226
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
225
227
|
* @param {Object} [options.context] Request context
|
|
226
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
228
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
227
229
|
*/
|
|
228
230
|
createUser({ username, password, accountInfo, utm, headers, context }) {
|
|
229
231
|
return this.post({
|
|
@@ -244,7 +246,7 @@ class Particle {
|
|
|
244
246
|
* @param {String} options.username Email of the user
|
|
245
247
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
246
248
|
* @param {Object} [options.context] Request context
|
|
247
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
249
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
248
250
|
*/
|
|
249
251
|
resetPassword({ username, headers, context }) {
|
|
250
252
|
return this.post({
|
|
@@ -260,7 +262,7 @@ class Particle {
|
|
|
260
262
|
* @param {String} options.token Access token you wish to revoke
|
|
261
263
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
262
264
|
* @param {Object} [options.context] Request context
|
|
263
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
265
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
264
266
|
*/
|
|
265
267
|
deleteAccessToken({ token, headers, context }) {
|
|
266
268
|
return this.delete({
|
|
@@ -275,7 +277,7 @@ class Particle {
|
|
|
275
277
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
276
278
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
277
279
|
* @param {Object} [options.context] Request context
|
|
278
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
280
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
279
281
|
*/
|
|
280
282
|
deleteCurrentAccessToken({ auth, headers, context }) {
|
|
281
283
|
return this.delete({
|
|
@@ -291,7 +293,7 @@ class Particle {
|
|
|
291
293
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
292
294
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
293
295
|
* @param {Object} [options.context] Request context
|
|
294
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
296
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
295
297
|
*/
|
|
296
298
|
deleteActiveAccessTokens({ auth, headers, context }) {
|
|
297
299
|
return this.delete({
|
|
@@ -308,7 +310,7 @@ class Particle {
|
|
|
308
310
|
* @param {String} options.password Password
|
|
309
311
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
310
312
|
* @param {Object} [options.context] Request context
|
|
311
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
313
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
312
314
|
*/
|
|
313
315
|
deleteUser({ auth, password, headers, context }) {
|
|
314
316
|
return this.delete({
|
|
@@ -327,7 +329,7 @@ class Particle {
|
|
|
327
329
|
* retrieve only the unique tracking ID for the current login.
|
|
328
330
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
329
331
|
* @param {Object} [options.context] Request context
|
|
330
|
-
* @returns {Promise<JSONResponse<TrackingIdentityResponse>>} A promise that resolves with the response data
|
|
332
|
+
* @returns {Promise<T.JSONResponse<T.TrackingIdentityResponse>>} A promise that resolves with the response data
|
|
331
333
|
*/
|
|
332
334
|
trackingIdentity({ full = false, auth, headers, context } = {}) {
|
|
333
335
|
return this.get({
|
|
@@ -352,7 +354,7 @@ class Particle {
|
|
|
352
354
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
353
355
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
354
356
|
* @param {Object} [options.context] Request context
|
|
355
|
-
* @returns {Promise<JSONResponse<DeviceInfo[]>>} A promise that resolves with the response data
|
|
357
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo[] | T.DeviceListResponse>>} A promise that resolves with the response data
|
|
356
358
|
*/
|
|
357
359
|
listDevices({ deviceId, deviceName, groups, sortAttr, sortDir, page, perPage, product, auth, headers, context }) {
|
|
358
360
|
let uri;
|
|
@@ -368,11 +370,10 @@ class Particle {
|
|
|
368
370
|
page,
|
|
369
371
|
per_page: perPage
|
|
370
372
|
};
|
|
373
|
+
return this.get({ uri, auth, headers, query, context });
|
|
371
374
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
return this.get({ uri, auth, headers, query, context });
|
|
375
|
+
uri = '/v1/devices';
|
|
376
|
+
return this.get({ uri, auth, headers, context });
|
|
376
377
|
}
|
|
377
378
|
/**
|
|
378
379
|
* Get detailed informationa about a device
|
|
@@ -382,7 +383,7 @@ class Particle {
|
|
|
382
383
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
383
384
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
384
385
|
* @param {Object} [options.context] Request context
|
|
385
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
386
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
386
387
|
*/
|
|
387
388
|
getDevice({ deviceId, product, auth, headers, context }) {
|
|
388
389
|
const uri = this.deviceUri({ deviceId, product });
|
|
@@ -396,7 +397,7 @@ class Particle {
|
|
|
396
397
|
* @param {boolean} options.requestTransfer True to request the device be transfered from another user
|
|
397
398
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
398
399
|
* @param {Object} [options.context] Request context
|
|
399
|
-
* @returns {Promise<JSONResponse<ClaimResponse>>} A promise that resolves with the response data
|
|
400
|
+
* @returns {Promise<T.JSONResponse<T.ClaimResponse>>} A promise that resolves with the response data
|
|
400
401
|
*/
|
|
401
402
|
claimDevice({ deviceId, requestTransfer, auth, headers, context }) {
|
|
402
403
|
return this.post({
|
|
@@ -420,7 +421,7 @@ class Particle {
|
|
|
420
421
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
421
422
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
422
423
|
* @param {Object} [options.context] Request context
|
|
423
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
424
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
424
425
|
*/
|
|
425
426
|
addDeviceToProduct({ deviceId, product, file, auth, headers, context }) {
|
|
426
427
|
let files;
|
|
@@ -450,7 +451,7 @@ class Particle {
|
|
|
450
451
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
451
452
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
452
453
|
* @param {Object} [options.context] Request context
|
|
453
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
454
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
454
455
|
*/
|
|
455
456
|
removeDevice({ deviceId, deny, product, auth, headers, context }) {
|
|
456
457
|
const uri = this.deviceUri({ deviceId, product });
|
|
@@ -465,7 +466,7 @@ class Particle {
|
|
|
465
466
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
466
467
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
467
468
|
* @param {Object} [options.context] Request context
|
|
468
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
469
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
469
470
|
*/
|
|
470
471
|
removeDeviceOwner({ deviceId, product, auth, headers, context }) {
|
|
471
472
|
const uri = `/v1/products/${product}/devices/${deviceId}/owner`;
|
|
@@ -480,7 +481,7 @@ class Particle {
|
|
|
480
481
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
481
482
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
482
483
|
* @param {Object} [options.context] Request context
|
|
483
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
484
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
484
485
|
*/
|
|
485
486
|
renameDevice({ deviceId, name, product, auth, headers, context }) {
|
|
486
487
|
return this.updateDevice({ deviceId, name, product, auth, headers, context });
|
|
@@ -494,7 +495,7 @@ class Particle {
|
|
|
494
495
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
495
496
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
496
497
|
* @param {Object} [options.context] Request context
|
|
497
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
498
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
498
499
|
*/
|
|
499
500
|
signalDevice({ deviceId, signal, product, auth, headers, context }) {
|
|
500
501
|
return this.updateDevice({ deviceId, signal, product, auth, headers, context });
|
|
@@ -508,7 +509,7 @@ class Particle {
|
|
|
508
509
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
509
510
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
510
511
|
* @param {Object} [options.context] Request context
|
|
511
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
512
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
512
513
|
*/
|
|
513
514
|
setDeviceNotes({ deviceId, notes, product, auth, headers, context }) {
|
|
514
515
|
return this.updateDevice({ deviceId, notes, product, auth, headers, context });
|
|
@@ -522,7 +523,7 @@ class Particle {
|
|
|
522
523
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
523
524
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
524
525
|
* @param {Object} [options.context] Request context
|
|
525
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
526
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
526
527
|
*/
|
|
527
528
|
markAsDevelopmentDevice({ deviceId, development = true, product, auth, headers, context }) {
|
|
528
529
|
return this.updateDevice({ deviceId, development, product, auth, headers, context });
|
|
@@ -537,7 +538,7 @@ class Particle {
|
|
|
537
538
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
538
539
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
539
540
|
* @param {Object} [options.context] Request context
|
|
540
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
541
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
541
542
|
*/
|
|
542
543
|
lockDeviceProductFirmware({ deviceId, desiredFirmwareVersion, flash, product, auth, headers, context }) {
|
|
543
544
|
return this.updateDevice({ deviceId, desiredFirmwareVersion, flash, product, auth, headers, context });
|
|
@@ -550,7 +551,7 @@ class Particle {
|
|
|
550
551
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
551
552
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
552
553
|
* @param {Object} [options.context] Request context
|
|
553
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
554
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
554
555
|
*/
|
|
555
556
|
unlockDeviceProductFirmware({ deviceId, product, auth, headers, context }) {
|
|
556
557
|
return this.updateDevice({ deviceId, desiredFirmwareVersion: null, product, auth, headers, context });
|
|
@@ -570,7 +571,7 @@ class Particle {
|
|
|
570
571
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
571
572
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
572
573
|
* @param {Object} [options.context] Request context
|
|
573
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
574
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
574
575
|
*/
|
|
575
576
|
updateDevice({ deviceId, name, signal, notes, development, desiredFirmwareVersion, flash, product, auth, headers, context }) {
|
|
576
577
|
let signalValue;
|
|
@@ -599,7 +600,7 @@ class Particle {
|
|
|
599
600
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor.
|
|
600
601
|
* @param {Object} [options.headers] Key/value pairs to send as headers.
|
|
601
602
|
* @param {Object} [options.context] Request context.
|
|
602
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
603
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
603
604
|
*/
|
|
604
605
|
unprotectDevice({ deviceId, org, product, action, serverNonce, deviceNonce, deviceSignature, devicePublicKeyFingerprint, auth, headers, context }) {
|
|
605
606
|
const data = { action };
|
|
@@ -625,7 +626,7 @@ class Particle {
|
|
|
625
626
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
626
627
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
627
628
|
* @param {Object} [options.context] Request context
|
|
628
|
-
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
629
|
+
* @returns {Promise<T.JSONResponse<T.DeviceInfo>>} A promise that resolves with the response data
|
|
629
630
|
*/
|
|
630
631
|
provisionDevice({ productId, auth, headers, context }) {
|
|
631
632
|
return this.post({
|
|
@@ -646,7 +647,7 @@ class Particle {
|
|
|
646
647
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
647
648
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
648
649
|
* @param {Object} [options.context] Request context
|
|
649
|
-
* @returns {Promise<JSONResponse<ClaimCodeResponse>>} A promise that resolves with the response data
|
|
650
|
+
* @returns {Promise<T.JSONResponse<T.ClaimCodeResponse>>} A promise that resolves with the response data
|
|
650
651
|
*/
|
|
651
652
|
getClaimCode({ iccid, product, auth, headers, context }) {
|
|
652
653
|
const uri = product ? `/v1/products/${product}/device_claims` : '/v1/device_claims';
|
|
@@ -661,7 +662,7 @@ class Particle {
|
|
|
661
662
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
662
663
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
663
664
|
* @param {Object} [options.context] Request context
|
|
664
|
-
* @returns {Promise<JSONResponse<DeviceVariableResponse>>} A promise that resolves with the response data
|
|
665
|
+
* @returns {Promise<T.JSONResponse<T.DeviceVariableResponse>>} A promise that resolves with the response data
|
|
665
666
|
*/
|
|
666
667
|
getVariable({ deviceId, name, product, auth, headers, context }) {
|
|
667
668
|
const uri = product ?
|
|
@@ -679,7 +680,7 @@ class Particle {
|
|
|
679
680
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
680
681
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
681
682
|
* @param {Object} [options.context] Request context
|
|
682
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
683
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
683
684
|
*/
|
|
684
685
|
flashDevice({ deviceId, product, files, targetVersion, auth, headers, context }) {
|
|
685
686
|
const uri = this.deviceUri({ deviceId, product });
|
|
@@ -701,7 +702,7 @@ class Particle {
|
|
|
701
702
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
702
703
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
703
704
|
* @param {Object} [options.context] Request context
|
|
704
|
-
* @returns {Promise<JSONResponse<CompileResponse>>} A promise that resolves with the response data
|
|
705
|
+
* @returns {Promise<T.JSONResponse<T.CompileResponse>>} A promise that resolves with the response data
|
|
705
706
|
*/
|
|
706
707
|
compileCode({ files, platformId, targetVersion, auth, headers, context }) {
|
|
707
708
|
const form = { platform_id: platformId };
|
|
@@ -749,7 +750,7 @@ class Particle {
|
|
|
749
750
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
750
751
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
751
752
|
* @param {Object} [options.context] Request context
|
|
752
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
753
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
753
754
|
*/
|
|
754
755
|
sendPublicKey({ deviceId, key, algorithm, auth, headers, context }) {
|
|
755
756
|
return this.post({
|
|
@@ -776,7 +777,7 @@ class Particle {
|
|
|
776
777
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
777
778
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
778
779
|
* @param {Object} [options.context] Request context
|
|
779
|
-
* @returns {Promise<JSONResponse<FunctionCallResponse>>} A promise that resolves with the response data
|
|
780
|
+
* @returns {Promise<T.JSONResponse<T.FunctionCallResponse>>} A promise that resolves with the response data
|
|
780
781
|
*/
|
|
781
782
|
callFunction({ deviceId, name, argument, product, auth, headers, context }) {
|
|
782
783
|
const uri = product ?
|
|
@@ -814,7 +815,7 @@ class Particle {
|
|
|
814
815
|
uri += `/${encodeURIComponent(name)}`;
|
|
815
816
|
}
|
|
816
817
|
const activeAuth = this._getActiveAuthToken(auth) || '';
|
|
817
|
-
return new EventStream(`${this.baseUrl}${uri}`, activeAuth).connect();
|
|
818
|
+
return new EventStream(`${this.baseUrl}${uri}`, activeAuth, this.httpAgent).connect();
|
|
818
819
|
}
|
|
819
820
|
/**
|
|
820
821
|
* Publish a event to the Particle Cloud
|
|
@@ -826,7 +827,7 @@ class Particle {
|
|
|
826
827
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
827
828
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
828
829
|
* @param {Object} [options.context] Request context
|
|
829
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
830
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
830
831
|
*/
|
|
831
832
|
publishEvent({ name, data, isPrivate, product, auth, headers, context }) {
|
|
832
833
|
const uri = product ? `/v1/products/${product}/events` : '/v1/devices/events';
|
|
@@ -859,7 +860,7 @@ class Particle {
|
|
|
859
860
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
860
861
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
861
862
|
* @param {Object} [options.context] Request context
|
|
862
|
-
* @returns {Promise<JSONResponse<CreateWebhookResponse>>} A promise that resolves with the response data
|
|
863
|
+
* @returns {Promise<T.JSONResponse<T.CreateWebhookResponse>>} A promise that resolves with the response data
|
|
863
864
|
*/
|
|
864
865
|
createWebhook({ event, url, device, rejectUnauthorized, noDefaults, hook, product, auth, headers, context }) {
|
|
865
866
|
const uri = product ? `/v1/products/${product}/webhooks` : '/v1/webhooks';
|
|
@@ -889,7 +890,7 @@ class Particle {
|
|
|
889
890
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
890
891
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
891
892
|
* @param {Object} [options.context] Request context
|
|
892
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
893
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
893
894
|
*/
|
|
894
895
|
deleteWebhook({ hookId, product, auth, headers, context }) {
|
|
895
896
|
const uri = product ? `/v1/products/${product}/webhooks/${hookId}` : `/v1/webhooks/${hookId}`;
|
|
@@ -902,7 +903,7 @@ class Particle {
|
|
|
902
903
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
903
904
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
904
905
|
* @param {Object} [options.context] Request context
|
|
905
|
-
* @returns {Promise<JSONResponse<WebhookInfo[]>>} A promise that resolves with the response data
|
|
906
|
+
* @returns {Promise<T.JSONResponse<T.WebhookInfo[]>>} A promise that resolves with the response data
|
|
906
907
|
*/
|
|
907
908
|
listWebhooks({ product, auth, headers, context }) {
|
|
908
909
|
const uri = product ? `/v1/products/${product}/webhooks` : '/v1/webhooks';
|
|
@@ -921,7 +922,7 @@ class Particle {
|
|
|
921
922
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
922
923
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
923
924
|
* @param {Object} [options.context] Request context
|
|
924
|
-
* @returns {Promise<JSONResponse<IntegrationInfo>>} A promise that resolves with the response data
|
|
925
|
+
* @returns {Promise<T.JSONResponse<T.IntegrationInfo>>} A promise that resolves with the response data
|
|
925
926
|
*/
|
|
926
927
|
createIntegration({ event, settings, deviceId, product, auth, headers, context }) {
|
|
927
928
|
const uri = product ? `/v1/products/${product}/integrations` : '/v1/integrations';
|
|
@@ -942,7 +943,7 @@ class Particle {
|
|
|
942
943
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
943
944
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
944
945
|
* @param {Object} [options.context] Request context
|
|
945
|
-
* @returns {Promise<JSONResponse<IntegrationInfo>>} A promise that resolves with the response data
|
|
946
|
+
* @returns {Promise<T.JSONResponse<T.IntegrationInfo>>} A promise that resolves with the response data
|
|
946
947
|
*/
|
|
947
948
|
editIntegration({ integrationId, event, settings, deviceId, product, auth, headers, context }) {
|
|
948
949
|
const uri = product ? `/v1/products/${product}/integrations/${integrationId}` : `/v1/integrations/${integrationId}`;
|
|
@@ -958,7 +959,7 @@ class Particle {
|
|
|
958
959
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
959
960
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
960
961
|
* @param {Object} [options.context] Request context
|
|
961
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
962
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
962
963
|
*/
|
|
963
964
|
deleteIntegration({ integrationId, product, auth, headers, context }) {
|
|
964
965
|
const uri = product ? `/v1/products/${product}/integrations/${integrationId}` : `/v1/integrations/${integrationId}`;
|
|
@@ -971,7 +972,7 @@ class Particle {
|
|
|
971
972
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
972
973
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
973
974
|
* @param {Object} [options.context] Request context
|
|
974
|
-
* @returns {Promise<JSONResponse<IntegrationInfo[]>>} A promise that resolves with the response data
|
|
975
|
+
* @returns {Promise<T.JSONResponse<T.IntegrationInfo[]>>} A promise that resolves with the response data
|
|
975
976
|
*/
|
|
976
977
|
listIntegrations({ product, auth, headers, context }) {
|
|
977
978
|
const uri = product ? `/v1/products/${product}/integrations` : '/v1/integrations';
|
|
@@ -983,7 +984,7 @@ class Particle {
|
|
|
983
984
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
984
985
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
985
986
|
* @param {Object} [options.context] Request context
|
|
986
|
-
* @returns {Promise<JSONResponse<UserInfo>>} A promise that resolves with the response data
|
|
987
|
+
* @returns {Promise<T.JSONResponse<T.UserInfo>>} A promise that resolves with the response data
|
|
987
988
|
*/
|
|
988
989
|
getUserInfo({ auth, headers, context }) {
|
|
989
990
|
return this.get({ uri: '/v1/user', auth, headers, context });
|
|
@@ -995,7 +996,7 @@ class Particle {
|
|
|
995
996
|
* @param {String} options.accountInfo Set user's extended info fields (name, business account, company name, etc)
|
|
996
997
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
997
998
|
* @param {Object} [options.context] Request context
|
|
998
|
-
* @returns {Promise<JSONResponse<UserInfo>>} A promise that resolves with the response data
|
|
999
|
+
* @returns {Promise<T.JSONResponse<T.UserInfo>>} A promise that resolves with the response data
|
|
999
1000
|
*/
|
|
1000
1001
|
setUserInfo({ accountInfo, auth, headers, context }) {
|
|
1001
1002
|
const data = { account_info: accountInfo };
|
|
@@ -1010,7 +1011,7 @@ class Particle {
|
|
|
1010
1011
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
1011
1012
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1012
1013
|
* @param {Object} [options.context] Request context
|
|
1013
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1014
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1014
1015
|
*/
|
|
1015
1016
|
changeUsername({ currentPassword, username, invalidateTokens = false, auth, headers, context }) {
|
|
1016
1017
|
const data = { username, current_password: currentPassword };
|
|
@@ -1028,7 +1029,7 @@ class Particle {
|
|
|
1028
1029
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
1029
1030
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1030
1031
|
* @param {Object} [options.context] Request context
|
|
1031
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1032
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1032
1033
|
*/
|
|
1033
1034
|
changeUserPassword({ currentPassword, password, invalidateTokens = false, auth, headers, context }) {
|
|
1034
1035
|
const data = { password, current_password: currentPassword };
|
|
@@ -1049,7 +1050,7 @@ class Particle {
|
|
|
1049
1050
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1050
1051
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1051
1052
|
* @param {Object} [options.context] Request context
|
|
1052
|
-
* @returns {Promise<JSONResponse<SimInfo[]>>} A promise that resolves with the response data
|
|
1053
|
+
* @returns {Promise<T.JSONResponse<T.SimInfo[]>>} A promise that resolves with the response data
|
|
1053
1054
|
*/
|
|
1054
1055
|
listSIMs({ iccid, deviceId, deviceName, page, perPage, product, auth, headers, context }) {
|
|
1055
1056
|
const uri = product ? `/v1/products/${product}/sims` : '/v1/sims';
|
|
@@ -1064,7 +1065,7 @@ class Particle {
|
|
|
1064
1065
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1065
1066
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1066
1067
|
* @param {Object} [options.context] Request context
|
|
1067
|
-
* @returns {Promise<JSONResponse<SimDataUsage>>} A promise that resolves with the response data
|
|
1068
|
+
* @returns {Promise<T.JSONResponse<T.SimDataUsage>>} A promise that resolves with the response data
|
|
1068
1069
|
*/
|
|
1069
1070
|
getSIMDataUsage({ iccid, product, auth, headers, context }) {
|
|
1070
1071
|
const uri = product ?
|
|
@@ -1079,7 +1080,7 @@ class Particle {
|
|
|
1079
1080
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1080
1081
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1081
1082
|
* @param {Object} [options.context] Request context
|
|
1082
|
-
* @returns {Promise<JSONResponse<SimDataUsage>>} A promise that resolves with the response data
|
|
1083
|
+
* @returns {Promise<T.JSONResponse<T.SimDataUsage>>} A promise that resolves with the response data
|
|
1083
1084
|
*/
|
|
1084
1085
|
getFleetDataUsage({ product, auth, headers, context }) {
|
|
1085
1086
|
return this.get({
|
|
@@ -1096,80 +1097,11 @@ class Particle {
|
|
|
1096
1097
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1097
1098
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1098
1099
|
* @param {Object} [options.context] Request context
|
|
1099
|
-
* @returns {Promise<JSONResponse<SimInfo>>} A promise that resolves with the response data
|
|
1100
|
+
* @returns {Promise<T.JSONResponse<T.SimInfo>>} A promise that resolves with the response data
|
|
1100
1101
|
*/
|
|
1101
1102
|
checkSIM({ iccid, auth, headers, context }) {
|
|
1102
1103
|
return this.head({ uri: `/v1/sims/${iccid}`, auth, headers, context });
|
|
1103
1104
|
}
|
|
1104
|
-
/**
|
|
1105
|
-
* Activate and add SIM cards to an account or product
|
|
1106
|
-
* @param {Object} options Options for this API call
|
|
1107
|
-
* @param {String} options.iccid ICCID of the SIM card
|
|
1108
|
-
* @param {Array<String>} options.iccids (Product only) ICCID of multiple SIM cards to import
|
|
1109
|
-
* @param {String} options.country The ISO country code for the SIM cards
|
|
1110
|
-
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1111
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1112
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1113
|
-
* @param {Object} [options.context] Request context
|
|
1114
|
-
* @param {any} [options.promoCode]
|
|
1115
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1116
|
-
*/
|
|
1117
|
-
activateSIM({ iccid, iccids, country, promoCode, product, auth, headers, context }) {
|
|
1118
|
-
const resolvedIccids = iccids || [iccid];
|
|
1119
|
-
const uri = product ? `/v1/products/${product}/sims` : `/v1/sims/${iccid}`;
|
|
1120
|
-
const data = product ?
|
|
1121
|
-
{ sims: resolvedIccids, country } :
|
|
1122
|
-
{ country, promoCode, action: 'activate' };
|
|
1123
|
-
const method = product ? 'post' : 'put';
|
|
1124
|
-
return this.request({ uri, method, headers, data, auth, context });
|
|
1125
|
-
}
|
|
1126
|
-
/**
|
|
1127
|
-
* Deactivate a SIM card so it doesn't incur data usage in future months.
|
|
1128
|
-
* @param {Object} options Options for this API call
|
|
1129
|
-
* @param {String} options.iccid ICCID of the SIM card
|
|
1130
|
-
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1131
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1132
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1133
|
-
* @param {Object} [options.context] Request context
|
|
1134
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1135
|
-
*/
|
|
1136
|
-
deactivateSIM({ iccid, product, auth, headers, context }) {
|
|
1137
|
-
const uri = product ? `/v1/products/${product}/sims/${iccid}` : `/v1/sims/${iccid}`;
|
|
1138
|
-
const data = { action: 'deactivate' };
|
|
1139
|
-
return this.put({ uri, auth, headers, data, context });
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused
|
|
1143
|
-
* @param {Object} options Options for this API call
|
|
1144
|
-
* @param {String} options.iccid ICCID of the SIM card
|
|
1145
|
-
* @param {Number} [options.mbLimit] New monthly data limit. Necessary if unpausing a SIM card
|
|
1146
|
-
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1147
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1148
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1149
|
-
* @param {Object} [options.context] Request context
|
|
1150
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1151
|
-
*/
|
|
1152
|
-
reactivateSIM({ iccid, mbLimit, product, auth, headers, context }) {
|
|
1153
|
-
const uri = product ? `/v1/products/${product}/sims/${iccid}` : `/v1/sims/${iccid}`;
|
|
1154
|
-
const data = { mb_limit: mbLimit, action: 'reactivate' };
|
|
1155
|
-
return this.put({ uri, auth, headers, data, context });
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Update SIM card data limit
|
|
1159
|
-
* @param {Object} options Options for this API call
|
|
1160
|
-
* @param {String} options.iccid ICCID of the SIM card
|
|
1161
|
-
* @param {Array} options.mbLimit Data limit in megabyte for the SIM card
|
|
1162
|
-
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1163
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1164
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1165
|
-
* @param {Object} [options.context] Request context
|
|
1166
|
-
* @returns {Promise<JSONResponse<SimInfo>>} A promise that resolves with the response data
|
|
1167
|
-
*/
|
|
1168
|
-
updateSIM({ iccid, mbLimit, product, auth, headers, context }) {
|
|
1169
|
-
const uri = product ? `/v1/products/${product}/sims/${iccid}` : `/v1/sims/${iccid}`;
|
|
1170
|
-
const data = { mb_limit: mbLimit };
|
|
1171
|
-
return this.put({ uri, auth, headers, data, context });
|
|
1172
|
-
}
|
|
1173
1105
|
/**
|
|
1174
1106
|
* Remove a SIM card from an account so it can be activated by a different account
|
|
1175
1107
|
* @param {Object} options Options for this API call
|
|
@@ -1178,7 +1110,7 @@ class Particle {
|
|
|
1178
1110
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1179
1111
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1180
1112
|
* @param {Object} [options.context] Request context
|
|
1181
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1113
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1182
1114
|
*/
|
|
1183
1115
|
removeSIM({ iccid, product, auth, headers, context }) {
|
|
1184
1116
|
const uri = product ? `/v1/products/${product}/sims/${iccid}` : `/v1/sims/${iccid}`;
|
|
@@ -1191,7 +1123,7 @@ class Particle {
|
|
|
1191
1123
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1192
1124
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1193
1125
|
* @param {Object} [options.context] Request context
|
|
1194
|
-
* @returns {Promise<JSONResponse<BuildTargetsResponse>>} A promise that resolves with the response data
|
|
1126
|
+
* @returns {Promise<T.JSONResponse<T.BuildTargetsResponse>>} A promise that resolves with the response data
|
|
1195
1127
|
*/
|
|
1196
1128
|
listBuildTargets({ onlyFeatured, auth, headers, context }) {
|
|
1197
1129
|
const query = onlyFeatured ? { featured: !!onlyFeatured } : undefined;
|
|
@@ -1331,7 +1263,7 @@ class Particle {
|
|
|
1331
1263
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1332
1264
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1333
1265
|
* @param {Object} [options.context] Request context
|
|
1334
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1266
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1335
1267
|
*/
|
|
1336
1268
|
deleteLibrary({ name, force, auth, headers, context }) {
|
|
1337
1269
|
return this.delete({
|
|
@@ -1377,7 +1309,7 @@ class Particle {
|
|
|
1377
1309
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1378
1310
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1379
1311
|
* @param {Object} [options.context] Request context
|
|
1380
|
-
* @returns {Promise<JSONResponse<OAuthClientInfo>>} A promise that resolves with the response data
|
|
1312
|
+
* @returns {Promise<T.JSONResponse<T.OAuthClientInfo>>} A promise that resolves with the response data
|
|
1381
1313
|
*/
|
|
1382
1314
|
createOAuthClient({ name, type, redirect_uri, scope, product, auth, headers, context }) {
|
|
1383
1315
|
const uri = product ? `/v1/products/${product}/clients` : '/v1/clients';
|
|
@@ -1394,7 +1326,7 @@ class Particle {
|
|
|
1394
1326
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1395
1327
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1396
1328
|
* @param {Object} [options.context] Request context
|
|
1397
|
-
* @returns {Promise<JSONResponse<OAuthClientInfo>>} A promise that resolves with the response data
|
|
1329
|
+
* @returns {Promise<T.JSONResponse<T.OAuthClientInfo>>} A promise that resolves with the response data
|
|
1398
1330
|
*/
|
|
1399
1331
|
updateOAuthClient({ clientId, name, scope, product, auth, headers, context }) {
|
|
1400
1332
|
const uri = product ? `/v1/products/${product}/clients/${clientId}` : `/v1/clients/${clientId}`;
|
|
@@ -1409,7 +1341,7 @@ class Particle {
|
|
|
1409
1341
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1410
1342
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1411
1343
|
* @param {Object} [options.context] Request context
|
|
1412
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1344
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1413
1345
|
*/
|
|
1414
1346
|
deleteOAuthClient({ clientId, product, auth, headers, context }) {
|
|
1415
1347
|
const uri = product ? `/v1/products/${product}/clients/${clientId}` : `/v1/clients/${clientId}`;
|
|
@@ -1445,7 +1377,7 @@ class Particle {
|
|
|
1445
1377
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1446
1378
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1447
1379
|
* @param {Object} [options.context] Request context
|
|
1448
|
-
* @returns {Promise<JSONResponse<ProductFirmwareInfo[]>>} A promise that resolves with the response data
|
|
1380
|
+
* @returns {Promise<T.JSONResponse<T.ProductFirmwareInfo[]>>} A promise that resolves with the response data
|
|
1449
1381
|
*/
|
|
1450
1382
|
listProductFirmware({ product, auth, headers, context }) {
|
|
1451
1383
|
return this.get({ uri: `/v1/products/${product}/firmware`, auth, headers, context });
|
|
@@ -1462,7 +1394,7 @@ class Particle {
|
|
|
1462
1394
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1463
1395
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1464
1396
|
* @param {Object} [options.context] Request context
|
|
1465
|
-
* @returns {Promise<JSONResponse<ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1397
|
+
* @returns {Promise<T.JSONResponse<T.ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1466
1398
|
*/
|
|
1467
1399
|
uploadProductFirmware({ file, version, title, description, product, auth, headers, context }) {
|
|
1468
1400
|
return this.request({
|
|
@@ -1489,7 +1421,7 @@ class Particle {
|
|
|
1489
1421
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1490
1422
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1491
1423
|
* @param {Object} [options.context] Request context
|
|
1492
|
-
* @returns {Promise<JSONResponse<ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1424
|
+
* @returns {Promise<T.JSONResponse<T.ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1493
1425
|
*/
|
|
1494
1426
|
getProductFirmware({ version, product, auth, headers, context }) {
|
|
1495
1427
|
return this.get({
|
|
@@ -1509,7 +1441,7 @@ class Particle {
|
|
|
1509
1441
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1510
1442
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1511
1443
|
* @param {Object} [options.context] Request context
|
|
1512
|
-
* @returns {Promise<JSONResponse<ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1444
|
+
* @returns {Promise<T.JSONResponse<T.ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1513
1445
|
*/
|
|
1514
1446
|
updateProductFirmware({ version, title, description, product, auth, headers, context }) {
|
|
1515
1447
|
const uri = `/v1/products/${product}/firmware/${version}`;
|
|
@@ -1562,7 +1494,7 @@ class Particle {
|
|
|
1562
1494
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1563
1495
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1564
1496
|
* @param {Object} [options.context] Request context
|
|
1565
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1497
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1566
1498
|
*/
|
|
1567
1499
|
releaseProductFirmware({ version, product, product_default, groups, intelligent, auth, headers, context }) {
|
|
1568
1500
|
const uri = `/v1/products/${product}/firmware/release`;
|
|
@@ -1575,7 +1507,7 @@ class Particle {
|
|
|
1575
1507
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1576
1508
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1577
1509
|
* @param {Object} [options.context] Request context
|
|
1578
|
-
* @returns {Promise<JSONResponse<TeamMember[]>>} A promise that resolves with the response data
|
|
1510
|
+
* @returns {Promise<T.JSONResponse<T.TeamMember[]>>} A promise that resolves with the response data
|
|
1579
1511
|
*/
|
|
1580
1512
|
listTeamMembers({ product, auth, headers, context }) {
|
|
1581
1513
|
return this.get({
|
|
@@ -1593,7 +1525,7 @@ class Particle {
|
|
|
1593
1525
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1594
1526
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1595
1527
|
* @param {Object} [options.context] Request context
|
|
1596
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1528
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1597
1529
|
*/
|
|
1598
1530
|
inviteTeamMember({ username, product, auth, headers, context }) {
|
|
1599
1531
|
return this.post({
|
|
@@ -1612,7 +1544,7 @@ class Particle {
|
|
|
1612
1544
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1613
1545
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1614
1546
|
* @param {Object} [options.context] Request context
|
|
1615
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1547
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
1616
1548
|
*/
|
|
1617
1549
|
removeTeamMember({ username, product, auth, headers, context }) {
|
|
1618
1550
|
return this.delete({
|
|
@@ -1629,7 +1561,7 @@ class Particle {
|
|
|
1629
1561
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1630
1562
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1631
1563
|
* @param {Object} [options.context] Request context
|
|
1632
|
-
* @returns {Promise<JSONResponse<SerialNumberResponse>>} A promise that resolves with the response data
|
|
1564
|
+
* @returns {Promise<T.JSONResponse<T.SerialNumberResponse>>} A promise that resolves with the response data
|
|
1633
1565
|
*/
|
|
1634
1566
|
lookupSerialNumber({ serialNumber, auth, headers, context }) {
|
|
1635
1567
|
return this.get({
|
|
@@ -1639,154 +1571,6 @@ class Particle {
|
|
|
1639
1571
|
context
|
|
1640
1572
|
});
|
|
1641
1573
|
}
|
|
1642
|
-
/**
|
|
1643
|
-
* Create a mesh network
|
|
1644
|
-
* @param {Object} options Options for this API call
|
|
1645
|
-
* @param {String} options.name Network name
|
|
1646
|
-
* @param {String} options.deviceId Gateway device ID
|
|
1647
|
-
* @param {String} [options.iccid] ICCID of the active SIM card (only for cellular gateway devices)
|
|
1648
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1649
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1650
|
-
* @param {Object} [options.context] Request context
|
|
1651
|
-
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1652
|
-
*/
|
|
1653
|
-
createMeshNetwork({ name, deviceId, iccid, auth, headers, context }) {
|
|
1654
|
-
return this.post({
|
|
1655
|
-
uri: '/v1/networks',
|
|
1656
|
-
auth,
|
|
1657
|
-
headers,
|
|
1658
|
-
data: { name, device_id: deviceId, iccid },
|
|
1659
|
-
context
|
|
1660
|
-
});
|
|
1661
|
-
}
|
|
1662
|
-
/**
|
|
1663
|
-
* Remove a mesh network.
|
|
1664
|
-
* @param {Object} options Options for this API call
|
|
1665
|
-
* @param {String} options.networkId Network ID or name
|
|
1666
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1667
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1668
|
-
* @param {Object} [options.context] Request context
|
|
1669
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1670
|
-
*/
|
|
1671
|
-
removeMeshNetwork({ networkId, auth, headers, context }) {
|
|
1672
|
-
return this.delete({ uri: `/v1/networks/${networkId}`, auth, headers, context });
|
|
1673
|
-
}
|
|
1674
|
-
/**
|
|
1675
|
-
* List all mesh networks
|
|
1676
|
-
* @param {Object} options Options for this API call
|
|
1677
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1678
|
-
* @param {Number} [options.page] Current page of results
|
|
1679
|
-
* @param {Number} [options.perPage] Records per page
|
|
1680
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1681
|
-
* @param {Object} [options.context] Request context
|
|
1682
|
-
* @returns {Promise<JSONResponse<NetworkInfo[]>>} A promise that resolves with the response data
|
|
1683
|
-
*/
|
|
1684
|
-
listMeshNetworks({ page, perPage, auth, headers, context }) {
|
|
1685
|
-
const query = page ? { page, per_page: perPage } : undefined;
|
|
1686
|
-
return this.get({ uri: '/v1/networks', auth, headers, query, context });
|
|
1687
|
-
}
|
|
1688
|
-
/**
|
|
1689
|
-
* Get information about a mesh network.
|
|
1690
|
-
* @param {Object} options Options for this API call
|
|
1691
|
-
* @param {String} options.networkId Network ID or name
|
|
1692
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1693
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1694
|
-
* @param {Object} [options.context] Request context
|
|
1695
|
-
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1696
|
-
*/
|
|
1697
|
-
getMeshNetwork({ networkId, auth, headers, context }) {
|
|
1698
|
-
return this.get({ uri: `/v1/networks/${networkId}`, auth, headers, context });
|
|
1699
|
-
}
|
|
1700
|
-
/**
|
|
1701
|
-
* Modify a mesh network.
|
|
1702
|
-
* @param {Object} options Options for this API call
|
|
1703
|
-
* @param {String} options.networkId Network ID or name
|
|
1704
|
-
* @param {String} options.action 'add-device', 'remove-device', 'gateway-enable' or 'gateway-disable'
|
|
1705
|
-
* @param {String} options.deviceId Device ID
|
|
1706
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1707
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1708
|
-
* @param {Object} [options.context] Request context
|
|
1709
|
-
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1710
|
-
*/
|
|
1711
|
-
updateMeshNetwork({ networkId, action, deviceId, auth, headers, context }) {
|
|
1712
|
-
return this.put({
|
|
1713
|
-
uri: `/v1/networks/${networkId}`,
|
|
1714
|
-
auth,
|
|
1715
|
-
headers,
|
|
1716
|
-
data: { action, device_id: deviceId },
|
|
1717
|
-
context
|
|
1718
|
-
});
|
|
1719
|
-
}
|
|
1720
|
-
/**
|
|
1721
|
-
* Add a device to a mesh network.
|
|
1722
|
-
* @param {Object} options Options for this API call
|
|
1723
|
-
* @param {String} options.networkId Network ID or name
|
|
1724
|
-
* @param {String} options.deviceId Device ID
|
|
1725
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1726
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1727
|
-
* @param {Object} [options.context] Request context
|
|
1728
|
-
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1729
|
-
*/
|
|
1730
|
-
addMeshNetworkDevice({ networkId, deviceId, auth, headers, context }) {
|
|
1731
|
-
return this.updateMeshNetwork({
|
|
1732
|
-
action: 'add-device',
|
|
1733
|
-
networkId,
|
|
1734
|
-
deviceId,
|
|
1735
|
-
auth,
|
|
1736
|
-
headers,
|
|
1737
|
-
context
|
|
1738
|
-
});
|
|
1739
|
-
}
|
|
1740
|
-
/**
|
|
1741
|
-
* Remove a device from a mesh network.
|
|
1742
|
-
* @param {Object} options Options for this API call
|
|
1743
|
-
* @param {String} [options.networkId] Network ID or name
|
|
1744
|
-
* @param {String} options.deviceId Device ID
|
|
1745
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1746
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1747
|
-
* @param {Object} [options.context] Request context
|
|
1748
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1749
|
-
*/
|
|
1750
|
-
removeMeshNetworkDevice({ networkId, deviceId, auth, headers, context }) {
|
|
1751
|
-
if (!networkId) {
|
|
1752
|
-
return this.delete({
|
|
1753
|
-
uri: `/v1/devices/${deviceId}/network`,
|
|
1754
|
-
auth,
|
|
1755
|
-
headers,
|
|
1756
|
-
context
|
|
1757
|
-
});
|
|
1758
|
-
}
|
|
1759
|
-
return this.updateMeshNetwork({
|
|
1760
|
-
action: 'remove-device',
|
|
1761
|
-
networkId,
|
|
1762
|
-
deviceId,
|
|
1763
|
-
auth,
|
|
1764
|
-
headers,
|
|
1765
|
-
context
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
/**
|
|
1769
|
-
* List all devices of a mesh network.
|
|
1770
|
-
* @param {Object} options Options for this API call
|
|
1771
|
-
* @param {String} options.networkId Network ID or name
|
|
1772
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1773
|
-
* @param {Number} [options.role] Device role: 'gateway' or 'node'
|
|
1774
|
-
* @param {Number} [options.page] Current page of results
|
|
1775
|
-
* @param {Number} [options.perPage] Records per page
|
|
1776
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1777
|
-
* @param {Object} [options.context] Request context
|
|
1778
|
-
* @returns {Promise<JSONResponse<DeviceInfo[]>>} A promise that resolves with the response data
|
|
1779
|
-
*/
|
|
1780
|
-
listMeshNetworkDevices({ networkId, role, page, perPage, auth, headers, context }) {
|
|
1781
|
-
const query = (role || page) ? { role, page, per_page: perPage } : undefined;
|
|
1782
|
-
return this.get({
|
|
1783
|
-
uri: `/v1/networks/${networkId}/devices`,
|
|
1784
|
-
auth,
|
|
1785
|
-
headers,
|
|
1786
|
-
query,
|
|
1787
|
-
context
|
|
1788
|
-
});
|
|
1789
|
-
}
|
|
1790
1574
|
/**
|
|
1791
1575
|
* Get product configuration
|
|
1792
1576
|
* @param {Object} options Options for this API call
|
|
@@ -1794,7 +1578,7 @@ class Particle {
|
|
|
1794
1578
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1795
1579
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1796
1580
|
* @param {Object} [options.context] Request context
|
|
1797
|
-
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1581
|
+
* @returns {Promise<T.JSONResponse<T.ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1798
1582
|
*/
|
|
1799
1583
|
getProductConfiguration({ auth, product, headers, context }) {
|
|
1800
1584
|
return this.get({
|
|
@@ -1811,7 +1595,7 @@ class Particle {
|
|
|
1811
1595
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1812
1596
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1813
1597
|
* @param {Object} [options.context] Request context
|
|
1814
|
-
* @returns {Promise<JSONResponse<object>>} A promise that resolves with the response data
|
|
1598
|
+
* @returns {Promise<T.JSONResponse<object>>} A promise that resolves with the response data
|
|
1815
1599
|
*/
|
|
1816
1600
|
getProductConfigurationSchema({ auth, product, headers = {}, context }) {
|
|
1817
1601
|
headers.accept = 'application/schema+json';
|
|
@@ -1830,7 +1614,7 @@ class Particle {
|
|
|
1830
1614
|
* @param {String} options.deviceId Device ID to access
|
|
1831
1615
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1832
1616
|
* @param {Object} [options.context] Request context
|
|
1833
|
-
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1617
|
+
* @returns {Promise<T.JSONResponse<T.ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1834
1618
|
*/
|
|
1835
1619
|
getProductDeviceConfiguration({ auth, product, deviceId, headers, context }) {
|
|
1836
1620
|
return this.get({
|
|
@@ -1848,7 +1632,7 @@ class Particle {
|
|
|
1848
1632
|
* @param {String} options.deviceId Device ID to access
|
|
1849
1633
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1850
1634
|
* @param {Object} [options.context] Request context
|
|
1851
|
-
* @returns {Promise<JSONResponse<object>>} A promise that resolves with the response data
|
|
1635
|
+
* @returns {Promise<T.JSONResponse<object>>} A promise that resolves with the response data
|
|
1852
1636
|
*/
|
|
1853
1637
|
getProductDeviceConfigurationSchema({ auth, product, deviceId, headers = {}, context }) {
|
|
1854
1638
|
headers.accept = 'application/schema+json';
|
|
@@ -1867,7 +1651,7 @@ class Particle {
|
|
|
1867
1651
|
* @param {Object} options.config Product configuration to update
|
|
1868
1652
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1869
1653
|
* @param {Object} [options.context] Request context
|
|
1870
|
-
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1654
|
+
* @returns {Promise<T.JSONResponse<T.ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1871
1655
|
*/
|
|
1872
1656
|
setProductConfiguration({ auth, product, config, headers, context }) {
|
|
1873
1657
|
return this.put({
|
|
@@ -1887,7 +1671,7 @@ class Particle {
|
|
|
1887
1671
|
* @param {String} options.deviceId Device ID to access
|
|
1888
1672
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1889
1673
|
* @param {Object} [options.context] Request context
|
|
1890
|
-
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1674
|
+
* @returns {Promise<T.JSONResponse<T.ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1891
1675
|
*/
|
|
1892
1676
|
setProductDeviceConfiguration({ auth, product, deviceId, config, headers, context }) {
|
|
1893
1677
|
return this.put({
|
|
@@ -1913,7 +1697,7 @@ class Particle {
|
|
|
1913
1697
|
* @param {String} options.perPage Number of results per page. Defaults to 20. Maximum of 100
|
|
1914
1698
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1915
1699
|
* @param {Object} [options.context] Request context
|
|
1916
|
-
* @returns {Promise<JSONResponse<LocationListResponse>>} A promise that resolves with the response data
|
|
1700
|
+
* @returns {Promise<T.JSONResponse<T.LocationListResponse>>} A promise that resolves with the response data
|
|
1917
1701
|
*/
|
|
1918
1702
|
getProductLocations({ auth, product, dateRange, rectBl, rectTr, deviceId, deviceName, groups, page, perPage, headers, context }) {
|
|
1919
1703
|
return this.get({
|
|
@@ -1946,7 +1730,7 @@ class Particle {
|
|
|
1946
1730
|
* @param {Object} [options.context] Request context
|
|
1947
1731
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1948
1732
|
* @param {Object} [options.context] Request context
|
|
1949
|
-
* @returns {Promise<JSONResponse<DeviceLocationInfo>>} A promise that resolves with the response data
|
|
1733
|
+
* @returns {Promise<T.JSONResponse<T.DeviceLocationInfo>>} A promise that resolves with the response data
|
|
1950
1734
|
*/
|
|
1951
1735
|
getProductDeviceLocations({ auth, product, dateRange, rectBl, rectTr, deviceId, headers, context }) {
|
|
1952
1736
|
return this.get({
|
|
@@ -1973,7 +1757,7 @@ class Particle {
|
|
|
1973
1757
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1974
1758
|
* @param {Object} [options.context] Request context
|
|
1975
1759
|
*
|
|
1976
|
-
* @returns {Promise<JSONResponse<ExecuteLogicResponse>>} A promise that resolves with the response data
|
|
1760
|
+
* @returns {Promise<T.JSONResponse<T.ExecuteLogicResponse>>} A promise that resolves with the response data
|
|
1977
1761
|
*/
|
|
1978
1762
|
executeLogic({ auth, org, logic, headers, context }) {
|
|
1979
1763
|
return this.post({
|
|
@@ -2000,7 +1784,7 @@ class Particle {
|
|
|
2000
1784
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2001
1785
|
* @param {Object} [options.context] Request context
|
|
2002
1786
|
*
|
|
2003
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to the created logic function data.
|
|
1787
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to the created logic function data.
|
|
2004
1788
|
*/
|
|
2005
1789
|
createLogicFunction({ auth, org, logicFunction, headers, context }) {
|
|
2006
1790
|
return this.post({
|
|
@@ -2021,7 +1805,7 @@ class Particle {
|
|
|
2021
1805
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2022
1806
|
* @param {Object} [options.context] Request context
|
|
2023
1807
|
*
|
|
2024
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to the specified logic function data.
|
|
1808
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to the specified logic function data.
|
|
2025
1809
|
*/
|
|
2026
1810
|
getLogicFunction({ auth, org, logicFunctionId, headers, context }) {
|
|
2027
1811
|
return this.get({
|
|
@@ -2044,7 +1828,7 @@ class Particle {
|
|
|
2044
1828
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2045
1829
|
* @param {Object} [options.context] Request context.
|
|
2046
1830
|
*
|
|
2047
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to the updated logic function data.
|
|
1831
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to the updated logic function data.
|
|
2048
1832
|
*/
|
|
2049
1833
|
updateLogicFunction({ auth, org, logicFunctionId, logicFunction, headers, context }) {
|
|
2050
1834
|
return this.put({
|
|
@@ -2065,7 +1849,7 @@ class Particle {
|
|
|
2065
1849
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2066
1850
|
* @param {Object} [options.context] Request context.
|
|
2067
1851
|
*
|
|
2068
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1852
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
2069
1853
|
*/
|
|
2070
1854
|
deleteLogicFunction({ auth, org, logicFunctionId, headers, context }) {
|
|
2071
1855
|
return this.delete({
|
|
@@ -2085,7 +1869,7 @@ class Particle {
|
|
|
2085
1869
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2086
1870
|
* @param {Object} [options.context] Request context.
|
|
2087
1871
|
*
|
|
2088
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to an array of logic functions data.
|
|
1872
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to an array of logic functions data.
|
|
2089
1873
|
*/
|
|
2090
1874
|
listLogicFunctions({ auth, org, todayStats, headers, context }) {
|
|
2091
1875
|
return this.get({
|
|
@@ -2108,7 +1892,7 @@ class Particle {
|
|
|
2108
1892
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2109
1893
|
* @param {Object} [options.context] Request context
|
|
2110
1894
|
*
|
|
2111
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to an array of logic run data.
|
|
1895
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to an array of logic run data.
|
|
2112
1896
|
*/
|
|
2113
1897
|
listLogicRuns({ auth, org, logicFunctionId, headers, context }) {
|
|
2114
1898
|
return this.get({
|
|
@@ -2129,7 +1913,7 @@ class Particle {
|
|
|
2129
1913
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2130
1914
|
* @param {Object} [options.context] Request context
|
|
2131
1915
|
*
|
|
2132
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to an array of logic run data for the specified logic run ID.
|
|
1916
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to an array of logic run data for the specified logic run ID.
|
|
2133
1917
|
*/
|
|
2134
1918
|
getLogicRun({ auth, org, logicFunctionId, logicRunId, headers, context }) {
|
|
2135
1919
|
return this.get({
|
|
@@ -2150,7 +1934,7 @@ class Particle {
|
|
|
2150
1934
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2151
1935
|
* @param {Object} [options.context] Request context
|
|
2152
1936
|
*
|
|
2153
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to the logs for the specified logic run ID.
|
|
1937
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to the logs for the specified logic run ID.
|
|
2154
1938
|
*/
|
|
2155
1939
|
getLogicRunLogs({ auth, org, logicFunctionId, logicRunId, headers, context }) {
|
|
2156
1940
|
return this.get({
|
|
@@ -2170,7 +1954,7 @@ class Particle {
|
|
|
2170
1954
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2171
1955
|
* @param {Object} [options.context] Request context
|
|
2172
1956
|
*
|
|
2173
|
-
* @returns {Promise<JSONResponse<LedgerDefinition>>} A promise that resolves with the response data
|
|
1957
|
+
* @returns {Promise<T.JSONResponse<T.LedgerDefinition>>} A promise that resolves with the response data
|
|
2174
1958
|
*/
|
|
2175
1959
|
createLedger({ auth, org, ledger, headers, context }) {
|
|
2176
1960
|
return this.post({
|
|
@@ -2191,7 +1975,7 @@ class Particle {
|
|
|
2191
1975
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2192
1976
|
* @param {Object} [options.context] Request context
|
|
2193
1977
|
*
|
|
2194
|
-
* @returns {Promise<JSONResponse<LedgerDefinition>>} A promise that resolves with the response data
|
|
1978
|
+
* @returns {Promise<T.JSONResponse<T.LedgerDefinition>>} A promise that resolves with the response data
|
|
2195
1979
|
*/
|
|
2196
1980
|
getLedger({ auth, org, ledgerName, headers, context }) {
|
|
2197
1981
|
return this.get({
|
|
@@ -2212,7 +1996,7 @@ class Particle {
|
|
|
2212
1996
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2213
1997
|
* @param {Object} [options.context] Request context.
|
|
2214
1998
|
*
|
|
2215
|
-
* @returns {Promise<JSONResponse<LedgerDefinition>>} A promise that resolves with the response data
|
|
1999
|
+
* @returns {Promise<T.JSONResponse<T.LedgerDefinition>>} A promise that resolves with the response data
|
|
2216
2000
|
*/
|
|
2217
2001
|
updateLedger({ auth, org, ledgerName, ledger, headers, context }) {
|
|
2218
2002
|
return this.put({
|
|
@@ -2233,7 +2017,7 @@ class Particle {
|
|
|
2233
2017
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2234
2018
|
* @param {Object} [options.context] Request context.
|
|
2235
2019
|
*
|
|
2236
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
2020
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
2237
2021
|
*/
|
|
2238
2022
|
archiveLedger({ auth, org, ledgerName, headers, context }) {
|
|
2239
2023
|
return this.delete({
|
|
@@ -2259,7 +2043,7 @@ class Particle {
|
|
|
2259
2043
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2260
2044
|
* @param {Object} [options.context] Request context.
|
|
2261
2045
|
*
|
|
2262
|
-
* @returns {Promise<RequestResponse>} A promise that resolves to an array of ledger definition data.
|
|
2046
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves to an array of ledger definition data.
|
|
2263
2047
|
*/
|
|
2264
2048
|
listLedgers({ auth, org, scope, page, perPage, archived, headers, context }) {
|
|
2265
2049
|
return this.get({
|
|
@@ -2286,7 +2070,7 @@ class Particle {
|
|
|
2286
2070
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2287
2071
|
* @param {Object} [options.context] Request context
|
|
2288
2072
|
*
|
|
2289
|
-
* @returns {Promise<JSONResponse<LedgerInstance>>} A promise that resolves with the response data
|
|
2073
|
+
* @returns {Promise<T.JSONResponse<T.LedgerInstance>>} A promise that resolves with the response data
|
|
2290
2074
|
*/
|
|
2291
2075
|
getLedgerInstance({ auth, org, ledgerName, scopeValue, headers, context }) {
|
|
2292
2076
|
return this.get({
|
|
@@ -2312,7 +2096,7 @@ class Particle {
|
|
|
2312
2096
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2313
2097
|
* @param {Object} [options.context] Request context.
|
|
2314
2098
|
*
|
|
2315
|
-
* @returns {Promise<JSONResponse<LedgerInstance>>} A promise that resolves with the response data
|
|
2099
|
+
* @returns {Promise<T.JSONResponse<T.LedgerInstance>>} A promise that resolves with the response data
|
|
2316
2100
|
*/
|
|
2317
2101
|
setLedgerInstance({ auth, org, ledgerName, scopeValue, instance, setMode, headers, context }) {
|
|
2318
2102
|
return this.put({
|
|
@@ -2337,7 +2121,7 @@ class Particle {
|
|
|
2337
2121
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2338
2122
|
* @param {Object} [options.context] Request context.
|
|
2339
2123
|
*
|
|
2340
|
-
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
2124
|
+
* @returns {Promise<T.JSONResponse<T.OKResponse>>} A promise that resolves with the response data
|
|
2341
2125
|
*/
|
|
2342
2126
|
deleteLedgerInstance({ auth, org, ledgerName, scopeValue, headers, context }) {
|
|
2343
2127
|
return this.delete({
|
|
@@ -2359,7 +2143,7 @@ class Particle {
|
|
|
2359
2143
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2360
2144
|
* @param {Object} [options.context] Request context.
|
|
2361
2145
|
*
|
|
2362
|
-
* @returns {Promise<JSONResponse<LedgerInstanceListResponse>>} A promise that resolves with the response data
|
|
2146
|
+
* @returns {Promise<T.JSONResponse<T.LedgerInstanceListResponse>>} A promise that resolves with the response data
|
|
2363
2147
|
*/
|
|
2364
2148
|
listLedgerInstances({ auth, org, ledgerName, page, perPage, headers, context }) {
|
|
2365
2149
|
return this.get({
|
|
@@ -2386,7 +2170,7 @@ class Particle {
|
|
|
2386
2170
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2387
2171
|
* @param {Object} [options.context] Request context
|
|
2388
2172
|
*
|
|
2389
|
-
* @returns {Promise<JSONResponse<LedgerVersionListResponse>>} A promise that resolves with the response data
|
|
2173
|
+
* @returns {Promise<T.JSONResponse<T.LedgerVersionListResponse>>} A promise that resolves with the response data
|
|
2390
2174
|
*/
|
|
2391
2175
|
listLedgerInstanceVersions({ auth, org, ledgerName, scopeValue, replacedBefore, replacedAfter, headers, context }) {
|
|
2392
2176
|
return this.get({
|
|
@@ -2412,7 +2196,7 @@ class Particle {
|
|
|
2412
2196
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2413
2197
|
* @param {Object} [options.context] Request context
|
|
2414
2198
|
*
|
|
2415
|
-
* @returns {Promise<JSONResponse<LedgerInstance>>} A promise that resolves with the response data
|
|
2199
|
+
* @returns {Promise<T.JSONResponse<T.LedgerInstance>>} A promise that resolves with the response data
|
|
2416
2200
|
*/
|
|
2417
2201
|
getLedgerInstanceVersion({ auth, org, ledgerName, scopeValue, version, headers, context }) {
|
|
2418
2202
|
return this.get({
|
|
@@ -2434,7 +2218,7 @@ class Particle {
|
|
|
2434
2218
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2435
2219
|
* @param {Object} [options.context] Request context
|
|
2436
2220
|
*
|
|
2437
|
-
* @returns {Promise<JSONResponse<DeviceOsVersion[]>>} A promise that resolves with the response data
|
|
2221
|
+
* @returns {Promise<T.JSONResponse<T.DeviceOsVersion[]>>} A promise that resolves with the response data
|
|
2438
2222
|
*/
|
|
2439
2223
|
listDeviceOsVersions({ platformId, internalVersion, page, perPage, auth, headers, context }) {
|
|
2440
2224
|
const query = {
|
|
@@ -2461,7 +2245,7 @@ class Particle {
|
|
|
2461
2245
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2462
2246
|
* @param {Object} [options.context] Request context
|
|
2463
2247
|
*
|
|
2464
|
-
* @returns {Promise<JSONResponse<DeviceOsVersion>>} A promise that resolves with the response data
|
|
2248
|
+
* @returns {Promise<T.JSONResponse<T.DeviceOsVersion>>} A promise that resolves with the response data
|
|
2465
2249
|
*/
|
|
2466
2250
|
getDeviceOsVersion({ version, platformId, auth, headers, context }) {
|
|
2467
2251
|
const query = platformId ? { platform_id: platformId } : {};
|
|
@@ -2485,7 +2269,7 @@ class Particle {
|
|
|
2485
2269
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2486
2270
|
* @param {Object} [options.context] Request context
|
|
2487
2271
|
*
|
|
2488
|
-
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the env vars data
|
|
2272
|
+
* @returns {Promise<T.JSONResponse<T.EnvVarsResponse>>} A promise that resolves with the env vars data
|
|
2489
2273
|
*/
|
|
2490
2274
|
listEnvVars({ product, org, deviceId, sandbox, auth, headers, context }) {
|
|
2491
2275
|
return this.get({
|
|
@@ -2506,7 +2290,7 @@ class Particle {
|
|
|
2506
2290
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2507
2291
|
* @param {Object} [options.context] Request context
|
|
2508
2292
|
*
|
|
2509
|
-
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
2293
|
+
* @returns {Promise<T.JSONResponse<T.EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
2510
2294
|
*/
|
|
2511
2295
|
updateEnvVars({ ops, product, org, deviceId, sandbox, auth, headers, context }) {
|
|
2512
2296
|
return this.patch({
|
|
@@ -2529,7 +2313,7 @@ class Particle {
|
|
|
2529
2313
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2530
2314
|
* @param {Object} [options.context] Request context
|
|
2531
2315
|
*
|
|
2532
|
-
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
2316
|
+
* @returns {Promise<T.JSONResponse<T.EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
2533
2317
|
*/
|
|
2534
2318
|
setEnvVar({ key, value, product, org, deviceId, sandbox, auth, headers, context }) {
|
|
2535
2319
|
return this.put({
|
|
@@ -2551,7 +2335,7 @@ class Particle {
|
|
|
2551
2335
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2552
2336
|
* @param {Object} [options.context] Request context
|
|
2553
2337
|
*
|
|
2554
|
-
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
2338
|
+
* @returns {Promise<T.JSONResponse<T.EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
2555
2339
|
*/
|
|
2556
2340
|
deleteEnvVar({ key, product, org, deviceId, sandbox, auth, headers, context }) {
|
|
2557
2341
|
return this.delete({
|
|
@@ -2571,7 +2355,7 @@ class Particle {
|
|
|
2571
2355
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2572
2356
|
* @param {Object} [options.context] Request context
|
|
2573
2357
|
*
|
|
2574
|
-
* @returns {Promise<JSONResponse<EnvVarsRenderResponse>>} A promise that resolves with the rendered env vars
|
|
2358
|
+
* @returns {Promise<T.JSONResponse<T.EnvVarsRenderResponse>>} A promise that resolves with the rendered env vars
|
|
2575
2359
|
*/
|
|
2576
2360
|
renderEnvVars({ product, org, deviceId, sandbox, auth, headers, context }) {
|
|
2577
2361
|
return this.get({
|
|
@@ -2591,7 +2375,7 @@ class Particle {
|
|
|
2591
2375
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2592
2376
|
* @param {Object} [options.context] Request context
|
|
2593
2377
|
*
|
|
2594
|
-
* @returns {Promise<JSONResponse<EnvVarsRolloutResponse>>} A promise that resolves with the rollout diff
|
|
2378
|
+
* @returns {Promise<T.JSONResponse<T.EnvVarsRolloutResponse>>} A promise that resolves with the rollout diff
|
|
2595
2379
|
*/
|
|
2596
2380
|
reviewEnvVarsRollout({ product, org, deviceId, sandbox, auth, headers, context }) {
|
|
2597
2381
|
return this.get({
|
|
@@ -2612,7 +2396,7 @@ class Particle {
|
|
|
2612
2396
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2613
2397
|
* @param {Object} [options.context] Request context
|
|
2614
2398
|
*
|
|
2615
|
-
* @returns {Promise<JSONResponse<EnvVarsRolloutStartResponse>>} A promise that resolves with success status
|
|
2399
|
+
* @returns {Promise<T.JSONResponse<T.EnvVarsRolloutStartResponse>>} A promise that resolves with success status
|
|
2616
2400
|
*/
|
|
2617
2401
|
startEnvVarsRollout({ when, product, org, deviceId, sandbox, auth, headers, context }) {
|
|
2618
2402
|
return this.post({
|
|
@@ -2677,7 +2461,7 @@ class Particle {
|
|
|
2677
2461
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2678
2462
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2679
2463
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2680
|
-
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
2464
|
+
* @returns {Promise<T.JSONResponse<T>>} A promise that resolves with the response data
|
|
2681
2465
|
*/
|
|
2682
2466
|
get({ uri, auth, headers, query, context }) {
|
|
2683
2467
|
context = this._buildContext(context);
|
|
@@ -2692,7 +2476,7 @@ class Particle {
|
|
|
2692
2476
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2693
2477
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2694
2478
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2695
|
-
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
2479
|
+
* @returns {Promise<T.JSONResponse<T>>} A promise that resolves with the response data
|
|
2696
2480
|
*/
|
|
2697
2481
|
head({ uri, auth, headers, query, context }) {
|
|
2698
2482
|
context = this._buildContext(context);
|
|
@@ -2707,7 +2491,7 @@ class Particle {
|
|
|
2707
2491
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2708
2492
|
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
2709
2493
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2710
|
-
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
2494
|
+
* @returns {Promise<T.JSONResponse<T>>} A promise that resolves with the response data
|
|
2711
2495
|
*/
|
|
2712
2496
|
post({ uri, auth, headers, data, context }) {
|
|
2713
2497
|
context = this._buildContext(context);
|
|
@@ -2723,7 +2507,7 @@ class Particle {
|
|
|
2723
2507
|
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
2724
2508
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2725
2509
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2726
|
-
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
2510
|
+
* @returns {Promise<T.JSONResponse<T>>} A promise that resolves with the response data
|
|
2727
2511
|
*/
|
|
2728
2512
|
put({ uri, auth, headers, data, query, context }) {
|
|
2729
2513
|
context = this._buildContext(context);
|
|
@@ -2738,7 +2522,7 @@ class Particle {
|
|
|
2738
2522
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2739
2523
|
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
2740
2524
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2741
|
-
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
2525
|
+
* @returns {Promise<T.JSONResponse<T>>} A promise that resolves with the response data
|
|
2742
2526
|
*/
|
|
2743
2527
|
patch({ uri, auth, headers, data, context }) {
|
|
2744
2528
|
context = this._buildContext(context);
|
|
@@ -2753,7 +2537,7 @@ class Particle {
|
|
|
2753
2537
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2754
2538
|
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
2755
2539
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2756
|
-
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
2540
|
+
* @returns {Promise<T.JSONResponse<T>>} A promise that resolves with the response data
|
|
2757
2541
|
*/
|
|
2758
2542
|
delete({ uri, auth, headers, data, context }) {
|
|
2759
2543
|
context = this._buildContext(context);
|
|
@@ -2773,7 +2557,7 @@ class Particle {
|
|
|
2773
2557
|
* @param {Object} [args.files] Array of file names and file content
|
|
2774
2558
|
* @param {Object} [args.context] The invocation context, describing the tool and project.
|
|
2775
2559
|
* @param {boolean} [args.isBuffer] Indicate if the response should be treated as Buffer instead of JSON
|
|
2776
|
-
* @returns {Promise<RequestResponse>} A promise that resolves with the response data
|
|
2560
|
+
* @returns {Promise<T.RequestResponse>} A promise that resolves with the response data
|
|
2777
2561
|
*/
|
|
2778
2562
|
request(args) {
|
|
2779
2563
|
args.context = this._buildContext(args.context);
|