/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 28498c21a6f5 */ 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 { SearchResult, SearchResult$inboundSchema, SearchResult$Outbound, SearchResult$outboundSchema, } from "./searchresult.js"; export type ExtractedQnA = { /** * Heading text that was matched to produce this result. */ heading?: string | undefined; /** * Question text that was matched to produce this result. */ question?: string | undefined; questionResult?: SearchResult | undefined; }; /** @internal */ export const ExtractedQnA$inboundSchema: z.ZodType< ExtractedQnA, z.ZodTypeDef, unknown > = z.object({ heading: z.string().optional(), question: z.string().optional(), questionResult: z.lazy(() => SearchResult$inboundSchema).optional(), }); /** @internal */ export type ExtractedQnA$Outbound = { heading?: string | undefined; question?: string | undefined; questionResult?: SearchResult$Outbound | undefined; }; /** @internal */ export const ExtractedQnA$outboundSchema: z.ZodType< ExtractedQnA$Outbound, z.ZodTypeDef, ExtractedQnA > = z.object({ heading: z.string().optional(), question: z.string().optional(), questionResult: z.lazy(() => SearchResult$outboundSchema).optional(), }); export function extractedQnAToJSON(extractedQnA: ExtractedQnA): string { return JSON.stringify(ExtractedQnA$outboundSchema.parse(extractedQnA)); } export function extractedQnAFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExtractedQnA$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractedQnA' from JSON`, ); }