/* * 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"; export type ForexTick = { date: Date; price: number; }; /** @internal */ export const ForexTick$inboundSchema: z.ZodType< ForexTick, z.ZodTypeDef, unknown > = z.object({ date: z.string().datetime({ offset: true }).transform(v => new Date(v)), price: z.number(), }); /** @internal */ export type ForexTick$Outbound = { date: string; price: number; }; /** @internal */ export const ForexTick$outboundSchema: z.ZodType< ForexTick$Outbound, z.ZodTypeDef, ForexTick > = z.object({ date: z.date().transform(v => v.toISOString()), price: z.number(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ForexTick$ { /** @deprecated use `ForexTick$inboundSchema` instead. */ export const inboundSchema = ForexTick$inboundSchema; /** @deprecated use `ForexTick$outboundSchema` instead. */ export const outboundSchema = ForexTick$outboundSchema; /** @deprecated use `ForexTick$Outbound` instead. */ export type Outbound = ForexTick$Outbound; } export function forexTickToJSON(forexTick: ForexTick): string { return JSON.stringify(ForexTick$outboundSchema.parse(forexTick)); } export function forexTickFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ForexTick$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ForexTick' from JSON`, ); }