/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { PreIpoCompanyNewsEventArticle, PreIpoCompanyNewsEventArticle$inboundSchema, PreIpoCompanyNewsEventArticle$Outbound, PreIpoCompanyNewsEventArticle$outboundSchema, } from "./preipocompanynewseventarticle.js"; /** * A Pre IPO Company News Event. */ export type PreIpoCompanyNewsEvent = { /** * The news articles related to the Pre IPO Company News Event. */ articles?: Array | undefined; /** * The description of the Pre IPO Company News Event. */ description?: string | undefined; /** * The time the news event occurred. */ eventTime?: Date | null | undefined; /** * The resource name of the Pre IPO Company News Event. Format: preIpoCompanies/{pre_ipo_company}/newsEvents/{newsEvent} */ name?: string | undefined; /** * The ID of the Pre IPO Company News Event. */ newsEventId?: string | undefined; /** * The ID of the Pre IPO Company. */ preIpoCompanyId?: string | undefined; /** * The title of the Pre IPO Company News Event. */ title?: string | undefined; }; /** @internal */ export const PreIpoCompanyNewsEvent$inboundSchema: z.ZodType< PreIpoCompanyNewsEvent, z.ZodTypeDef, unknown > = z.object({ articles: z.array(PreIpoCompanyNewsEventArticle$inboundSchema).optional(), description: z.string().optional(), event_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), name: z.string().optional(), news_event_id: z.string().optional(), pre_ipo_company_id: z.string().optional(), title: z.string().optional(), }).transform((v) => { return remap$(v, { "event_time": "eventTime", "news_event_id": "newsEventId", "pre_ipo_company_id": "preIpoCompanyId", }); }); /** @internal */ export type PreIpoCompanyNewsEvent$Outbound = { articles?: Array | undefined; description?: string | undefined; event_time?: string | null | undefined; name?: string | undefined; news_event_id?: string | undefined; pre_ipo_company_id?: string | undefined; title?: string | undefined; }; /** @internal */ export const PreIpoCompanyNewsEvent$outboundSchema: z.ZodType< PreIpoCompanyNewsEvent$Outbound, z.ZodTypeDef, PreIpoCompanyNewsEvent > = z.object({ articles: z.array(PreIpoCompanyNewsEventArticle$outboundSchema).optional(), description: z.string().optional(), eventTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), name: z.string().optional(), newsEventId: z.string().optional(), preIpoCompanyId: z.string().optional(), title: z.string().optional(), }).transform((v) => { return remap$(v, { eventTime: "event_time", newsEventId: "news_event_id", preIpoCompanyId: "pre_ipo_company_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PreIpoCompanyNewsEvent$ { /** @deprecated use `PreIpoCompanyNewsEvent$inboundSchema` instead. */ export const inboundSchema = PreIpoCompanyNewsEvent$inboundSchema; /** @deprecated use `PreIpoCompanyNewsEvent$outboundSchema` instead. */ export const outboundSchema = PreIpoCompanyNewsEvent$outboundSchema; /** @deprecated use `PreIpoCompanyNewsEvent$Outbound` instead. */ export type Outbound = PreIpoCompanyNewsEvent$Outbound; } export function preIpoCompanyNewsEventToJSON( preIpoCompanyNewsEvent: PreIpoCompanyNewsEvent, ): string { return JSON.stringify( PreIpoCompanyNewsEvent$outboundSchema.parse(preIpoCompanyNewsEvent), ); } export function preIpoCompanyNewsEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PreIpoCompanyNewsEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PreIpoCompanyNewsEvent' from JSON`, ); }