/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 3ca79660e70e */ 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 { AutocompleteResult, AutocompleteResult$inboundSchema, } from "./autocompleteresult.js"; import { AutocompleteResultGroup, AutocompleteResultGroup$inboundSchema, } from "./autocompleteresultgroup.js"; import { GleanDataError, GleanDataError$inboundSchema, } from "./gleandataerror.js"; import { SessionInfo, SessionInfo$inboundSchema } from "./sessioninfo.js"; export type AutocompleteResponse = { /** * List of experiment ids for the corresponding request. */ experimentIds?: Array | undefined; /** * An opaque token that represents this particular set of autocomplete results. To be used for /feedback reporting. */ trackingToken?: string | undefined; sessionInfo?: SessionInfo | undefined; results?: Array | undefined; /** * Subsections of the results list from which distinct sections should be created. */ groups?: Array | undefined; gleanDataError?: GleanDataError | undefined; /** * Time in milliseconds the backend took to respond to the request. */ backendTimeMillis?: number | undefined; }; /** @internal */ export const AutocompleteResponse$inboundSchema: z.ZodType< AutocompleteResponse, z.ZodTypeDef, unknown > = z.object({ experimentIds: z.array(z.number().int()).optional(), trackingToken: z.string().optional(), sessionInfo: SessionInfo$inboundSchema.optional(), results: z.array(AutocompleteResult$inboundSchema).optional(), groups: z.array(AutocompleteResultGroup$inboundSchema).optional(), errorInfo: GleanDataError$inboundSchema.optional(), backendTimeMillis: z.number().int().optional(), }).transform((v) => { return remap$(v, { "errorInfo": "gleanDataError", }); }); export function autocompleteResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AutocompleteResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AutocompleteResponse' from JSON`, ); }