/* * 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 { Forecast, Forecast$inboundSchema, Forecast$Outbound, Forecast$outboundSchema, } from "./forecast.js"; import { MarketDriver, MarketDriver$inboundSchema, MarketDriver$Outbound, MarketDriver$outboundSchema, } from "./marketdriver.js"; import { MovingAverage, MovingAverage$inboundSchema, MovingAverage$Outbound, MovingAverage$outboundSchema, } from "./movingaverage.js"; import { Tick, Tick$inboundSchema, Tick$Outbound, Tick$outboundSchema, } from "./tick.js"; export type ContractWithForecasts = { assetSymbol: string; symbol: string; name: string; lastTick?: Tick | null | undefined; forecasts: Array; marketDrivers: Array | null; movingAverages: Array | null; }; /** @internal */ export const ContractWithForecasts$inboundSchema: z.ZodType< ContractWithForecasts, z.ZodTypeDef, unknown > = z.object({ asset_symbol: z.string(), symbol: z.string(), name: z.string(), last_tick: z.nullable(Tick$inboundSchema).optional(), forecasts: z.array(Forecast$inboundSchema), market_drivers: z.nullable(z.array(MarketDriver$inboundSchema)), moving_averages: z.nullable(z.array(MovingAverage$inboundSchema)), }).transform((v) => { return remap$(v, { "asset_symbol": "assetSymbol", "last_tick": "lastTick", "market_drivers": "marketDrivers", "moving_averages": "movingAverages", }); }); /** @internal */ export type ContractWithForecasts$Outbound = { asset_symbol: string; symbol: string; name: string; last_tick?: Tick$Outbound | null | undefined; forecasts: Array; market_drivers: Array | null; moving_averages: Array | null; }; /** @internal */ export const ContractWithForecasts$outboundSchema: z.ZodType< ContractWithForecasts$Outbound, z.ZodTypeDef, ContractWithForecasts > = z.object({ assetSymbol: z.string(), symbol: z.string(), name: z.string(), lastTick: z.nullable(Tick$outboundSchema).optional(), forecasts: z.array(Forecast$outboundSchema), marketDrivers: z.nullable(z.array(MarketDriver$outboundSchema)), movingAverages: z.nullable(z.array(MovingAverage$outboundSchema)), }).transform((v) => { return remap$(v, { assetSymbol: "asset_symbol", lastTick: "last_tick", marketDrivers: "market_drivers", movingAverages: "moving_averages", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ContractWithForecasts$ { /** @deprecated use `ContractWithForecasts$inboundSchema` instead. */ export const inboundSchema = ContractWithForecasts$inboundSchema; /** @deprecated use `ContractWithForecasts$outboundSchema` instead. */ export const outboundSchema = ContractWithForecasts$outboundSchema; /** @deprecated use `ContractWithForecasts$Outbound` instead. */ export type Outbound = ContractWithForecasts$Outbound; } export function contractWithForecastsToJSON( contractWithForecasts: ContractWithForecasts, ): string { return JSON.stringify( ContractWithForecasts$outboundSchema.parse(contractWithForecasts), ); } export function contractWithForecastsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractWithForecasts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractWithForecasts' from JSON`, ); }