/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 0a81094fce8f */ 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 { ClusterTypeEnum, ClusterTypeEnum$inboundSchema, ClusterTypeEnum$outboundSchema, } from "./clustertypeenum.js"; import { SearchResult, SearchResult$inboundSchema, SearchResult$Outbound, SearchResult$outboundSchema, } from "./searchresult.js"; export type ClusterGroup = { /** * A list of results that should be displayed as associated with this result. */ clusteredResults?: Array | undefined; /** * The reason for inclusion of clusteredResults. */ clusterType?: ClusterTypeEnum | undefined; /** * The default number of results to display before truncating and showing a "see more" link */ visibleCountHint: number; }; /** @internal */ export const ClusterGroup$inboundSchema: z.ZodType< ClusterGroup, z.ZodTypeDef, unknown > = z.object({ clusteredResults: z.array(z.lazy(() => SearchResult$inboundSchema)) .optional(), clusterType: ClusterTypeEnum$inboundSchema.optional(), visibleCountHint: z.number().int(), }); /** @internal */ export type ClusterGroup$Outbound = { clusteredResults?: Array | undefined; clusterType?: string | undefined; visibleCountHint: number; }; /** @internal */ export const ClusterGroup$outboundSchema: z.ZodType< ClusterGroup$Outbound, z.ZodTypeDef, ClusterGroup > = z.object({ clusteredResults: z.array(z.lazy(() => SearchResult$outboundSchema)) .optional(), clusterType: ClusterTypeEnum$outboundSchema.optional(), visibleCountHint: z.number().int(), }); export function clusterGroupToJSON(clusterGroup: ClusterGroup): string { return JSON.stringify(ClusterGroup$outboundSchema.parse(clusterGroup)); } export function clusterGroupFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ClusterGroup$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ClusterGroup' from JSON`, ); }