Skip to content

Commit

Permalink
Return action_attempts where it makes sense
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Sep 26, 2023
1 parent 2710e93 commit 7e70c6f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
10 changes: 5 additions & 5 deletions generate-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ const endpointResources: Partial<
> = {
'/access_codes/generate_code': 'generated_code',
'/access_codes/pull_backup_access_code': 'backup_access_code',
'/acs/users/add_to_access_group': null,
'/acs/users/remove_from_access_group': null,
'/acs/access_groups/list_users': 'acs_users',
'/acs/access_groups/remove_user': null,
'/acs/users/add_to_access_group': null,
'/acs/users/remove_from_access_group': null,
'/connect_webviews/view': null,
'/devices/list_device_providers': 'device_providers',
'/locks/lock_door': null,
'/locks/unlock_door': null,
'/noise_sensors/noise_thresholds/create': null,
'/locks/lock_door': 'action_attempt',
'/locks/unlock_door': 'action_attempt',
'/noise_sensors/noise_thresholds/create': null, // could return action action_attempt
'/thermostats/cool': null,
'/thermostats/heat': null,
'/thermostats/heat_cool': null,
Expand Down
14 changes: 10 additions & 4 deletions src/lib/seam/connect/routes/locks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,26 @@ export class SeamHttpLocks {
return data.locks
}

async lockDoor(body: LocksLockDoorBody): Promise<void> {
await this.client.request<LocksLockDoorResponse>({
async lockDoor(
body: LocksLockDoorBody,
): Promise<LocksLockDoorResponse['action_attempt']> {
const { data } = await this.client.request<LocksLockDoorResponse>({
url: '/locks/lock_door',
method: 'post',
data: body,
})
return data.action_attempt
}

async unlockDoor(body: LocksUnlockDoorBody): Promise<void> {
await this.client.request<LocksUnlockDoorResponse>({
async unlockDoor(
body: LocksUnlockDoorBody,
): Promise<LocksUnlockDoorResponse['action_attempt']> {
const { data } = await this.client.request<LocksUnlockDoorResponse>({
url: '/locks/unlock_door',
method: 'post',
data: body,
})
return data.action_attempt
}
}

Expand Down
16 changes: 10 additions & 6 deletions src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
return new SeamHttpNoiseSensorsNoiseThresholds(opts)
}

async create(body: NoiseSensorsNoiseThresholdsCreateBody): Promise<void> {
await this.client.request<NoiseSensorsNoiseThresholdsCreateResponse>({
url: '/noise_sensors/noise_thresholds/create',
method: 'post',
data: body,
})
async create(
body: NoiseSensorsNoiseThresholdsCreateBody,
): Promise<NoiseSensorsNoiseThresholdsCreateResponse['action_attempt']> {
const { data } =
await this.client.request<NoiseSensorsNoiseThresholdsCreateResponse>({
url: '/noise_sensors/noise_thresholds/create',
method: 'post',
data: body,
})
return data.action_attempt
}

async delete(body: NoiseSensorsNoiseThresholdsDeleteBody): Promise<void> {
Expand Down

0 comments on commit 7e70c6f

Please sign in to comment.