/* * 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 updated extraction schema with new updatedAt timestamp */ export type SchemaUpdateResponseData = { /** * 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 updating an existing extraction schema. */ export type SchemaUpdateResponse = { /** * Indicates whether the schema update was successful */ success: boolean; /** * The updated extraction schema with new updatedAt timestamp */ data: SchemaUpdateResponseData; }; /** @internal */ export const SchemaUpdateResponseData$inboundSchema: z.ZodType< SchemaUpdateResponseData, 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 SchemaUpdateResponseData$Outbound = { id: string; name: string; description?: string | undefined; schema: { [k: string]: any }; metadata?: { [k: string]: any } | undefined; createdAt: string; updatedAt: string; }; /** @internal */ export const SchemaUpdateResponseData$outboundSchema: z.ZodType< SchemaUpdateResponseData$Outbound, z.ZodTypeDef, SchemaUpdateResponseData > = 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 schemaUpdateResponseDataToJSON( schemaUpdateResponseData: SchemaUpdateResponseData, ): string { return JSON.stringify( SchemaUpdateResponseData$outboundSchema.parse(schemaUpdateResponseData), ); } export function schemaUpdateResponseDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchemaUpdateResponseData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchemaUpdateResponseData' from JSON`, ); } /** @internal */ export const SchemaUpdateResponse$inboundSchema: z.ZodType< SchemaUpdateResponse, z.ZodTypeDef, unknown > = z.object({ success: z.boolean(), data: z.lazy(() => SchemaUpdateResponseData$inboundSchema), }); /** @internal */ export type SchemaUpdateResponse$Outbound = { success: boolean; data: SchemaUpdateResponseData$Outbound; }; /** @internal */ export const SchemaUpdateResponse$outboundSchema: z.ZodType< SchemaUpdateResponse$Outbound, z.ZodTypeDef, SchemaUpdateResponse > = z.object({ success: z.boolean(), data: z.lazy(() => SchemaUpdateResponseData$outboundSchema), }); export function schemaUpdateResponseToJSON( schemaUpdateResponse: SchemaUpdateResponse, ): string { return JSON.stringify( SchemaUpdateResponse$outboundSchema.parse(schemaUpdateResponse), ); } export function schemaUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchemaUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchemaUpdateResponse' from JSON`, ); }