/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 2f03b2f90555 */ 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"; import { Document, Document$inboundSchema, Document$Outbound, Document$outboundSchema, } from "./document.js"; import { StructuredResult, StructuredResult$inboundSchema, StructuredResult$Outbound, StructuredResult$outboundSchema, } from "./structuredresult.js"; export type StructuredTextItem = { link?: string | undefined; document?: Document | undefined; text?: string | undefined; /** * A single object that can support any object in the work graph. Only a single object will be populated. */ structuredResult?: StructuredResult | undefined; }; /** @internal */ export const StructuredTextItem$inboundSchema: z.ZodType< StructuredTextItem, z.ZodTypeDef, unknown > = z.object({ link: z.string().optional(), document: z.lazy(() => Document$inboundSchema).optional(), text: z.string().optional(), structuredResult: z.lazy(() => StructuredResult$inboundSchema).optional(), }); /** @internal */ export type StructuredTextItem$Outbound = { link?: string | undefined; document?: Document$Outbound | undefined; text?: string | undefined; structuredResult?: StructuredResult$Outbound | undefined; }; /** @internal */ export const StructuredTextItem$outboundSchema: z.ZodType< StructuredTextItem$Outbound, z.ZodTypeDef, StructuredTextItem > = z.object({ link: z.string().optional(), document: z.lazy(() => Document$outboundSchema).optional(), text: z.string().optional(), structuredResult: z.lazy(() => StructuredResult$outboundSchema).optional(), }); export function structuredTextItemToJSON( structuredTextItem: StructuredTextItem, ): string { return JSON.stringify( StructuredTextItem$outboundSchema.parse(structuredTextItem), ); } export function structuredTextItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => StructuredTextItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StructuredTextItem' from JSON`, ); }