@seamapi/http 0.22.0 → 0.23.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/README.md CHANGED
@@ -366,7 +366,7 @@ Either pass the `endpoint` option, or set the `SEAM_ENDPOINT` environment variab
366
366
  #### Configuring the Axios Client
367
367
 
368
368
  The Axios client and retry behavior may be configured with custom initiation options
369
- via [`axiosOptions`] and [`axiosRetryOptions`][axiosRetryOptions].
369
+ via [`axiosOptions`][axiosOptions] and [`axiosRetryOptions`][axiosRetryOptions].
370
370
  Options are deep merged with the default options.
371
371
 
372
372
  [axiosOptions]: https://axios-http.com/docs/config_defaults
package/dist/connect.cjs CHANGED
@@ -3410,12 +3410,24 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
3410
3410
  this.defaults
3411
3411
  );
3412
3412
  }
3413
- async cool(body) {
3414
- await this.client.request({
3413
+ async cool(body, options = {}) {
3414
+ const { data } = await this.client.request({
3415
3415
  url: "/thermostats/cool",
3416
3416
  method: "post",
3417
3417
  data: body
3418
3418
  });
3419
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
3420
+ if (waitForActionAttempt !== false) {
3421
+ return await resolveActionAttempt(
3422
+ data.action_attempt,
3423
+ SeamHttpActionAttempts.fromClient(this.client, {
3424
+ ...this.defaults,
3425
+ waitForActionAttempt: false
3426
+ }),
3427
+ typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
3428
+ );
3429
+ }
3430
+ return data.action_attempt;
3419
3431
  }
3420
3432
  async get(body) {
3421
3433
  const { data } = await this.client.request({
@@ -3425,19 +3437,43 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
3425
3437
  });
3426
3438
  return data.thermostat;
3427
3439
  }
3428
- async heat(body) {
3429
- await this.client.request({
3440
+ async heat(body, options = {}) {
3441
+ const { data } = await this.client.request({
3430
3442
  url: "/thermostats/heat",
3431
3443
  method: "post",
3432
3444
  data: body
3433
3445
  });
3446
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
3447
+ if (waitForActionAttempt !== false) {
3448
+ return await resolveActionAttempt(
3449
+ data.action_attempt,
3450
+ SeamHttpActionAttempts.fromClient(this.client, {
3451
+ ...this.defaults,
3452
+ waitForActionAttempt: false
3453
+ }),
3454
+ typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
3455
+ );
3456
+ }
3457
+ return data.action_attempt;
3434
3458
  }
3435
- async heatCool(body) {
3436
- await this.client.request({
3459
+ async heatCool(body, options = {}) {
3460
+ const { data } = await this.client.request({
3437
3461
  url: "/thermostats/heat_cool",
3438
3462
  method: "post",
3439
3463
  data: body
3440
3464
  });
3465
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
3466
+ if (waitForActionAttempt !== false) {
3467
+ return await resolveActionAttempt(
3468
+ data.action_attempt,
3469
+ SeamHttpActionAttempts.fromClient(this.client, {
3470
+ ...this.defaults,
3471
+ waitForActionAttempt: false
3472
+ }),
3473
+ typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
3474
+ );
3475
+ }
3476
+ return data.action_attempt;
3441
3477
  }
3442
3478
  async list(body) {
3443
3479
  const { data } = await this.client.request({
@@ -3447,19 +3483,43 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
3447
3483
  });
3448
3484
  return data.thermostats;
3449
3485
  }
3450
- async off(body) {
3451
- await this.client.request({
3486
+ async off(body, options = {}) {
3487
+ const { data } = await this.client.request({
3452
3488
  url: "/thermostats/off",
3453
3489
  method: "post",
3454
3490
  data: body
3455
3491
  });
3492
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
3493
+ if (waitForActionAttempt !== false) {
3494
+ return await resolveActionAttempt(
3495
+ data.action_attempt,
3496
+ SeamHttpActionAttempts.fromClient(this.client, {
3497
+ ...this.defaults,
3498
+ waitForActionAttempt: false
3499
+ }),
3500
+ typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
3501
+ );
3502
+ }
3503
+ return data.action_attempt;
3456
3504
  }
3457
- async setFanMode(body) {
3458
- await this.client.request({
3505
+ async setFanMode(body, options = {}) {
3506
+ const { data } = await this.client.request({
3459
3507
  url: "/thermostats/set_fan_mode",
3460
3508
  method: "post",
3461
3509
  data: body
3462
3510
  });
3511
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
3512
+ if (waitForActionAttempt !== false) {
3513
+ return await resolveActionAttempt(
3514
+ data.action_attempt,
3515
+ SeamHttpActionAttempts.fromClient(this.client, {
3516
+ ...this.defaults,
3517
+ waitForActionAttempt: false
3518
+ }),
3519
+ typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
3520
+ );
3521
+ }
3522
+ return data.action_attempt;
3463
3523
  }
3464
3524
  async update(body) {
3465
3525
  await this.client.request({