@seamapi/http 0.25.0 → 0.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -74,13 +74,29 @@ $ npm install -D @seamapi/types@latest
74
74
 
75
75
  ## Usage
76
76
 
77
+ ### Examples
78
+
79
+ _These examples assume `SEAM_API_KEY` is set in your environment._
80
+
81
+ #### List devices
82
+
77
83
  ```ts
78
84
  import { SeamHttp } from '@seamapi/http/connect'
79
85
 
80
- const seam = new SeamHttp('your-api-key')
86
+ const seam = new SeamHttp()
81
87
  const devices = await seam.devices.list()
82
88
  ```
83
89
 
90
+ #### Unlock a door
91
+
92
+ ```ts
93
+ import { SeamHttp } from '@seamapi/http/connect'
94
+
95
+ const seam = new SeamHttp()
96
+ const lock = await seam.locks.get({ name: 'Front Door' })
97
+ await seam.locks.unlockDoor({ device_id: lock.device_id })
98
+ ```
99
+
84
100
  ### Authentication Methods
85
101
 
86
102
  The SDK supports several authentication mechanisms.
@@ -124,7 +140,7 @@ const seam = SeamHttp.fromClientSessionToken('some-client-session-token')
124
140
 
125
141
  The client session token may be updated using
126
142
 
127
- ```
143
+ ```ts
128
144
  const seam = SeamHttp.fromClientSessionToken('some-client-session-token')
129
145
 
130
146
  await seam.updateClientSessionToken('some-new-client-session-token')
package/dist/connect.cjs CHANGED
@@ -653,9 +653,10 @@ var SeamActionAttemptTimeoutError = class extends SeamActionAttemptError {
653
653
  };
654
654
  var isSuccessfulActionAttempt = (actionAttempt) => actionAttempt.status === "success";
655
655
  var isFailedActionAttempt = (actionAttempt) => actionAttempt.status === "error";
656
- var _parent, _config;
656
+ var _a, _parent, _config;
657
657
  var SeamHttpRequest = class {
658
658
  constructor(parent, config) {
659
+ this[_a] = "SeamHttpRequest";
659
660
  __privateAdd(this, _parent, void 0);
660
661
  __privateAdd(this, _config, void 0);
661
662
  __privateSet(this, _parent, parent);
@@ -706,10 +707,17 @@ var SeamHttpRequest = class {
706
707
  }
707
708
  return data;
708
709
  }
709
- then(onfulfilled, onrejected) {
710
- return this.execute().then(onfulfilled, onrejected);
710
+ async then(onfulfilled, onrejected) {
711
+ return await this.execute().then(onfulfilled, onrejected);
712
+ }
713
+ async catch(onrejected) {
714
+ return await this.execute().catch(onrejected);
715
+ }
716
+ async finally(onfinally) {
717
+ return await this.execute().finally(onfinally);
711
718
  }
712
719
  };
720
+ _a = Symbol.toStringTag;
713
721
  _parent = new WeakMap();
714
722
  _config = new WeakMap();
715
723
  var getUrlPrefix = (input) => {
@@ -4377,6 +4385,7 @@ exports.SeamHttpNoiseSensors = SeamHttpNoiseSensors;
4377
4385
  exports.SeamHttpNoiseSensorsNoiseThresholds = SeamHttpNoiseSensorsNoiseThresholds;
4378
4386
  exports.SeamHttpPhones = SeamHttpPhones;
4379
4387
  exports.SeamHttpPhonesSimulate = SeamHttpPhonesSimulate;
4388
+ exports.SeamHttpRequest = SeamHttpRequest;
4380
4389
  exports.SeamHttpThermostats = SeamHttpThermostats;
4381
4390
  exports.SeamHttpThermostatsClimateSettingSchedules = SeamHttpThermostatsClimateSettingSchedules;
4382
4391
  exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;