From cbbd52f32ba11602d233251369bbe0f8e8e81308 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Thu, 25 Sep 2025 19:11:43 +0000 Subject: [PATCH 1/2] feat: Update to @seamapi/types@1.590.0 --- package-lock.json | 8 +- package.json | 2 +- .../connect/routes/seam-http-endpoints.ts | 20 ++ .../connect/routes/seam/customer/v1/index.ts | 1 + .../routes/seam/customer/v1/spaces/index.ts | 6 + .../routes/seam/customer/v1/spaces/spaces.ts | 201 ++++++++++++++++++ .../connect/routes/seam/customer/v1/v1.ts | 10 +- 7 files changed, 238 insertions(+), 10 deletions(-) create mode 100644 src/lib/seam/connect/routes/seam/customer/v1/spaces/index.ts create mode 100644 src/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.ts diff --git a/package-lock.json b/package-lock.json index 2f7299f8..7eb2f775 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@seamapi/blueprint": "^0.51.1", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.585.0", + "@seamapi/types": "1.590.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^22.15.21", @@ -1371,9 +1371,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.585.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.585.0.tgz", - "integrity": "sha512-Nxzw4vBtne74FH0Lb7InIZVLufS/yAX5JWuYD48vbnT/nYlZZGLOvepyl3SAYuPIv5msewEy55cLCGVuiwa6Jw==", + "version": "1.590.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.590.0.tgz", + "integrity": "sha512-s96t5h3UYfEZWUXOuKUnjAzw5N8ey1BtwOXdqdXUkZO2+1toTMDaPJewe2LYU6xQ5FeukfxpK3G1XphifylXhQ==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index fdf6b891..80908420 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "@seamapi/blueprint": "^0.51.1", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.585.0", + "@seamapi/types": "1.590.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^22.15.21", diff --git a/src/lib/seam/connect/routes/seam-http-endpoints.ts b/src/lib/seam/connect/routes/seam-http-endpoints.ts index 80504d1f..cfe379be 100644 --- a/src/lib/seam/connect/routes/seam-http-endpoints.ts +++ b/src/lib/seam/connect/routes/seam-http-endpoints.ts @@ -620,6 +620,12 @@ import { type SeamCustomerV1SettingsUpdateRequest, SeamHttpSeamCustomerV1Settings, } from './seam/customer/v1/settings/index.js' +import { + type SeamCustomerV1SpacesCreateOptions, + type SeamCustomerV1SpacesCreateParameters, + type SeamCustomerV1SpacesCreateRequest, + SeamHttpSeamCustomerV1Spaces, +} from './seam/customer/v1/spaces/index.js' import { SeamHttpSeamPartnerV1BuildingBlocksSpaces, type SeamPartnerV1BuildingBlocksSpacesAutoMapOptions, @@ -3151,6 +3157,19 @@ export class SeamHttpEndpoints { } } + get '/seam/customer/v1/spaces/create'(): ( + parameters?: SeamCustomerV1SpacesCreateParameters, + options?: SeamCustomerV1SpacesCreateOptions, + ) => SeamCustomerV1SpacesCreateRequest { + const { client, defaults } = this + return function seamCustomerV1SpacesCreate( + ...args: Parameters + ): ReturnType { + const seam = SeamHttpSeamCustomerV1Spaces.fromClient(client, defaults) + return seam.create(...args) + } + } + get '/seam/partner/v1/building_blocks/spaces/auto_map'(): ( parameters?: SeamPartnerV1BuildingBlocksSpacesAutoMapParameters, options?: SeamPartnerV1BuildingBlocksSpacesAutoMapOptions, @@ -4453,6 +4472,7 @@ export type SeamHttpEndpointMutationPaths = | '/seam/customer/v1/automations/delete' | '/seam/customer/v1/automations/update' | '/seam/customer/v1/settings/update' + | '/seam/customer/v1/spaces/create' | '/spaces/add_acs_entrances' | '/spaces/add_devices' | '/spaces/create' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/index.ts b/src/lib/seam/connect/routes/seam/customer/v1/index.ts index fb0b2d2f..4bc4f3bf 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/index.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/index.ts @@ -9,4 +9,5 @@ export * from './events/index.js' export * from './portals/index.js' export * from './reservations/index.js' export * from './settings/index.js' +export * from './spaces/index.js' export * from './v1.js' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/spaces/index.ts b/src/lib/seam/connect/routes/seam/customer/v1/spaces/index.ts new file mode 100644 index 00000000..af3f0bb2 --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/spaces/index.ts @@ -0,0 +1,6 @@ +/* + * Automatically generated by codegen/smith.ts. + * Do not edit this file or add other files to this directory. + */ + +export * from './spaces.js' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.ts b/src/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.ts new file mode 100644 index 00000000..7d9f8bb0 --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.ts @@ -0,0 +1,201 @@ +/* + * Automatically generated by codegen/smith.ts. + * Do not edit this file or add other files to this directory. + */ + +import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect' + +import { seamApiLtsVersion } from 'lib/lts-version.js' +import { + getAuthHeadersForClientSessionToken, + warnOnInsecureuserIdentifierKey, +} from 'lib/seam/connect/auth.js' +import { type Client, createClient } from 'lib/seam/connect/client.js' +import { + isSeamHttpOptionsWithApiKey, + isSeamHttpOptionsWithClient, + isSeamHttpOptionsWithClientSessionToken, + isSeamHttpOptionsWithConsoleSessionToken, + isSeamHttpOptionsWithPersonalAccessToken, + type SeamHttpFromPublishableKeyOptions, + SeamHttpInvalidOptionsError, + type SeamHttpOptions, + type SeamHttpOptionsWithApiKey, + type SeamHttpOptionsWithClient, + type SeamHttpOptionsWithClientSessionToken, + type SeamHttpOptionsWithConsoleSessionToken, + type SeamHttpOptionsWithPersonalAccessToken, + type SeamHttpRequestOptions, +} from 'lib/seam/connect/options.js' +import { + limitToSeamHttpRequestOptions, + parseOptions, +} from 'lib/seam/connect/parse-options.js' +import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js' +import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js' +import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js' +import type { SetNonNullable } from 'lib/types.js' + +export class SeamHttpSeamCustomerV1Spaces { + client: Client + readonly defaults: Required + readonly ltsVersion = seamApiLtsVersion + static ltsVersion = seamApiLtsVersion + + constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) { + const options = parseOptions(apiKeyOrOptions) + this.client = 'client' in options ? options.client : createClient(options) + this.defaults = limitToSeamHttpRequestOptions(options) + } + + static fromClient( + client: SeamHttpOptionsWithClient['client'], + options: Omit = {}, + ): SeamHttpSeamCustomerV1Spaces { + const constructorOptions = { ...options, client } + if (!isSeamHttpOptionsWithClient(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing client') + } + return new SeamHttpSeamCustomerV1Spaces(constructorOptions) + } + + static fromApiKey( + apiKey: SeamHttpOptionsWithApiKey['apiKey'], + options: Omit = {}, + ): SeamHttpSeamCustomerV1Spaces { + const constructorOptions = { ...options, apiKey } + if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing apiKey') + } + return new SeamHttpSeamCustomerV1Spaces(constructorOptions) + } + + static fromClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + options: Omit< + SeamHttpOptionsWithClientSessionToken, + 'clientSessionToken' + > = {}, + ): SeamHttpSeamCustomerV1Spaces { + const constructorOptions = { ...options, clientSessionToken } + if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') + } + return new SeamHttpSeamCustomerV1Spaces(constructorOptions) + } + + static async fromPublishableKey( + publishableKey: string, + userIdentifierKey: string, + options: SeamHttpFromPublishableKeyOptions = {}, + ): Promise { + warnOnInsecureuserIdentifierKey(userIdentifierKey) + const clientOptions = parseOptions({ ...options, publishableKey }) + if (isSeamHttpOptionsWithClient(clientOptions)) { + throw new SeamHttpInvalidOptionsError( + 'The client option cannot be used with SeamHttpSeamCustomerV1Spaces.fromPublishableKey', + ) + } + const client = createClient(clientOptions) + const clientSessions = SeamHttpClientSessions.fromClient(client) + const { token } = await clientSessions.getOrCreate({ + user_identifier_key: userIdentifierKey, + }) + return SeamHttpSeamCustomerV1Spaces.fromClientSessionToken(token, options) + } + + static fromConsoleSessionToken( + consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], + workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithConsoleSessionToken, + 'consoleSessionToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1Spaces { + const constructorOptions = { ...options, consoleSessionToken, workspaceId } + if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing consoleSessionToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1Spaces(constructorOptions) + } + + static fromPersonalAccessToken( + personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], + workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithPersonalAccessToken, + 'personalAccessToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1Spaces { + const constructorOptions = { ...options, personalAccessToken, workspaceId } + if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing personalAccessToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1Spaces(constructorOptions) + } + + createPaginator( + request: SeamHttpRequest, + ): SeamPaginator { + return new SeamPaginator(this, request) + } + + async updateClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + ): Promise { + const { headers } = this.client.defaults + const authHeaders = getAuthHeadersForClientSessionToken({ + clientSessionToken, + }) + for (const key of Object.keys(authHeaders)) { + if (headers[key] == null) { + throw new Error( + 'Cannot update a clientSessionToken on a client created without a clientSessionToken', + ) + } + } + this.client.defaults.headers = { ...headers, ...authHeaders } + const clientSessions = SeamHttpClientSessions.fromClient(this.client) + await clientSessions.get() + } + + create( + parameters?: SeamCustomerV1SpacesCreateParameters, + options: SeamCustomerV1SpacesCreateOptions = {}, + ): SeamCustomerV1SpacesCreateRequest { + return new SeamHttpRequest(this, { + pathname: '/seam/customer/v1/spaces/create', + method: 'POST', + body: parameters, + responseKey: 'space', + options, + }) + } +} + +export type SeamCustomerV1SpacesCreateParameters = + RouteRequestBody<'/seam/customer/v1/spaces/create'> + +/** + * @deprecated Use SeamCustomerV1SpacesCreateParameters instead. + */ +export type SeamCustomerV1SpacesCreateBody = + SeamCustomerV1SpacesCreateParameters + +/** + * @deprecated Use SeamCustomerV1SpacesCreateRequest instead. + */ +export type SeamCustomerV1SpacesCreateResponse = SetNonNullable< + Required> +> + +export type SeamCustomerV1SpacesCreateRequest = SeamHttpRequest< + SeamCustomerV1SpacesCreateResponse, + 'space' +> + +export interface SeamCustomerV1SpacesCreateOptions {} diff --git a/src/lib/seam/connect/routes/seam/customer/v1/v1.ts b/src/lib/seam/connect/routes/seam/customer/v1/v1.ts index fc8a7128..5da95044 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/v1.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/v1.ts @@ -39,6 +39,7 @@ import { SeamHttpSeamCustomerV1Events } from './events/index.js' import { SeamHttpSeamCustomerV1Portals } from './portals/index.js' import { SeamHttpSeamCustomerV1Reservations } from './reservations/index.js' import { SeamHttpSeamCustomerV1Settings } from './settings/index.js' +import { SeamHttpSeamCustomerV1Spaces } from './spaces/index.js' export class SeamHttpSeamCustomerV1 { client: Client @@ -48,11 +49,6 @@ export class SeamHttpSeamCustomerV1 { constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) { const options = parseOptions(apiKeyOrOptions) - if (!options.isUndocumentedApiEnabled) { - throw new Error( - 'Cannot use undocumented API without isUndocumentedApiEnabled', - ) - } this.client = 'client' in options ? options.client : createClient(options) this.defaults = limitToSeamHttpRequestOptions(options) } @@ -204,4 +200,8 @@ export class SeamHttpSeamCustomerV1 { get settings(): SeamHttpSeamCustomerV1Settings { return SeamHttpSeamCustomerV1Settings.fromClient(this.client, this.defaults) } + + get spaces(): SeamHttpSeamCustomerV1Spaces { + return SeamHttpSeamCustomerV1Spaces.fromClient(this.client, this.defaults) + } } From ff7f495ed38a288e8322f094bef45ac9817820c8 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Thu, 25 Sep 2025 19:14:06 +0000 Subject: [PATCH 2/2] ci: Generate code --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7eb2f775..63af7b24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.585.0" + "@seamapi/types": "^1.590.0" }, "peerDependenciesMeta": { "@seamapi/types": { diff --git a/package.json b/package.json index 80908420..2345eae1 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.585.0" + "@seamapi/types": "^1.590.0" }, "peerDependenciesMeta": { "@seamapi/types": {