/* * 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 { SectorIndexTick, SectorIndexTick$inboundSchema, SectorIndexTick$Outbound, SectorIndexTick$outboundSchema, } from "./sectorindextick.js"; export type SectorIndexHistoricalData = { assetClass: string; data: Array; }; /** @internal */ export const SectorIndexHistoricalData$inboundSchema: z.ZodType< SectorIndexHistoricalData, z.ZodTypeDef, unknown > = z.object({ asset_class: z.string(), data: z.array(SectorIndexTick$inboundSchema), }).transform((v) => { return remap$(v, { "asset_class": "assetClass", }); }); /** @internal */ export type SectorIndexHistoricalData$Outbound = { asset_class: string; data: Array; }; /** @internal */ export const SectorIndexHistoricalData$outboundSchema: z.ZodType< SectorIndexHistoricalData$Outbound, z.ZodTypeDef, SectorIndexHistoricalData > = z.object({ assetClass: z.string(), data: z.array(SectorIndexTick$outboundSchema), }).transform((v) => { return remap$(v, { assetClass: "asset_class", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SectorIndexHistoricalData$ { /** @deprecated use `SectorIndexHistoricalData$inboundSchema` instead. */ export const inboundSchema = SectorIndexHistoricalData$inboundSchema; /** @deprecated use `SectorIndexHistoricalData$outboundSchema` instead. */ export const outboundSchema = SectorIndexHistoricalData$outboundSchema; /** @deprecated use `SectorIndexHistoricalData$Outbound` instead. */ export type Outbound = SectorIndexHistoricalData$Outbound; } export function sectorIndexHistoricalDataToJSON( sectorIndexHistoricalData: SectorIndexHistoricalData, ): string { return JSON.stringify( SectorIndexHistoricalData$outboundSchema.parse(sectorIndexHistoricalData), ); } export function sectorIndexHistoricalDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SectorIndexHistoricalData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SectorIndexHistoricalData' from JSON`, ); }