particle-api-js 10.6.0 → 11.0.0
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/CHANGELOG.md +4 -0
- package/dist/particle.min.js +1 -1
- package/dist/particle.min.js.map +1 -1
- package/docs/api.md +255 -291
- package/package.json +1 -1
- package/src/Agent.js +10 -33
- package/src/EventStream.js +4 -1
- package/src/Particle.js +123 -169
- package/test/Agent.spec.js +0 -22
- package/test/EventStream.spec.js +4 -1
- package/test/Particle.spec.js +1 -57
package/src/Particle.js
CHANGED
|
@@ -14,7 +14,6 @@ const Client = require('./Client');
|
|
|
14
14
|
*
|
|
15
15
|
* @typedef {import('./Agent').RequestResponse} RequestResponse
|
|
16
16
|
* @typedef {import('./Agent').RequestError} RequestError
|
|
17
|
-
* @typedef {import('./Agent').Auth} Auth
|
|
18
17
|
*/
|
|
19
18
|
// These typedef avoid importing the type on every @return statement
|
|
20
19
|
class Particle {
|
|
@@ -28,7 +27,7 @@ class Particle {
|
|
|
28
27
|
* @param {string} [options.clientSecret]
|
|
29
28
|
* @param {string} [options.clientId]
|
|
30
29
|
* @param {number} [options.tokenDuration]
|
|
31
|
-
* @param {
|
|
30
|
+
* @param {string} [options.auth] The access token. If not specified here, will have to be added to every request
|
|
32
31
|
*/
|
|
33
32
|
constructor(options = {}){
|
|
34
33
|
if (options.auth) {
|
|
@@ -125,7 +124,7 @@ class Particle {
|
|
|
125
124
|
/**
|
|
126
125
|
* Enable MFA on the currently logged in user
|
|
127
126
|
* @param {Object} options Options for this API call
|
|
128
|
-
* @param {
|
|
127
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
129
128
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
130
129
|
* @param {Object} [options.context] Request context
|
|
131
130
|
* @returns {Promise} A promise
|
|
@@ -137,7 +136,7 @@ class Particle {
|
|
|
137
136
|
/**
|
|
138
137
|
* Confirm MFA for the user. This must be called with current TOTP code, determined from the results of enableMfa(). You will be prompted to enter an OTP code every time you login after enrollment is confirmed.
|
|
139
138
|
* @param {Object} options Options for this API call
|
|
140
|
-
* @param {
|
|
139
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
141
140
|
* @param {Object} options.mfaToken Token given from previous step to
|
|
142
141
|
* @param {Object} options.otp Current one-time-password generated from the authentication app
|
|
143
142
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
@@ -164,7 +163,7 @@ class Particle {
|
|
|
164
163
|
/**
|
|
165
164
|
* Disable MFA for the user.
|
|
166
165
|
* @param {Object} options Options for this API call
|
|
167
|
-
* @param {
|
|
166
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
168
167
|
* @param {Object} options.currentPassword User's current password
|
|
169
168
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
170
169
|
* @param {Object} [options.context] Request context
|
|
@@ -290,30 +289,10 @@ class Particle {
|
|
|
290
289
|
});
|
|
291
290
|
}
|
|
292
291
|
|
|
293
|
-
/**
|
|
294
|
-
* Revoke an access token
|
|
295
|
-
* @param {Object} options Options for this API call
|
|
296
|
-
* @param {String} options.username Username of the Particle cloud account that the token belongs to.
|
|
297
|
-
* @param {String} options.password Password for the account
|
|
298
|
-
* @param {String} options.token Access token you wish to revoke
|
|
299
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
300
|
-
* @param {Object} [options.context] Request context
|
|
301
|
-
* @returns {Promise} A promise
|
|
302
|
-
*/
|
|
303
|
-
deleteAccessToken({ username, password, token, headers, context }){
|
|
304
|
-
return this.delete({
|
|
305
|
-
uri: `/v1/access_tokens/${token}`,
|
|
306
|
-
auth: { username, password },
|
|
307
|
-
headers,
|
|
308
|
-
data: { access_token: token },
|
|
309
|
-
context
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
|
|
313
292
|
/**
|
|
314
293
|
* Revoke the current session access token
|
|
315
294
|
* @param {Object} options Options for this API call
|
|
316
|
-
* @param {
|
|
295
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
317
296
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
318
297
|
* @param {Object} [options.context] Request context
|
|
319
298
|
* @returns {Promise} A promise
|
|
@@ -330,7 +309,7 @@ class Particle {
|
|
|
330
309
|
/**
|
|
331
310
|
* Revoke all active access tokens
|
|
332
311
|
* @param {Object} options Options for this API call
|
|
333
|
-
* @param {
|
|
312
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
334
313
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
335
314
|
* @param {Object} [options.context] Request context
|
|
336
315
|
* @returns {Promise} A promise
|
|
@@ -347,7 +326,7 @@ class Particle {
|
|
|
347
326
|
/**
|
|
348
327
|
* Delete the current user
|
|
349
328
|
* @param {Object} options Options for this API call
|
|
350
|
-
* @param {
|
|
329
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
351
330
|
* @param {String} options.password Password
|
|
352
331
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
353
332
|
* @param {Object} [options.context] Request context
|
|
@@ -363,30 +342,10 @@ class Particle {
|
|
|
363
342
|
});
|
|
364
343
|
}
|
|
365
344
|
|
|
366
|
-
/**
|
|
367
|
-
* List all valid access tokens for a Particle Cloud account
|
|
368
|
-
* @param {Object} options Options for this API call
|
|
369
|
-
* @param {String} options.username Username
|
|
370
|
-
* @param {String} options.password Password
|
|
371
|
-
* @param {String} options.otp Current one-time-password generated from the authentication application
|
|
372
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
373
|
-
* @param {Object} [options.context] Request context
|
|
374
|
-
* @returns {Promise} A promise
|
|
375
|
-
*/
|
|
376
|
-
listAccessTokens({ username, password, otp, headers, context }){
|
|
377
|
-
return this.get({
|
|
378
|
-
uri: '/v1/access_tokens',
|
|
379
|
-
auth: { username, password },
|
|
380
|
-
query: otp ? { otp } : undefined,
|
|
381
|
-
headers,
|
|
382
|
-
context
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
|
|
386
345
|
/**
|
|
387
346
|
* Retrieves the information that is used to identify the current login for tracking.
|
|
388
347
|
* @param {Object} [options] Options for this API call
|
|
389
|
-
* @param {
|
|
348
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
390
349
|
* @param {Boolean} [options.full] When true, retrieve all information for registering a user with the tracking API. When false,
|
|
391
350
|
* retrieve only the unique tracking ID for the current login.
|
|
392
351
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -414,7 +373,7 @@ class Particle {
|
|
|
414
373
|
* @param {Number} [options.page] (Product only) Current page of results
|
|
415
374
|
* @param {Number} [options.perPage] (Product only) Records per page
|
|
416
375
|
* @param {String} [options.product] List devices in this product ID or slug
|
|
417
|
-
* @param {
|
|
376
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
418
377
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
419
378
|
* @param {Object} [options.context] Request context
|
|
420
379
|
* @returns {Promise} A promise
|
|
@@ -445,7 +404,7 @@ class Particle {
|
|
|
445
404
|
* @param {Object} options Options for this API call
|
|
446
405
|
* @param {String} options.deviceId Device ID or Name
|
|
447
406
|
* @param {String} [options.product] Device in this product ID or slug
|
|
448
|
-
* @param {
|
|
407
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
449
408
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
450
409
|
* @param {Object} [options.context] Request context
|
|
451
410
|
* @returns {Promise} A promise
|
|
@@ -459,7 +418,7 @@ class Particle {
|
|
|
459
418
|
* Claim a device to the account. The device must be online and unclaimed.
|
|
460
419
|
* @param {Object} options Options for this API call
|
|
461
420
|
* @param {String} options.deviceId Device ID
|
|
462
|
-
* @param {
|
|
421
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
463
422
|
* @param {boolean} options.requestTransfer True to request the device be transfered from another user
|
|
464
423
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
465
424
|
* @param {Object} [options.context] Request context
|
|
@@ -485,7 +444,7 @@ class Particle {
|
|
|
485
444
|
* @param {Object} options.file A file that contains a single-column list of device IDs, device serial numbers, device IMEIs, or devie ICCIDs.
|
|
486
445
|
* Node: Either a path or Buffer. Browser: a File or Blob.
|
|
487
446
|
* @param {String} options.product Add to this product ID or slug
|
|
488
|
-
* @param {
|
|
447
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
489
448
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
490
449
|
* @param {Object} [options.context] Request context
|
|
491
450
|
* @returns {Promise} A promise
|
|
@@ -516,7 +475,7 @@ class Particle {
|
|
|
516
475
|
* @param {String} options.deviceId Device ID or Name
|
|
517
476
|
* @param {Boolean} [options.deny] (Product only) Deny this quarantined device, instead of removing an already approved device
|
|
518
477
|
* @param {String} options.product Remove from this product ID or slug
|
|
519
|
-
* @param {
|
|
478
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
520
479
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
521
480
|
* @param {Object} [options.context] Request context
|
|
522
481
|
* @returns {Promise} A promise
|
|
@@ -532,7 +491,7 @@ class Particle {
|
|
|
532
491
|
* @param {Object} options Options for this API call
|
|
533
492
|
* @param {String} options.deviceId Device ID or Name
|
|
534
493
|
* @param {String} options.product Remove from this product ID or slug
|
|
535
|
-
* @param {
|
|
494
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
536
495
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
537
496
|
* @param {Object} [options.context] Request context
|
|
538
497
|
* @returns {Promise} A promise
|
|
@@ -548,7 +507,7 @@ class Particle {
|
|
|
548
507
|
* @param {String} options.deviceId Device ID or Name
|
|
549
508
|
* @param {String} options.name Desired Name
|
|
550
509
|
* @param {String} [options.product] Rename device in this product ID or slug
|
|
551
|
-
* @param {
|
|
510
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
552
511
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
553
512
|
* @param {Object} [options.context] Request context
|
|
554
513
|
* @returns {Promise} A promise
|
|
@@ -563,7 +522,7 @@ class Particle {
|
|
|
563
522
|
* @param {String} options.deviceId Device ID or Name
|
|
564
523
|
* @param {Boolean} options.signal Signal on or off
|
|
565
524
|
* @param {String} [options.product] Device in this product ID or slug
|
|
566
|
-
* @param {
|
|
525
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
567
526
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
568
527
|
* @param {Object} [options.context] Request context
|
|
569
528
|
* @returns {Promise} A promise
|
|
@@ -578,7 +537,7 @@ class Particle {
|
|
|
578
537
|
* @param {String} options.deviceId Device ID or Name
|
|
579
538
|
* @param {String} options.notes Your notes about this device
|
|
580
539
|
* @param {String} [options.product] Device in this product ID or slug
|
|
581
|
-
* @param {
|
|
540
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
582
541
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
583
542
|
* @param {Object} [options.context] Request context
|
|
584
543
|
* @returns {Promise} A promise
|
|
@@ -593,7 +552,7 @@ class Particle {
|
|
|
593
552
|
* @param {String} options.deviceId Device ID or Name
|
|
594
553
|
* @param {Boolean} options.development Set to true to mark as development, false to return to product fleet
|
|
595
554
|
* @param {String} options.product Device in this product ID or slug
|
|
596
|
-
* @param {
|
|
555
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
597
556
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
598
557
|
* @param {Object} [options.context] Request context
|
|
599
558
|
* @returns {Promise} A promise
|
|
@@ -609,7 +568,7 @@ class Particle {
|
|
|
609
568
|
* @param {Number} options.desiredFirmwareVersion Lock the product device to run this firmware version.
|
|
610
569
|
* @param {Boolean} [options.flash] Immediately flash firmware indicated by desiredFirmwareVersion
|
|
611
570
|
* @param {String} options.product Device in this product ID or slug
|
|
612
|
-
* @param {
|
|
571
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
613
572
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
614
573
|
* @param {Object} [options.context] Request context
|
|
615
574
|
* @returns {Promise} A promise
|
|
@@ -623,7 +582,7 @@ class Particle {
|
|
|
623
582
|
* @param {Object} options Options for this API call
|
|
624
583
|
* @param {String} options.deviceId Device ID or Name
|
|
625
584
|
* @param {String} options.product Device in this product ID or slug
|
|
626
|
-
* @param {
|
|
585
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
627
586
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
628
587
|
* @param {Object} [options.context] Request context
|
|
629
588
|
* @returns {Promise} A promise
|
|
@@ -644,7 +603,7 @@ class Particle {
|
|
|
644
603
|
* Pass `null` to unlock firmware and go back to released firmware.
|
|
645
604
|
* @param {Boolean} [options.flash] (Product only) Immediately flash firmware indicated by desiredFirmwareVersion
|
|
646
605
|
* @param {String} [options.product] Device in this product ID or slug
|
|
647
|
-
* @param {
|
|
606
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
648
607
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
649
608
|
* @param {Object} [options.context] Request context
|
|
650
609
|
* @returns {Promise} A promise
|
|
@@ -676,7 +635,7 @@ class Particle {
|
|
|
676
635
|
* @param {String} [options.deviceSignature] Base64-encoded device signature. Mandatory if `action` is `confirm`,
|
|
677
636
|
* @param {String} [options.devicePublicKeyFingerprint] Base64-encoded fingerprint of the device public key.
|
|
678
637
|
* Mandatory if `action` is `confirm`,
|
|
679
|
-
* @param {
|
|
638
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor.
|
|
680
639
|
* @param {Object} [options.headers] Key/value pairs to send as headers.
|
|
681
640
|
* @param {Object} [options.context] Request context.
|
|
682
641
|
* @returns {Promise} A promise
|
|
@@ -703,7 +662,7 @@ class Particle {
|
|
|
703
662
|
* Provision a new device for products that allow self-provisioning
|
|
704
663
|
* @param {Object} options Options for this API call
|
|
705
664
|
* @param {String} options.productId Product ID where to create this device
|
|
706
|
-
* @param {
|
|
665
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
707
666
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
708
667
|
* @param {Object} [options.context] Request context
|
|
709
668
|
* @returns {Promise} A promise
|
|
@@ -725,7 +684,7 @@ class Particle {
|
|
|
725
684
|
* @param {Object} options Options for this API call
|
|
726
685
|
* @param {String} [options.iccid] ICCID of the SIM card used in the Electron
|
|
727
686
|
* @param {String} [options.product] Device in this product ID or slug
|
|
728
|
-
* @param {
|
|
687
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
729
688
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
730
689
|
* @param {Object} [options.context] Request context
|
|
731
690
|
* @returns {Promise} A promise
|
|
@@ -750,7 +709,7 @@ class Particle {
|
|
|
750
709
|
* @param {String} options.deviceId Device ID or Name
|
|
751
710
|
* @param {String} options.name Variable name
|
|
752
711
|
* @param {String} [options.product] Device in this product ID or slug
|
|
753
|
-
* @param {
|
|
712
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
754
713
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
755
714
|
* @param {Object} [options.context] Request context
|
|
756
715
|
* @returns {Promise} A promise
|
|
@@ -770,7 +729,7 @@ class Particle {
|
|
|
770
729
|
* @param {String} options.product Flash device in this product ID or slug
|
|
771
730
|
* @param {Object} options.files Object containing files to be compiled and flashed. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
|
|
772
731
|
* @param {String} [options.targetVersion=latest] System firmware version to compile against
|
|
773
|
-
* @param {
|
|
732
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
774
733
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
775
734
|
* @param {Object} [options.context] Request context
|
|
776
735
|
* @returns {Promise} A promise
|
|
@@ -792,7 +751,7 @@ class Particle {
|
|
|
792
751
|
* DEPRECATED: Flash the Tinker application to a device. Instead compile and flash the Tinker source code.
|
|
793
752
|
* @param {Object} options Options for this API call
|
|
794
753
|
* @param {String} options.deviceId Device ID or Name
|
|
795
|
-
* @param {
|
|
754
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
796
755
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
797
756
|
* @param {Object} [options.context] Request context
|
|
798
757
|
* @returns {Promise} A promise
|
|
@@ -820,7 +779,7 @@ class Particle {
|
|
|
820
779
|
* @param {Object} options.files Object containing files to be compiled. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
|
|
821
780
|
* @param {Number} [options.platformId] Platform id number of the device you are compiling for. Common values are 0=Core, 6=Photon, 10=Electron.
|
|
822
781
|
* @param {String} [options.targetVersion=latest] System firmware version to compile against
|
|
823
|
-
* @param {
|
|
782
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
824
783
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
825
784
|
* @param {Object} [options.context] Request context
|
|
826
785
|
* @returns {Promise} A promise
|
|
@@ -849,7 +808,7 @@ class Particle {
|
|
|
849
808
|
* Download a firmware binary
|
|
850
809
|
* @param {Object} options Options for this API call
|
|
851
810
|
* @param {String} options.binaryId Binary ID received from a successful compile call
|
|
852
|
-
* @param {
|
|
811
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
853
812
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
854
813
|
* @param {Object} [options.context] Request context
|
|
855
814
|
* @returns {Promise<RequestResponse, RequestError>} A promise
|
|
@@ -871,7 +830,7 @@ class Particle {
|
|
|
871
830
|
* @param {String} options.deviceId Device ID or Name
|
|
872
831
|
* @param {String | Buffer} options.key Public key contents
|
|
873
832
|
* @param {String} [options.algorithm=rsa] Algorithm used to generate the public key. Valid values are `rsa` or `ecc`.
|
|
874
|
-
* @param {
|
|
833
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
875
834
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
876
835
|
* @param {Object} [options.context] Request context
|
|
877
836
|
* @returns {Promise} A promise
|
|
@@ -899,7 +858,7 @@ class Particle {
|
|
|
899
858
|
* @param {String} options.name Function name
|
|
900
859
|
* @param {String} options.argument Function argument
|
|
901
860
|
* @param {String} [options.product] Device in this product ID or slug
|
|
902
|
-
* @param {
|
|
861
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
903
862
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
904
863
|
* @param {Object} [options.context] Request context
|
|
905
864
|
* @returns {Promise} A promise
|
|
@@ -918,7 +877,7 @@ class Particle {
|
|
|
918
877
|
* @param {String} [options.name] Event Name
|
|
919
878
|
* @param {String} [options.org] Organization Slug
|
|
920
879
|
* @param {String} [options.product] Events for this product ID or slug
|
|
921
|
-
* @param {
|
|
880
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
922
881
|
* @returns {Promise} If the promise resolves, the resolution value will be an EventStream object that will
|
|
923
882
|
* emit 'event' events.
|
|
924
883
|
*/
|
|
@@ -956,7 +915,7 @@ class Particle {
|
|
|
956
915
|
* @param {String} options.data Event data
|
|
957
916
|
* @param {Boolean} options.isPrivate Should the event be publicly available?
|
|
958
917
|
* @param {String} [options.product] Event for this product ID or slug
|
|
959
|
-
* @param {
|
|
918
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
960
919
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
961
920
|
* @param {Object} [options.context] Request context
|
|
962
921
|
* @returns {Promise} A promise
|
|
@@ -970,7 +929,7 @@ class Particle {
|
|
|
970
929
|
/**
|
|
971
930
|
* @typedef {Object} Hook
|
|
972
931
|
* @property {String} [method=POST] Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
|
|
973
|
-
* @property {Object} [auth] Auth data like `{
|
|
932
|
+
* @property {Object} [auth] Auth data like `{ user: 'me', pass: '1234' }` for basic auth or `{ bearer: 'token' }` to send with the Webhook request
|
|
974
933
|
* @property {Object} [headers] Additional headers to add to the Webhook like `{ 'X-ONE': '1', X-TWO: '2' }`
|
|
975
934
|
* @property {Object} [query] Query params to add to the Webhook request like `{ foo: 'foo', bar: 'bar' }`
|
|
976
935
|
* @property {Object} [json] JSON data to send with the Webhook request - sets `Content-Type` to `application/json`
|
|
@@ -991,7 +950,7 @@ class Particle {
|
|
|
991
950
|
* @param {Boolean} [options.noDefaults] Don't include default event data in the webhook request
|
|
992
951
|
* @param {Hook} [options.hook] Webhook configuration settings
|
|
993
952
|
* @param {String} [options.product] Webhook for this product ID or slug
|
|
994
|
-
* @param {
|
|
953
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
995
954
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
996
955
|
* @param {Object} [options.context] Request context
|
|
997
956
|
* @returns {Promise} A promise
|
|
@@ -1025,7 +984,7 @@ class Particle {
|
|
|
1025
984
|
* @param {Object} options Options for this API call
|
|
1026
985
|
* @param {String} options.hookId Webhook ID
|
|
1027
986
|
* @param {String} [options.product] Webhook for this product ID or slug
|
|
1028
|
-
* @param {
|
|
987
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1029
988
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1030
989
|
* @param {Object} [options.context] Request context
|
|
1031
990
|
* @returns {Promise} A promise
|
|
@@ -1039,7 +998,7 @@ class Particle {
|
|
|
1039
998
|
* List all webhooks owned by the account or product
|
|
1040
999
|
* @param {Object} options Options for this API call
|
|
1041
1000
|
* @param {String} [options.product] Webhooks for this product ID or slug
|
|
1042
|
-
* @param {
|
|
1001
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1043
1002
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1044
1003
|
* @param {Object} [options.context] Request context
|
|
1045
1004
|
* @returns {Promise} A promise
|
|
@@ -1059,7 +1018,7 @@ class Particle {
|
|
|
1059
1018
|
* @param {Object} options.settings Settings specific to that integration type
|
|
1060
1019
|
* @param {String} [options.deviceId] Trigger integration only for this device ID or Name
|
|
1061
1020
|
* @param {String} [options.product] Integration for this product ID or slug
|
|
1062
|
-
* @param {
|
|
1021
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1063
1022
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1064
1023
|
* @param {Object} [options.context] Request context
|
|
1065
1024
|
* @returns {Promise} A promise
|
|
@@ -1081,7 +1040,7 @@ class Particle {
|
|
|
1081
1040
|
* @param {Object} [options.settings] Change the settings specific to that integration type
|
|
1082
1041
|
* @param {String} [options.deviceId] Trigger integration only for this device ID or Name
|
|
1083
1042
|
* @param {String} [options.product] Integration for this product ID or slug
|
|
1084
|
-
* @param {
|
|
1043
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1085
1044
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1086
1045
|
* @param {Object} [options.context] Request context
|
|
1087
1046
|
* @returns {Promise} A promise
|
|
@@ -1098,7 +1057,7 @@ class Particle {
|
|
|
1098
1057
|
* @param {Object} options Options for this API call
|
|
1099
1058
|
* @param {String} options.integrationId The integration to remove
|
|
1100
1059
|
* @param {String} [options.product] Integration for this product ID or slug
|
|
1101
|
-
* @param {
|
|
1060
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1102
1061
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1103
1062
|
* @param {Object} [options.context] Request context
|
|
1104
1063
|
* @returns {Promise} A promise
|
|
@@ -1112,7 +1071,7 @@ class Particle {
|
|
|
1112
1071
|
* List all integrations owned by the account or product
|
|
1113
1072
|
* @param {Object} options Options for this API call
|
|
1114
1073
|
* @param {String} [options.product] Integrations for this product ID or slug
|
|
1115
|
-
* @param {
|
|
1074
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1116
1075
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1117
1076
|
* @param {Object} [options.context] Request context
|
|
1118
1077
|
* @returns {Promise} A promise
|
|
@@ -1125,7 +1084,7 @@ class Particle {
|
|
|
1125
1084
|
/**
|
|
1126
1085
|
* Get details about the current user
|
|
1127
1086
|
* @param {Object} options Options for this API call
|
|
1128
|
-
* @param {
|
|
1087
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1129
1088
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1130
1089
|
* @param {Object} [options.context] Request context
|
|
1131
1090
|
* @returns {Promise} A promise
|
|
@@ -1137,7 +1096,7 @@ class Particle {
|
|
|
1137
1096
|
/**
|
|
1138
1097
|
* Set details on the current user
|
|
1139
1098
|
* @param {Object} options Options for this API call
|
|
1140
|
-
* @param {
|
|
1099
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1141
1100
|
* @param {String} options.accountInfo Set user's extended info fields (name, business account, company name, etc)
|
|
1142
1101
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1143
1102
|
* @param {Object} [options.context] Request context
|
|
@@ -1151,7 +1110,7 @@ class Particle {
|
|
|
1151
1110
|
/**
|
|
1152
1111
|
* Change username (i.e, email)
|
|
1153
1112
|
* @param {Object} options Options for this API call
|
|
1154
|
-
* @param {
|
|
1113
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1155
1114
|
* @param {String} options.currentPassword Current password
|
|
1156
1115
|
* @param {String} options.username New email
|
|
1157
1116
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
@@ -1172,7 +1131,7 @@ class Particle {
|
|
|
1172
1131
|
/**
|
|
1173
1132
|
* Change user's password
|
|
1174
1133
|
* @param {Object} options Options for this API call
|
|
1175
|
-
* @param {
|
|
1134
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1176
1135
|
* @param {String} options.currentPassword Current password
|
|
1177
1136
|
* @param {String} options.password New password
|
|
1178
1137
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
@@ -1199,7 +1158,7 @@ class Particle {
|
|
|
1199
1158
|
* @param {Number} [options.page] (Product only) Current page of results
|
|
1200
1159
|
* @param {Number} [options.perPage] (Product only) Records per page
|
|
1201
1160
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1202
|
-
* @param {
|
|
1161
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1203
1162
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1204
1163
|
* @param {Object} [options.context] Request context
|
|
1205
1164
|
* @returns {Promise} A promise
|
|
@@ -1215,7 +1174,7 @@ class Particle {
|
|
|
1215
1174
|
* @param {Object} options Options for this API call
|
|
1216
1175
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1217
1176
|
* @param {String} [options.product] SIM card for this product ID or slug
|
|
1218
|
-
* @param {
|
|
1177
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1219
1178
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1220
1179
|
* @param {Object} [options.context] Request context
|
|
1221
1180
|
* @returns {Promise} A promise
|
|
@@ -1232,7 +1191,7 @@ class Particle {
|
|
|
1232
1191
|
* Get data usage for all SIM cards in a product the current billing period
|
|
1233
1192
|
* @param {Object} options Options for this API call
|
|
1234
1193
|
* @param {String} options.product SIM cards for this product ID or slug
|
|
1235
|
-
* @param {
|
|
1194
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1236
1195
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1237
1196
|
* @param {Object} [options.context] Request context
|
|
1238
1197
|
* @returns {Promise} A promise
|
|
@@ -1250,7 +1209,7 @@ class Particle {
|
|
|
1250
1209
|
* Check SIM status
|
|
1251
1210
|
* @param {Object} options Options for this API call
|
|
1252
1211
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1253
|
-
* @param {
|
|
1212
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1254
1213
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1255
1214
|
* @param {Object} [options.context] Request context
|
|
1256
1215
|
* @returns {Promise} A promise
|
|
@@ -1266,7 +1225,7 @@ class Particle {
|
|
|
1266
1225
|
* @param {Array<String>} options.iccids (Product only) ICCID of multiple SIM cards to import
|
|
1267
1226
|
* @param {String} options.country The ISO country code for the SIM cards
|
|
1268
1227
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1269
|
-
* @param {
|
|
1228
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1270
1229
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1271
1230
|
* @param {Object} [options.context] Request context
|
|
1272
1231
|
* @param {any} [options.promoCode]
|
|
@@ -1289,7 +1248,7 @@ class Particle {
|
|
|
1289
1248
|
* @param {Object} options Options for this API call
|
|
1290
1249
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1291
1250
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1292
|
-
* @param {
|
|
1251
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1293
1252
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1294
1253
|
* @param {Object} [options.context] Request context
|
|
1295
1254
|
* @returns {Promise} A promise
|
|
@@ -1306,7 +1265,7 @@ class Particle {
|
|
|
1306
1265
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1307
1266
|
* @param {Number} [options.mbLimit] New monthly data limit. Necessary if unpausing a SIM card
|
|
1308
1267
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1309
|
-
* @param {
|
|
1268
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1310
1269
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1311
1270
|
* @param {Object} [options.context] Request context
|
|
1312
1271
|
* @returns {Promise} A promise
|
|
@@ -1323,7 +1282,7 @@ class Particle {
|
|
|
1323
1282
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1324
1283
|
* @param {Array} options.mbLimit Data limit in megabyte for the SIM card
|
|
1325
1284
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1326
|
-
* @param {
|
|
1285
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1327
1286
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1328
1287
|
* @param {Object} [options.context] Request context
|
|
1329
1288
|
* @returns {Promise} A promise
|
|
@@ -1339,7 +1298,7 @@ class Particle {
|
|
|
1339
1298
|
* @param {Object} options Options for this API call
|
|
1340
1299
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1341
1300
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1342
|
-
* @param {
|
|
1301
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1343
1302
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1344
1303
|
* @param {Object} [options.context] Request context
|
|
1345
1304
|
* @returns {Promise} A promise
|
|
@@ -1353,7 +1312,7 @@ class Particle {
|
|
|
1353
1312
|
* List valid build targets to be used for compiling
|
|
1354
1313
|
* @param {Object} options Options for this API call
|
|
1355
1314
|
* @param {Boolean} [options.onlyFeatured=false] Only list featured build targets
|
|
1356
|
-
* @param {
|
|
1315
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1357
1316
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1358
1317
|
* @param {Object} [options.context] Request context
|
|
1359
1318
|
* @returns {Promise} A promise
|
|
@@ -1382,7 +1341,7 @@ class Particle {
|
|
|
1382
1341
|
* - 'featured' - list only featured libraries
|
|
1383
1342
|
* @param {String} options.excludeScopes list of scopes to exclude
|
|
1384
1343
|
* @param {String} options.category Category to filter
|
|
1385
|
-
* @param {
|
|
1344
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1386
1345
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1387
1346
|
* @param {Object} [options.context] Request context
|
|
1388
1347
|
* @returns {Promise} A promise
|
|
@@ -1415,7 +1374,7 @@ class Particle {
|
|
|
1415
1374
|
* @param {Object} options Options for this API call
|
|
1416
1375
|
* @param {String} options.name Name of the library to fetch
|
|
1417
1376
|
* @param {String} options.version Version of the library to fetch (default: latest)
|
|
1418
|
-
* @param {
|
|
1377
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1419
1378
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1420
1379
|
* @param {Object} [options.context] Request context
|
|
1421
1380
|
* @returns {Promise} A promise
|
|
@@ -1436,7 +1395,7 @@ class Particle {
|
|
|
1436
1395
|
* @param {String} options.name Name of the library to fetch
|
|
1437
1396
|
* @param {Number} options.page Page index (default, first page)
|
|
1438
1397
|
* @param {Number} options.limit Number of items per page
|
|
1439
|
-
* @param {
|
|
1398
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1440
1399
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1441
1400
|
* @param {Object} [options.context] Request context
|
|
1442
1401
|
* @returns {Promise} A promise
|
|
@@ -1456,7 +1415,7 @@ class Particle {
|
|
|
1456
1415
|
* @param {Object} options Options for this API call
|
|
1457
1416
|
* @param {String | Buffer} options.archive Compressed archive file containing the library sources
|
|
1458
1417
|
* Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
|
|
1459
|
-
* @param {
|
|
1418
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1460
1419
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1461
1420
|
* @param {Object} [options.context] Request context
|
|
1462
1421
|
* @returns {Promise} A promise
|
|
@@ -1480,7 +1439,7 @@ class Particle {
|
|
|
1480
1439
|
* Publish the latest version of a library to the public
|
|
1481
1440
|
* @param {Object} options Options for this API call
|
|
1482
1441
|
* @param {String} options.name Name of the library to publish
|
|
1483
|
-
* @param {
|
|
1442
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1484
1443
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1485
1444
|
* @param {Object} [options.context] Request context
|
|
1486
1445
|
* @returns {Promise} A promise
|
|
@@ -1501,7 +1460,7 @@ class Particle {
|
|
|
1501
1460
|
* @param {Object} options Options for this API call
|
|
1502
1461
|
* @param {String} options.name Name of the library to remove
|
|
1503
1462
|
* @param {String} options.force Key to force deleting a public library
|
|
1504
|
-
* @param {
|
|
1463
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1505
1464
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1506
1465
|
* @param {Object} [options.context] Request context
|
|
1507
1466
|
* @returns {Promise} A promise
|
|
@@ -1532,7 +1491,7 @@ class Particle {
|
|
|
1532
1491
|
* List OAuth client created by the account
|
|
1533
1492
|
* @param {Object} options Options for this API call
|
|
1534
1493
|
* @param {String} [options.product] List clients for this product ID or slug
|
|
1535
|
-
* @param {
|
|
1494
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1536
1495
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1537
1496
|
* @param {Object} [options.context] Request context
|
|
1538
1497
|
* @returns {Promise} A promise
|
|
@@ -1550,7 +1509,7 @@ class Particle {
|
|
|
1550
1509
|
* @param {String} [options.redirect_uri] URL to redirect after OAuth flow. Only for type web.
|
|
1551
1510
|
* @param {Object} [options.scope] Limits what the access tokens created by this client can do.
|
|
1552
1511
|
* @param {String} [options.product] Create client for this product ID or slug
|
|
1553
|
-
* @param {
|
|
1512
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1554
1513
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1555
1514
|
* @param {Object} [options.context] Request context
|
|
1556
1515
|
* @returns {Promise} A promise
|
|
@@ -1568,7 +1527,7 @@ class Particle {
|
|
|
1568
1527
|
* @param {String} [options.name] New Name of the OAuth client
|
|
1569
1528
|
* @param {Object} [options.scope] New scope of the OAuth client
|
|
1570
1529
|
* @param {String} [options.product] Update client linked to this product ID or slug
|
|
1571
|
-
* @param {
|
|
1530
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1572
1531
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1573
1532
|
* @param {Object} [options.context] Request context
|
|
1574
1533
|
* @returns {Promise} A promise
|
|
@@ -1584,7 +1543,7 @@ class Particle {
|
|
|
1584
1543
|
* @param {Object} options Options for this API call
|
|
1585
1544
|
* @param {String} options.clientId The OAuth client to update
|
|
1586
1545
|
* @param {String} [options.product] OAuth client linked to this product ID or slug
|
|
1587
|
-
* @param {
|
|
1546
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1588
1547
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1589
1548
|
* @param {Object} [options.context] Request context
|
|
1590
1549
|
* @returns {Promise} A promise
|
|
@@ -1597,7 +1556,7 @@ class Particle {
|
|
|
1597
1556
|
/**
|
|
1598
1557
|
* List products the account has access to
|
|
1599
1558
|
* @param {Object} options Options for this API call
|
|
1600
|
-
* @param {
|
|
1559
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1601
1560
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1602
1561
|
* @param {Object} [options.context] Request context
|
|
1603
1562
|
* @returns {Promise} A promise
|
|
@@ -1610,7 +1569,7 @@ class Particle {
|
|
|
1610
1569
|
* Get detailed information about a product
|
|
1611
1570
|
* @param {Object} options Options for this API call
|
|
1612
1571
|
* @param {String} options.product Product ID or slug
|
|
1613
|
-
* @param {
|
|
1572
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1614
1573
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1615
1574
|
* @param {Object} [options.context] Request context
|
|
1616
1575
|
* @returns {Promise} A promise
|
|
@@ -1623,7 +1582,7 @@ class Particle {
|
|
|
1623
1582
|
* List product firmware versions
|
|
1624
1583
|
* @param {Object} options Options for this API call
|
|
1625
1584
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1626
|
-
* @param {
|
|
1585
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1627
1586
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1628
1587
|
* @param {Object} [options.context] Request context
|
|
1629
1588
|
* @returns {Promise} A promise
|
|
@@ -1641,7 +1600,7 @@ class Particle {
|
|
|
1641
1600
|
* @param {String} options.title Short identifier for the new firmware
|
|
1642
1601
|
* @param {String} [options.description] Longer description for the new firmware
|
|
1643
1602
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1644
|
-
* @param {
|
|
1603
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1645
1604
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1646
1605
|
* @param {Object} [options.context] Request context
|
|
1647
1606
|
* @returns {Promise} A promise
|
|
@@ -1669,7 +1628,7 @@ class Particle {
|
|
|
1669
1628
|
* @param {Object} options Options for this API call
|
|
1670
1629
|
* @param {Number} options.version Version number of firmware
|
|
1671
1630
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1672
|
-
* @param {
|
|
1631
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1673
1632
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1674
1633
|
* @param {Object} [options.context] Request context
|
|
1675
1634
|
* @returns {Promise} A promise
|
|
@@ -1690,7 +1649,7 @@ class Particle {
|
|
|
1690
1649
|
* @param {String} [options.title] New title
|
|
1691
1650
|
* @param {String} [options.description] New description
|
|
1692
1651
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1693
|
-
* @param {
|
|
1652
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1694
1653
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1695
1654
|
* @param {Object} [options.context] Request context
|
|
1696
1655
|
* @returns {Promise} A promise
|
|
@@ -1705,7 +1664,7 @@ class Particle {
|
|
|
1705
1664
|
* @param {Object} options Options for this API call
|
|
1706
1665
|
* @param {Number} options.version Version number of new firmware
|
|
1707
1666
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1708
|
-
* @param {
|
|
1667
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1709
1668
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1710
1669
|
* @param {Object} [options.context] Request context
|
|
1711
1670
|
* @returns {Promise<RequestResponse, RequestError>} A promise that resolves with either the requested data or an error object
|
|
@@ -1726,7 +1685,7 @@ class Particle {
|
|
|
1726
1685
|
* @param {Object} options Options for this API call
|
|
1727
1686
|
* @param {Number} options.version Version number of new firmware
|
|
1728
1687
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1729
|
-
* @param {
|
|
1688
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1730
1689
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1731
1690
|
* @param {Object} [options.context] Request context
|
|
1732
1691
|
* @returns {Promise} A promise
|
|
@@ -1740,7 +1699,7 @@ class Particle {
|
|
|
1740
1699
|
* List product team members
|
|
1741
1700
|
* @param {Object} options Options for this API call
|
|
1742
1701
|
* @param {String} options.product Team for this product ID or slug
|
|
1743
|
-
* @param {
|
|
1702
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1744
1703
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1745
1704
|
* @param {Object} [options.context] Request context
|
|
1746
1705
|
* @returns {Promise} A promise
|
|
@@ -1759,7 +1718,7 @@ class Particle {
|
|
|
1759
1718
|
* @param {Object} options Options for this API call
|
|
1760
1719
|
* @param {String} options.username Username for the Particle account
|
|
1761
1720
|
* @param {String} options.product Team for this product ID or slug
|
|
1762
|
-
* @param {
|
|
1721
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1763
1722
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1764
1723
|
* @param {Object} [options.context] Request context
|
|
1765
1724
|
* @returns {Promise} A promise
|
|
@@ -1779,7 +1738,7 @@ class Particle {
|
|
|
1779
1738
|
* @param {Object} options Options for this API call
|
|
1780
1739
|
* @param {String} options.username Username for the Particle account
|
|
1781
1740
|
* @param {String} options.product Team for this product ID or slug
|
|
1782
|
-
* @param {
|
|
1741
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1783
1742
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1784
1743
|
* @param {Object} [options.context] Request context
|
|
1785
1744
|
* @returns {Promise} A promise
|
|
@@ -1797,7 +1756,7 @@ class Particle {
|
|
|
1797
1756
|
* Fetch details about a serial number
|
|
1798
1757
|
* @param {Object} options Options for this API call
|
|
1799
1758
|
* @param {String} options.serialNumber The serial number printed on the barcode of the device packaging
|
|
1800
|
-
* @param {
|
|
1759
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1801
1760
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1802
1761
|
* @param {Object} [options.context] Request context
|
|
1803
1762
|
* @returns {Promise} A promise
|
|
@@ -1817,7 +1776,7 @@ class Particle {
|
|
|
1817
1776
|
* @param {String} options.name Network name
|
|
1818
1777
|
* @param {String} options.deviceId Gateway device ID
|
|
1819
1778
|
* @param {String} [options.iccid] ICCID of the active SIM card (only for cellular gateway devices)
|
|
1820
|
-
* @param {
|
|
1779
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1821
1780
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1822
1781
|
* @param {Object} [options.context] Request context
|
|
1823
1782
|
* @returns {Promise<Object>} A promise
|
|
@@ -1836,7 +1795,7 @@ class Particle {
|
|
|
1836
1795
|
* Remove a mesh network.
|
|
1837
1796
|
* @param {Object} options Options for this API call
|
|
1838
1797
|
* @param {String} options.networkId Network ID or name
|
|
1839
|
-
* @param {
|
|
1798
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1840
1799
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1841
1800
|
* @param {Object} [options.context] Request context
|
|
1842
1801
|
* @returns {Promise<Object>} A promise
|
|
@@ -1848,7 +1807,7 @@ class Particle {
|
|
|
1848
1807
|
/**
|
|
1849
1808
|
* List all mesh networks
|
|
1850
1809
|
* @param {Object} options Options for this API call
|
|
1851
|
-
* @param {
|
|
1810
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1852
1811
|
* @param {Number} [options.page] Current page of results
|
|
1853
1812
|
* @param {Number} [options.perPage] Records per page
|
|
1854
1813
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -1864,7 +1823,7 @@ class Particle {
|
|
|
1864
1823
|
* Get information about a mesh network.
|
|
1865
1824
|
* @param {Object} options Options for this API call
|
|
1866
1825
|
* @param {String} options.networkId Network ID or name
|
|
1867
|
-
* @param {
|
|
1826
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1868
1827
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1869
1828
|
* @param {Object} [options.context] Request context
|
|
1870
1829
|
* @returns {Promise<Object>} A promise
|
|
@@ -1879,7 +1838,7 @@ class Particle {
|
|
|
1879
1838
|
* @param {String} options.networkId Network ID or name
|
|
1880
1839
|
* @param {String} options.action 'add-device', 'remove-device', 'gateway-enable' or 'gateway-disable'
|
|
1881
1840
|
* @param {String} options.deviceId Device ID
|
|
1882
|
-
* @param {
|
|
1841
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1883
1842
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1884
1843
|
* @param {Object} [options.context] Request context
|
|
1885
1844
|
* @returns {Promise<Object>} A promise
|
|
@@ -1899,7 +1858,7 @@ class Particle {
|
|
|
1899
1858
|
* @param {Object} options Options for this API call
|
|
1900
1859
|
* @param {String} options.networkId Network ID or name
|
|
1901
1860
|
* @param {String} options.deviceId Device ID
|
|
1902
|
-
* @param {
|
|
1861
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1903
1862
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1904
1863
|
* @param {Object} [options.context] Request context
|
|
1905
1864
|
* @returns {Promise<Object>} A promise
|
|
@@ -1920,7 +1879,7 @@ class Particle {
|
|
|
1920
1879
|
* @param {Object} options Options for this API call
|
|
1921
1880
|
* @param {String} [options.networkId] Network ID or name
|
|
1922
1881
|
* @param {String} options.deviceId Device ID
|
|
1923
|
-
* @param {
|
|
1882
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1924
1883
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1925
1884
|
* @param {Object} [options.context] Request context
|
|
1926
1885
|
* @returns {Promise<Object>} A promise
|
|
@@ -1947,7 +1906,7 @@ class Particle {
|
|
|
1947
1906
|
* List all devices of a mesh network.
|
|
1948
1907
|
* @param {Object} options Options for this API call
|
|
1949
1908
|
* @param {String} options.networkId Network ID or name
|
|
1950
|
-
* @param {
|
|
1909
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1951
1910
|
* @param {Number} [options.role] Device role: 'gateway' or 'node'
|
|
1952
1911
|
* @param {Number} [options.page] Current page of results
|
|
1953
1912
|
* @param {Number} [options.perPage] Records per page
|
|
@@ -1970,7 +1929,7 @@ class Particle {
|
|
|
1970
1929
|
* Get product configuration
|
|
1971
1930
|
* @param {Object} options Options for this API call
|
|
1972
1931
|
* @param {String} options.product Config for this product ID or slug
|
|
1973
|
-
* @param {
|
|
1932
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1974
1933
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1975
1934
|
* @param {Object} [options.context] Request context
|
|
1976
1935
|
* @returns {Promise} A promise
|
|
@@ -1988,7 +1947,7 @@ class Particle {
|
|
|
1988
1947
|
* Get product configuration schema
|
|
1989
1948
|
* @param {Object} options Options for this API call
|
|
1990
1949
|
* @param {String} options.product Config for this product ID or slug
|
|
1991
|
-
* @param {
|
|
1950
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1992
1951
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1993
1952
|
* @param {Object} [options.context] Request context
|
|
1994
1953
|
* @returns {Promise} A promise
|
|
@@ -2007,7 +1966,7 @@ class Particle {
|
|
|
2007
1966
|
* Get product device's configuration
|
|
2008
1967
|
* @param {Object} options Options for this API call
|
|
2009
1968
|
* @param {String} options.product Config for this product ID or slug
|
|
2010
|
-
* @param {
|
|
1969
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2011
1970
|
* @param {String} options.deviceId Device ID to access
|
|
2012
1971
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2013
1972
|
* @param {Object} [options.context] Request context
|
|
@@ -2026,7 +1985,7 @@ class Particle {
|
|
|
2026
1985
|
* Get product device's configuration schema
|
|
2027
1986
|
* @param {Object} options Options for this API call
|
|
2028
1987
|
* @param {String} options.product Config for this product ID or slug
|
|
2029
|
-
* @param {
|
|
1988
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2030
1989
|
* @param {String} options.deviceId Device ID to access
|
|
2031
1990
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2032
1991
|
* @param {Object} [options.context] Request context
|
|
@@ -2046,7 +2005,7 @@ class Particle {
|
|
|
2046
2005
|
* Set product configuration
|
|
2047
2006
|
* @param {Object} options Options for this API call
|
|
2048
2007
|
* @param {String} options.product Config for this product ID or slug
|
|
2049
|
-
* @param {
|
|
2008
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2050
2009
|
* @param {Object} options.config Product configuration to update
|
|
2051
2010
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2052
2011
|
* @param {Object} [options.context] Request context
|
|
@@ -2066,7 +2025,7 @@ class Particle {
|
|
|
2066
2025
|
* Set product configuration for a specific device within the product
|
|
2067
2026
|
* @param {Object} options Options for this API call
|
|
2068
2027
|
* @param {String} options.product Config for this product ID or slug
|
|
2069
|
-
* @param {
|
|
2028
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2070
2029
|
* @param {Object} options.config Product configuration to update
|
|
2071
2030
|
* @param {String} options.deviceId Device ID to access
|
|
2072
2031
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2087,7 +2046,7 @@ class Particle {
|
|
|
2087
2046
|
* Query location for devices within a product
|
|
2088
2047
|
* @param {Object} options Options for this API call
|
|
2089
2048
|
* @param {String} options.product Locations for this product ID or slug
|
|
2090
|
-
* @param {
|
|
2049
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2091
2050
|
* @param {String} options.dateRange Start and end date in ISO8601 format, separated by comma, to query
|
|
2092
2051
|
* @param {String} options.rectBl Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
2093
2052
|
* @param {String} options.rectTr Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
@@ -2123,7 +2082,7 @@ class Particle {
|
|
|
2123
2082
|
* Query location for one device within a product
|
|
2124
2083
|
* @param {Object} options Options for this API call
|
|
2125
2084
|
* @param {String} options.product Locations for this product ID or slug
|
|
2126
|
-
* @param {
|
|
2085
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2127
2086
|
* @param {String} options.dateRange Start and end date in ISO8601 format, separated by comma, to query
|
|
2128
2087
|
* @param {String} options.rectBl Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
2129
2088
|
* @param {String} options.rectTr Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
@@ -2154,7 +2113,7 @@ class Particle {
|
|
|
2154
2113
|
* NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.
|
|
2155
2114
|
*
|
|
2156
2115
|
* @param {Object} options The options for creating the logic function.
|
|
2157
|
-
* @param {
|
|
2116
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2158
2117
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2159
2118
|
* @param {Object} options.logic The logic "function" which will be executed once
|
|
2160
2119
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2182,7 +2141,7 @@ class Particle {
|
|
|
2182
2141
|
* according to the cron and start_at properties.
|
|
2183
2142
|
*
|
|
2184
2143
|
* @param {Object} options The options for creating the logic function.
|
|
2185
|
-
* @param {
|
|
2144
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2186
2145
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2187
2146
|
* @param {Object} options.logicFunction The logic function object containing the function details.
|
|
2188
2147
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2204,7 +2163,7 @@ class Particle {
|
|
|
2204
2163
|
* Get a logic function in the specified organization or sandbox by logic function ID.
|
|
2205
2164
|
*
|
|
2206
2165
|
* @param {Object} options The options for the logic function.
|
|
2207
|
-
* @param {
|
|
2166
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2208
2167
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2209
2168
|
* @param {string} options.logicFunctionId The ID of the logic function to retrieve.
|
|
2210
2169
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2227,7 +2186,7 @@ class Particle {
|
|
|
2227
2186
|
* If you include an id on a logic trigger, it will update the logic trigger in place.
|
|
2228
2187
|
*
|
|
2229
2188
|
* @param {Object} options The options for updating the logic function.
|
|
2230
|
-
* @param {
|
|
2189
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2231
2190
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2232
2191
|
* @param {string} options.logicFunctionId The ID of the logic function to update.
|
|
2233
2192
|
* @param {Object} options.logicFunction The logic function object containing the logic function details.
|
|
@@ -2250,7 +2209,7 @@ class Particle {
|
|
|
2250
2209
|
* Deletes a logic function in the specified organization or sandbox by logic function ID.
|
|
2251
2210
|
*
|
|
2252
2211
|
* @param {Object} options The options for deleting the logic function.
|
|
2253
|
-
* @param {
|
|
2212
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2254
2213
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2255
2214
|
* @param {string} options.logicFunctionId The ID of the logic function to delete.
|
|
2256
2215
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2271,7 +2230,7 @@ class Particle {
|
|
|
2271
2230
|
* Lists all logic functions in the specified organization or sandbox.
|
|
2272
2231
|
*
|
|
2273
2232
|
* @param {Object} options The options for listing logic functions.
|
|
2274
|
-
* @param {
|
|
2233
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2275
2234
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2276
2235
|
* @param {boolean} [options.todayStats] Whether to include today's stats in the response
|
|
2277
2236
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2295,7 +2254,7 @@ class Particle {
|
|
|
2295
2254
|
* Lists all logic runs for the specified logic function in the specified organization or sandbox.
|
|
2296
2255
|
*
|
|
2297
2256
|
* @param {Object} options The options for the request.
|
|
2298
|
-
* @param {
|
|
2257
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2299
2258
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2300
2259
|
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic runs.
|
|
2301
2260
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2316,7 +2275,7 @@ class Particle {
|
|
|
2316
2275
|
* Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.
|
|
2317
2276
|
*
|
|
2318
2277
|
* @param {Object} options The options for the request.
|
|
2319
|
-
* @param {
|
|
2278
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2320
2279
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2321
2280
|
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic run.
|
|
2322
2281
|
* @param {string} options.logicRunId The ID of the logic run to retrieve.
|
|
@@ -2338,7 +2297,7 @@ class Particle {
|
|
|
2338
2297
|
* Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.
|
|
2339
2298
|
*
|
|
2340
2299
|
* @param {Object} options The options for the request.
|
|
2341
|
-
* @param {
|
|
2300
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2342
2301
|
* @param {string} [options.org] The unique identifier of the organization.
|
|
2343
2302
|
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic run logs.
|
|
2344
2303
|
* @param {string} options.logicRunId The ID of the logic run for which to retrieve the logs.
|
|
@@ -2360,7 +2319,7 @@ class Particle {
|
|
|
2360
2319
|
* Creates a new ledger definition in the specified organization or sandbox.
|
|
2361
2320
|
*
|
|
2362
2321
|
* @param {Object} options The options for creating the ledger definition.
|
|
2363
|
-
* @param {
|
|
2322
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2364
2323
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2365
2324
|
* @param {object} options.ledger The ledger definition object.
|
|
2366
2325
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2382,7 +2341,7 @@ class Particle {
|
|
|
2382
2341
|
* Get a ledger definition in the specified organization or sandbox by ledger name.
|
|
2383
2342
|
*
|
|
2384
2343
|
* @param {Object} options The options for the ledger definition.
|
|
2385
|
-
* @param {
|
|
2344
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2386
2345
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2387
2346
|
* @param {string} options.ledgerName The ID of the ledger definition to retrieve.
|
|
2388
2347
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2403,7 +2362,7 @@ class Particle {
|
|
|
2403
2362
|
* Updates an existing ledger definition in the specified organization or sandbox.
|
|
2404
2363
|
*
|
|
2405
2364
|
* @param {Object} options The options for updating the ledger definition.
|
|
2406
|
-
* @param {
|
|
2365
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2407
2366
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2408
2367
|
* @param {string} options.ledgerName Name of the ledger definition to update.
|
|
2409
2368
|
* @param {object} options.ledger The ledger definition object.
|
|
@@ -2426,7 +2385,7 @@ class Particle {
|
|
|
2426
2385
|
* Archives a ledger definition in the specified organization or sandbox by ledger name.
|
|
2427
2386
|
*
|
|
2428
2387
|
* @param {Object} options The options for archiving the ledger definition.
|
|
2429
|
-
* @param {
|
|
2388
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2430
2389
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2431
2390
|
* @param {string} options.ledgerName Name of the ledger definition to archive.
|
|
2432
2391
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2451,7 +2410,7 @@ class Particle {
|
|
|
2451
2410
|
* Lists all ledger definitions in the specified organization or sandbox.
|
|
2452
2411
|
*
|
|
2453
2412
|
* @param {Object} options The options for listing ledger definitions.
|
|
2454
|
-
* @param {
|
|
2413
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2455
2414
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2456
2415
|
* @param {Scope} [options.scope] Filter to show only ledgers of the specified scope
|
|
2457
2416
|
* @param {boolean} [options.archived] Filter to show only archived ledger or non-archived ledgers. If not provided, all ledgers are returned.
|
|
@@ -2481,7 +2440,7 @@ class Particle {
|
|
|
2481
2440
|
* Get ledger instance data.
|
|
2482
2441
|
*
|
|
2483
2442
|
* @param {Object} options The options for the ledger instance.
|
|
2484
|
-
* @param {
|
|
2443
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2485
2444
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2486
2445
|
* @param {string} options.ledgerName Ledger name.
|
|
2487
2446
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2507,7 +2466,7 @@ class Particle {
|
|
|
2507
2466
|
* Set ledger instance data.
|
|
2508
2467
|
*
|
|
2509
2468
|
* @param {Object} options The options for updating the ledger instance.
|
|
2510
|
-
* @param {
|
|
2469
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2511
2470
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2512
2471
|
* @param {string} options.ledgerName Ledger name.
|
|
2513
2472
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2535,7 +2494,7 @@ class Particle {
|
|
|
2535
2494
|
* Delete a ledger instance in the specified organization or sandbox by ledger name.
|
|
2536
2495
|
*
|
|
2537
2496
|
* @param {Object} options The options for archiving the ledger instance.
|
|
2538
|
-
* @param {
|
|
2497
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2539
2498
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2540
2499
|
* @param {string} options.ledgerName Name of the ledger instance to archive.
|
|
2541
2500
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2557,7 +2516,7 @@ class Particle {
|
|
|
2557
2516
|
* Lists ledger instances in the specified organization or sandbox.
|
|
2558
2517
|
*
|
|
2559
2518
|
* @param {Object} options The options for listing ledger instances.
|
|
2560
|
-
* @param {
|
|
2519
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2561
2520
|
* @param {string} [options.org] The unique identifier of the organization.
|
|
2562
2521
|
* @param {string} options.ledgerName Name of the ledger instance to archive.
|
|
2563
2522
|
* @param {number} [options.page] Page of results to display
|
|
@@ -2584,7 +2543,7 @@ class Particle {
|
|
|
2584
2543
|
* List ledger instance versions
|
|
2585
2544
|
*
|
|
2586
2545
|
* @param {Object} options The options for the ledger instance.
|
|
2587
|
-
* @param {
|
|
2546
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2588
2547
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2589
2548
|
* @param {string} options.ledgerName Ledger name.
|
|
2590
2549
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2612,7 +2571,7 @@ class Particle {
|
|
|
2612
2571
|
* Get specific ledger instance version
|
|
2613
2572
|
*
|
|
2614
2573
|
* @param {Object} options The options for the ledger instance.
|
|
2615
|
-
* @param {
|
|
2574
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2616
2575
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2617
2576
|
* @param {string} options.ledgerName Ledger name.
|
|
2618
2577
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2639,7 +2598,7 @@ class Particle {
|
|
|
2639
2598
|
* @param {Number} [options.internalVersion] Internal version number to filter Device OS versions
|
|
2640
2599
|
* @param {Number} [options.page] Page number for pagination
|
|
2641
2600
|
* @param {Number} [options.perPage] Number of items per page
|
|
2642
|
-
* @param {
|
|
2601
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2643
2602
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2644
2603
|
* @param {Object} [options.context] Request context
|
|
2645
2604
|
*
|
|
@@ -2668,7 +2627,7 @@ class Particle {
|
|
|
2668
2627
|
* @param {Object} options Options for this API call
|
|
2669
2628
|
* @param {String} options.version Version of the Device OS
|
|
2670
2629
|
* @param {Number} [options.platformId] Optional platform ID to filter Device OS version
|
|
2671
|
-
* @param {
|
|
2630
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2672
2631
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2673
2632
|
* @param {Object} [options.context] Request context
|
|
2674
2633
|
*
|
|
@@ -2687,16 +2646,14 @@ class Particle {
|
|
|
2687
2646
|
|
|
2688
2647
|
/**
|
|
2689
2648
|
* Set default auth token that will be used in each method if `auth` is not provided
|
|
2690
|
-
* @param {
|
|
2649
|
+
* @param {string} auth The access token
|
|
2691
2650
|
* @throws {Error} When not auth string is provided
|
|
2692
2651
|
*/
|
|
2693
2652
|
setDefaultAuth(auth){
|
|
2694
2653
|
if (typeof auth === 'string' && auth.length !== 0) {
|
|
2695
2654
|
this._defaultAuth = auth;
|
|
2696
|
-
} else if (typeof auth === 'object' && 'username' in auth && 'password' in auth) {
|
|
2697
|
-
this._defaultAuth = auth;
|
|
2698
2655
|
} else {
|
|
2699
|
-
throw new Error('Must pass a non-empty string
|
|
2656
|
+
throw new Error('Must pass a non-empty string representing an auth token!');
|
|
2700
2657
|
}
|
|
2701
2658
|
}
|
|
2702
2659
|
/**
|
|
@@ -2742,7 +2699,7 @@ class Particle {
|
|
|
2742
2699
|
* Make a GET request
|
|
2743
2700
|
* @param {object} params
|
|
2744
2701
|
* @param {string} params.uri The URI to request
|
|
2745
|
-
* @param {
|
|
2702
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2746
2703
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2747
2704
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2748
2705
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2758,7 +2715,7 @@ class Particle {
|
|
|
2758
2715
|
* Make a HEAD request
|
|
2759
2716
|
* @param {object} params
|
|
2760
2717
|
* @param {string} params.uri The URI to request
|
|
2761
|
-
* @param {
|
|
2718
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2762
2719
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2763
2720
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2764
2721
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2774,7 +2731,7 @@ class Particle {
|
|
|
2774
2731
|
* Make a POST request
|
|
2775
2732
|
* @param {object} params
|
|
2776
2733
|
* @param {string} params.uri The URI to request
|
|
2777
|
-
* @param {
|
|
2734
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2778
2735
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2779
2736
|
* @param {string | object} [params.data] Request body
|
|
2780
2737
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2790,7 +2747,7 @@ class Particle {
|
|
|
2790
2747
|
* Make a PUT request
|
|
2791
2748
|
* @param {object} params
|
|
2792
2749
|
* @param {string} params.uri The URI to request
|
|
2793
|
-
* @param {
|
|
2750
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2794
2751
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2795
2752
|
* @param {string | object} [params.data] Request body
|
|
2796
2753
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
@@ -2807,7 +2764,7 @@ class Particle {
|
|
|
2807
2764
|
* Make a DELETE request
|
|
2808
2765
|
* @param {object} params
|
|
2809
2766
|
* @param {string} params.uri The URI to request
|
|
2810
|
-
* @param {
|
|
2767
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2811
2768
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2812
2769
|
* @param {string | object} [params.data] Request body
|
|
2813
2770
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2826,7 +2783,7 @@ class Particle {
|
|
|
2826
2783
|
* @param {String} args.method The method used to request the URI, should be in uppercase.
|
|
2827
2784
|
* @param {Object} [args.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2828
2785
|
* @param {object} [args.data] Arbitrary data to send as the body.
|
|
2829
|
-
* @param {
|
|
2786
|
+
* @param {string} [args.auth] Authorization
|
|
2830
2787
|
* @param {Object} [args.query] Query parameters
|
|
2831
2788
|
* @param {Object} [args.form] Form fields
|
|
2832
2789
|
* @param {Object} [args.files] Array of file names and file content
|
|
@@ -2852,7 +2809,4 @@ class Particle {
|
|
|
2852
2809
|
}
|
|
2853
2810
|
}
|
|
2854
2811
|
|
|
2855
|
-
// Aliases for backwards compatibility
|
|
2856
|
-
Particle.prototype.removeAccessToken = Particle.prototype.deleteAccessToken;
|
|
2857
|
-
|
|
2858
2812
|
module.exports = Particle;
|