From ebf271add9abd8bc7f8b3811e350c26a8e0b39c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 06:13:28 +0000 Subject: [PATCH 1/3] feat(deps-dev): bump @seamapi/types in the seam group Bumps the seam group with 1 update: [@seamapi/types](https://github.com/seamapi/types). Updates `@seamapi/types` from 1.235.1 to 1.242.0 - [Release notes](https://github.com/seamapi/types/releases) - [Changelog](https://github.com/seamapi/types/blob/main/.releaserc.json) - [Commits](https://github.com/seamapi/types/compare/v1.235.1...v1.242.0) --- updated-dependencies: - dependency-name: "@seamapi/types" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: seam ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 26e6632c..5e6dee95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ }, "devDependencies": { "@seamapi/fake-seam-connect": "^1.71.0", - "@seamapi/types": "1.235.1", + "@seamapi/types": "1.242.0", "@types/eslint": "^8.44.2", "@types/node": "^20.8.10", "ava": "^5.0.1", @@ -1049,9 +1049,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.235.1", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.235.1.tgz", - "integrity": "sha512-LhX9GbJABzaEneWIyvLKL1RXGwA/mAzCxBPD0E32Dwsd19K85YJj/xxooeC4SmL166qCU1OdlPWt2Or92wc5xQ==", + "version": "1.242.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.242.0.tgz", + "integrity": "sha512-s3r5T9ttfEgdhKgY4RgsA2FOc25q4hxYet82WqKfB7TsGDwrl1V5LUKf9xQOHbWQuTfigitZOOzqUbg1PaiNbA==", "dev": true, "engines": { "node": ">=18.12.0", diff --git a/package.json b/package.json index 38ebdaf2..e2dd1ebc 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ }, "devDependencies": { "@seamapi/fake-seam-connect": "^1.71.0", - "@seamapi/types": "1.235.1", + "@seamapi/types": "1.242.0", "@types/eslint": "^8.44.2", "@types/node": "^20.8.10", "ava": "^5.0.1", From 035e957286c34d796e2fb74d9b099790b99e4931 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Fri, 13 Sep 2024 10:23:53 -0700 Subject: [PATCH 2/3] Rename climate_setting_schedules to schedules --- generate-routes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate-routes.ts b/generate-routes.ts index 442016dc..7231eff2 100644 --- a/generate-routes.ts +++ b/generate-routes.ts @@ -64,7 +64,7 @@ const routePaths = [ '/phones', '/phones/simulate', '/thermostats', - '/thermostats/climate_setting_schedules', + '/thermostats/schedules', '/user_identities', '/user_identities/enrollment_automations', '/webhooks', @@ -90,7 +90,7 @@ const routePathSubresources: Partial< '/phones': ['simulate'], '/devices': ['unmanaged', 'simulate'], '/noise_sensors': ['noise_thresholds', 'simulate'], - '/thermostats': ['climate_setting_schedules'], + '/thermostats': ['schedules'], '/user_identities': ['enrollment_automations'], } From 7049e50335b189dc7861cf20e4245387465dffa4 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 13 Sep 2024 17:26:05 +0000 Subject: [PATCH 3/3] ci: Generate code --- package-lock.json | 2 +- package.json | 2 +- src/lib/seam/connect/routes/index.ts | 2 +- ...-schedules.ts => thermostats-schedules.ts} | 119 ++++++++---------- src/lib/seam/connect/routes/thermostats.ts | 114 +++++++++++++++-- 5 files changed, 159 insertions(+), 80 deletions(-) rename src/lib/seam/connect/routes/{thermostats-climate-setting-schedules.ts => thermostats-schedules.ts} (61%) diff --git a/package-lock.json b/package-lock.json index 5e6dee95..e678bf5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "npm": ">= 9.0.0" }, "peerDependencies": { - "@seamapi/types": "^1.235.1" + "@seamapi/types": "^1.242.0" }, "peerDependenciesMeta": { "@seamapi/types": { diff --git a/package.json b/package.json index e2dd1ebc..e497e420 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "npm": ">= 9.0.0" }, "peerDependencies": { - "@seamapi/types": "^1.235.1" + "@seamapi/types": "^1.242.0" }, "peerDependenciesMeta": { "@seamapi/types": { diff --git a/src/lib/seam/connect/routes/index.ts b/src/lib/seam/connect/routes/index.ts index d4e02cd5..39678048 100644 --- a/src/lib/seam/connect/routes/index.ts +++ b/src/lib/seam/connect/routes/index.ts @@ -28,7 +28,7 @@ export * from './noise-sensors-simulate.js' export * from './phones.js' export * from './phones-simulate.js' export * from './thermostats.js' -export * from './thermostats-climate-setting-schedules.js' +export * from './thermostats-schedules.js' export * from './user-identities.js' export * from './user-identities-enrollment-automations.js' export * from './webhooks.js' diff --git a/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts b/src/lib/seam/connect/routes/thermostats-schedules.ts similarity index 61% rename from src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts rename to src/lib/seam/connect/routes/thermostats-schedules.ts index 0d97ddbf..027219e9 100644 --- a/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +++ b/src/lib/seam/connect/routes/thermostats-schedules.ts @@ -35,7 +35,7 @@ import type { SetNonNullable } from 'lib/types.js' import { SeamHttpClientSessions } from './client-sessions.js' -export class SeamHttpThermostatsClimateSettingSchedules { +export class SeamHttpThermostatsSchedules { client: Client readonly defaults: Required @@ -48,23 +48,23 @@ export class SeamHttpThermostatsClimateSettingSchedules { static fromClient( client: SeamHttpOptionsWithClient['client'], options: Omit = {}, - ): SeamHttpThermostatsClimateSettingSchedules { + ): SeamHttpThermostatsSchedules { const constructorOptions = { ...options, client } if (!isSeamHttpOptionsWithClient(constructorOptions)) { throw new SeamHttpInvalidOptionsError('Missing client') } - return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions) + return new SeamHttpThermostatsSchedules(constructorOptions) } static fromApiKey( apiKey: SeamHttpOptionsWithApiKey['apiKey'], options: Omit = {}, - ): SeamHttpThermostatsClimateSettingSchedules { + ): SeamHttpThermostatsSchedules { const constructorOptions = { ...options, apiKey } if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { throw new SeamHttpInvalidOptionsError('Missing apiKey') } - return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions) + return new SeamHttpThermostatsSchedules(constructorOptions) } static fromClientSessionToken( @@ -73,19 +73,19 @@ export class SeamHttpThermostatsClimateSettingSchedules { SeamHttpOptionsWithClientSessionToken, 'clientSessionToken' > = {}, - ): SeamHttpThermostatsClimateSettingSchedules { + ): SeamHttpThermostatsSchedules { const constructorOptions = { ...options, clientSessionToken } if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') } - return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions) + return new SeamHttpThermostatsSchedules(constructorOptions) } static async fromPublishableKey( publishableKey: string, userIdentifierKey: string, options: SeamHttpFromPublishableKeyOptions = {}, - ): Promise { + ): Promise { warnOnInsecureuserIdentifierKey(userIdentifierKey) const clientOptions = parseOptions({ ...options, publishableKey }) if (isSeamHttpOptionsWithClient(clientOptions)) { @@ -98,10 +98,7 @@ export class SeamHttpThermostatsClimateSettingSchedules { const { token } = await clientSessions.getOrCreate({ user_identifier_key: userIdentifierKey, }) - return SeamHttpThermostatsClimateSettingSchedules.fromClientSessionToken( - token, - options, - ) + return SeamHttpThermostatsSchedules.fromClientSessionToken(token, options) } static fromConsoleSessionToken( @@ -111,14 +108,14 @@ export class SeamHttpThermostatsClimateSettingSchedules { SeamHttpOptionsWithConsoleSessionToken, 'consoleSessionToken' | 'workspaceId' > = {}, - ): SeamHttpThermostatsClimateSettingSchedules { + ): SeamHttpThermostatsSchedules { const constructorOptions = { ...options, consoleSessionToken, workspaceId } if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { throw new SeamHttpInvalidOptionsError( 'Missing consoleSessionToken or workspaceId', ) } - return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions) + return new SeamHttpThermostatsSchedules(constructorOptions) } static fromPersonalAccessToken( @@ -128,14 +125,14 @@ export class SeamHttpThermostatsClimateSettingSchedules { SeamHttpOptionsWithPersonalAccessToken, 'personalAccessToken' | 'workspaceId' > = {}, - ): SeamHttpThermostatsClimateSettingSchedules { + ): SeamHttpThermostatsSchedules { const constructorOptions = { ...options, personalAccessToken, workspaceId } if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { throw new SeamHttpInvalidOptionsError( 'Missing personalAccessToken or workspaceId', ) } - return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions) + return new SeamHttpThermostatsSchedules(constructorOptions) } async updateClientSessionToken( @@ -158,24 +155,24 @@ export class SeamHttpThermostatsClimateSettingSchedules { } create( - body?: ThermostatsClimateSettingSchedulesCreateBody, + body?: ThermostatsSchedulesCreateBody, ): SeamHttpRequest< - ThermostatsClimateSettingSchedulesCreateResponse, - 'climate_setting_schedule' + ThermostatsSchedulesCreateResponse, + 'thermostat_schedule' > { return new SeamHttpRequest(this, { - path: '/thermostats/climate_setting_schedules/create', + path: '/thermostats/schedules/create', method: 'post', body, - responseKey: 'climate_setting_schedule', + responseKey: 'thermostat_schedule', }) } delete( - body?: ThermostatsClimateSettingSchedulesDeleteParams, + body?: ThermostatsSchedulesDeleteParams, ): SeamHttpRequest { return new SeamHttpRequest(this, { - path: '/thermostats/climate_setting_schedules/delete', + path: '/thermostats/schedules/delete', method: 'post', body, responseKey: undefined, @@ -183,38 +180,32 @@ export class SeamHttpThermostatsClimateSettingSchedules { } get( - body?: ThermostatsClimateSettingSchedulesGetParams, - ): SeamHttpRequest< - ThermostatsClimateSettingSchedulesGetResponse, - 'climate_setting_schedule' - > { + body?: ThermostatsSchedulesGetParams, + ): SeamHttpRequest { return new SeamHttpRequest(this, { - path: '/thermostats/climate_setting_schedules/get', + path: '/thermostats/schedules/get', method: 'post', body, - responseKey: 'climate_setting_schedule', + responseKey: 'thermostat_schedule', }) } list( - body?: ThermostatsClimateSettingSchedulesListParams, - ): SeamHttpRequest< - ThermostatsClimateSettingSchedulesListResponse, - 'climate_setting_schedules' - > { + body?: ThermostatsSchedulesListParams, + ): SeamHttpRequest { return new SeamHttpRequest(this, { - path: '/thermostats/climate_setting_schedules/list', + path: '/thermostats/schedules/list', method: 'post', body, - responseKey: 'climate_setting_schedules', + responseKey: 'thermostat_schedules', }) } update( - body?: ThermostatsClimateSettingSchedulesUpdateBody, + body?: ThermostatsSchedulesUpdateBody, ): SeamHttpRequest { return new SeamHttpRequest(this, { - path: '/thermostats/climate_setting_schedules/update', + path: '/thermostats/schedules/update', method: 'post', body, responseKey: undefined, @@ -222,47 +213,47 @@ export class SeamHttpThermostatsClimateSettingSchedules { } } -export type ThermostatsClimateSettingSchedulesCreateBody = - RouteRequestBody<'/thermostats/climate_setting_schedules/create'> +export type ThermostatsSchedulesCreateBody = + RouteRequestBody<'/thermostats/schedules/create'> -export type ThermostatsClimateSettingSchedulesCreateResponse = SetNonNullable< - Required> +export type ThermostatsSchedulesCreateResponse = SetNonNullable< + Required> > -export type ThermostatsClimateSettingSchedulesCreateOptions = never +export type ThermostatsSchedulesCreateOptions = never -export type ThermostatsClimateSettingSchedulesDeleteParams = - RouteRequestBody<'/thermostats/climate_setting_schedules/delete'> +export type ThermostatsSchedulesDeleteParams = + RouteRequestBody<'/thermostats/schedules/delete'> -export type ThermostatsClimateSettingSchedulesDeleteResponse = SetNonNullable< - Required> +export type ThermostatsSchedulesDeleteResponse = SetNonNullable< + Required> > -export type ThermostatsClimateSettingSchedulesDeleteOptions = never +export type ThermostatsSchedulesDeleteOptions = never -export type ThermostatsClimateSettingSchedulesGetParams = - RouteRequestBody<'/thermostats/climate_setting_schedules/get'> +export type ThermostatsSchedulesGetParams = + RouteRequestBody<'/thermostats/schedules/get'> -export type ThermostatsClimateSettingSchedulesGetResponse = SetNonNullable< - Required> +export type ThermostatsSchedulesGetResponse = SetNonNullable< + Required> > -export type ThermostatsClimateSettingSchedulesGetOptions = never +export type ThermostatsSchedulesGetOptions = never -export type ThermostatsClimateSettingSchedulesListParams = - RouteRequestBody<'/thermostats/climate_setting_schedules/list'> +export type ThermostatsSchedulesListParams = + RouteRequestBody<'/thermostats/schedules/list'> -export type ThermostatsClimateSettingSchedulesListResponse = SetNonNullable< - Required> +export type ThermostatsSchedulesListResponse = SetNonNullable< + Required> > -export type ThermostatsClimateSettingSchedulesListOptions = never +export type ThermostatsSchedulesListOptions = never -export type ThermostatsClimateSettingSchedulesUpdateBody = - RouteRequestBody<'/thermostats/climate_setting_schedules/update'> +export type ThermostatsSchedulesUpdateBody = + RouteRequestBody<'/thermostats/schedules/update'> -export type ThermostatsClimateSettingSchedulesUpdateResponse = SetNonNullable< - Required> +export type ThermostatsSchedulesUpdateResponse = SetNonNullable< + Required> > -export type ThermostatsClimateSettingSchedulesUpdateOptions = never +export type ThermostatsSchedulesUpdateOptions = never diff --git a/src/lib/seam/connect/routes/thermostats.ts b/src/lib/seam/connect/routes/thermostats.ts index a2faa5ff..0f281a1c 100644 --- a/src/lib/seam/connect/routes/thermostats.ts +++ b/src/lib/seam/connect/routes/thermostats.ts @@ -34,7 +34,7 @@ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js' import type { SetNonNullable } from 'lib/types.js' import { SeamHttpClientSessions } from './client-sessions.js' -import { SeamHttpThermostatsClimateSettingSchedules } from './thermostats-climate-setting-schedules.js' +import { SeamHttpThermostatsSchedules } from './thermostats-schedules.js' export class SeamHttpThermostats { client: Client @@ -155,11 +155,24 @@ export class SeamHttpThermostats { await clientSessions.get() } - get climateSettingSchedules(): SeamHttpThermostatsClimateSettingSchedules { - return SeamHttpThermostatsClimateSettingSchedules.fromClient( - this.client, - this.defaults, - ) + get schedules(): SeamHttpThermostatsSchedules { + return SeamHttpThermostatsSchedules.fromClient(this.client, this.defaults) + } + + activateClimatePreset( + body?: ThermostatsActivateClimatePresetBody, + options: Pick = {}, + ): SeamHttpRequest< + ThermostatsActivateClimatePresetResponse, + 'action_attempt' + > { + return new SeamHttpRequest(this, { + path: '/thermostats/activate_climate_preset', + method: 'post', + body, + responseKey: 'action_attempt', + options, + }) } cool( @@ -175,6 +188,28 @@ export class SeamHttpThermostats { }) } + createClimatePreset( + body?: ThermostatsCreateClimatePresetBody, + ): SeamHttpRequest { + return new SeamHttpRequest(this, { + path: '/thermostats/create_climate_preset', + method: 'post', + body, + responseKey: undefined, + }) + } + + deleteClimatePreset( + body?: ThermostatsDeleteClimatePresetBody, + ): SeamHttpRequest { + return new SeamHttpRequest(this, { + path: '/thermostats/delete_climate_preset', + method: 'post', + body, + responseKey: undefined, + }) + } + get( body?: ThermostatsGetParams, ): SeamHttpRequest { @@ -236,6 +271,17 @@ export class SeamHttpThermostats { }) } + setFallbackClimatePreset( + body?: ThermostatsSetFallbackClimatePresetBody, + ): SeamHttpRequest { + return new SeamHttpRequest(this, { + path: '/thermostats/set_fallback_climate_preset', + method: 'post', + body, + responseKey: undefined, + }) + } + setFanMode( body?: ThermostatsSetFanModeBody, options: Pick = {}, @@ -249,16 +295,30 @@ export class SeamHttpThermostats { }) } - update(body?: ThermostatsUpdateBody): SeamHttpRequest { + updateClimatePreset( + body?: ThermostatsUpdateClimatePresetBody, + ): SeamHttpRequest { return new SeamHttpRequest(this, { - path: '/thermostats/update', + path: '/thermostats/update_climate_preset', method: 'post', body, - responseKey: undefined, + responseKey: 'climate_preset', }) } } +export type ThermostatsActivateClimatePresetBody = + RouteRequestBody<'/thermostats/activate_climate_preset'> + +export type ThermostatsActivateClimatePresetResponse = SetNonNullable< + Required> +> + +export type ThermostatsActivateClimatePresetOptions = Pick< + SeamHttpRequestOptions, + 'waitForActionAttempt' +> + export type ThermostatsCoolBody = RouteRequestBody<'/thermostats/cool'> export type ThermostatsCoolResponse = SetNonNullable< @@ -270,6 +330,24 @@ export type ThermostatsCoolOptions = Pick< 'waitForActionAttempt' > +export type ThermostatsCreateClimatePresetBody = + RouteRequestBody<'/thermostats/create_climate_preset'> + +export type ThermostatsCreateClimatePresetResponse = SetNonNullable< + Required> +> + +export type ThermostatsCreateClimatePresetOptions = never + +export type ThermostatsDeleteClimatePresetBody = + RouteRequestBody<'/thermostats/delete_climate_preset'> + +export type ThermostatsDeleteClimatePresetResponse = SetNonNullable< + Required> +> + +export type ThermostatsDeleteClimatePresetOptions = never + export type ThermostatsGetParams = RouteRequestBody<'/thermostats/get'> export type ThermostatsGetResponse = SetNonNullable< @@ -319,6 +397,15 @@ export type ThermostatsOffOptions = Pick< 'waitForActionAttempt' > +export type ThermostatsSetFallbackClimatePresetBody = + RouteRequestBody<'/thermostats/set_fallback_climate_preset'> + +export type ThermostatsSetFallbackClimatePresetResponse = SetNonNullable< + Required> +> + +export type ThermostatsSetFallbackClimatePresetOptions = never + export type ThermostatsSetFanModeBody = RouteRequestBody<'/thermostats/set_fan_mode'> @@ -331,10 +418,11 @@ export type ThermostatsSetFanModeOptions = Pick< 'waitForActionAttempt' > -export type ThermostatsUpdateBody = RouteRequestBody<'/thermostats/update'> +export type ThermostatsUpdateClimatePresetBody = + RouteRequestBody<'/thermostats/update_climate_preset'> -export type ThermostatsUpdateResponse = SetNonNullable< - Required> +export type ThermostatsUpdateClimatePresetResponse = SetNonNullable< + Required> > -export type ThermostatsUpdateOptions = never +export type ThermostatsUpdateClimatePresetOptions = never