/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ThreatReference, ThreatReference$inboundSchema, } from "./threatreference.js"; export type ThreatListItem = { /** * The date and time when the threat was added. */ addedAt?: Date | undefined; /** * Total count of assets affected by this threat. */ count: number; /** * Detailed description of the threat. */ description?: string | undefined; /** * Number of hosts affected by this threat. */ hostCount: number; /** * Unique identifier of the threat. */ id: string; /** * Human-readable name of the threat. */ name?: string | undefined; /** * External reference links for the threat. */ references?: Array | null | undefined; /** * Number of web properties affected by this threat. */ webCount: number; }; /** @internal */ export const ThreatListItem$inboundSchema: z.ZodType< ThreatListItem, z.ZodTypeDef, unknown > = z.object({ added_at: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), count: z.number().int(), description: z.string().optional(), host_count: z.number().int(), id: z.string(), name: z.string().optional(), references: z.nullable(z.array(ThreatReference$inboundSchema)).optional(), web_count: z.number().int(), }).transform((v) => { return remap$(v, { "added_at": "addedAt", "host_count": "hostCount", "web_count": "webCount", }); }); export function threatListItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ThreatListItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ThreatListItem' from JSON`, ); }