/* * 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 created extraction schema with generated ID and timestamps */ export type SchemaCreateResponseData = { /** * 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 creating a new extraction schema. */ export type SchemaCreateResponse = { /** * Indicates whether the schema creation was successful */ success: boolean; /** * The created extraction schema with generated ID and timestamps */ data: SchemaCreateResponseData; }; /** @internal */ export const SchemaCreateResponseData$inboundSchema: z.ZodType< SchemaCreateResponseData, 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 SchemaCreateResponseData$Outbound = { id: string; name: string; description?: string | undefined; schema: { [k: string]: any }; metadata?: { [k: string]: any } | undefined; createdAt: string; updatedAt: string; }; /** @internal */ export const SchemaCreateResponseData$outboundSchema: z.ZodType< SchemaCreateResponseData$Outbound, z.ZodTypeDef, SchemaCreateResponseData > = 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 schemaCreateResponseDataToJSON( schemaCreateResponseData: SchemaCreateResponseData, ): string { return JSON.stringify( SchemaCreateResponseData$outboundSchema.parse(schemaCreateResponseData), ); } export function schemaCreateResponseDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchemaCreateResponseData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchemaCreateResponseData' from JSON`, ); } /** @internal */ export const SchemaCreateResponse$inboundSchema: z.ZodType< SchemaCreateResponse, z.ZodTypeDef, unknown > = z.object({ success: z.boolean(), data: z.lazy(() => SchemaCreateResponseData$inboundSchema), }); /** @internal */ export type SchemaCreateResponse$Outbound = { success: boolean; data: SchemaCreateResponseData$Outbound; }; /** @internal */ export const SchemaCreateResponse$outboundSchema: z.ZodType< SchemaCreateResponse$Outbound, z.ZodTypeDef, SchemaCreateResponse > = z.object({ success: z.boolean(), data: z.lazy(() => SchemaCreateResponseData$outboundSchema), }); export function schemaCreateResponseToJSON( schemaCreateResponse: SchemaCreateResponse, ): string { return JSON.stringify( SchemaCreateResponse$outboundSchema.parse(schemaCreateResponse), ); } export function schemaCreateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchemaCreateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchemaCreateResponse' from JSON`, ); }