/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type V3CollectionsCrudListGlobals = { organizationId?: string | undefined; }; export const CollectionStatuses = { Populating: "populating", Active: "active", Paused: "paused", Archived: "archived", } as const; export type CollectionStatuses = ClosedEnum; export type V3CollectionsCrudListRequest = { /** * 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; /** * page token for the requested page of collection results */ pageToken?: string | undefined; /** * amount of results to return per page */ pageSize?: number | undefined; /** * statuses of collection for results to be filtered on. */ collectionStatuses?: Array | null | undefined; }; export type V3CollectionsCrudListResponse = { headers: { [k: string]: Array }; result: components.ResponseEnvelopeListCollectionsResponseV1; }; /** @internal */ export const CollectionStatuses$outboundSchema: z.ZodNativeEnum< typeof CollectionStatuses > = z.nativeEnum(CollectionStatuses); /** @internal */ export type V3CollectionsCrudListRequest$Outbound = { organization_id?: string | undefined; page_token?: string | undefined; page_size?: number | undefined; collection_statuses?: Array | null | undefined; }; /** @internal */ export const V3CollectionsCrudListRequest$outboundSchema: z.ZodType< V3CollectionsCrudListRequest$Outbound, z.ZodTypeDef, V3CollectionsCrudListRequest > = z.object({ organizationId: z.string().optional(), pageToken: z.string().optional(), pageSize: z.number().int().optional(), collectionStatuses: z.nullable(z.array(CollectionStatuses$outboundSchema)) .optional(), }).transform((v) => { return remap$(v, { organizationId: "organization_id", pageToken: "page_token", pageSize: "page_size", collectionStatuses: "collection_statuses", }); }); export function v3CollectionsCrudListRequestToJSON( v3CollectionsCrudListRequest: V3CollectionsCrudListRequest, ): string { return JSON.stringify( V3CollectionsCrudListRequest$outboundSchema.parse( v3CollectionsCrudListRequest, ), ); } /** @internal */ export const V3CollectionsCrudListResponse$inboundSchema: z.ZodType< V3CollectionsCrudListResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ResponseEnvelopeListCollectionsResponseV1$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function v3CollectionsCrudListResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => V3CollectionsCrudListResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'V3CollectionsCrudListResponse' from JSON`, ); }