particle-api-js 10.6.0 → 11.1.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 +7 -0
- package/dist/particle.min.js +1 -1
- package/dist/particle.min.js.map +1 -1
- package/docs/api.md +256 -276
- package/package.json +1 -1
- package/src/Agent.js +10 -33
- package/src/EventStream.js +4 -1
- package/src/Particle.js +124 -154
- package/test/Agent.spec.js +0 -22
- package/test/EventStream.spec.js +4 -1
- package/test/Particle.spec.js +1 -46
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
|
|
@@ -293,19 +292,15 @@ class Particle {
|
|
|
293
292
|
/**
|
|
294
293
|
* Revoke an access token
|
|
295
294
|
* @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
295
|
* @param {String} options.token Access token you wish to revoke
|
|
299
296
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
300
297
|
* @param {Object} [options.context] Request context
|
|
301
298
|
* @returns {Promise} A promise
|
|
302
299
|
*/
|
|
303
|
-
deleteAccessToken({
|
|
300
|
+
deleteAccessToken({ token, headers, context }){
|
|
304
301
|
return this.delete({
|
|
305
302
|
uri: `/v1/access_tokens/${token}`,
|
|
306
|
-
auth: { username, password },
|
|
307
303
|
headers,
|
|
308
|
-
data: { access_token: token },
|
|
309
304
|
context
|
|
310
305
|
});
|
|
311
306
|
}
|
|
@@ -313,7 +308,7 @@ class Particle {
|
|
|
313
308
|
/**
|
|
314
309
|
* Revoke the current session access token
|
|
315
310
|
* @param {Object} options Options for this API call
|
|
316
|
-
* @param {
|
|
311
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
317
312
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
318
313
|
* @param {Object} [options.context] Request context
|
|
319
314
|
* @returns {Promise} A promise
|
|
@@ -330,7 +325,7 @@ class Particle {
|
|
|
330
325
|
/**
|
|
331
326
|
* Revoke all active access tokens
|
|
332
327
|
* @param {Object} options Options for this API call
|
|
333
|
-
* @param {
|
|
328
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
334
329
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
335
330
|
* @param {Object} [options.context] Request context
|
|
336
331
|
* @returns {Promise} A promise
|
|
@@ -347,7 +342,7 @@ class Particle {
|
|
|
347
342
|
/**
|
|
348
343
|
* Delete the current user
|
|
349
344
|
* @param {Object} options Options for this API call
|
|
350
|
-
* @param {
|
|
345
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
351
346
|
* @param {String} options.password Password
|
|
352
347
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
353
348
|
* @param {Object} [options.context] Request context
|
|
@@ -363,30 +358,10 @@ class Particle {
|
|
|
363
358
|
});
|
|
364
359
|
}
|
|
365
360
|
|
|
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
361
|
/**
|
|
387
362
|
* Retrieves the information that is used to identify the current login for tracking.
|
|
388
363
|
* @param {Object} [options] Options for this API call
|
|
389
|
-
* @param {
|
|
364
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
390
365
|
* @param {Boolean} [options.full] When true, retrieve all information for registering a user with the tracking API. When false,
|
|
391
366
|
* retrieve only the unique tracking ID for the current login.
|
|
392
367
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -414,7 +389,7 @@ class Particle {
|
|
|
414
389
|
* @param {Number} [options.page] (Product only) Current page of results
|
|
415
390
|
* @param {Number} [options.perPage] (Product only) Records per page
|
|
416
391
|
* @param {String} [options.product] List devices in this product ID or slug
|
|
417
|
-
* @param {
|
|
392
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
418
393
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
419
394
|
* @param {Object} [options.context] Request context
|
|
420
395
|
* @returns {Promise} A promise
|
|
@@ -445,7 +420,7 @@ class Particle {
|
|
|
445
420
|
* @param {Object} options Options for this API call
|
|
446
421
|
* @param {String} options.deviceId Device ID or Name
|
|
447
422
|
* @param {String} [options.product] Device in this product ID or slug
|
|
448
|
-
* @param {
|
|
423
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
449
424
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
450
425
|
* @param {Object} [options.context] Request context
|
|
451
426
|
* @returns {Promise} A promise
|
|
@@ -459,7 +434,7 @@ class Particle {
|
|
|
459
434
|
* Claim a device to the account. The device must be online and unclaimed.
|
|
460
435
|
* @param {Object} options Options for this API call
|
|
461
436
|
* @param {String} options.deviceId Device ID
|
|
462
|
-
* @param {
|
|
437
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
463
438
|
* @param {boolean} options.requestTransfer True to request the device be transfered from another user
|
|
464
439
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
465
440
|
* @param {Object} [options.context] Request context
|
|
@@ -485,7 +460,7 @@ class Particle {
|
|
|
485
460
|
* @param {Object} options.file A file that contains a single-column list of device IDs, device serial numbers, device IMEIs, or devie ICCIDs.
|
|
486
461
|
* Node: Either a path or Buffer. Browser: a File or Blob.
|
|
487
462
|
* @param {String} options.product Add to this product ID or slug
|
|
488
|
-
* @param {
|
|
463
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
489
464
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
490
465
|
* @param {Object} [options.context] Request context
|
|
491
466
|
* @returns {Promise} A promise
|
|
@@ -516,7 +491,7 @@ class Particle {
|
|
|
516
491
|
* @param {String} options.deviceId Device ID or Name
|
|
517
492
|
* @param {Boolean} [options.deny] (Product only) Deny this quarantined device, instead of removing an already approved device
|
|
518
493
|
* @param {String} options.product Remove from this product ID or slug
|
|
519
|
-
* @param {
|
|
494
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
520
495
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
521
496
|
* @param {Object} [options.context] Request context
|
|
522
497
|
* @returns {Promise} A promise
|
|
@@ -532,7 +507,7 @@ class Particle {
|
|
|
532
507
|
* @param {Object} options Options for this API call
|
|
533
508
|
* @param {String} options.deviceId Device ID or Name
|
|
534
509
|
* @param {String} options.product Remove from this product ID or slug
|
|
535
|
-
* @param {
|
|
510
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
536
511
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
537
512
|
* @param {Object} [options.context] Request context
|
|
538
513
|
* @returns {Promise} A promise
|
|
@@ -548,7 +523,7 @@ class Particle {
|
|
|
548
523
|
* @param {String} options.deviceId Device ID or Name
|
|
549
524
|
* @param {String} options.name Desired Name
|
|
550
525
|
* @param {String} [options.product] Rename device in this product ID or slug
|
|
551
|
-
* @param {
|
|
526
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
552
527
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
553
528
|
* @param {Object} [options.context] Request context
|
|
554
529
|
* @returns {Promise} A promise
|
|
@@ -563,7 +538,7 @@ class Particle {
|
|
|
563
538
|
* @param {String} options.deviceId Device ID or Name
|
|
564
539
|
* @param {Boolean} options.signal Signal on or off
|
|
565
540
|
* @param {String} [options.product] Device in this product ID or slug
|
|
566
|
-
* @param {
|
|
541
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
567
542
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
568
543
|
* @param {Object} [options.context] Request context
|
|
569
544
|
* @returns {Promise} A promise
|
|
@@ -578,7 +553,7 @@ class Particle {
|
|
|
578
553
|
* @param {String} options.deviceId Device ID or Name
|
|
579
554
|
* @param {String} options.notes Your notes about this device
|
|
580
555
|
* @param {String} [options.product] Device in this product ID or slug
|
|
581
|
-
* @param {
|
|
556
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
582
557
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
583
558
|
* @param {Object} [options.context] Request context
|
|
584
559
|
* @returns {Promise} A promise
|
|
@@ -593,7 +568,7 @@ class Particle {
|
|
|
593
568
|
* @param {String} options.deviceId Device ID or Name
|
|
594
569
|
* @param {Boolean} options.development Set to true to mark as development, false to return to product fleet
|
|
595
570
|
* @param {String} options.product Device in this product ID or slug
|
|
596
|
-
* @param {
|
|
571
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
597
572
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
598
573
|
* @param {Object} [options.context] Request context
|
|
599
574
|
* @returns {Promise} A promise
|
|
@@ -609,7 +584,7 @@ class Particle {
|
|
|
609
584
|
* @param {Number} options.desiredFirmwareVersion Lock the product device to run this firmware version.
|
|
610
585
|
* @param {Boolean} [options.flash] Immediately flash firmware indicated by desiredFirmwareVersion
|
|
611
586
|
* @param {String} options.product Device in this product ID or slug
|
|
612
|
-
* @param {
|
|
587
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
613
588
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
614
589
|
* @param {Object} [options.context] Request context
|
|
615
590
|
* @returns {Promise} A promise
|
|
@@ -623,7 +598,7 @@ class Particle {
|
|
|
623
598
|
* @param {Object} options Options for this API call
|
|
624
599
|
* @param {String} options.deviceId Device ID or Name
|
|
625
600
|
* @param {String} options.product Device in this product ID or slug
|
|
626
|
-
* @param {
|
|
601
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
627
602
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
628
603
|
* @param {Object} [options.context] Request context
|
|
629
604
|
* @returns {Promise} A promise
|
|
@@ -644,7 +619,7 @@ class Particle {
|
|
|
644
619
|
* Pass `null` to unlock firmware and go back to released firmware.
|
|
645
620
|
* @param {Boolean} [options.flash] (Product only) Immediately flash firmware indicated by desiredFirmwareVersion
|
|
646
621
|
* @param {String} [options.product] Device in this product ID or slug
|
|
647
|
-
* @param {
|
|
622
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
648
623
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
649
624
|
* @param {Object} [options.context] Request context
|
|
650
625
|
* @returns {Promise} A promise
|
|
@@ -676,7 +651,7 @@ class Particle {
|
|
|
676
651
|
* @param {String} [options.deviceSignature] Base64-encoded device signature. Mandatory if `action` is `confirm`,
|
|
677
652
|
* @param {String} [options.devicePublicKeyFingerprint] Base64-encoded fingerprint of the device public key.
|
|
678
653
|
* Mandatory if `action` is `confirm`,
|
|
679
|
-
* @param {
|
|
654
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor.
|
|
680
655
|
* @param {Object} [options.headers] Key/value pairs to send as headers.
|
|
681
656
|
* @param {Object} [options.context] Request context.
|
|
682
657
|
* @returns {Promise} A promise
|
|
@@ -703,7 +678,7 @@ class Particle {
|
|
|
703
678
|
* Provision a new device for products that allow self-provisioning
|
|
704
679
|
* @param {Object} options Options for this API call
|
|
705
680
|
* @param {String} options.productId Product ID where to create this device
|
|
706
|
-
* @param {
|
|
681
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
707
682
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
708
683
|
* @param {Object} [options.context] Request context
|
|
709
684
|
* @returns {Promise} A promise
|
|
@@ -725,7 +700,7 @@ class Particle {
|
|
|
725
700
|
* @param {Object} options Options for this API call
|
|
726
701
|
* @param {String} [options.iccid] ICCID of the SIM card used in the Electron
|
|
727
702
|
* @param {String} [options.product] Device in this product ID or slug
|
|
728
|
-
* @param {
|
|
703
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
729
704
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
730
705
|
* @param {Object} [options.context] Request context
|
|
731
706
|
* @returns {Promise} A promise
|
|
@@ -750,7 +725,7 @@ class Particle {
|
|
|
750
725
|
* @param {String} options.deviceId Device ID or Name
|
|
751
726
|
* @param {String} options.name Variable name
|
|
752
727
|
* @param {String} [options.product] Device in this product ID or slug
|
|
753
|
-
* @param {
|
|
728
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
754
729
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
755
730
|
* @param {Object} [options.context] Request context
|
|
756
731
|
* @returns {Promise} A promise
|
|
@@ -770,7 +745,7 @@ class Particle {
|
|
|
770
745
|
* @param {String} options.product Flash device in this product ID or slug
|
|
771
746
|
* @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
747
|
* @param {String} [options.targetVersion=latest] System firmware version to compile against
|
|
773
|
-
* @param {
|
|
748
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
774
749
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
775
750
|
* @param {Object} [options.context] Request context
|
|
776
751
|
* @returns {Promise} A promise
|
|
@@ -792,7 +767,7 @@ class Particle {
|
|
|
792
767
|
* DEPRECATED: Flash the Tinker application to a device. Instead compile and flash the Tinker source code.
|
|
793
768
|
* @param {Object} options Options for this API call
|
|
794
769
|
* @param {String} options.deviceId Device ID or Name
|
|
795
|
-
* @param {
|
|
770
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
796
771
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
797
772
|
* @param {Object} [options.context] Request context
|
|
798
773
|
* @returns {Promise} A promise
|
|
@@ -820,7 +795,7 @@ class Particle {
|
|
|
820
795
|
* @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
796
|
* @param {Number} [options.platformId] Platform id number of the device you are compiling for. Common values are 0=Core, 6=Photon, 10=Electron.
|
|
822
797
|
* @param {String} [options.targetVersion=latest] System firmware version to compile against
|
|
823
|
-
* @param {
|
|
798
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
824
799
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
825
800
|
* @param {Object} [options.context] Request context
|
|
826
801
|
* @returns {Promise} A promise
|
|
@@ -849,7 +824,7 @@ class Particle {
|
|
|
849
824
|
* Download a firmware binary
|
|
850
825
|
* @param {Object} options Options for this API call
|
|
851
826
|
* @param {String} options.binaryId Binary ID received from a successful compile call
|
|
852
|
-
* @param {
|
|
827
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
853
828
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
854
829
|
* @param {Object} [options.context] Request context
|
|
855
830
|
* @returns {Promise<RequestResponse, RequestError>} A promise
|
|
@@ -871,7 +846,7 @@ class Particle {
|
|
|
871
846
|
* @param {String} options.deviceId Device ID or Name
|
|
872
847
|
* @param {String | Buffer} options.key Public key contents
|
|
873
848
|
* @param {String} [options.algorithm=rsa] Algorithm used to generate the public key. Valid values are `rsa` or `ecc`.
|
|
874
|
-
* @param {
|
|
849
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
875
850
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
876
851
|
* @param {Object} [options.context] Request context
|
|
877
852
|
* @returns {Promise} A promise
|
|
@@ -899,7 +874,7 @@ class Particle {
|
|
|
899
874
|
* @param {String} options.name Function name
|
|
900
875
|
* @param {String} options.argument Function argument
|
|
901
876
|
* @param {String} [options.product] Device in this product ID or slug
|
|
902
|
-
* @param {
|
|
877
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
903
878
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
904
879
|
* @param {Object} [options.context] Request context
|
|
905
880
|
* @returns {Promise} A promise
|
|
@@ -918,7 +893,7 @@ class Particle {
|
|
|
918
893
|
* @param {String} [options.name] Event Name
|
|
919
894
|
* @param {String} [options.org] Organization Slug
|
|
920
895
|
* @param {String} [options.product] Events for this product ID or slug
|
|
921
|
-
* @param {
|
|
896
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
922
897
|
* @returns {Promise} If the promise resolves, the resolution value will be an EventStream object that will
|
|
923
898
|
* emit 'event' events.
|
|
924
899
|
*/
|
|
@@ -956,7 +931,7 @@ class Particle {
|
|
|
956
931
|
* @param {String} options.data Event data
|
|
957
932
|
* @param {Boolean} options.isPrivate Should the event be publicly available?
|
|
958
933
|
* @param {String} [options.product] Event for this product ID or slug
|
|
959
|
-
* @param {
|
|
934
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
960
935
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
961
936
|
* @param {Object} [options.context] Request context
|
|
962
937
|
* @returns {Promise} A promise
|
|
@@ -970,7 +945,7 @@ class Particle {
|
|
|
970
945
|
/**
|
|
971
946
|
* @typedef {Object} Hook
|
|
972
947
|
* @property {String} [method=POST] Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
|
|
973
|
-
* @property {Object} [auth] Auth data like `{
|
|
948
|
+
* @property {Object} [auth] Auth data like `{ user: 'me', pass: '1234' }` for basic auth or `{ bearer: 'token' }` to send with the Webhook request
|
|
974
949
|
* @property {Object} [headers] Additional headers to add to the Webhook like `{ 'X-ONE': '1', X-TWO: '2' }`
|
|
975
950
|
* @property {Object} [query] Query params to add to the Webhook request like `{ foo: 'foo', bar: 'bar' }`
|
|
976
951
|
* @property {Object} [json] JSON data to send with the Webhook request - sets `Content-Type` to `application/json`
|
|
@@ -991,7 +966,7 @@ class Particle {
|
|
|
991
966
|
* @param {Boolean} [options.noDefaults] Don't include default event data in the webhook request
|
|
992
967
|
* @param {Hook} [options.hook] Webhook configuration settings
|
|
993
968
|
* @param {String} [options.product] Webhook for this product ID or slug
|
|
994
|
-
* @param {
|
|
969
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
995
970
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
996
971
|
* @param {Object} [options.context] Request context
|
|
997
972
|
* @returns {Promise} A promise
|
|
@@ -1025,7 +1000,7 @@ class Particle {
|
|
|
1025
1000
|
* @param {Object} options Options for this API call
|
|
1026
1001
|
* @param {String} options.hookId Webhook ID
|
|
1027
1002
|
* @param {String} [options.product] Webhook for this product ID or slug
|
|
1028
|
-
* @param {
|
|
1003
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1029
1004
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1030
1005
|
* @param {Object} [options.context] Request context
|
|
1031
1006
|
* @returns {Promise} A promise
|
|
@@ -1039,7 +1014,7 @@ class Particle {
|
|
|
1039
1014
|
* List all webhooks owned by the account or product
|
|
1040
1015
|
* @param {Object} options Options for this API call
|
|
1041
1016
|
* @param {String} [options.product] Webhooks for this product ID or slug
|
|
1042
|
-
* @param {
|
|
1017
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1043
1018
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1044
1019
|
* @param {Object} [options.context] Request context
|
|
1045
1020
|
* @returns {Promise} A promise
|
|
@@ -1059,7 +1034,7 @@ class Particle {
|
|
|
1059
1034
|
* @param {Object} options.settings Settings specific to that integration type
|
|
1060
1035
|
* @param {String} [options.deviceId] Trigger integration only for this device ID or Name
|
|
1061
1036
|
* @param {String} [options.product] Integration for this product ID or slug
|
|
1062
|
-
* @param {
|
|
1037
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1063
1038
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1064
1039
|
* @param {Object} [options.context] Request context
|
|
1065
1040
|
* @returns {Promise} A promise
|
|
@@ -1081,7 +1056,7 @@ class Particle {
|
|
|
1081
1056
|
* @param {Object} [options.settings] Change the settings specific to that integration type
|
|
1082
1057
|
* @param {String} [options.deviceId] Trigger integration only for this device ID or Name
|
|
1083
1058
|
* @param {String} [options.product] Integration for this product ID or slug
|
|
1084
|
-
* @param {
|
|
1059
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1085
1060
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1086
1061
|
* @param {Object} [options.context] Request context
|
|
1087
1062
|
* @returns {Promise} A promise
|
|
@@ -1098,7 +1073,7 @@ class Particle {
|
|
|
1098
1073
|
* @param {Object} options Options for this API call
|
|
1099
1074
|
* @param {String} options.integrationId The integration to remove
|
|
1100
1075
|
* @param {String} [options.product] Integration for this product ID or slug
|
|
1101
|
-
* @param {
|
|
1076
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1102
1077
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1103
1078
|
* @param {Object} [options.context] Request context
|
|
1104
1079
|
* @returns {Promise} A promise
|
|
@@ -1112,7 +1087,7 @@ class Particle {
|
|
|
1112
1087
|
* List all integrations owned by the account or product
|
|
1113
1088
|
* @param {Object} options Options for this API call
|
|
1114
1089
|
* @param {String} [options.product] Integrations for this product ID or slug
|
|
1115
|
-
* @param {
|
|
1090
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1116
1091
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1117
1092
|
* @param {Object} [options.context] Request context
|
|
1118
1093
|
* @returns {Promise} A promise
|
|
@@ -1125,7 +1100,7 @@ class Particle {
|
|
|
1125
1100
|
/**
|
|
1126
1101
|
* Get details about the current user
|
|
1127
1102
|
* @param {Object} options Options for this API call
|
|
1128
|
-
* @param {
|
|
1103
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1129
1104
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1130
1105
|
* @param {Object} [options.context] Request context
|
|
1131
1106
|
* @returns {Promise} A promise
|
|
@@ -1137,7 +1112,7 @@ class Particle {
|
|
|
1137
1112
|
/**
|
|
1138
1113
|
* Set details on the current user
|
|
1139
1114
|
* @param {Object} options Options for this API call
|
|
1140
|
-
* @param {
|
|
1115
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1141
1116
|
* @param {String} options.accountInfo Set user's extended info fields (name, business account, company name, etc)
|
|
1142
1117
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1143
1118
|
* @param {Object} [options.context] Request context
|
|
@@ -1151,7 +1126,7 @@ class Particle {
|
|
|
1151
1126
|
/**
|
|
1152
1127
|
* Change username (i.e, email)
|
|
1153
1128
|
* @param {Object} options Options for this API call
|
|
1154
|
-
* @param {
|
|
1129
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1155
1130
|
* @param {String} options.currentPassword Current password
|
|
1156
1131
|
* @param {String} options.username New email
|
|
1157
1132
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
@@ -1172,7 +1147,7 @@ class Particle {
|
|
|
1172
1147
|
/**
|
|
1173
1148
|
* Change user's password
|
|
1174
1149
|
* @param {Object} options Options for this API call
|
|
1175
|
-
* @param {
|
|
1150
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1176
1151
|
* @param {String} options.currentPassword Current password
|
|
1177
1152
|
* @param {String} options.password New password
|
|
1178
1153
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
@@ -1199,7 +1174,7 @@ class Particle {
|
|
|
1199
1174
|
* @param {Number} [options.page] (Product only) Current page of results
|
|
1200
1175
|
* @param {Number} [options.perPage] (Product only) Records per page
|
|
1201
1176
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1202
|
-
* @param {
|
|
1177
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1203
1178
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1204
1179
|
* @param {Object} [options.context] Request context
|
|
1205
1180
|
* @returns {Promise} A promise
|
|
@@ -1215,7 +1190,7 @@ class Particle {
|
|
|
1215
1190
|
* @param {Object} options Options for this API call
|
|
1216
1191
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1217
1192
|
* @param {String} [options.product] SIM card for this product ID or slug
|
|
1218
|
-
* @param {
|
|
1193
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1219
1194
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1220
1195
|
* @param {Object} [options.context] Request context
|
|
1221
1196
|
* @returns {Promise} A promise
|
|
@@ -1232,7 +1207,7 @@ class Particle {
|
|
|
1232
1207
|
* Get data usage for all SIM cards in a product the current billing period
|
|
1233
1208
|
* @param {Object} options Options for this API call
|
|
1234
1209
|
* @param {String} options.product SIM cards for this product ID or slug
|
|
1235
|
-
* @param {
|
|
1210
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1236
1211
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1237
1212
|
* @param {Object} [options.context] Request context
|
|
1238
1213
|
* @returns {Promise} A promise
|
|
@@ -1250,7 +1225,7 @@ class Particle {
|
|
|
1250
1225
|
* Check SIM status
|
|
1251
1226
|
* @param {Object} options Options for this API call
|
|
1252
1227
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1253
|
-
* @param {
|
|
1228
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1254
1229
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1255
1230
|
* @param {Object} [options.context] Request context
|
|
1256
1231
|
* @returns {Promise} A promise
|
|
@@ -1266,7 +1241,7 @@ class Particle {
|
|
|
1266
1241
|
* @param {Array<String>} options.iccids (Product only) ICCID of multiple SIM cards to import
|
|
1267
1242
|
* @param {String} options.country The ISO country code for the SIM cards
|
|
1268
1243
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1269
|
-
* @param {
|
|
1244
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1270
1245
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1271
1246
|
* @param {Object} [options.context] Request context
|
|
1272
1247
|
* @param {any} [options.promoCode]
|
|
@@ -1289,7 +1264,7 @@ class Particle {
|
|
|
1289
1264
|
* @param {Object} options Options for this API call
|
|
1290
1265
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1291
1266
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1292
|
-
* @param {
|
|
1267
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1293
1268
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1294
1269
|
* @param {Object} [options.context] Request context
|
|
1295
1270
|
* @returns {Promise} A promise
|
|
@@ -1306,7 +1281,7 @@ class Particle {
|
|
|
1306
1281
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1307
1282
|
* @param {Number} [options.mbLimit] New monthly data limit. Necessary if unpausing a SIM card
|
|
1308
1283
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1309
|
-
* @param {
|
|
1284
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1310
1285
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1311
1286
|
* @param {Object} [options.context] Request context
|
|
1312
1287
|
* @returns {Promise} A promise
|
|
@@ -1323,7 +1298,7 @@ class Particle {
|
|
|
1323
1298
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1324
1299
|
* @param {Array} options.mbLimit Data limit in megabyte for the SIM card
|
|
1325
1300
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1326
|
-
* @param {
|
|
1301
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1327
1302
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1328
1303
|
* @param {Object} [options.context] Request context
|
|
1329
1304
|
* @returns {Promise} A promise
|
|
@@ -1339,7 +1314,7 @@ class Particle {
|
|
|
1339
1314
|
* @param {Object} options Options for this API call
|
|
1340
1315
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1341
1316
|
* @param {String} [options.product] SIM cards for this product ID or slug
|
|
1342
|
-
* @param {
|
|
1317
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1343
1318
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1344
1319
|
* @param {Object} [options.context] Request context
|
|
1345
1320
|
* @returns {Promise} A promise
|
|
@@ -1353,7 +1328,7 @@ class Particle {
|
|
|
1353
1328
|
* List valid build targets to be used for compiling
|
|
1354
1329
|
* @param {Object} options Options for this API call
|
|
1355
1330
|
* @param {Boolean} [options.onlyFeatured=false] Only list featured build targets
|
|
1356
|
-
* @param {
|
|
1331
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1357
1332
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1358
1333
|
* @param {Object} [options.context] Request context
|
|
1359
1334
|
* @returns {Promise} A promise
|
|
@@ -1382,7 +1357,7 @@ class Particle {
|
|
|
1382
1357
|
* - 'featured' - list only featured libraries
|
|
1383
1358
|
* @param {String} options.excludeScopes list of scopes to exclude
|
|
1384
1359
|
* @param {String} options.category Category to filter
|
|
1385
|
-
* @param {
|
|
1360
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1386
1361
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1387
1362
|
* @param {Object} [options.context] Request context
|
|
1388
1363
|
* @returns {Promise} A promise
|
|
@@ -1415,7 +1390,7 @@ class Particle {
|
|
|
1415
1390
|
* @param {Object} options Options for this API call
|
|
1416
1391
|
* @param {String} options.name Name of the library to fetch
|
|
1417
1392
|
* @param {String} options.version Version of the library to fetch (default: latest)
|
|
1418
|
-
* @param {
|
|
1393
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1419
1394
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1420
1395
|
* @param {Object} [options.context] Request context
|
|
1421
1396
|
* @returns {Promise} A promise
|
|
@@ -1436,7 +1411,7 @@ class Particle {
|
|
|
1436
1411
|
* @param {String} options.name Name of the library to fetch
|
|
1437
1412
|
* @param {Number} options.page Page index (default, first page)
|
|
1438
1413
|
* @param {Number} options.limit Number of items per page
|
|
1439
|
-
* @param {
|
|
1414
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1440
1415
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1441
1416
|
* @param {Object} [options.context] Request context
|
|
1442
1417
|
* @returns {Promise} A promise
|
|
@@ -1456,7 +1431,7 @@ class Particle {
|
|
|
1456
1431
|
* @param {Object} options Options for this API call
|
|
1457
1432
|
* @param {String | Buffer} options.archive Compressed archive file containing the library sources
|
|
1458
1433
|
* Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
|
|
1459
|
-
* @param {
|
|
1434
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1460
1435
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1461
1436
|
* @param {Object} [options.context] Request context
|
|
1462
1437
|
* @returns {Promise} A promise
|
|
@@ -1480,7 +1455,7 @@ class Particle {
|
|
|
1480
1455
|
* Publish the latest version of a library to the public
|
|
1481
1456
|
* @param {Object} options Options for this API call
|
|
1482
1457
|
* @param {String} options.name Name of the library to publish
|
|
1483
|
-
* @param {
|
|
1458
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1484
1459
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1485
1460
|
* @param {Object} [options.context] Request context
|
|
1486
1461
|
* @returns {Promise} A promise
|
|
@@ -1501,7 +1476,7 @@ class Particle {
|
|
|
1501
1476
|
* @param {Object} options Options for this API call
|
|
1502
1477
|
* @param {String} options.name Name of the library to remove
|
|
1503
1478
|
* @param {String} options.force Key to force deleting a public library
|
|
1504
|
-
* @param {
|
|
1479
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1505
1480
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1506
1481
|
* @param {Object} [options.context] Request context
|
|
1507
1482
|
* @returns {Promise} A promise
|
|
@@ -1532,7 +1507,7 @@ class Particle {
|
|
|
1532
1507
|
* List OAuth client created by the account
|
|
1533
1508
|
* @param {Object} options Options for this API call
|
|
1534
1509
|
* @param {String} [options.product] List clients for this product ID or slug
|
|
1535
|
-
* @param {
|
|
1510
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1536
1511
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1537
1512
|
* @param {Object} [options.context] Request context
|
|
1538
1513
|
* @returns {Promise} A promise
|
|
@@ -1550,7 +1525,7 @@ class Particle {
|
|
|
1550
1525
|
* @param {String} [options.redirect_uri] URL to redirect after OAuth flow. Only for type web.
|
|
1551
1526
|
* @param {Object} [options.scope] Limits what the access tokens created by this client can do.
|
|
1552
1527
|
* @param {String} [options.product] Create client for this product ID or slug
|
|
1553
|
-
* @param {
|
|
1528
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1554
1529
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1555
1530
|
* @param {Object} [options.context] Request context
|
|
1556
1531
|
* @returns {Promise} A promise
|
|
@@ -1568,7 +1543,7 @@ class Particle {
|
|
|
1568
1543
|
* @param {String} [options.name] New Name of the OAuth client
|
|
1569
1544
|
* @param {Object} [options.scope] New scope of the OAuth client
|
|
1570
1545
|
* @param {String} [options.product] Update client linked to this product ID or slug
|
|
1571
|
-
* @param {
|
|
1546
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1572
1547
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1573
1548
|
* @param {Object} [options.context] Request context
|
|
1574
1549
|
* @returns {Promise} A promise
|
|
@@ -1584,7 +1559,7 @@ class Particle {
|
|
|
1584
1559
|
* @param {Object} options Options for this API call
|
|
1585
1560
|
* @param {String} options.clientId The OAuth client to update
|
|
1586
1561
|
* @param {String} [options.product] OAuth client linked to this product ID or slug
|
|
1587
|
-
* @param {
|
|
1562
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1588
1563
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1589
1564
|
* @param {Object} [options.context] Request context
|
|
1590
1565
|
* @returns {Promise} A promise
|
|
@@ -1597,7 +1572,7 @@ class Particle {
|
|
|
1597
1572
|
/**
|
|
1598
1573
|
* List products the account has access to
|
|
1599
1574
|
* @param {Object} options Options for this API call
|
|
1600
|
-
* @param {
|
|
1575
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1601
1576
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1602
1577
|
* @param {Object} [options.context] Request context
|
|
1603
1578
|
* @returns {Promise} A promise
|
|
@@ -1610,7 +1585,7 @@ class Particle {
|
|
|
1610
1585
|
* Get detailed information about a product
|
|
1611
1586
|
* @param {Object} options Options for this API call
|
|
1612
1587
|
* @param {String} options.product Product ID or slug
|
|
1613
|
-
* @param {
|
|
1588
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1614
1589
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1615
1590
|
* @param {Object} [options.context] Request context
|
|
1616
1591
|
* @returns {Promise} A promise
|
|
@@ -1623,7 +1598,7 @@ class Particle {
|
|
|
1623
1598
|
* List product firmware versions
|
|
1624
1599
|
* @param {Object} options Options for this API call
|
|
1625
1600
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1626
|
-
* @param {
|
|
1601
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1627
1602
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1628
1603
|
* @param {Object} [options.context] Request context
|
|
1629
1604
|
* @returns {Promise} A promise
|
|
@@ -1641,7 +1616,7 @@ class Particle {
|
|
|
1641
1616
|
* @param {String} options.title Short identifier for the new firmware
|
|
1642
1617
|
* @param {String} [options.description] Longer description for the new firmware
|
|
1643
1618
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1644
|
-
* @param {
|
|
1619
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1645
1620
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1646
1621
|
* @param {Object} [options.context] Request context
|
|
1647
1622
|
* @returns {Promise} A promise
|
|
@@ -1669,7 +1644,7 @@ class Particle {
|
|
|
1669
1644
|
* @param {Object} options Options for this API call
|
|
1670
1645
|
* @param {Number} options.version Version number of firmware
|
|
1671
1646
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1672
|
-
* @param {
|
|
1647
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1673
1648
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1674
1649
|
* @param {Object} [options.context] Request context
|
|
1675
1650
|
* @returns {Promise} A promise
|
|
@@ -1690,7 +1665,7 @@ class Particle {
|
|
|
1690
1665
|
* @param {String} [options.title] New title
|
|
1691
1666
|
* @param {String} [options.description] New description
|
|
1692
1667
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1693
|
-
* @param {
|
|
1668
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1694
1669
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1695
1670
|
* @param {Object} [options.context] Request context
|
|
1696
1671
|
* @returns {Promise} A promise
|
|
@@ -1705,7 +1680,7 @@ class Particle {
|
|
|
1705
1680
|
* @param {Object} options Options for this API call
|
|
1706
1681
|
* @param {Number} options.version Version number of new firmware
|
|
1707
1682
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1708
|
-
* @param {
|
|
1683
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1709
1684
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1710
1685
|
* @param {Object} [options.context] Request context
|
|
1711
1686
|
* @returns {Promise<RequestResponse, RequestError>} A promise that resolves with either the requested data or an error object
|
|
@@ -1726,7 +1701,7 @@ class Particle {
|
|
|
1726
1701
|
* @param {Object} options Options for this API call
|
|
1727
1702
|
* @param {Number} options.version Version number of new firmware
|
|
1728
1703
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1729
|
-
* @param {
|
|
1704
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1730
1705
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1731
1706
|
* @param {Object} [options.context] Request context
|
|
1732
1707
|
* @returns {Promise} A promise
|
|
@@ -1740,7 +1715,7 @@ class Particle {
|
|
|
1740
1715
|
* List product team members
|
|
1741
1716
|
* @param {Object} options Options for this API call
|
|
1742
1717
|
* @param {String} options.product Team for this product ID or slug
|
|
1743
|
-
* @param {
|
|
1718
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1744
1719
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1745
1720
|
* @param {Object} [options.context] Request context
|
|
1746
1721
|
* @returns {Promise} A promise
|
|
@@ -1759,7 +1734,7 @@ class Particle {
|
|
|
1759
1734
|
* @param {Object} options Options for this API call
|
|
1760
1735
|
* @param {String} options.username Username for the Particle account
|
|
1761
1736
|
* @param {String} options.product Team for this product ID or slug
|
|
1762
|
-
* @param {
|
|
1737
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1763
1738
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1764
1739
|
* @param {Object} [options.context] Request context
|
|
1765
1740
|
* @returns {Promise} A promise
|
|
@@ -1779,7 +1754,7 @@ class Particle {
|
|
|
1779
1754
|
* @param {Object} options Options for this API call
|
|
1780
1755
|
* @param {String} options.username Username for the Particle account
|
|
1781
1756
|
* @param {String} options.product Team for this product ID or slug
|
|
1782
|
-
* @param {
|
|
1757
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1783
1758
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1784
1759
|
* @param {Object} [options.context] Request context
|
|
1785
1760
|
* @returns {Promise} A promise
|
|
@@ -1797,7 +1772,7 @@ class Particle {
|
|
|
1797
1772
|
* Fetch details about a serial number
|
|
1798
1773
|
* @param {Object} options Options for this API call
|
|
1799
1774
|
* @param {String} options.serialNumber The serial number printed on the barcode of the device packaging
|
|
1800
|
-
* @param {
|
|
1775
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1801
1776
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1802
1777
|
* @param {Object} [options.context] Request context
|
|
1803
1778
|
* @returns {Promise} A promise
|
|
@@ -1817,7 +1792,7 @@ class Particle {
|
|
|
1817
1792
|
* @param {String} options.name Network name
|
|
1818
1793
|
* @param {String} options.deviceId Gateway device ID
|
|
1819
1794
|
* @param {String} [options.iccid] ICCID of the active SIM card (only for cellular gateway devices)
|
|
1820
|
-
* @param {
|
|
1795
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1821
1796
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1822
1797
|
* @param {Object} [options.context] Request context
|
|
1823
1798
|
* @returns {Promise<Object>} A promise
|
|
@@ -1836,7 +1811,7 @@ class Particle {
|
|
|
1836
1811
|
* Remove a mesh network.
|
|
1837
1812
|
* @param {Object} options Options for this API call
|
|
1838
1813
|
* @param {String} options.networkId Network ID or name
|
|
1839
|
-
* @param {
|
|
1814
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1840
1815
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1841
1816
|
* @param {Object} [options.context] Request context
|
|
1842
1817
|
* @returns {Promise<Object>} A promise
|
|
@@ -1848,7 +1823,7 @@ class Particle {
|
|
|
1848
1823
|
/**
|
|
1849
1824
|
* List all mesh networks
|
|
1850
1825
|
* @param {Object} options Options for this API call
|
|
1851
|
-
* @param {
|
|
1826
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1852
1827
|
* @param {Number} [options.page] Current page of results
|
|
1853
1828
|
* @param {Number} [options.perPage] Records per page
|
|
1854
1829
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -1864,7 +1839,7 @@ class Particle {
|
|
|
1864
1839
|
* Get information about a mesh network.
|
|
1865
1840
|
* @param {Object} options Options for this API call
|
|
1866
1841
|
* @param {String} options.networkId Network ID or name
|
|
1867
|
-
* @param {
|
|
1842
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1868
1843
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1869
1844
|
* @param {Object} [options.context] Request context
|
|
1870
1845
|
* @returns {Promise<Object>} A promise
|
|
@@ -1879,7 +1854,7 @@ class Particle {
|
|
|
1879
1854
|
* @param {String} options.networkId Network ID or name
|
|
1880
1855
|
* @param {String} options.action 'add-device', 'remove-device', 'gateway-enable' or 'gateway-disable'
|
|
1881
1856
|
* @param {String} options.deviceId Device ID
|
|
1882
|
-
* @param {
|
|
1857
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1883
1858
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1884
1859
|
* @param {Object} [options.context] Request context
|
|
1885
1860
|
* @returns {Promise<Object>} A promise
|
|
@@ -1899,7 +1874,7 @@ class Particle {
|
|
|
1899
1874
|
* @param {Object} options Options for this API call
|
|
1900
1875
|
* @param {String} options.networkId Network ID or name
|
|
1901
1876
|
* @param {String} options.deviceId Device ID
|
|
1902
|
-
* @param {
|
|
1877
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1903
1878
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1904
1879
|
* @param {Object} [options.context] Request context
|
|
1905
1880
|
* @returns {Promise<Object>} A promise
|
|
@@ -1920,7 +1895,7 @@ class Particle {
|
|
|
1920
1895
|
* @param {Object} options Options for this API call
|
|
1921
1896
|
* @param {String} [options.networkId] Network ID or name
|
|
1922
1897
|
* @param {String} options.deviceId Device ID
|
|
1923
|
-
* @param {
|
|
1898
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1924
1899
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1925
1900
|
* @param {Object} [options.context] Request context
|
|
1926
1901
|
* @returns {Promise<Object>} A promise
|
|
@@ -1947,7 +1922,7 @@ class Particle {
|
|
|
1947
1922
|
* List all devices of a mesh network.
|
|
1948
1923
|
* @param {Object} options Options for this API call
|
|
1949
1924
|
* @param {String} options.networkId Network ID or name
|
|
1950
|
-
* @param {
|
|
1925
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1951
1926
|
* @param {Number} [options.role] Device role: 'gateway' or 'node'
|
|
1952
1927
|
* @param {Number} [options.page] Current page of results
|
|
1953
1928
|
* @param {Number} [options.perPage] Records per page
|
|
@@ -1970,7 +1945,7 @@ class Particle {
|
|
|
1970
1945
|
* Get product configuration
|
|
1971
1946
|
* @param {Object} options Options for this API call
|
|
1972
1947
|
* @param {String} options.product Config for this product ID or slug
|
|
1973
|
-
* @param {
|
|
1948
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1974
1949
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1975
1950
|
* @param {Object} [options.context] Request context
|
|
1976
1951
|
* @returns {Promise} A promise
|
|
@@ -1988,7 +1963,7 @@ class Particle {
|
|
|
1988
1963
|
* Get product configuration schema
|
|
1989
1964
|
* @param {Object} options Options for this API call
|
|
1990
1965
|
* @param {String} options.product Config for this product ID or slug
|
|
1991
|
-
* @param {
|
|
1966
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1992
1967
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1993
1968
|
* @param {Object} [options.context] Request context
|
|
1994
1969
|
* @returns {Promise} A promise
|
|
@@ -2007,7 +1982,7 @@ class Particle {
|
|
|
2007
1982
|
* Get product device's configuration
|
|
2008
1983
|
* @param {Object} options Options for this API call
|
|
2009
1984
|
* @param {String} options.product Config for this product ID or slug
|
|
2010
|
-
* @param {
|
|
1985
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2011
1986
|
* @param {String} options.deviceId Device ID to access
|
|
2012
1987
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2013
1988
|
* @param {Object} [options.context] Request context
|
|
@@ -2026,7 +2001,7 @@ class Particle {
|
|
|
2026
2001
|
* Get product device's configuration schema
|
|
2027
2002
|
* @param {Object} options Options for this API call
|
|
2028
2003
|
* @param {String} options.product Config for this product ID or slug
|
|
2029
|
-
* @param {
|
|
2004
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2030
2005
|
* @param {String} options.deviceId Device ID to access
|
|
2031
2006
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2032
2007
|
* @param {Object} [options.context] Request context
|
|
@@ -2046,7 +2021,7 @@ class Particle {
|
|
|
2046
2021
|
* Set product configuration
|
|
2047
2022
|
* @param {Object} options Options for this API call
|
|
2048
2023
|
* @param {String} options.product Config for this product ID or slug
|
|
2049
|
-
* @param {
|
|
2024
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2050
2025
|
* @param {Object} options.config Product configuration to update
|
|
2051
2026
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2052
2027
|
* @param {Object} [options.context] Request context
|
|
@@ -2066,7 +2041,7 @@ class Particle {
|
|
|
2066
2041
|
* Set product configuration for a specific device within the product
|
|
2067
2042
|
* @param {Object} options Options for this API call
|
|
2068
2043
|
* @param {String} options.product Config for this product ID or slug
|
|
2069
|
-
* @param {
|
|
2044
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2070
2045
|
* @param {Object} options.config Product configuration to update
|
|
2071
2046
|
* @param {String} options.deviceId Device ID to access
|
|
2072
2047
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2087,7 +2062,7 @@ class Particle {
|
|
|
2087
2062
|
* Query location for devices within a product
|
|
2088
2063
|
* @param {Object} options Options for this API call
|
|
2089
2064
|
* @param {String} options.product Locations for this product ID or slug
|
|
2090
|
-
* @param {
|
|
2065
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2091
2066
|
* @param {String} options.dateRange Start and end date in ISO8601 format, separated by comma, to query
|
|
2092
2067
|
* @param {String} options.rectBl Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
2093
2068
|
* @param {String} options.rectTr Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
@@ -2123,7 +2098,7 @@ class Particle {
|
|
|
2123
2098
|
* Query location for one device within a product
|
|
2124
2099
|
* @param {Object} options Options for this API call
|
|
2125
2100
|
* @param {String} options.product Locations for this product ID or slug
|
|
2126
|
-
* @param {
|
|
2101
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2127
2102
|
* @param {String} options.dateRange Start and end date in ISO8601 format, separated by comma, to query
|
|
2128
2103
|
* @param {String} options.rectBl Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
2129
2104
|
* @param {String} options.rectTr Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
|
|
@@ -2154,7 +2129,7 @@ class Particle {
|
|
|
2154
2129
|
* NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.
|
|
2155
2130
|
*
|
|
2156
2131
|
* @param {Object} options The options for creating the logic function.
|
|
2157
|
-
* @param {
|
|
2132
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2158
2133
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2159
2134
|
* @param {Object} options.logic The logic "function" which will be executed once
|
|
2160
2135
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2182,7 +2157,7 @@ class Particle {
|
|
|
2182
2157
|
* according to the cron and start_at properties.
|
|
2183
2158
|
*
|
|
2184
2159
|
* @param {Object} options The options for creating the logic function.
|
|
2185
|
-
* @param {
|
|
2160
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2186
2161
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2187
2162
|
* @param {Object} options.logicFunction The logic function object containing the function details.
|
|
2188
2163
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2204,7 +2179,7 @@ class Particle {
|
|
|
2204
2179
|
* Get a logic function in the specified organization or sandbox by logic function ID.
|
|
2205
2180
|
*
|
|
2206
2181
|
* @param {Object} options The options for the logic function.
|
|
2207
|
-
* @param {
|
|
2182
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2208
2183
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2209
2184
|
* @param {string} options.logicFunctionId The ID of the logic function to retrieve.
|
|
2210
2185
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2227,7 +2202,7 @@ class Particle {
|
|
|
2227
2202
|
* If you include an id on a logic trigger, it will update the logic trigger in place.
|
|
2228
2203
|
*
|
|
2229
2204
|
* @param {Object} options The options for updating the logic function.
|
|
2230
|
-
* @param {
|
|
2205
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2231
2206
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2232
2207
|
* @param {string} options.logicFunctionId The ID of the logic function to update.
|
|
2233
2208
|
* @param {Object} options.logicFunction The logic function object containing the logic function details.
|
|
@@ -2250,7 +2225,7 @@ class Particle {
|
|
|
2250
2225
|
* Deletes a logic function in the specified organization or sandbox by logic function ID.
|
|
2251
2226
|
*
|
|
2252
2227
|
* @param {Object} options The options for deleting the logic function.
|
|
2253
|
-
* @param {
|
|
2228
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2254
2229
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2255
2230
|
* @param {string} options.logicFunctionId The ID of the logic function to delete.
|
|
2256
2231
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2271,7 +2246,7 @@ class Particle {
|
|
|
2271
2246
|
* Lists all logic functions in the specified organization or sandbox.
|
|
2272
2247
|
*
|
|
2273
2248
|
* @param {Object} options The options for listing logic functions.
|
|
2274
|
-
* @param {
|
|
2249
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2275
2250
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2276
2251
|
* @param {boolean} [options.todayStats] Whether to include today's stats in the response
|
|
2277
2252
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2295,7 +2270,7 @@ class Particle {
|
|
|
2295
2270
|
* Lists all logic runs for the specified logic function in the specified organization or sandbox.
|
|
2296
2271
|
*
|
|
2297
2272
|
* @param {Object} options The options for the request.
|
|
2298
|
-
* @param {
|
|
2273
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2299
2274
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2300
2275
|
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic runs.
|
|
2301
2276
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2316,7 +2291,7 @@ class Particle {
|
|
|
2316
2291
|
* Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.
|
|
2317
2292
|
*
|
|
2318
2293
|
* @param {Object} options The options for the request.
|
|
2319
|
-
* @param {
|
|
2294
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2320
2295
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2321
2296
|
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic run.
|
|
2322
2297
|
* @param {string} options.logicRunId The ID of the logic run to retrieve.
|
|
@@ -2338,7 +2313,7 @@ class Particle {
|
|
|
2338
2313
|
* Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.
|
|
2339
2314
|
*
|
|
2340
2315
|
* @param {Object} options The options for the request.
|
|
2341
|
-
* @param {
|
|
2316
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2342
2317
|
* @param {string} [options.org] The unique identifier of the organization.
|
|
2343
2318
|
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic run logs.
|
|
2344
2319
|
* @param {string} options.logicRunId The ID of the logic run for which to retrieve the logs.
|
|
@@ -2360,7 +2335,7 @@ class Particle {
|
|
|
2360
2335
|
* Creates a new ledger definition in the specified organization or sandbox.
|
|
2361
2336
|
*
|
|
2362
2337
|
* @param {Object} options The options for creating the ledger definition.
|
|
2363
|
-
* @param {
|
|
2338
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2364
2339
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2365
2340
|
* @param {object} options.ledger The ledger definition object.
|
|
2366
2341
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2382,7 +2357,7 @@ class Particle {
|
|
|
2382
2357
|
* Get a ledger definition in the specified organization or sandbox by ledger name.
|
|
2383
2358
|
*
|
|
2384
2359
|
* @param {Object} options The options for the ledger definition.
|
|
2385
|
-
* @param {
|
|
2360
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2386
2361
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2387
2362
|
* @param {string} options.ledgerName The ID of the ledger definition to retrieve.
|
|
2388
2363
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2403,7 +2378,7 @@ class Particle {
|
|
|
2403
2378
|
* Updates an existing ledger definition in the specified organization or sandbox.
|
|
2404
2379
|
*
|
|
2405
2380
|
* @param {Object} options The options for updating the ledger definition.
|
|
2406
|
-
* @param {
|
|
2381
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2407
2382
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2408
2383
|
* @param {string} options.ledgerName Name of the ledger definition to update.
|
|
2409
2384
|
* @param {object} options.ledger The ledger definition object.
|
|
@@ -2426,7 +2401,7 @@ class Particle {
|
|
|
2426
2401
|
* Archives a ledger definition in the specified organization or sandbox by ledger name.
|
|
2427
2402
|
*
|
|
2428
2403
|
* @param {Object} options The options for archiving the ledger definition.
|
|
2429
|
-
* @param {
|
|
2404
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2430
2405
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2431
2406
|
* @param {string} options.ledgerName Name of the ledger definition to archive.
|
|
2432
2407
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
@@ -2451,7 +2426,7 @@ class Particle {
|
|
|
2451
2426
|
* Lists all ledger definitions in the specified organization or sandbox.
|
|
2452
2427
|
*
|
|
2453
2428
|
* @param {Object} options The options for listing ledger definitions.
|
|
2454
|
-
* @param {
|
|
2429
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2455
2430
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2456
2431
|
* @param {Scope} [options.scope] Filter to show only ledgers of the specified scope
|
|
2457
2432
|
* @param {boolean} [options.archived] Filter to show only archived ledger or non-archived ledgers. If not provided, all ledgers are returned.
|
|
@@ -2481,7 +2456,7 @@ class Particle {
|
|
|
2481
2456
|
* Get ledger instance data.
|
|
2482
2457
|
*
|
|
2483
2458
|
* @param {Object} options The options for the ledger instance.
|
|
2484
|
-
* @param {
|
|
2459
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2485
2460
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2486
2461
|
* @param {string} options.ledgerName Ledger name.
|
|
2487
2462
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2507,7 +2482,7 @@ class Particle {
|
|
|
2507
2482
|
* Set ledger instance data.
|
|
2508
2483
|
*
|
|
2509
2484
|
* @param {Object} options The options for updating the ledger instance.
|
|
2510
|
-
* @param {
|
|
2485
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2511
2486
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2512
2487
|
* @param {string} options.ledgerName Ledger name.
|
|
2513
2488
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2535,7 +2510,7 @@ class Particle {
|
|
|
2535
2510
|
* Delete a ledger instance in the specified organization or sandbox by ledger name.
|
|
2536
2511
|
*
|
|
2537
2512
|
* @param {Object} options The options for archiving the ledger instance.
|
|
2538
|
-
* @param {
|
|
2513
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2539
2514
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2540
2515
|
* @param {string} options.ledgerName Name of the ledger instance to archive.
|
|
2541
2516
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2557,7 +2532,7 @@ class Particle {
|
|
|
2557
2532
|
* Lists ledger instances in the specified organization or sandbox.
|
|
2558
2533
|
*
|
|
2559
2534
|
* @param {Object} options The options for listing ledger instances.
|
|
2560
|
-
* @param {
|
|
2535
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2561
2536
|
* @param {string} [options.org] The unique identifier of the organization.
|
|
2562
2537
|
* @param {string} options.ledgerName Name of the ledger instance to archive.
|
|
2563
2538
|
* @param {number} [options.page] Page of results to display
|
|
@@ -2584,7 +2559,7 @@ class Particle {
|
|
|
2584
2559
|
* List ledger instance versions
|
|
2585
2560
|
*
|
|
2586
2561
|
* @param {Object} options The options for the ledger instance.
|
|
2587
|
-
* @param {
|
|
2562
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2588
2563
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2589
2564
|
* @param {string} options.ledgerName Ledger name.
|
|
2590
2565
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2612,7 +2587,7 @@ class Particle {
|
|
|
2612
2587
|
* Get specific ledger instance version
|
|
2613
2588
|
*
|
|
2614
2589
|
* @param {Object} options The options for the ledger instance.
|
|
2615
|
-
* @param {
|
|
2590
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2616
2591
|
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
|
|
2617
2592
|
* @param {string} options.ledgerName Ledger name.
|
|
2618
2593
|
* @param {string} options.scopeValue Scope value.
|
|
@@ -2639,7 +2614,7 @@ class Particle {
|
|
|
2639
2614
|
* @param {Number} [options.internalVersion] Internal version number to filter Device OS versions
|
|
2640
2615
|
* @param {Number} [options.page] Page number for pagination
|
|
2641
2616
|
* @param {Number} [options.perPage] Number of items per page
|
|
2642
|
-
* @param {
|
|
2617
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2643
2618
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2644
2619
|
* @param {Object} [options.context] Request context
|
|
2645
2620
|
*
|
|
@@ -2668,7 +2643,7 @@ class Particle {
|
|
|
2668
2643
|
* @param {Object} options Options for this API call
|
|
2669
2644
|
* @param {String} options.version Version of the Device OS
|
|
2670
2645
|
* @param {Number} [options.platformId] Optional platform ID to filter Device OS version
|
|
2671
|
-
* @param {
|
|
2646
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2672
2647
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2673
2648
|
* @param {Object} [options.context] Request context
|
|
2674
2649
|
*
|
|
@@ -2687,16 +2662,14 @@ class Particle {
|
|
|
2687
2662
|
|
|
2688
2663
|
/**
|
|
2689
2664
|
* Set default auth token that will be used in each method if `auth` is not provided
|
|
2690
|
-
* @param {
|
|
2665
|
+
* @param {string} auth The access token
|
|
2691
2666
|
* @throws {Error} When not auth string is provided
|
|
2692
2667
|
*/
|
|
2693
2668
|
setDefaultAuth(auth){
|
|
2694
2669
|
if (typeof auth === 'string' && auth.length !== 0) {
|
|
2695
2670
|
this._defaultAuth = auth;
|
|
2696
|
-
} else if (typeof auth === 'object' && 'username' in auth && 'password' in auth) {
|
|
2697
|
-
this._defaultAuth = auth;
|
|
2698
2671
|
} else {
|
|
2699
|
-
throw new Error('Must pass a non-empty string
|
|
2672
|
+
throw new Error('Must pass a non-empty string representing an auth token!');
|
|
2700
2673
|
}
|
|
2701
2674
|
}
|
|
2702
2675
|
/**
|
|
@@ -2742,7 +2715,7 @@ class Particle {
|
|
|
2742
2715
|
* Make a GET request
|
|
2743
2716
|
* @param {object} params
|
|
2744
2717
|
* @param {string} params.uri The URI to request
|
|
2745
|
-
* @param {
|
|
2718
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2746
2719
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2747
2720
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2748
2721
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2758,7 +2731,7 @@ class Particle {
|
|
|
2758
2731
|
* Make a HEAD request
|
|
2759
2732
|
* @param {object} params
|
|
2760
2733
|
* @param {string} params.uri The URI to request
|
|
2761
|
-
* @param {
|
|
2734
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2762
2735
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2763
2736
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2764
2737
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2774,7 +2747,7 @@ class Particle {
|
|
|
2774
2747
|
* Make a POST request
|
|
2775
2748
|
* @param {object} params
|
|
2776
2749
|
* @param {string} params.uri The URI to request
|
|
2777
|
-
* @param {
|
|
2750
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2778
2751
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2779
2752
|
* @param {string | object} [params.data] Request body
|
|
2780
2753
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2790,7 +2763,7 @@ class Particle {
|
|
|
2790
2763
|
* Make a PUT request
|
|
2791
2764
|
* @param {object} params
|
|
2792
2765
|
* @param {string} params.uri The URI to request
|
|
2793
|
-
* @param {
|
|
2766
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2794
2767
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2795
2768
|
* @param {string | object} [params.data] Request body
|
|
2796
2769
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
@@ -2807,7 +2780,7 @@ class Particle {
|
|
|
2807
2780
|
* Make a DELETE request
|
|
2808
2781
|
* @param {object} params
|
|
2809
2782
|
* @param {string} params.uri The URI to request
|
|
2810
|
-
* @param {
|
|
2783
|
+
* @param {string} [params.auth] Authorization token to use
|
|
2811
2784
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2812
2785
|
* @param {string | object} [params.data] Request body
|
|
2813
2786
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
@@ -2826,7 +2799,7 @@ class Particle {
|
|
|
2826
2799
|
* @param {String} args.method The method used to request the URI, should be in uppercase.
|
|
2827
2800
|
* @param {Object} [args.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2828
2801
|
* @param {object} [args.data] Arbitrary data to send as the body.
|
|
2829
|
-
* @param {
|
|
2802
|
+
* @param {string} [args.auth] Authorization
|
|
2830
2803
|
* @param {Object} [args.query] Query parameters
|
|
2831
2804
|
* @param {Object} [args.form] Form fields
|
|
2832
2805
|
* @param {Object} [args.files] Array of file names and file content
|
|
@@ -2852,7 +2825,4 @@ class Particle {
|
|
|
2852
2825
|
}
|
|
2853
2826
|
}
|
|
2854
2827
|
|
|
2855
|
-
// Aliases for backwards compatibility
|
|
2856
|
-
Particle.prototype.removeAccessToken = Particle.prototype.deleteAccessToken;
|
|
2857
|
-
|
|
2858
2828
|
module.exports = Particle;
|