/* * 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"; export type ResponseContent = { type?: "text" | undefined; text: string; annotations?: Array<{ [k: string]: any }> | undefined; }; /** @internal */ export const ResponseContent$inboundSchema: z.ZodType< ResponseContent, z.ZodTypeDef, unknown > = z.object({ type: z.literal("text").default("text"), text: z.string(), annotations: z.array(z.record(z.any())).optional(), }); /** @internal */ export type ResponseContent$Outbound = { type: "text"; text: string; annotations?: Array<{ [k: string]: any }> | undefined; }; /** @internal */ export const ResponseContent$outboundSchema: z.ZodType< ResponseContent$Outbound, z.ZodTypeDef, ResponseContent > = z.object({ type: z.literal("text").default("text" as const), text: z.string(), annotations: z.array(z.record(z.any())).optional(), }); export function responseContentToJSON( responseContent: ResponseContent, ): string { return JSON.stringify(ResponseContent$outboundSchema.parse(responseContent)); } export function responseContentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseContent' from JSON`, ); }