/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The requested extraction schema */ export type SchemaGetResponseData = { /** * Unique identifier for the extraction schema */ id: string; /** * Name of the extraction schema */ name: string; /** * Optional description of the schema */ description?: string | undefined; /** * The JSON Schema object defining the extraction structure */ schema: { [k: string]: any }; /** * Optional metadata associated with the schema */ metadata?: { [k: string]: any } | undefined; /** * ISO 8601 timestamp when the schema was created */ createdAt: string; /** * ISO 8601 timestamp when the schema was last updated */ updatedAt: string; }; /** * Response from retrieving an extraction schema by ID. */ export type SchemaGetResponse = { /** * Indicates whether the schema retrieval was successful */ success: boolean; /** * The requested extraction schema */ data: SchemaGetResponseData; }; /** @internal */ export const SchemaGetResponseData$inboundSchema: z.ZodType< SchemaGetResponseData, z.ZodTypeDef, unknown > = z.object({ id: z.string(), name: z.string(), description: z.string().optional(), schema: z.record(z.any()), metadata: z.record(z.any()).optional(), createdAt: z.string(), updatedAt: z.string(), }); /** @internal */ export type SchemaGetResponseData$Outbound = { id: string; name: string; description?: string | undefined; schema: { [k: string]: any }; metadata?: { [k: string]: any } | undefined; createdAt: string; updatedAt: string; }; /** @internal */ export const SchemaGetResponseData$outboundSchema: z.ZodType< SchemaGetResponseData$Outbound, z.ZodTypeDef, SchemaGetResponseData > = z.object({ id: z.string(), name: z.string(), description: z.string().optional(), schema: z.record(z.any()), metadata: z.record(z.any()).optional(), createdAt: z.string(), updatedAt: z.string(), }); export function schemaGetResponseDataToJSON( schemaGetResponseData: SchemaGetResponseData, ): string { return JSON.stringify( SchemaGetResponseData$outboundSchema.parse(schemaGetResponseData), ); } export function schemaGetResponseDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchemaGetResponseData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchemaGetResponseData' from JSON`, ); } /** @internal */ export const SchemaGetResponse$inboundSchema: z.ZodType< SchemaGetResponse, z.ZodTypeDef, unknown > = z.object({ success: z.boolean(), data: z.lazy(() => SchemaGetResponseData$inboundSchema), }); /** @internal */ export type SchemaGetResponse$Outbound = { success: boolean; data: SchemaGetResponseData$Outbound; }; /** @internal */ export const SchemaGetResponse$outboundSchema: z.ZodType< SchemaGetResponse$Outbound, z.ZodTypeDef, SchemaGetResponse > = z.object({ success: z.boolean(), data: z.lazy(() => SchemaGetResponseData$outboundSchema), }); export function schemaGetResponseToJSON( schemaGetResponse: SchemaGetResponse, ): string { return JSON.stringify( SchemaGetResponse$outboundSchema.parse(schemaGetResponse), ); } export function schemaGetResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchemaGetResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchemaGetResponse' from JSON`, ); }