/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AlternativeQuery, AlternativeQuery$inboundSchema, } from "./alternativequery.js"; import { ConvertQueryError, ConvertQueryError$inboundSchema, } from "./convertqueryerror.js"; export const SearchConvertQueryResponseTargets = { Host: "host", Web: "web", Cert: "cert", Unknown: "unknown", } as const; export type SearchConvertQueryResponseTargets = OpenEnum< typeof SearchConvertQueryResponseTargets >; export type SearchConvertQueryResponse = { /** * Alternative queries that may be used. For example, a query that includes web results in addition to host results. */ alternativeQueries?: Array | null | undefined; /** * Comments about the query conversion. */ comments?: Array | null | undefined; /** * The original query, converted to CenQL syntax. This may be empty if unable to translate the query. */ convertedQuery?: string | undefined; /** * The error messages if the query could not be converted. */ errors: Array | null; /** * The original Censys Search Language query. */ originalQuery: string; /** * The types of Platform data records (host, cert, and web) that can be targeted by the converted query. Note: Does not include targets that could be returned due to full-document search. This may be empty if the query is a match-all for full-document search query. */ targets: Array | null; }; /** @internal */ export const SearchConvertQueryResponseTargets$inboundSchema: z.ZodType< SearchConvertQueryResponseTargets, z.ZodTypeDef, unknown > = openEnums.inboundSchema(SearchConvertQueryResponseTargets); /** @internal */ export const SearchConvertQueryResponse$inboundSchema: z.ZodType< SearchConvertQueryResponse, z.ZodTypeDef, unknown > = z.object({ alternative_queries: z.nullable(z.array(AlternativeQuery$inboundSchema)) .optional(), comments: z.nullable(z.array(z.string())).optional(), converted_query: z.string().optional(), errors: z.nullable(z.array(ConvertQueryError$inboundSchema)), original_query: z.string(), targets: z.nullable(z.array(SearchConvertQueryResponseTargets$inboundSchema)), }).transform((v) => { return remap$(v, { "alternative_queries": "alternativeQueries", "converted_query": "convertedQuery", "original_query": "originalQuery", }); }); export function searchConvertQueryResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SearchConvertQueryResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SearchConvertQueryResponse' from JSON`, ); }