/* * 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 GetFeaturesHistoricalValuesRequest = { /** * Feature code */ featureCode: string; /** * Start of feature data window (YYYY-MM-DD) */ startDate?: string | null | undefined; /** * End of feature data window (YYYY-MM-DD) */ endDate?: string | null | undefined; /** * If a future symbol is provided and a model for that commodity exists, a signed strength indicator will be returned in addition to the feature value */ addStrengthForCommodity?: 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; /** * If a `weekly` or `monthly` frequency is requested, this parameter allows to control how the returned data is aggregated over each period. `mean` and `last` are supported */ agg?: string | null | undefined; }; /** @internal */ export const GetFeaturesHistoricalValuesRequest$inboundSchema: z.ZodType< GetFeaturesHistoricalValuesRequest, z.ZodTypeDef, unknown > = z.object({ feature_code: z.string(), start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), add_strength_for_commodity: z.nullable(z.string()).optional(), freq: z.nullable(z.string()).optional(), agg: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "feature_code": "featureCode", "start_date": "startDate", "end_date": "endDate", "add_strength_for_commodity": "addStrengthForCommodity", }); }); /** @internal */ export type GetFeaturesHistoricalValuesRequest$Outbound = { feature_code: string; start_date?: string | null | undefined; end_date?: string | null | undefined; add_strength_for_commodity?: string | null | undefined; freq?: string | null | undefined; agg?: string | null | undefined; }; /** @internal */ export const GetFeaturesHistoricalValuesRequest$outboundSchema: z.ZodType< GetFeaturesHistoricalValuesRequest$Outbound, z.ZodTypeDef, GetFeaturesHistoricalValuesRequest > = z.object({ featureCode: z.string(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), addStrengthForCommodity: z.nullable(z.string()).optional(), freq: z.nullable(z.string()).optional(), agg: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { featureCode: "feature_code", startDate: "start_date", endDate: "end_date", addStrengthForCommodity: "add_strength_for_commodity", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetFeaturesHistoricalValuesRequest$ { /** @deprecated use `GetFeaturesHistoricalValuesRequest$inboundSchema` instead. */ export const inboundSchema = GetFeaturesHistoricalValuesRequest$inboundSchema; /** @deprecated use `GetFeaturesHistoricalValuesRequest$outboundSchema` instead. */ export const outboundSchema = GetFeaturesHistoricalValuesRequest$outboundSchema; /** @deprecated use `GetFeaturesHistoricalValuesRequest$Outbound` instead. */ export type Outbound = GetFeaturesHistoricalValuesRequest$Outbound; } export function getFeaturesHistoricalValuesRequestToJSON( getFeaturesHistoricalValuesRequest: GetFeaturesHistoricalValuesRequest, ): string { return JSON.stringify( GetFeaturesHistoricalValuesRequest$outboundSchema.parse( getFeaturesHistoricalValuesRequest, ), ); } export function getFeaturesHistoricalValuesRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetFeaturesHistoricalValuesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetFeaturesHistoricalValuesRequest' from JSON`, ); }