/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Custom date object to present related Dow Jones dates because any value can be null, Month is represented randomly like June, Jun, 6 etc. etc. */ export type DowJonesDate = { /** * Day */ day?: string | undefined; /** * Month */ month?: string | undefined; /** * Year */ year?: string | undefined; }; /** @internal */ export const DowJonesDate$inboundSchema: z.ZodType< DowJonesDate, z.ZodTypeDef, unknown > = z.object({ day: z.string().optional(), month: z.string().optional(), year: z.string().optional(), }); /** @internal */ export type DowJonesDate$Outbound = { day?: string | undefined; month?: string | undefined; year?: string | undefined; }; /** @internal */ export const DowJonesDate$outboundSchema: z.ZodType< DowJonesDate$Outbound, z.ZodTypeDef, DowJonesDate > = z.object({ day: z.string().optional(), month: z.string().optional(), year: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DowJonesDate$ { /** @deprecated use `DowJonesDate$inboundSchema` instead. */ export const inboundSchema = DowJonesDate$inboundSchema; /** @deprecated use `DowJonesDate$outboundSchema` instead. */ export const outboundSchema = DowJonesDate$outboundSchema; /** @deprecated use `DowJonesDate$Outbound` instead. */ export type Outbound = DowJonesDate$Outbound; } export function dowJonesDateToJSON(dowJonesDate: DowJonesDate): string { return JSON.stringify(DowJonesDate$outboundSchema.parse(dowJonesDate)); } export function dowJonesDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DowJonesDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DowJonesDate' from JSON`, ); }