diff --git a/package-lock.json b/package-lock.json index c83f0116..1e39af17 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.772.0", + "@seamapi/types": "1.776.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^24.10.9", @@ -49,7 +49,7 @@ "npm": ">=10.9.4" }, "peerDependencies": { - "@seamapi/types": "^1.772.0" + "@seamapi/types": "^1.776.0" }, "peerDependenciesMeta": { "@seamapi/types": { @@ -1405,9 +1405,9 @@ "license": "MIT" }, "node_modules/@seamapi/types": { - "version": "1.772.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.772.0.tgz", - "integrity": "sha512-/MFq/zRLLo4/QDgOR1jIPWfqGeAAlH4plSRLJ0njdfV0AHFqODlCUp8uE2oOO6LYsNOXXPltG1hLR6TDIMBXPg==", + "version": "1.776.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.776.0.tgz", + "integrity": "sha512-GGga66wdzx6ilHj0xEtIMwFZ+AfV1HGZLRq3OuYeHfM7YixXhC2/OEd486Tn7eqsVM15qR224VHeMtkjJAVfJA==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index b762c182..d90b0ff4 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "npm": ">=10.9.4" }, "peerDependencies": { - "@seamapi/types": "^1.772.0" + "@seamapi/types": "^1.776.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.772.0", + "@seamapi/types": "1.776.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^24.10.9", diff --git a/src/lib/seam/connect/routes/seam-http-endpoints.ts b/src/lib/seam/connect/routes/seam-http-endpoints.ts index 8760bab6..7fbd53bc 100644 --- a/src/lib/seam/connect/routes/seam-http-endpoints.ts +++ b/src/lib/seam/connect/routes/seam-http-endpoints.ts @@ -647,6 +647,15 @@ import { type SeamCustomerV1ConnectorCustomersListRequest, SeamHttpSeamCustomerV1ConnectorCustomers, } from './seam/customer/v1/connector-customers/index.js' +import { + type SeamCustomerV1ConnectorsIcalGenerateConfigOptions, + type SeamCustomerV1ConnectorsIcalGenerateConfigParameters, + type SeamCustomerV1ConnectorsIcalGenerateConfigRequest, + type SeamCustomerV1ConnectorsIcalValidateConfigOptions, + type SeamCustomerV1ConnectorsIcalValidateConfigParameters, + type SeamCustomerV1ConnectorsIcalValidateConfigRequest, + SeamHttpSeamCustomerV1ConnectorsIcal, +} from './seam/customer/v1/connectors/ical/index.js' import { type SeamCustomerV1ConnectorsAuthorizeOptions, type SeamCustomerV1ConnectorsAuthorizeParameters, @@ -3537,6 +3546,52 @@ export class SeamHttpEndpoints { } } + get '/seam/customer/v1/connectors/ical/generate-config'(): ( + parameters?: SeamCustomerV1ConnectorsIcalGenerateConfigParameters, + options?: SeamCustomerV1ConnectorsIcalGenerateConfigOptions, + ) => SeamCustomerV1ConnectorsIcalGenerateConfigRequest { + const { client, defaults } = this + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return function seamCustomerV1ConnectorsIcalGenerateConfig( + ...args: Parameters< + SeamHttpSeamCustomerV1ConnectorsIcal['generateConfig'] + > + ): ReturnType { + const seam = SeamHttpSeamCustomerV1ConnectorsIcal.fromClient( + client, + defaults, + ) + return seam.generateConfig(...args) + } + } + + get '/seam/customer/v1/connectors/ical/validate-config'(): ( + parameters?: SeamCustomerV1ConnectorsIcalValidateConfigParameters, + options?: SeamCustomerV1ConnectorsIcalValidateConfigOptions, + ) => SeamCustomerV1ConnectorsIcalValidateConfigRequest { + const { client, defaults } = this + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return function seamCustomerV1ConnectorsIcalValidateConfig( + ...args: Parameters< + SeamHttpSeamCustomerV1ConnectorsIcal['validateConfig'] + > + ): ReturnType { + const seam = SeamHttpSeamCustomerV1ConnectorsIcal.fromClient( + client, + defaults, + ) + return seam.validateConfig(...args) + } + } + get '/seam/customer/v1/customers/automations/get'(): ( parameters?: SeamCustomerV1CustomersAutomationsGetParameters, options?: SeamCustomerV1CustomersAutomationsGetOptions, @@ -5297,6 +5352,8 @@ export type SeamHttpEndpointMutationPaths = | '/seam/customer/v1/connectors/delete' | '/seam/customer/v1/connectors/sync' | '/seam/customer/v1/connectors/update' + | '/seam/customer/v1/connectors/ical/generate-config' + | '/seam/customer/v1/connectors/ical/validate-config' | '/seam/customer/v1/customers/automations/update' | '/seam/customer/v1/customers/open_portal' | '/seam/customer/v1/portals/update' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.ts b/src/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.ts index 72c2a5a3..f73752db 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.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 { SeamHttpSeamCustomerV1ConnectorsIcal } from './ical/index.js' + export class SeamHttpSeamCustomerV1Connectors { client: Client readonly defaults: Required @@ -175,6 +177,13 @@ export class SeamHttpSeamCustomerV1Connectors { await clientSessions.get() } + get ical(): SeamHttpSeamCustomerV1ConnectorsIcal { + return SeamHttpSeamCustomerV1ConnectorsIcal.fromClient( + this.client, + this.defaults, + ) + } + authorize( parameters?: SeamCustomerV1ConnectorsAuthorizeParameters, options: SeamCustomerV1ConnectorsAuthorizeOptions = {}, diff --git a/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.ts b/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.ts new file mode 100644 index 00000000..b244e6a8 --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.ts @@ -0,0 +1,255 @@ +/* + * 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 SeamHttpSeamCustomerV1ConnectorsIcal { + 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 = {}, + ): SeamHttpSeamCustomerV1ConnectorsIcal { + const constructorOptions = { ...options, client } + if (!isSeamHttpOptionsWithClient(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing client') + } + return new SeamHttpSeamCustomerV1ConnectorsIcal(constructorOptions) + } + + static fromApiKey( + apiKey: SeamHttpOptionsWithApiKey['apiKey'], + options: Omit = {}, + ): SeamHttpSeamCustomerV1ConnectorsIcal { + const constructorOptions = { ...options, apiKey } + if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing apiKey') + } + return new SeamHttpSeamCustomerV1ConnectorsIcal(constructorOptions) + } + + static fromClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + options: Omit< + SeamHttpOptionsWithClientSessionToken, + 'clientSessionToken' + > = {}, + ): SeamHttpSeamCustomerV1ConnectorsIcal { + const constructorOptions = { ...options, clientSessionToken } + if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') + } + return new SeamHttpSeamCustomerV1ConnectorsIcal(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 SeamHttpSeamCustomerV1ConnectorsIcal.fromPublishableKey', + ) + } + const client = createClient(clientOptions) + const clientSessions = SeamHttpClientSessions.fromClient(client) + const { token } = await clientSessions.getOrCreate({ + user_identifier_key: userIdentifierKey, + }) + return SeamHttpSeamCustomerV1ConnectorsIcal.fromClientSessionToken( + token, + options, + ) + } + + static fromConsoleSessionToken( + consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], + workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithConsoleSessionToken, + 'consoleSessionToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1ConnectorsIcal { + const constructorOptions = { ...options, consoleSessionToken, workspaceId } + if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing consoleSessionToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1ConnectorsIcal(constructorOptions) + } + + static fromPersonalAccessToken( + personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], + workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithPersonalAccessToken, + 'personalAccessToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamCustomerV1ConnectorsIcal { + const constructorOptions = { ...options, personalAccessToken, workspaceId } + if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing personalAccessToken or workspaceId', + ) + } + return new SeamHttpSeamCustomerV1ConnectorsIcal(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() + } + + generateConfig( + parameters?: SeamCustomerV1ConnectorsIcalGenerateConfigParameters, + options: SeamCustomerV1ConnectorsIcalGenerateConfigOptions = {}, + ): SeamCustomerV1ConnectorsIcalGenerateConfigRequest { + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return new SeamHttpRequest(this, { + pathname: '/seam/customer/v1/connectors/ical/generate-config', + method: 'POST', + body: parameters, + responseKey: 'generated_config', + options, + }) + } + + validateConfig( + parameters?: SeamCustomerV1ConnectorsIcalValidateConfigParameters, + options: SeamCustomerV1ConnectorsIcalValidateConfigOptions = {}, + ): SeamCustomerV1ConnectorsIcalValidateConfigRequest { + if (!this.defaults.isUndocumentedApiEnabled) { + throw new Error( + 'Cannot use undocumented API without isUndocumentedApiEnabled', + ) + } + return new SeamHttpRequest(this, { + pathname: '/seam/customer/v1/connectors/ical/validate-config', + method: 'POST', + body: parameters, + responseKey: 'validation_result', + options, + }) + } +} + +export type SeamCustomerV1ConnectorsIcalGenerateConfigParameters = + RouteRequestBody<'/seam/customer/v1/connectors/ical/generate-config'> + +/** + * @deprecated Use SeamCustomerV1ConnectorsIcalGenerateConfigParameters instead. + */ +export type SeamCustomerV1ConnectorsIcalGenerateConfigBody = + SeamCustomerV1ConnectorsIcalGenerateConfigParameters + +/** + * @deprecated Use SeamCustomerV1ConnectorsIcalGenerateConfigRequest instead. + */ +export type SeamCustomerV1ConnectorsIcalGenerateConfigResponse = SetNonNullable< + Required> +> + +export type SeamCustomerV1ConnectorsIcalGenerateConfigRequest = SeamHttpRequest< + SeamCustomerV1ConnectorsIcalGenerateConfigResponse, + 'generated_config' +> + +export interface SeamCustomerV1ConnectorsIcalGenerateConfigOptions {} + +export type SeamCustomerV1ConnectorsIcalValidateConfigParameters = + RouteRequestBody<'/seam/customer/v1/connectors/ical/validate-config'> + +/** + * @deprecated Use SeamCustomerV1ConnectorsIcalValidateConfigParameters instead. + */ +export type SeamCustomerV1ConnectorsIcalValidateConfigBody = + SeamCustomerV1ConnectorsIcalValidateConfigParameters + +/** + * @deprecated Use SeamCustomerV1ConnectorsIcalValidateConfigRequest instead. + */ +export type SeamCustomerV1ConnectorsIcalValidateConfigResponse = SetNonNullable< + Required> +> + +export type SeamCustomerV1ConnectorsIcalValidateConfigRequest = SeamHttpRequest< + SeamCustomerV1ConnectorsIcalValidateConfigResponse, + 'validation_result' +> + +export interface SeamCustomerV1ConnectorsIcalValidateConfigOptions {} diff --git a/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/index.ts b/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/index.ts new file mode 100644 index 00000000..1d8f8cd6 --- /dev/null +++ b/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/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 './ical.js' diff --git a/src/lib/seam/connect/routes/seam/customer/v1/connectors/index.ts b/src/lib/seam/connect/routes/seam/customer/v1/connectors/index.ts index 9ed7924e..08e965a8 100644 --- a/src/lib/seam/connect/routes/seam/customer/v1/connectors/index.ts +++ b/src/lib/seam/connect/routes/seam/customer/v1/connectors/index.ts @@ -4,3 +4,4 @@ */ export * from './connectors.js' +export * from './ical/index.js'