Skip to content

Commit 72ee97c

Browse files
authored
feat: Add thermostat program action attempt
1 parent 93ce540 commit 72ee97c

File tree

4 files changed

+5234
-573
lines changed

4 files changed

+5234
-573
lines changed

src/lib/seam/connect/models/action-attempts/action-attempt.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { deprecated_action_attempts } from './deprecated.js'
55
import { encode_access_method_action_attempt } from './encode-access-method.js'
66
import { encode_credential_action_attempt } from './encode-credential.js'
77
import { lock_door_action_attempt } from './lock-door.js'
8+
import { push_thermostat_programs_action_attempt } from './push-thermostat-programs.js'
89
import { reset_sandbox_workspace_action_attempt } from './reset-sandbox-workspace.js'
910
import { scan_credential_action_attempt } from './scan-credential.js'
1011
import { set_fan_mode_action_attempt } from './set-fan-mode.js'
@@ -25,6 +26,7 @@ export const action_attempt = z.union([
2526
...activate_climate_preset_action_attempt.options,
2627
...simulate_keypad_code_entry_action_attempt.options,
2728
...simulate_manual_lock_via_keypad_action_attempt.options,
29+
...push_thermostat_programs_action_attempt.options,
2830
...deprecated_action_attempts,
2931
]).describe(`
3032
---
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { z } from 'zod'
2+
3+
import {
4+
common_failed_action_attempt,
5+
common_pending_action_attempt,
6+
common_succeeded_action_attempt,
7+
} from './common.js'
8+
9+
const action_type = z.literal('PUSH_THERMOSTAT_PROGRAMS')
10+
11+
const error = z.object({
12+
type: z.string(),
13+
message: z.string(),
14+
})
15+
16+
const result = z.object({})
17+
18+
export const push_thermostat_programs_action_attempt = z.discriminatedUnion(
19+
'status',
20+
[
21+
common_pending_action_attempt
22+
.extend({
23+
action_type,
24+
})
25+
.describe('Pushing thermostat weekly programs.'),
26+
common_succeeded_action_attempt
27+
.extend({
28+
action_type,
29+
result,
30+
})
31+
.describe('Pushing thermostat weekly programs succeeded.'),
32+
common_failed_action_attempt
33+
.extend({ action_type, error })
34+
.describe('Pushing thermostat weekly programs failed.'),
35+
],
36+
)

src/lib/seam/connect/openapi.ts

Lines changed: 134 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -6353,6 +6353,104 @@ export default {
63536353
],
63546354
type: 'object',
63556355
},
6356+
{
6357+
description: 'Pushing thermostat weekly programs.',
6358+
properties: {
6359+
action_attempt_id: {
6360+
description: 'ID of the action attempt.',
6361+
format: 'uuid',
6362+
type: 'string',
6363+
},
6364+
action_type: {
6365+
enum: ['PUSH_THERMOSTAT_PROGRAMS'],
6366+
type: 'string',
6367+
},
6368+
error: {
6369+
description:
6370+
'Errors associated with the action attempt. Null for pending action attempts.',
6371+
nullable: true,
6372+
},
6373+
result: {
6374+
description:
6375+
'Result of the action attempt. Null for pending action attempts.',
6376+
nullable: true,
6377+
},
6378+
status: { enum: ['pending'], type: 'string' },
6379+
},
6380+
required: [
6381+
'action_attempt_id',
6382+
'status',
6383+
'result',
6384+
'error',
6385+
'action_type',
6386+
],
6387+
type: 'object',
6388+
},
6389+
{
6390+
description: 'Pushing thermostat weekly programs succeeded.',
6391+
properties: {
6392+
action_attempt_id: {
6393+
description: 'ID of the action attempt.',
6394+
format: 'uuid',
6395+
type: 'string',
6396+
},
6397+
action_type: {
6398+
enum: ['PUSH_THERMOSTAT_PROGRAMS'],
6399+
type: 'string',
6400+
},
6401+
error: {
6402+
description:
6403+
'Errors associated with the action attempt. Null for successful action attempts.',
6404+
nullable: true,
6405+
},
6406+
result: { properties: {}, type: 'object' },
6407+
status: { enum: ['success'], type: 'string' },
6408+
},
6409+
required: [
6410+
'action_attempt_id',
6411+
'status',
6412+
'error',
6413+
'action_type',
6414+
'result',
6415+
],
6416+
type: 'object',
6417+
},
6418+
{
6419+
description: 'Pushing thermostat weekly programs failed.',
6420+
properties: {
6421+
action_attempt_id: {
6422+
description: 'ID of the action attempt.',
6423+
format: 'uuid',
6424+
type: 'string',
6425+
},
6426+
action_type: {
6427+
enum: ['PUSH_THERMOSTAT_PROGRAMS'],
6428+
type: 'string',
6429+
},
6430+
error: {
6431+
properties: {
6432+
message: { type: 'string' },
6433+
type: { type: 'string' },
6434+
},
6435+
required: ['type', 'message'],
6436+
type: 'object',
6437+
},
6438+
result: {
6439+
description:
6440+
'Result of the action attempt. Null for failed action attempts.',
6441+
nullable: true,
6442+
},
6443+
status: { enum: ['error'], type: 'string' },
6444+
},
6445+
required: [
6446+
'action_attempt_id',
6447+
'status',
6448+
'result',
6449+
'action_type',
6450+
'error',
6451+
],
6452+
type: 'object',
6453+
},
63566454
{
63576455
properties: {
63586456
action_attempt_id: {
@@ -29864,86 +29962,12 @@ export default {
2986429962
'application/json': {
2986529963
schema: {
2986629964
properties: {
29867-
ok: { type: 'boolean' },
29868-
thermostat_weekly_program: {
29869-
properties: {
29870-
created_at: {
29871-
description:
29872-
'Date and time at which the thermostat weekly program was created.',
29873-
format: 'date-time',
29874-
type: 'string',
29875-
},
29876-
device_id: {
29877-
description:
29878-
'ID of the thermostat device the weekly program is for.',
29879-
format: 'uuid',
29880-
type: 'string',
29881-
},
29882-
friday_program_id: {
29883-
description:
29884-
'ID of the thermostat daily program to run on Fridays.',
29885-
format: 'uuid',
29886-
nullable: true,
29887-
type: 'string',
29888-
},
29889-
monday_program_id: {
29890-
description:
29891-
'ID of the thermostat daily program to run on Mondays.',
29892-
format: 'uuid',
29893-
nullable: true,
29894-
type: 'string',
29895-
},
29896-
saturday_program_id: {
29897-
description:
29898-
'ID of the thermostat daily program to run on Saturdays.',
29899-
format: 'uuid',
29900-
nullable: true,
29901-
type: 'string',
29902-
},
29903-
sunday_program_id: {
29904-
description:
29905-
'ID of the thermostat daily program to run on Sundays.',
29906-
format: 'uuid',
29907-
nullable: true,
29908-
type: 'string',
29909-
},
29910-
thursday_program_id: {
29911-
description:
29912-
'ID of the thermostat daily program to run on Thursdays.',
29913-
format: 'uuid',
29914-
nullable: true,
29915-
type: 'string',
29916-
},
29917-
tuesday_program_id: {
29918-
description:
29919-
'ID of the thermostat daily program to run on Tuesdays.',
29920-
format: 'uuid',
29921-
nullable: true,
29922-
type: 'string',
29923-
},
29924-
wednesday_program_id: {
29925-
description:
29926-
'ID of the thermostat daily program to run on Wednesdays.',
29927-
format: 'uuid',
29928-
nullable: true,
29929-
type: 'string',
29930-
},
29931-
},
29932-
required: [
29933-
'device_id',
29934-
'monday_program_id',
29935-
'tuesday_program_id',
29936-
'wednesday_program_id',
29937-
'thursday_program_id',
29938-
'friday_program_id',
29939-
'saturday_program_id',
29940-
'sunday_program_id',
29941-
'created_at',
29942-
],
29943-
type: 'object',
29965+
action_attempt: {
29966+
$ref: '#/components/schemas/action_attempt',
2994429967
},
29968+
ok: { type: 'boolean' },
2994529969
},
29946-
required: ['thermostat_weekly_program', 'ok'],
29970+
required: ['action_attempt', 'ok'],
2994729971
type: 'object',
2994829972
},
2994929973
},
@@ -29961,10 +29985,11 @@ export default {
2996129985
],
2996229986
summary: '/thermostats/activate_weekly_program',
2996329987
tags: ['/thermostats'],
29988+
'x-action-attempt-type': 'PUSH_THERMOSTAT_PROGRAMS',
2996429989
'x-fern-sdk-group-name': ['thermostats'],
2996529990
'x-fern-sdk-method-name': 'activate_weekly_program',
29966-
'x-fern-sdk-return-value': 'thermostat_weekly_program',
29967-
'x-response-key': 'thermostat_weekly_program',
29991+
'x-fern-sdk-return-value': 'action_attempt',
29992+
'x-response-key': 'action_attempt',
2996829993
'x-title': 'Activate a Thermostat Weekly Program',
2996929994
'x-undocumented': 'Unreleased.',
2997029995
},
@@ -29996,8 +30021,13 @@ export default {
2999630021
content: {
2999730022
'application/json': {
2999830023
schema: {
29999-
properties: { ok: { type: 'boolean' } },
30000-
required: ['ok'],
30024+
properties: {
30025+
action_attempt: {
30026+
$ref: '#/components/schemas/action_attempt',
30027+
},
30028+
ok: { type: 'boolean' },
30029+
},
30030+
required: ['action_attempt', 'ok'],
3000130031
type: 'object',
3000230032
},
3000330033
},
@@ -30015,9 +30045,11 @@ export default {
3001530045
],
3001630046
summary: '/thermostats/clear_weekly_program',
3001730047
tags: ['/thermostats'],
30048+
'x-action-attempt-type': 'PUSH_THERMOSTAT_PROGRAMS',
3001830049
'x-fern-sdk-group-name': ['thermostats'],
3001930050
'x-fern-sdk-method-name': 'clear_weekly_program',
30020-
'x-response-key': null,
30051+
'x-fern-sdk-return-value': 'action_attempt',
30052+
'x-response-key': 'action_attempt',
3002130053
'x-title': 'Clear a Thermostat Weekly Program',
3002230054
'x-undocumented': 'Unreleased.',
3002330055
},
@@ -30447,8 +30479,13 @@ export default {
3044730479
content: {
3044830480
'application/json': {
3044930481
schema: {
30450-
properties: { ok: { type: 'boolean' } },
30451-
required: ['ok'],
30482+
properties: {
30483+
action_attempt: {
30484+
$ref: '#/components/schemas/action_attempt',
30485+
},
30486+
ok: { type: 'boolean' },
30487+
},
30488+
required: ['action_attempt', 'ok'],
3045230489
type: 'object',
3045330490
},
3045430491
},
@@ -30466,8 +30503,9 @@ export default {
3046630503
],
3046730504
summary: '/thermostats/daily_programs/update',
3046830505
tags: ['/thermostats'],
30506+
'x-action-attempt-type': 'PUSH_THERMOSTAT_PROGRAMS',
3046930507
'x-fern-ignore': true,
30470-
'x-response-key': null,
30508+
'x-response-key': 'action_attempt',
3047130509
'x-title': 'Update a Thermostat Daily Program',
3047230510
'x-undocumented': 'Unreleased.',
3047330511
},
@@ -30522,8 +30560,13 @@ export default {
3052230560
content: {
3052330561
'application/json': {
3052430562
schema: {
30525-
properties: { ok: { type: 'boolean' } },
30526-
required: ['ok'],
30563+
properties: {
30564+
action_attempt: {
30565+
$ref: '#/components/schemas/action_attempt',
30566+
},
30567+
ok: { type: 'boolean' },
30568+
},
30569+
required: ['action_attempt', 'ok'],
3052730570
type: 'object',
3052830571
},
3052930572
},
@@ -30541,9 +30584,11 @@ export default {
3054130584
],
3054230585
summary: '/thermostats/daily_programs/update',
3054330586
tags: ['/thermostats'],
30587+
'x-action-attempt-type': 'PUSH_THERMOSTAT_PROGRAMS',
3054430588
'x-fern-sdk-group-name': ['thermostats', 'daily_programs'],
3054530589
'x-fern-sdk-method-name': 'update',
30546-
'x-response-key': null,
30590+
'x-fern-sdk-return-value': 'action_attempt',
30591+
'x-response-key': 'action_attempt',
3054730592
'x-title': 'Update a Thermostat Daily Program',
3054830593
'x-undocumented': 'Unreleased.',
3054930594
},

0 commit comments

Comments
 (0)