From 883b0be90e7a9dec355d9e7d085aed9a1abfb962 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 12 Dec 2025 18:01:04 +0000 Subject: [PATCH 1/2] feat: Update to @seamapi/types@1.683.0 --- package-lock.json | 8 +- package.json | 2 +- .../connect/routes/seam-http-endpoints.ts | 26 +++ .../seam/customer/v1/customers/customers.ts | 214 ++++++++++++++++++ .../seam/customer/v1/customers/index.ts | 6 + .../connect/routes/seam/customer/v1/index.ts | 1 + .../connect/routes/seam/customer/v1/v1.ts | 8 + 7 files changed, 260 insertions(+), 5 deletions(-) create mode 100644 src/lib/seam/connect/routes/seam/customer/v1/customers/customers.ts create mode 100644 src/lib/seam/connect/routes/seam/customer/v1/customers/index.ts diff --git a/package-lock.json b/package-lock.json index f19ade58..3a8bb813 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@seamapi/blueprint": "^0.52.2", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.680.0", + "@seamapi/types": "1.683.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^22.15.21", @@ -1388,9 +1388,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.680.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.680.0.tgz", - "integrity": "sha512-nXooes7XHC4Bi632MFFSTLF52WvdPu25ZzdAtcZEiUNTTy1I4MLmOsFrydnhdXWM17v1AazIwncybKFmC193fQ==", + "version": "1.683.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.683.0.tgz", + "integrity": "sha512-k01xjafqJX54HMLRfjeeyrP9dhKHVGS/824aptdElYo0JaWJQiEwvvLYunm4CYAFIa4mt4MhtoatE6VmQPyqUg==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index dc38147d..a108d651 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "@seamapi/blueprint": "^0.52.2", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.680.0", + "@seamapi/types": "1.683.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 b8e0920e..a6dc75e2 100644 --- a/src/lib/seam/connect/routes/seam-http-endpoints.ts +++ b/src/lib/seam/connect/routes/seam-http-endpoints.ts @@ -638,6 +638,12 @@ import { type SeamCustomerV1ConnectorsUpdateRequest, SeamHttpSeamCustomerV1Connectors, } from './seam/customer/v1/connectors/index.js' +import { + type SeamCustomerV1CustomersListOptions, + type SeamCustomerV1CustomersListParameters, + type SeamCustomerV1CustomersListRequest, + SeamHttpSeamCustomerV1Customers, +} from './seam/customer/v1/customers/index.js' import { type SeamCustomerV1EventsListOptions, type SeamCustomerV1EventsListParameters, @@ -3324,6 +3330,24 @@ export class SeamHttpEndpoints { } } + get '/seam/customer/v1/customers/list'(): ( + parameters?: SeamCustomerV1CustomersListParameters, + options?: SeamCustomerV1CustomersListOptions, + ) => SeamCustomerV1CustomersListRequest { + const { client, defaults } = this + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return function seamCustomerV1CustomersList( + ...args: Parameters + ): ReturnType { + const seam = SeamHttpSeamCustomerV1Customers.fromClient(client, defaults) + return seam.list(...args) + } + } + get '/seam/customer/v1/events/list'(): ( parameters?: SeamCustomerV1EventsListParameters, options?: SeamCustomerV1EventsListOptions, @@ -4730,6 +4754,7 @@ export type SeamHttpEndpointQueryPaths = | '/seam/customer/v1/connectors/authorize' | '/seam/customer/v1/connectors/connector_types' | '/seam/customer/v1/connectors/list' + | '/seam/customer/v1/customers/list' | '/seam/customer/v1/events/list' | '/seam/customer/v1/portals/get' | '/seam/customer/v1/reservations/get' @@ -4779,6 +4804,7 @@ export type SeamHttpEndpointPaginatedQueryPaths = | '/devices/unmanaged/list' | '/seam/console/v1/timelines/get' | '/seam/customer/v1/automation_runs/list' + | '/seam/customer/v1/customers/list' | '/seam/customer/v1/reservations/list' | '/seam/customer/v1/staff_members/list' | '/user_identities/list' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/customers/customers.ts b/src/lib/seam/connect/routes/seam/customer/v1/customers/customers.ts new file mode 100644 index 00000000..8ddff61c --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/customers/customers.ts @@ -0,0 +1,214 @@ +/* + * 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 SeamHttpSeamCustomerV1Customers { + client: Client + readonly defaults: Required + readonly ltsVersion = seamApiLtsVersion + static ltsVersion = seamApiLtsVersion + + 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) + } + + static fromClient( + client: SeamHttpOptionsWithClient['client'], + options: Omit = {}, + ): SeamHttpSeamCustomerV1Customers { + const constructorOptions = { ...options, client } + if (!isSeamHttpOptionsWithClient(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing client') + } + return new SeamHttpSeamCustomerV1Customers(constructorOptions) + } + + static fromApiKey( + apiKey: SeamHttpOptionsWithApiKey['apiKey'], + options: Omit = {}, + ): SeamHttpSeamCustomerV1Customers { + const constructorOptions = { ...options, apiKey } + if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing apiKey') + } + return new SeamHttpSeamCustomerV1Customers(constructorOptions) + } + + static fromClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + options: Omit< + SeamHttpOptionsWithClientSessionToken, + 'clientSessionToken' + > = {}, + ): SeamHttpSeamCustomerV1Customers { + const constructorOptions = { ...options, clientSessionToken } + if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') + } + return new SeamHttpSeamCustomerV1Customers(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 SeamHttpSeamCustomerV1Customers.fromPublishableKey', + ) + } + const client = createClient(clientOptions) + const clientSessions = SeamHttpClientSessions.fromClient(client) + const { token } = await clientSessions.getOrCreate({ + user_identifier_key: userIdentifierKey, + }) + return SeamHttpSeamCustomerV1Customers.fromClientSessionToken( + token, + options, + ) + } + + static fromConsoleSessionToken( + consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], + workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithConsoleSessionToken, + 'consoleSessionToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1Customers { + const constructorOptions = { ...options, consoleSessionToken, workspaceId } + if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing consoleSessionToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1Customers(constructorOptions) + } + + static fromPersonalAccessToken( + personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], + workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithPersonalAccessToken, + 'personalAccessToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1Customers { + const constructorOptions = { ...options, personalAccessToken, workspaceId } + if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing personalAccessToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1Customers(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() + } + + list( + parameters?: SeamCustomerV1CustomersListParameters, + options: SeamCustomerV1CustomersListOptions = {}, + ): SeamCustomerV1CustomersListRequest { + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return new SeamHttpRequest(this, { + pathname: '/seam/customer/v1/customers/list', + method: 'POST', + body: parameters, + responseKey: 'customers', + options, + }) + } +} + +export type SeamCustomerV1CustomersListParameters = + RouteRequestBody<'/seam/customer/v1/customers/list'> + +/** + * @deprecated Use SeamCustomerV1CustomersListParameters instead. + */ +export type SeamCustomerV1CustomersListParams = + SeamCustomerV1CustomersListParameters + +/** + * @deprecated Use SeamCustomerV1CustomersListRequest instead. + */ +export type SeamCustomerV1CustomersListResponse = SetNonNullable< + Required> +> + +export type SeamCustomerV1CustomersListRequest = SeamHttpRequest< + SeamCustomerV1CustomersListResponse, + 'customers' +> + +export interface SeamCustomerV1CustomersListOptions {} diff --git a/src/lib/seam/connect/routes/seam/customer/v1/customers/index.ts b/src/lib/seam/connect/routes/seam/customer/v1/customers/index.ts new file mode 100644 index 00000000..9126f05d --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/customers/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 './customers.js' 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 7f1df971..3dd32946 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/index.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/index.ts @@ -7,6 +7,7 @@ export * from './access-grants/index.js' export * from './automation-runs/index.js' export * from './automations/index.js' export * from './connectors/index.js' +export * from './customers/index.js' export * from './events/index.js' export * from './portals/index.js' export * from './reservations/index.js' 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 2b09567e..d43fe837 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/v1.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/v1.ts @@ -37,6 +37,7 @@ import { SeamHttpSeamCustomerV1AccessGrants } from './access-grants/index.js' import { SeamHttpSeamCustomerV1AutomationRuns } from './automation-runs/index.js' import { SeamHttpSeamCustomerV1Automations } from './automations/index.js' import { SeamHttpSeamCustomerV1Connectors } from './connectors/index.js' +import { SeamHttpSeamCustomerV1Customers } from './customers/index.js' import { SeamHttpSeamCustomerV1Events } from './events/index.js' import { SeamHttpSeamCustomerV1Portals } from './portals/index.js' import { SeamHttpSeamCustomerV1Reservations } from './reservations/index.js' @@ -204,6 +205,13 @@ export class SeamHttpSeamCustomerV1 { ) } + get customers(): SeamHttpSeamCustomerV1Customers { + return SeamHttpSeamCustomerV1Customers.fromClient( + this.client, + this.defaults, + ) + } + get events(): SeamHttpSeamCustomerV1Events { return SeamHttpSeamCustomerV1Events.fromClient(this.client, this.defaults) } From d1d016de40b907ce8ea9ed9b0de1eff0811520bd Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 12 Dec 2025 18:01:50 +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 3a8bb813..ff5fefb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.680.0" + "@seamapi/types": "^1.683.0" }, "peerDependenciesMeta": { "@seamapi/types": { diff --git a/package.json b/package.json index a108d651..913d4fbd 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.680.0" + "@seamapi/types": "^1.683.0" }, "peerDependenciesMeta": { "@seamapi/types": {