import {z} from 'zod' export type ComponentReferenceRequest = {component_id?: string | undefined, socket_names?: Array | undefined}; export type DescriptionInStringBasedClientKeyCreateRequestBase = string | null | string | string; export type NameInStringBasedClientKeyCreateRequestBase = string | string; export type AuthorizationUrlInOAuthClientKeyCreateRequest = string | string; export type AuthorizationUrlInOAuthGenericClientKeyCreateRequest = string | string; export type RequestInOAuthGenericClientKeyCreateRequest = {body?: (string | null) | undefined, headers?: {[key: string]: Array} | undefined, url?: string | undefined} | string | string | string | string; export type ResponseHandlerInOAuthGenericClientKeyCreateRequest = {accessToken?: string | undefined, expiresIn?: number | undefined} | string | string | string | string; export type AuthorizationUrlInOAuthLeadPerfectionClientKeyCreateRequest = string | string; export type AuthorizationUrlInOAuthListrakClientKeyCreateRequest = string | string; export type AuthorizationUrlInOAuthOptimoveClientKeyCreateRequest = string | string; export type AuthorizationUrlInOAuthSalesforceClientKeyCreateRequest = string | string; export type AuthorizationUrlInOAuthSfdcClientKeyCreateRequest = string | string; export type AuthorizationUrlInOAuthSfdcPasswordClientKeyCreateRequest = string | string; export type StringBasedClientKeyCreateRequest = {algorithm: 'A128KW', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'A192KW', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'A256KW', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'ES256_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'ES256_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'ES384_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'ES384_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'ES512_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'ES512_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'HS256', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'HS384', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'HS512', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'HTTP_BASIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'OAUTH', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', authorization_url: AuthorizationUrlInOAuthClientKeyCreateRequest, oauth_client_id: string, scope: string | null} | {algorithm: 'OAUTH_GENERIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', authorization_url: AuthorizationUrlInOAuthGenericClientKeyCreateRequest, oauth_client_id: string, request?: RequestInOAuthGenericClientKeyCreateRequest | undefined, response_handler?: ResponseHandlerInOAuthGenericClientKeyCreateRequest | undefined, scope: string | null} | {algorithm: 'OAUTH_LEAD_PERFECTION', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', app_key?: string | undefined, authorization_url: AuthorizationUrlInOAuthLeadPerfectionClientKeyCreateRequest, lead_perfection_client_id?: string | undefined, oauth_client_id: string, scope: string | null} | {algorithm: 'OAUTH_LISTRAK', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', authorization_url: AuthorizationUrlInOAuthListrakClientKeyCreateRequest, oauth_client_id: string, scope: string | null} | {algorithm: 'OAUTH_OPTIMOVE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', authorization_url: AuthorizationUrlInOAuthOptimoveClientKeyCreateRequest, oauth_client_id: string, scope: string | null} | {algorithm: 'OAUTH_SALESFORCE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', account_id: number, authorization_url: AuthorizationUrlInOAuthSalesforceClientKeyCreateRequest, oauth_client_id: string, scope: string | null} | {algorithm: 'OAUTH_SFDC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', authorization_url: AuthorizationUrlInOAuthSfdcClientKeyCreateRequest, oauth_client_id: string, scope: string | null} | {algorithm: 'OAUTH_SFDC_PASSWORD', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK', authorization_url: AuthorizationUrlInOAuthSfdcPasswordClientKeyCreateRequest, oauth_client_id: string, password: string, scope: string | null, username: string} | {algorithm: 'PASSWORD', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'PS256_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'PS256_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'PS384_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'PS384_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'PS512_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'PS512_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RS256_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RS256_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RS384_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RS384_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RS512_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RS512_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RSA', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RSA_OAEP_256_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RSA_OAEP_256_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RSA_OAEP_384_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RSA_OAEP_384_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RSA_OAEP_512_PRIVATE', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'} | {algorithm: 'RSA_OAEP_512_PUBLIC', component_ids?: Array | undefined, component_references?: Array | undefined, description: DescriptionInStringBasedClientKeyCreateRequestBase, key: string, name: NameInStringBasedClientKeyCreateRequestBase, partner_key_id: string | null, tags?: Array | undefined, type: 'JWT' | 'PASSWORD' | 'PGP' | 'PGP_EXTOLE' | 'SSH' | 'WEBHOOK'}; export type CreateApiV2SettingsSecurityKeysArgs = {body: StringBasedClientKeyCreateRequest}; export type CreateApiV2SettingsSecurityKeysOptions = {baseUrl?: string | undefined, HEADER?: string | undefined, fetch?: typeof fetch | undefined}; export const componentReferenceResponse = z.object({component_id: z.string().optional(), socket_names: z.array(z.string()).optional()}); export const zonedDateTime = z.string(); export const descriptionInClientKeyResponseBase = z.union([z.string().nullable(), z.string(), z.string()]); export const nameInClientKeyResponseBase = z.union([z.string(), z.string()]); export const authorizationUrlInOAuthClientKeyResponse = z.union([z.string(), z.string()]); export const authorizationUrlInOAuthGenericClientKeyResponse = z.union([z.string(), z.string()]); export const requestInOAuthGenericClientKeyResponse = z.union([z.object({body: z.string().nullable().optional(), headers: z.record(z.string(), z.array(z.string())).optional(), url: z.string().optional()}), z.string(), z.string(), z.string(), z.string()]); export const responseHandlerInOAuthGenericClientKeyResponse = z.union([z.object({accessToken: z.string().optional(), expiresIn: z.number().int().optional()}), z.string(), z.string(), z.string(), z.string()]); export const authorizationUrlInOAuthLeadPerfectionClientKeyResponse = z.union([z.string(), z.string()]); export const authorizationUrlInOAuthListrakClientKeyResponse = z.union([z.string(), z.string()]); export const authorizationUrlInOAuthOptimoveClientKeyResponse = z.union([z.string(), z.string()]); export const authorizationUrlInOAuthSalesforceClientKeyResponse = z.union([z.string(), z.string()]); export const authorizationUrlInOAuthSfdcClientKeyResponse = z.union([z.string(), z.string()]); export const authorizationUrlInOAuthSfdcPasswordClientKeyResponse = z.union([z.string(), z.string()]); export const clientKeyResponse = z.discriminatedUnion("algorithm", [z.object({algorithm: z.literal("A128KW"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("A192KW"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("A256KW"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("ES256_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("ES256_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("ES384_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("ES384_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("ES512_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("ES512_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("HS256"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("HS384"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("HS512"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("HTTP_BASIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("OAUTH"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, authorization_url: authorizationUrlInOAuthClientKeyResponse, oauth_client_id: z.string(), scope: z.string().nullable()}), z.object({algorithm: z.literal("OAUTH_GENERIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, authorization_url: authorizationUrlInOAuthGenericClientKeyResponse, oauth_client_id: z.string(), request: requestInOAuthGenericClientKeyResponse, response_handler: responseHandlerInOAuthGenericClientKeyResponse, scope: z.string().nullable()}), z.object({algorithm: z.literal("OAUTH_LEAD_PERFECTION"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, appKey: z.string(), app_key: z.string().optional(), authorization_url: authorizationUrlInOAuthLeadPerfectionClientKeyResponse, leadPerfectionClientId: z.string(), lead_perfection_client_id: z.string().optional(), oauth_client_id: z.string(), scope: z.string().nullable()}), z.object({algorithm: z.literal("OAUTH_LISTRAK"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, authorization_url: authorizationUrlInOAuthListrakClientKeyResponse, oauth_client_id: z.string(), scope: z.string().nullable()}), z.object({algorithm: z.literal("OAUTH_OPTIMOVE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, authorization_url: authorizationUrlInOAuthOptimoveClientKeyResponse, oauth_client_id: z.string(), scope: z.string().nullable()}), z.object({algorithm: z.literal("OAUTH_SALESFORCE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, account_id: z.number().int(), authorization_url: authorizationUrlInOAuthSalesforceClientKeyResponse, oauth_client_id: z.string(), scope: z.string().nullable()}), z.object({algorithm: z.literal("OAUTH_SFDC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, authorization_url: authorizationUrlInOAuthSfdcClientKeyResponse, oauth_client_id: z.string(), scope: z.string().nullable()}), z.object({algorithm: z.literal("OAUTH_SFDC_PASSWORD"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, authorization_url: authorizationUrlInOAuthSfdcPasswordClientKeyResponse, oauth_client_id: z.string(), password: z.string(), scope: z.string().nullable(), username: z.string()}), z.object({algorithm: z.literal("PASSWORD"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("PS256_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("PS256_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("PS384_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("PS384_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("PS512_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("PS512_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RS256_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RS256_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RS384_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RS384_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RS512_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RS512_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RSA"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RSA_OAEP_256_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RSA_OAEP_256_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RSA_OAEP_384_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RSA_OAEP_384_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RSA_OAEP_512_PRIVATE"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("RSA_OAEP_512_PUBLIC"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime}), z.object({algorithm: z.literal("SSL_PKCS_12"), component_ids: z.array(z.string()), component_references: z.array(componentReferenceResponse), created_at: zonedDateTime, description: descriptionInClientKeyResponseBase, id: z.string(), key: z.string(), name: nameInClientKeyResponseBase, partner_key_id: z.string(), tags: z.array(z.string()), type: z.enum(["JWT", "PASSWORD", "PGP", "PGP_EXTOLE", "SSH", "WEBHOOK"]), updated_at: zonedDateTime, password: z.string()})]); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Create client key * * POST /v2/settings/security/keys * * Also accepts auth: QUERY, COOKIE */ export const createApiV2SettingsSecurityKeys = async (args: CreateApiV2SettingsSecurityKeysArgs, options?: CreateApiV2SettingsSecurityKeysOptions) => { const {baseUrl = "https://api.extole.io", fetch: fetchFn = fetch, HEADER} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (HEADER !== undefined) headers.set("Authorization", HEADER) const url = `${baseUrl.replace(/\/+$/, '')}/v2/settings/security/keys${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(clientKeyResponse, await res.json()) };