/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 7e979b4ef721 */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type TextChunk = { type: "text"; text: string; }; /** @internal */ export const TextChunk$inboundSchema: z.ZodType = z.object({ type: z.literal("text"), text: z.string(), }); /** @internal */ export type TextChunk$Outbound = { type: "text"; text: string; }; /** @internal */ export const TextChunk$outboundSchema: z.ZodType< TextChunk$Outbound, TextChunk > = z.object({ type: z.literal("text"), text: z.string(), }); export function textChunkToJSON(textChunk: TextChunk): string { return JSON.stringify(TextChunk$outboundSchema.parse(textChunk)); } export function textChunkFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TextChunk$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TextChunk' from JSON`, ); }