/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 596d373cbd51 */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { GeneratedQna, GeneratedQna$inboundSchema } from "./generatedqna.js"; import { GleanDataError, GleanDataError$inboundSchema, } from "./gleandataerror.js"; import { SearchResult, SearchResult$inboundSchema } from "./searchresult.js"; import { SessionInfo, SessionInfo$inboundSchema } from "./sessioninfo.js"; import { StructuredResult, StructuredResult$inboundSchema, } from "./structuredresult.js"; export type ResultsResponse = { /** * A token that should be passed for additional requests related to this request (such as more results requests). */ trackingToken?: string | undefined; sessionInfo?: SessionInfo | undefined; results?: Array | undefined; structuredResults?: Array | undefined; generatedQnaResult?: GeneratedQna | undefined; gleanDataError?: GleanDataError | undefined; /** * A platform-generated request ID to correlate backend logs. */ requestID?: string | undefined; /** * Time in milliseconds the backend took to respond to the request. */ backendTimeMillis?: number | undefined; }; /** @internal */ export const ResultsResponse$inboundSchema: z.ZodType< ResultsResponse, z.ZodTypeDef, unknown > = z.object({ trackingToken: z.string().optional(), sessionInfo: SessionInfo$inboundSchema.optional(), results: z.array(SearchResult$inboundSchema).optional(), structuredResults: z.array(StructuredResult$inboundSchema).optional(), generatedQnaResult: GeneratedQna$inboundSchema.optional(), errorInfo: GleanDataError$inboundSchema.optional(), requestID: z.string().optional(), backendTimeMillis: z.number().int().optional(), }).transform((v) => { return remap$(v, { "errorInfo": "gleanDataError", }); }); export function resultsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResultsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResultsResponse' from JSON`, ); }