/* * 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 { SearchQueryHit, SearchQueryHit$inboundSchema, } from "./searchqueryhit.js"; export type SearchQueryResponse = { hits: Array | null; nextPageToken: string; previousPageToken: string; queryDurationMillis: number; totalHits: number; }; /** @internal */ export const SearchQueryResponse$inboundSchema: z.ZodType< SearchQueryResponse, z.ZodTypeDef, unknown > = z.object({ hits: z.nullable(z.array(SearchQueryHit$inboundSchema)), next_page_token: z.string(), previous_page_token: z.string(), query_duration_millis: z.number().int(), total_hits: z.number(), }).transform((v) => { return remap$(v, { "next_page_token": "nextPageToken", "previous_page_token": "previousPageToken", "query_duration_millis": "queryDurationMillis", "total_hits": "totalHits", }); }); export function searchQueryResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SearchQueryResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SearchQueryResponse' from JSON`, ); }