/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d92a3760155f */ 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 { QuerySuggestion, QuerySuggestion$inboundSchema, } from "./querysuggestion.js"; import { QuerySuggestionList, QuerySuggestionList$inboundSchema, } from "./querysuggestionlist.js"; import { SearchWarning, SearchWarning$inboundSchema } from "./searchwarning.js"; import { TextRange, TextRange$inboundSchema } from "./textrange.js"; export type SearchResponseMetadata = { /** * A cleaned up or updated version of the query to be displayed in the query box. Useful for mapping visual facets to search operators. */ rewrittenQuery?: string | undefined; /** * The actual query used to perform search and return results. */ searchedQuery?: string | undefined; /** * The query used to perform search and return results, with negated terms and facets removed. */ searchedQueryWithoutNegation?: string | undefined; /** * The bolded ranges within the searched query. */ searchedQueryRanges?: Array | undefined; /** * The query text sent by the client in the request. */ originalQuery?: string | undefined; querySuggestion?: QuerySuggestion | undefined; additionalQuerySuggestions?: QuerySuggestionList | undefined; /** * A list of terms that were negated when processing the query. */ negatedTerms?: Array | undefined; /** * A different query was performed than the one requested. */ modifiedQueryWasUsed?: boolean | undefined; /** * No results were found for the original query. The usage of this bit in conjunction with modifiedQueryWasUsed will dictate whether the full page replacement is 0-result or few-result based. */ originalQueryHadNoResults?: boolean | undefined; searchWarning?: SearchWarning | undefined; /** * Whether the query triggered expert detection results in the People tab. */ triggeredExpertDetection?: boolean | undefined; /** * Whether the query was modified to remove quotes */ isNoQuotesSuggestion?: boolean | undefined; }; /** @internal */ export const SearchResponseMetadata$inboundSchema: z.ZodType< SearchResponseMetadata, z.ZodTypeDef, unknown > = z.object({ rewrittenQuery: z.string().optional(), searchedQuery: z.string().optional(), searchedQueryWithoutNegation: z.string().optional(), searchedQueryRanges: z.array(TextRange$inboundSchema).optional(), originalQuery: z.string().optional(), querySuggestion: QuerySuggestion$inboundSchema.optional(), additionalQuerySuggestions: QuerySuggestionList$inboundSchema.optional(), negatedTerms: z.array(z.string()).optional(), modifiedQueryWasUsed: z.boolean().optional(), originalQueryHadNoResults: z.boolean().optional(), searchWarning: SearchWarning$inboundSchema.optional(), triggeredExpertDetection: z.boolean().optional(), isNoQuotesSuggestion: z.boolean().optional(), }); export function searchResponseMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SearchResponseMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SearchResponseMetadata' from JSON`, ); }