/* * 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 GetAssetClassIndexRequest = { /** * A list of Asset Class (sector) identifier requested. `ALL` can be used to query all asset classes indices at the same time */ assetClassSymbol: string; /** * The type of indexing methodology requested. Equal weight (`equalweight`) or risk-parity (`riskparity`) are supported */ methodology: string; /** * Start of the index data window (YYYY-MM-DD) - Index will start at 100 on that date */ startDate?: string | null | undefined; /** * End of index data window (YYYY-MM-DD) */ endDate?: string | null | undefined; /** * By default, time-series are returned using daily time frequency. Request resampled data using `weekly` or `monthly` as query parameter */ freq?: string | null | undefined; }; /** @internal */ export const GetAssetClassIndexRequest$inboundSchema: z.ZodType< GetAssetClassIndexRequest, z.ZodTypeDef, unknown > = z.object({ asset_class_symbol: z.string(), methodology: z.string(), start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), freq: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "asset_class_symbol": "assetClassSymbol", "start_date": "startDate", "end_date": "endDate", }); }); /** @internal */ export type GetAssetClassIndexRequest$Outbound = { asset_class_symbol: string; methodology: string; start_date?: string | null | undefined; end_date?: string | null | undefined; freq?: string | null | undefined; }; /** @internal */ export const GetAssetClassIndexRequest$outboundSchema: z.ZodType< GetAssetClassIndexRequest$Outbound, z.ZodTypeDef, GetAssetClassIndexRequest > = z.object({ assetClassSymbol: z.string(), methodology: z.string(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), freq: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { assetClassSymbol: "asset_class_symbol", startDate: "start_date", endDate: "end_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetAssetClassIndexRequest$ { /** @deprecated use `GetAssetClassIndexRequest$inboundSchema` instead. */ export const inboundSchema = GetAssetClassIndexRequest$inboundSchema; /** @deprecated use `GetAssetClassIndexRequest$outboundSchema` instead. */ export const outboundSchema = GetAssetClassIndexRequest$outboundSchema; /** @deprecated use `GetAssetClassIndexRequest$Outbound` instead. */ export type Outbound = GetAssetClassIndexRequest$Outbound; } export function getAssetClassIndexRequestToJSON( getAssetClassIndexRequest: GetAssetClassIndexRequest, ): string { return JSON.stringify( GetAssetClassIndexRequest$outboundSchema.parse(getAssetClassIndexRequest), ); } export function getAssetClassIndexRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetAssetClassIndexRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAssetClassIndexRequest' from JSON`, ); }