/* * 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 V3GlobaldataServiceOnHostGlobals = { organizationId?: string | undefined; }; /** * Filter by transport protocol */ export const TransportProtocol = { Tcp: "tcp", Udp: "udp", Quic: "quic", } as const; /** * Filter by transport protocol */ export type TransportProtocol = ClosedEnum; export const OrderBy = { PortASC: "port ASC", PortDESC: "port DESC", ProtocolASC: "protocol ASC", ProtocolDESC: "protocol DESC", TransportProtocolASC: "transport_protocol ASC", TransportProtocolDESC: "transport_protocol DESC", } as const; export type OrderBy = ClosedEnum; export type V3GlobaldataServiceOnHostRequest = { /** * 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; /** * Start of date range (RFC3339 format, e.g., 2024-01-01T00:00:00Z). If not specified, defaults to the maximum query window back from the end time. */ startTime?: string | undefined; /** * End of date range (RFC3339 format, e.g., 2024-01-31T23:59:59Z). If not specified, defaults to now. Cannot be in the future. */ endTime?: string | undefined; /** * Number of results per page (max 100) */ pageSize?: number | undefined; /** * Pagination token from previous response */ pageToken?: string | undefined; /** * Filter by port number */ port?: number | undefined; /** * Filter by application protocol */ protocol?: string | undefined; /** * Filter by transport protocol */ transportProtocol?: TransportProtocol | undefined; /** * The IP address of a host. */ hostId: string; /** * Order observations by these fields. Multiple values can be provided to sort by multiple fields (e.g., ['port DESC', 'protocol ASC']). */ orderBy?: Array | null | undefined; }; export type V3GlobaldataServiceOnHostResponse = { headers: { [k: string]: Array }; result: components.ResponseEnvelopeServicesOnHostResponse; }; /** @internal */ export const TransportProtocol$outboundSchema: z.ZodNativeEnum< typeof TransportProtocol > = z.nativeEnum(TransportProtocol); /** @internal */ export const OrderBy$outboundSchema: z.ZodNativeEnum = z .nativeEnum(OrderBy); /** @internal */ export type V3GlobaldataServiceOnHostRequest$Outbound = { organization_id?: string | undefined; start_time?: string | undefined; end_time?: string | undefined; page_size: number; page_token?: string | undefined; port?: number | undefined; protocol?: string | undefined; transport_protocol?: string | undefined; host_id: string; order_by?: Array | null | undefined; }; /** @internal */ export const V3GlobaldataServiceOnHostRequest$outboundSchema: z.ZodType< V3GlobaldataServiceOnHostRequest$Outbound, z.ZodTypeDef, V3GlobaldataServiceOnHostRequest > = z.object({ organizationId: z.string().optional(), startTime: z.string().optional(), endTime: z.string().optional(), pageSize: z.number().int().default(100), pageToken: z.string().optional(), port: z.number().int().optional(), protocol: z.string().optional(), transportProtocol: TransportProtocol$outboundSchema.optional(), hostId: z.string(), orderBy: z.nullable(z.array(OrderBy$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { organizationId: "organization_id", startTime: "start_time", endTime: "end_time", pageSize: "page_size", pageToken: "page_token", transportProtocol: "transport_protocol", hostId: "host_id", orderBy: "order_by", }); }); export function v3GlobaldataServiceOnHostRequestToJSON( v3GlobaldataServiceOnHostRequest: V3GlobaldataServiceOnHostRequest, ): string { return JSON.stringify( V3GlobaldataServiceOnHostRequest$outboundSchema.parse( v3GlobaldataServiceOnHostRequest, ), ); } /** @internal */ export const V3GlobaldataServiceOnHostResponse$inboundSchema: z.ZodType< V3GlobaldataServiceOnHostResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ResponseEnvelopeServicesOnHostResponse$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function v3GlobaldataServiceOnHostResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => V3GlobaldataServiceOnHostResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'V3GlobaldataServiceOnHostResponse' from JSON`, ); }