/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type V3CollectionsSearchAggregateGlobals = { organizationId?: string | undefined; }; export type V3CollectionsSearchAggregateRequest = { /** * The ID of a Censys organization to associate the request with. See the [Getting Started docs](https://docs.censys.com/reference/get-started#step-3-find-and-use-your-organization-id-optional) for more information. */ organizationId?: string | undefined; /** * The UID for the collection. Obtain the collection ID using the [list collections endpoint](https://docs.censys.com/reference/v3-collections-crud-list#/) or via the collection URL when using the web console. */ collectionUid: string; searchAggregateInputBody: components.SearchAggregateInputBody; }; export type V3CollectionsSearchAggregateResponse = { headers: { [k: string]: Array }; result: components.ResponseEnvelopeSearchAggregateResponse; }; /** @internal */ export type V3CollectionsSearchAggregateRequest$Outbound = { organization_id?: string | undefined; collection_uid: string; SearchAggregateInputBody: components.SearchAggregateInputBody$Outbound; }; /** @internal */ export const V3CollectionsSearchAggregateRequest$outboundSchema: z.ZodType< V3CollectionsSearchAggregateRequest$Outbound, z.ZodTypeDef, V3CollectionsSearchAggregateRequest > = z.object({ organizationId: z.string().optional(), collectionUid: z.string(), searchAggregateInputBody: components.SearchAggregateInputBody$outboundSchema, }).transform((v) => { return remap$(v, { organizationId: "organization_id", collectionUid: "collection_uid", searchAggregateInputBody: "SearchAggregateInputBody", }); }); export function v3CollectionsSearchAggregateRequestToJSON( v3CollectionsSearchAggregateRequest: V3CollectionsSearchAggregateRequest, ): string { return JSON.stringify( V3CollectionsSearchAggregateRequest$outboundSchema.parse( v3CollectionsSearchAggregateRequest, ), ); } /** @internal */ export const V3CollectionsSearchAggregateResponse$inboundSchema: z.ZodType< V3CollectionsSearchAggregateResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ResponseEnvelopeSearchAggregateResponse$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function v3CollectionsSearchAggregateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => V3CollectionsSearchAggregateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'V3CollectionsSearchAggregateResponse' from JSON`, ); }