diff --git a/package-lock.json b/package-lock.json index 0358f62e..64a04c5d 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.725.0", + "@seamapi/types": "1.727.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^22.15.21", @@ -49,7 +49,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.725.0" + "@seamapi/types": "^1.727.0" }, "peerDependenciesMeta": { "@seamapi/types": { @@ -1388,9 +1388,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.725.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.725.0.tgz", - "integrity": "sha512-Wd2Egv9Vb8vrZVjFXA+sfWHd+liwgHHqRtMAGW58o1654obHYTsdMxs+HDARebKoVQ6YBcVJGcMgz2mIM7lrVA==", + "version": "1.727.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.727.0.tgz", + "integrity": "sha512-gFEaJaYm8Cy80gmrE434QFEc5i1n8voRG6GfOfCHM5LFg0C3p758ScmFYeqzgGtGiwLy+xeaR8kGcQ1beff2ag==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 135eae04..ada0bed1 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.725.0" + "@seamapi/types": "^1.727.0" }, "peerDependenciesMeta": { "@seamapi/types": { @@ -102,7 +102,7 @@ "@seamapi/blueprint": "^0.52.2", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.725.0", + "@seamapi/types": "1.727.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 5ec8cf5b..b25c8f09 100644 --- a/src/lib/seam/connect/routes/seam-http-endpoints.ts +++ b/src/lib/seam/connect/routes/seam-http-endpoints.ts @@ -713,6 +713,12 @@ import { type SeamCustomerV1SettingsUpdateRequest, SeamHttpSeamCustomerV1Settings, } from './seam/customer/v1/settings/index.js' +import { + type SeamCustomerV1SettingsVerticalResourceAliasesGetOptions, + type SeamCustomerV1SettingsVerticalResourceAliasesGetParameters, + type SeamCustomerV1SettingsVerticalResourceAliasesGetRequest, + SeamHttpSeamCustomerV1SettingsVerticalResourceAliases, +} from './seam/customer/v1/settings/vertical-resource-aliases/index.js' import { type SeamCustomerV1SpacesCreateOptions, type SeamCustomerV1SpacesCreateParameters, @@ -3655,6 +3661,32 @@ export class SeamHttpEndpoints { } } + get '/seam/customer/v1/settings/vertical_resource_aliases/get'(): ( + parameters?: SeamCustomerV1SettingsVerticalResourceAliasesGetParameters, + options?: SeamCustomerV1SettingsVerticalResourceAliasesGetOptions, + ) => SeamCustomerV1SettingsVerticalResourceAliasesGetRequest { + const { client, defaults } = this + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return function seamCustomerV1SettingsVerticalResourceAliasesGet( + ...args: Parameters< + SeamHttpSeamCustomerV1SettingsVerticalResourceAliases['get'] + > + ): ReturnType< + SeamHttpSeamCustomerV1SettingsVerticalResourceAliases['get'] + > { + const seam = + SeamHttpSeamCustomerV1SettingsVerticalResourceAliases.fromClient( + client, + defaults, + ) + return seam.get(...args) + } + } + get '/seam/customer/v1/spaces/create'(): ( parameters?: SeamCustomerV1SpacesCreateParameters, options?: SeamCustomerV1SpacesCreateOptions, @@ -4970,6 +5002,7 @@ export type SeamHttpEndpointQueryPaths = | '/seam/customer/v1/reservations/get' | '/seam/customer/v1/reservations/list' | '/seam/customer/v1/settings/get' + | '/seam/customer/v1/settings/vertical_resource_aliases/get' | '/seam/customer/v1/spaces/list' | '/seam/customer/v1/spaces/list_reservations' | '/seam/customer/v1/staff_members/get' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/settings/index.ts b/src/lib/seam/connect/routes/seam/customer/v1/settings/index.ts index 8671c36c..2d2ca6e4 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/settings/index.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/settings/index.ts @@ -4,3 +4,4 @@ */ export * from './settings.js' +export * from './vertical-resource-aliases/index.js' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/settings/settings.ts b/src/lib/seam/connect/routes/seam/customer/v1/settings/settings.ts index 13ad6aa4..72660e15 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/settings/settings.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/settings/settings.ts @@ -40,6 +40,8 @@ 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' +import { SeamHttpSeamCustomerV1SettingsVerticalResourceAliases } from './vertical-resource-aliases/index.js' + export class SeamHttpSeamCustomerV1Settings { client: Client readonly defaults: Required @@ -172,6 +174,13 @@ export class SeamHttpSeamCustomerV1Settings { await clientSessions.get() } + get verticalResourceAliases(): SeamHttpSeamCustomerV1SettingsVerticalResourceAliases { + return SeamHttpSeamCustomerV1SettingsVerticalResourceAliases.fromClient( + this.client, + this.defaults, + ) + } + get( parameters?: SeamCustomerV1SettingsGetParameters, options: SeamCustomerV1SettingsGetOptions = {}, diff --git a/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/index.ts b/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/index.ts new file mode 100644 index 00000000..dbbd1af2 --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/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 './vertical-resource-aliases.js' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/vertical-resource-aliases.ts b/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/vertical-resource-aliases.ts new file mode 100644 index 00000000..9532dd6c --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/vertical-resource-aliases.ts @@ -0,0 +1,228 @@ +/* + * 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 SeamHttpSeamCustomerV1SettingsVerticalResourceAliases { + 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 = {}, + ): SeamHttpSeamCustomerV1SettingsVerticalResourceAliases { + const constructorOptions = { ...options, client } + if (!isSeamHttpOptionsWithClient(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing client') + } + return new SeamHttpSeamCustomerV1SettingsVerticalResourceAliases( + constructorOptions, + ) + } + + static fromApiKey( + apiKey: SeamHttpOptionsWithApiKey['apiKey'], + options: Omit = {}, + ): SeamHttpSeamCustomerV1SettingsVerticalResourceAliases { + const constructorOptions = { ...options, apiKey } + if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing apiKey') + } + return new SeamHttpSeamCustomerV1SettingsVerticalResourceAliases( + constructorOptions, + ) + } + + static fromClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + options: Omit< + SeamHttpOptionsWithClientSessionToken, + 'clientSessionToken' + > = {}, + ): SeamHttpSeamCustomerV1SettingsVerticalResourceAliases { + const constructorOptions = { ...options, clientSessionToken } + if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') + } + return new SeamHttpSeamCustomerV1SettingsVerticalResourceAliases( + 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 SeamHttpSeamCustomerV1SettingsVerticalResourceAliases.fromPublishableKey', + ) + } + const client = createClient(clientOptions) + const clientSessions = SeamHttpClientSessions.fromClient(client) + const { token } = await clientSessions.getOrCreate({ + user_identifier_key: userIdentifierKey, + }) + return SeamHttpSeamCustomerV1SettingsVerticalResourceAliases.fromClientSessionToken( + token, + options, + ) + } + + static fromConsoleSessionToken( + consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], + workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithConsoleSessionToken, + 'consoleSessionToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1SettingsVerticalResourceAliases { + const constructorOptions = { ...options, consoleSessionToken, workspaceId } + if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing consoleSessionToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1SettingsVerticalResourceAliases( + constructorOptions, + ) + } + + static fromPersonalAccessToken( + personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], + workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithPersonalAccessToken, + 'personalAccessToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1SettingsVerticalResourceAliases { + const constructorOptions = { ...options, personalAccessToken, workspaceId } + if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing personalAccessToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1SettingsVerticalResourceAliases( + 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() + } + + get( + parameters?: SeamCustomerV1SettingsVerticalResourceAliasesGetParameters, + options: SeamCustomerV1SettingsVerticalResourceAliasesGetOptions = {}, + ): SeamCustomerV1SettingsVerticalResourceAliasesGetRequest { + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return new SeamHttpRequest(this, { + pathname: '/seam/customer/v1/settings/vertical_resource_aliases/get', + method: 'POST', + body: parameters, + responseKey: 'vertical_resource_aliases', + options, + }) + } +} + +export type SeamCustomerV1SettingsVerticalResourceAliasesGetParameters = + RouteRequestBody<'/seam/customer/v1/settings/vertical_resource_aliases/get'> + +/** + * @deprecated Use SeamCustomerV1SettingsVerticalResourceAliasesGetParameters instead. + */ +export type SeamCustomerV1SettingsVerticalResourceAliasesGetParams = + SeamCustomerV1SettingsVerticalResourceAliasesGetParameters + +/** + * @deprecated Use SeamCustomerV1SettingsVerticalResourceAliasesGetRequest instead. + */ +export type SeamCustomerV1SettingsVerticalResourceAliasesGetResponse = + SetNonNullable< + Required< + RouteResponse<'/seam/customer/v1/settings/vertical_resource_aliases/get'> + > + > + +export type SeamCustomerV1SettingsVerticalResourceAliasesGetRequest = + SeamHttpRequest< + SeamCustomerV1SettingsVerticalResourceAliasesGetResponse, + 'vertical_resource_aliases' + > + +export interface SeamCustomerV1SettingsVerticalResourceAliasesGetOptions {}