/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody = { organizationId?: string | undefined; tenantId?: string | undefined; accountId?: string | undefined; workspaceId?: string | undefined; keyId?: string | undefined; }; export const PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus = { StatusUnspecified: "STATUS_UNSPECIFIED", StatusActive: "STATUS_ACTIVE", StatusSuspended: "STATUS_SUSPENDED", StatusPendingVerification: "STATUS_PENDING_VERIFICATION", StatusRevoked: "STATUS_REVOKED", StatusExpired: "STATUS_EXPIRED", StatusRateLimited: "STATUS_RATE_LIMITED", StatusPendingReview: "STATUS_PENDING_REVIEW", StatusDeprecated: "STATUS_DEPRECATED", StatusMaintenance: "STATUS_MAINTENANCE", } as const; export type PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus = ClosedEnum< typeof PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus >; export type NewApiKey = { id?: string | undefined; name?: string | undefined; keyHash?: string | undefined; keyPrefix?: string | undefined; scopes?: Array | undefined; allowedIps?: Array | undefined; allowedDomains?: Array | undefined; allowedEnvironments?: Array | undefined; isTestKey?: boolean | undefined; requestsPerSecond?: number | undefined; requestsPerDay?: number | undefined; concurrentRequests?: number | undefined; monthlyRequestQuota?: string | undefined; costPerRequest?: number | undefined; billingTier?: string | undefined; totalRequests?: string | undefined; totalErrors?: string | undefined; lastUsedAt?: Date | undefined; averageResponseTime?: number | undefined; endpointUsageJson?: string | undefined; errorRatesJson?: string | undefined; recentErrors?: string | undefined; successfulRequestsCount?: number | undefined; successRate?: number | undefined; status?: PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus | undefined; createdAt?: Date | undefined; updatedAt?: Date | undefined; expiresAt?: Date | undefined; deletedAt?: Date | undefined; lastRotatedAt?: Date | undefined; lastSecurityReviewAt?: Date | undefined; requiresClientSecret?: boolean | undefined; clientSecretHash?: string | undefined; enforceHttps?: boolean | undefined; enforceSigning?: boolean | undefined; allowedSignatureAlgorithms?: Array | undefined; enforceMutualTls?: boolean | undefined; clientCertificateHash?: string | undefined; requireRequestSigning?: boolean | undefined; description?: string | undefined; metadataJson?: string | undefined; tags?: Array | undefined; apiVersion?: string | undefined; supportedFeatures?: Array | undefined; documentationUrl?: string | undefined; supportContact?: string | undefined; logAllRequests?: boolean | undefined; lastRotationReason?: string | undefined; lastRotationDate?: Date | undefined; rotationFrequencyDays?: number | undefined; complianceStandards?: Array | undefined; requiresAuditLogging?: boolean | undefined; dataResidency?: string | undefined; approvedIntegrations?: Array | undefined; alertEmails?: Array | undefined; webhookUrl?: string | undefined; alertOnQuotaThreshold?: boolean | undefined; quotaAlertThreshold?: number | undefined; alertOnErrorSpike?: boolean | undefined; errorAlertThreshold?: number | undefined; monitoringIntegrations?: Array | undefined; encrypted?: boolean | undefined; dataClassification?: string | undefined; maxUses?: number | undefined; rateLimit?: number | undefined; }; /** * Rotates an API key while maintaining its configuration */ export type PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody = { newApiKey?: NewApiKey | undefined; newKeyValue?: string | undefined; oldKeyExpiry?: Date | undefined; }; /** @internal */ export const PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$inboundSchema: z.ZodType< PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody, z.ZodTypeDef, unknown > = z.object({ organizationId: z.string().optional(), tenantId: z.string().optional(), accountId: z.string().optional(), workspaceId: z.string().optional(), keyId: z.string().optional(), }); /** @internal */ export type PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$Outbound = { organizationId?: string | undefined; tenantId?: string | undefined; accountId?: string | undefined; workspaceId?: string | undefined; keyId?: string | undefined; }; /** @internal */ export const PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$outboundSchema: z.ZodType< PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$Outbound, z.ZodTypeDef, PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody > = z.object({ organizationId: z.string().optional(), tenantId: z.string().optional(), accountId: z.string().optional(), workspaceId: z.string().optional(), keyId: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$ { /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$inboundSchema` instead. */ export const inboundSchema = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$inboundSchema; /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$outboundSchema` instead. */ export const outboundSchema = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$outboundSchema; /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$Outbound` instead. */ export type Outbound = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$Outbound; } export function postApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBodyToJSON( postApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody: PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody, ): string { return JSON.stringify( PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$outboundSchema .parse(postApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody), ); } export function postApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBodyFromJSON( jsonString: string, ): SafeParseResult< PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody, SDKValidationError > { return safeParse( jsonString, (x) => PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PostApiLeadScraperMicroserviceApiV1ApiKeysRotateRequestBody' from JSON`, ); } /** @internal */ export const PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$inboundSchema: z.ZodNativeEnum< typeof PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus > = z.nativeEnum(PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus); /** @internal */ export const PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$outboundSchema: z.ZodNativeEnum< typeof PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus > = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$ { /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$inboundSchema` instead. */ export const inboundSchema = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$inboundSchema; /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$outboundSchema` instead. */ export const outboundSchema = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$outboundSchema; } /** @internal */ export const NewApiKey$inboundSchema: z.ZodType< NewApiKey, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), name: z.string().optional(), keyHash: z.string().optional(), keyPrefix: z.string().optional(), scopes: z.array(z.string()).optional(), allowedIps: z.array(z.string()).optional(), allowedDomains: z.array(z.string()).optional(), allowedEnvironments: z.array(z.string()).optional(), isTestKey: z.boolean().optional(), requestsPerSecond: z.number().int().optional(), requestsPerDay: z.number().int().optional(), concurrentRequests: z.number().int().optional(), monthlyRequestQuota: z.string().optional(), costPerRequest: z.number().optional(), billingTier: z.string().optional(), totalRequests: z.string().optional(), totalErrors: z.string().optional(), lastUsedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), averageResponseTime: z.number().optional(), endpointUsageJson: z.string().optional(), errorRatesJson: z.string().optional(), recentErrors: z.string().optional(), successfulRequestsCount: z.number().int().optional(), successRate: z.number().optional(), status: PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$inboundSchema .default("STATUS_UNSPECIFIED"), createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), expiresAt: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), deletedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), lastRotatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), lastSecurityReviewAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), requiresClientSecret: z.boolean().optional(), clientSecretHash: z.string().optional(), enforceHttps: z.boolean().optional(), enforceSigning: z.boolean().optional(), allowedSignatureAlgorithms: z.array(z.string()).optional(), enforceMutualTls: z.boolean().optional(), clientCertificateHash: z.string().optional(), requireRequestSigning: z.boolean().optional(), description: z.string().optional(), metadataJson: z.string().optional(), tags: z.array(z.string()).optional(), apiVersion: z.string().optional(), supportedFeatures: z.array(z.string()).optional(), documentationUrl: z.string().optional(), supportContact: z.string().optional(), logAllRequests: z.boolean().optional(), lastRotationReason: z.string().optional(), lastRotationDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), rotationFrequencyDays: z.number().int().optional(), complianceStandards: z.array(z.string()).optional(), requiresAuditLogging: z.boolean().optional(), dataResidency: z.string().optional(), approvedIntegrations: z.array(z.string()).optional(), alertEmails: z.array(z.string()).optional(), webhookUrl: z.string().optional(), alertOnQuotaThreshold: z.boolean().optional(), quotaAlertThreshold: z.number().optional(), alertOnErrorSpike: z.boolean().optional(), errorAlertThreshold: z.number().optional(), monitoringIntegrations: z.array(z.string()).optional(), encrypted: z.boolean().optional(), dataClassification: z.string().optional(), maxUses: z.number().int().optional(), rateLimit: z.number().int().optional(), }); /** @internal */ export type NewApiKey$Outbound = { id?: string | undefined; name?: string | undefined; keyHash?: string | undefined; keyPrefix?: string | undefined; scopes?: Array | undefined; allowedIps?: Array | undefined; allowedDomains?: Array | undefined; allowedEnvironments?: Array | undefined; isTestKey?: boolean | undefined; requestsPerSecond?: number | undefined; requestsPerDay?: number | undefined; concurrentRequests?: number | undefined; monthlyRequestQuota?: string | undefined; costPerRequest?: number | undefined; billingTier?: string | undefined; totalRequests?: string | undefined; totalErrors?: string | undefined; lastUsedAt?: string | undefined; averageResponseTime?: number | undefined; endpointUsageJson?: string | undefined; errorRatesJson?: string | undefined; recentErrors?: string | undefined; successfulRequestsCount?: number | undefined; successRate?: number | undefined; status: string; createdAt?: string | undefined; updatedAt?: string | undefined; expiresAt?: string | undefined; deletedAt?: string | undefined; lastRotatedAt?: string | undefined; lastSecurityReviewAt?: string | undefined; requiresClientSecret?: boolean | undefined; clientSecretHash?: string | undefined; enforceHttps?: boolean | undefined; enforceSigning?: boolean | undefined; allowedSignatureAlgorithms?: Array | undefined; enforceMutualTls?: boolean | undefined; clientCertificateHash?: string | undefined; requireRequestSigning?: boolean | undefined; description?: string | undefined; metadataJson?: string | undefined; tags?: Array | undefined; apiVersion?: string | undefined; supportedFeatures?: Array | undefined; documentationUrl?: string | undefined; supportContact?: string | undefined; logAllRequests?: boolean | undefined; lastRotationReason?: string | undefined; lastRotationDate?: string | undefined; rotationFrequencyDays?: number | undefined; complianceStandards?: Array | undefined; requiresAuditLogging?: boolean | undefined; dataResidency?: string | undefined; approvedIntegrations?: Array | undefined; alertEmails?: Array | undefined; webhookUrl?: string | undefined; alertOnQuotaThreshold?: boolean | undefined; quotaAlertThreshold?: number | undefined; alertOnErrorSpike?: boolean | undefined; errorAlertThreshold?: number | undefined; monitoringIntegrations?: Array | undefined; encrypted?: boolean | undefined; dataClassification?: string | undefined; maxUses?: number | undefined; rateLimit?: number | undefined; }; /** @internal */ export const NewApiKey$outboundSchema: z.ZodType< NewApiKey$Outbound, z.ZodTypeDef, NewApiKey > = z.object({ id: z.string().optional(), name: z.string().optional(), keyHash: z.string().optional(), keyPrefix: z.string().optional(), scopes: z.array(z.string()).optional(), allowedIps: z.array(z.string()).optional(), allowedDomains: z.array(z.string()).optional(), allowedEnvironments: z.array(z.string()).optional(), isTestKey: z.boolean().optional(), requestsPerSecond: z.number().int().optional(), requestsPerDay: z.number().int().optional(), concurrentRequests: z.number().int().optional(), monthlyRequestQuota: z.string().optional(), costPerRequest: z.number().optional(), billingTier: z.string().optional(), totalRequests: z.string().optional(), totalErrors: z.string().optional(), lastUsedAt: z.date().transform(v => v.toISOString()).optional(), averageResponseTime: z.number().optional(), endpointUsageJson: z.string().optional(), errorRatesJson: z.string().optional(), recentErrors: z.string().optional(), successfulRequestsCount: z.number().int().optional(), successRate: z.number().optional(), status: PostApiLeadScraperMicroserviceApiV1ApiKeysRotateStatus$outboundSchema .default("STATUS_UNSPECIFIED"), createdAt: z.date().transform(v => v.toISOString()).optional(), updatedAt: z.date().transform(v => v.toISOString()).optional(), expiresAt: z.date().transform(v => v.toISOString()).optional(), deletedAt: z.date().transform(v => v.toISOString()).optional(), lastRotatedAt: z.date().transform(v => v.toISOString()).optional(), lastSecurityReviewAt: z.date().transform(v => v.toISOString()).optional(), requiresClientSecret: z.boolean().optional(), clientSecretHash: z.string().optional(), enforceHttps: z.boolean().optional(), enforceSigning: z.boolean().optional(), allowedSignatureAlgorithms: z.array(z.string()).optional(), enforceMutualTls: z.boolean().optional(), clientCertificateHash: z.string().optional(), requireRequestSigning: z.boolean().optional(), description: z.string().optional(), metadataJson: z.string().optional(), tags: z.array(z.string()).optional(), apiVersion: z.string().optional(), supportedFeatures: z.array(z.string()).optional(), documentationUrl: z.string().optional(), supportContact: z.string().optional(), logAllRequests: z.boolean().optional(), lastRotationReason: z.string().optional(), lastRotationDate: z.date().transform(v => v.toISOString()).optional(), rotationFrequencyDays: z.number().int().optional(), complianceStandards: z.array(z.string()).optional(), requiresAuditLogging: z.boolean().optional(), dataResidency: z.string().optional(), approvedIntegrations: z.array(z.string()).optional(), alertEmails: z.array(z.string()).optional(), webhookUrl: z.string().optional(), alertOnQuotaThreshold: z.boolean().optional(), quotaAlertThreshold: z.number().optional(), alertOnErrorSpike: z.boolean().optional(), errorAlertThreshold: z.number().optional(), monitoringIntegrations: z.array(z.string()).optional(), encrypted: z.boolean().optional(), dataClassification: z.string().optional(), maxUses: z.number().int().optional(), rateLimit: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace NewApiKey$ { /** @deprecated use `NewApiKey$inboundSchema` instead. */ export const inboundSchema = NewApiKey$inboundSchema; /** @deprecated use `NewApiKey$outboundSchema` instead. */ export const outboundSchema = NewApiKey$outboundSchema; /** @deprecated use `NewApiKey$Outbound` instead. */ export type Outbound = NewApiKey$Outbound; } export function newApiKeyToJSON(newApiKey: NewApiKey): string { return JSON.stringify(NewApiKey$outboundSchema.parse(newApiKey)); } export function newApiKeyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NewApiKey$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NewApiKey' from JSON`, ); } /** @internal */ export const PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$inboundSchema: z.ZodType< PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody, z.ZodTypeDef, unknown > = z.object({ newApiKey: z.lazy(() => NewApiKey$inboundSchema).optional(), newKeyValue: z.string().optional(), oldKeyExpiry: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), }); /** @internal */ export type PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$Outbound = { newApiKey?: NewApiKey$Outbound | undefined; newKeyValue?: string | undefined; oldKeyExpiry?: string | undefined; }; /** @internal */ export const PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$outboundSchema: z.ZodType< PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$Outbound, z.ZodTypeDef, PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody > = z.object({ newApiKey: z.lazy(() => NewApiKey$outboundSchema).optional(), newKeyValue: z.string().optional(), oldKeyExpiry: z.date().transform(v => v.toISOString()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$ { /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$inboundSchema` instead. */ export const inboundSchema = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$inboundSchema; /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$outboundSchema` instead. */ export const outboundSchema = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$outboundSchema; /** @deprecated use `PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$Outbound` instead. */ export type Outbound = PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$Outbound; } export function postApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBodyToJSON( postApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody: PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody, ): string { return JSON.stringify( PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$outboundSchema .parse(postApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody), ); } export function postApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBodyFromJSON( jsonString: string, ): SafeParseResult< PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody, SDKValidationError > { return safeParse( jsonString, (x) => PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PostApiLeadScraperMicroserviceApiV1ApiKeysRotateResponseBody' from JSON`, ); }