/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ 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 { SearchAggregateResponseBucket, SearchAggregateResponseBucket$inboundSchema, } from "./searchaggregateresponsebucket.js"; export type SearchAggregateResponse = { buckets: Array | null; isMoreThanTotalHits: boolean; otherCount: number; queryDurationMillis: number; totalCount: number; }; /** @internal */ export const SearchAggregateResponse$inboundSchema: z.ZodType< SearchAggregateResponse, z.ZodTypeDef, unknown > = z.object({ buckets: z.nullable(z.array(SearchAggregateResponseBucket$inboundSchema)), is_more_than_total_hits: z.boolean(), other_count: z.number().int(), query_duration_millis: z.number().int(), total_count: z.number().int(), }).transform((v) => { return remap$(v, { "is_more_than_total_hits": "isMoreThanTotalHits", "other_count": "otherCount", "query_duration_millis": "queryDurationMillis", "total_count": "totalCount", }); }); export function searchAggregateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SearchAggregateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SearchAggregateResponse' from JSON`, ); }