/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 23263cc3d4d9 */ 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 { FacetBucket, FacetBucket$inboundSchema } from "./facetbucket.js"; export type FacetResult = { /** * The source of this facet (e.g. container_name, type, last_updated_at). */ sourceName?: string | undefined; /** * How to display this facet. Currently supportes 'SelectSingle' and 'SelectMultiple'. */ operatorName?: string | undefined; /** * A list of unique buckets that exist within this result set. */ buckets?: Array | undefined; /** * Returns true if more buckets exist than those returned. Additional buckets can be retrieve by requesting again with a higher facetBucketSize. */ hasMoreBuckets?: boolean | undefined; /** * For most facets this will be the empty string, meaning the facet is high-level and applies to all documents for the datasource. When non-empty, this is used to group facets together (i.e. group facets for each doctype for a certain datasource) */ groupName?: string | undefined; }; /** @internal */ export const FacetResult$inboundSchema: z.ZodType< FacetResult, z.ZodTypeDef, unknown > = z.object({ sourceName: z.string().optional(), operatorName: z.string().optional(), buckets: z.array(FacetBucket$inboundSchema).optional(), hasMoreBuckets: z.boolean().optional(), groupName: z.string().optional(), }); export function facetResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FacetResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FacetResult' from JSON`, ); }