/* * 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"; export type AvailableFuture = { symbol: string; type: string; assetClassSymbol: string; name: string; tickSize?: number | null | undefined; unit?: string | null | undefined; sku: string | null; code: string | null; priceFile: string | null; marketDate?: Date | null | undefined; exchange?: string | null | undefined; hasForecast: boolean; }; /** @internal */ export const AvailableFuture$inboundSchema: z.ZodType< AvailableFuture, z.ZodTypeDef, unknown > = z.object({ symbol: z.string(), type: z.string(), asset_class_symbol: z.string(), name: z.string(), tick_size: z.nullable(z.number()).optional(), unit: z.nullable(z.string()).optional(), sku: z.nullable(z.string()), code: z.nullable(z.string()), price_file: z.nullable(z.string()), market_date: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), exchange: z.nullable(z.string()).optional(), has_forecast: z.boolean(), }).transform((v) => { return remap$(v, { "asset_class_symbol": "assetClassSymbol", "tick_size": "tickSize", "price_file": "priceFile", "market_date": "marketDate", "has_forecast": "hasForecast", }); }); /** @internal */ export type AvailableFuture$Outbound = { symbol: string; type: string; asset_class_symbol: string; name: string; tick_size?: number | null | undefined; unit?: string | null | undefined; sku: string | null; code: string | null; price_file: string | null; market_date?: string | null | undefined; exchange?: string | null | undefined; has_forecast: boolean; }; /** @internal */ export const AvailableFuture$outboundSchema: z.ZodType< AvailableFuture$Outbound, z.ZodTypeDef, AvailableFuture > = z.object({ symbol: z.string(), type: z.string(), assetClassSymbol: z.string(), name: z.string(), tickSize: z.nullable(z.number()).optional(), unit: z.nullable(z.string()).optional(), sku: z.nullable(z.string()), code: z.nullable(z.string()), priceFile: z.nullable(z.string()), marketDate: z.nullable(z.date().transform(v => v.toISOString())).optional(), exchange: z.nullable(z.string()).optional(), hasForecast: z.boolean(), }).transform((v) => { return remap$(v, { assetClassSymbol: "asset_class_symbol", tickSize: "tick_size", priceFile: "price_file", marketDate: "market_date", hasForecast: "has_forecast", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AvailableFuture$ { /** @deprecated use `AvailableFuture$inboundSchema` instead. */ export const inboundSchema = AvailableFuture$inboundSchema; /** @deprecated use `AvailableFuture$outboundSchema` instead. */ export const outboundSchema = AvailableFuture$outboundSchema; /** @deprecated use `AvailableFuture$Outbound` instead. */ export type Outbound = AvailableFuture$Outbound; } export function availableFutureToJSON( availableFuture: AvailableFuture, ): string { return JSON.stringify(AvailableFuture$outboundSchema.parse(availableFuture)); } export function availableFutureFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AvailableFuture$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AvailableFuture' from JSON`, ); }