/* * 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 GetSupplyRequest = { /** * Asset symbol */ symbol: string; /** * Country code (UN/LOCODE). If blank, return global data. */ countryCode?: string | null | undefined; /** * Start of date range for supply forecasts (YYYY-MM-DD) */ startDate?: string | null | undefined; /** * End of date range for supply forecasts (YYYY-MM-DD) */ endDate?: string | null | undefined; /** * Return feature contributions for requested forecasts. */ getFeatureContributions?: boolean | undefined; /** * Supply model to use for forecasting. */ model?: string | undefined; }; /** @internal */ export const GetSupplyRequest$inboundSchema: z.ZodType< GetSupplyRequest, z.ZodTypeDef, unknown > = z.object({ symbol: z.string(), country_code: z.nullable(z.string()).optional(), start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), get_feature_contributions: z.boolean().default(false), model: z.string().default("v2_wholecountry_92to23_interval10_yesyoy_xgb"), }).transform((v) => { return remap$(v, { "country_code": "countryCode", "start_date": "startDate", "end_date": "endDate", "get_feature_contributions": "getFeatureContributions", }); }); /** @internal */ export type GetSupplyRequest$Outbound = { symbol: string; country_code?: string | null | undefined; start_date?: string | null | undefined; end_date?: string | null | undefined; get_feature_contributions: boolean; model: string; }; /** @internal */ export const GetSupplyRequest$outboundSchema: z.ZodType< GetSupplyRequest$Outbound, z.ZodTypeDef, GetSupplyRequest > = z.object({ symbol: z.string(), countryCode: z.nullable(z.string()).optional(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), getFeatureContributions: z.boolean().default(false), model: z.string().default("v2_wholecountry_92to23_interval10_yesyoy_xgb"), }).transform((v) => { return remap$(v, { countryCode: "country_code", startDate: "start_date", endDate: "end_date", getFeatureContributions: "get_feature_contributions", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetSupplyRequest$ { /** @deprecated use `GetSupplyRequest$inboundSchema` instead. */ export const inboundSchema = GetSupplyRequest$inboundSchema; /** @deprecated use `GetSupplyRequest$outboundSchema` instead. */ export const outboundSchema = GetSupplyRequest$outboundSchema; /** @deprecated use `GetSupplyRequest$Outbound` instead. */ export type Outbound = GetSupplyRequest$Outbound; } export function getSupplyRequestToJSON( getSupplyRequest: GetSupplyRequest, ): string { return JSON.stringify( GetSupplyRequest$outboundSchema.parse(getSupplyRequest), ); } export function getSupplyRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetSupplyRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetSupplyRequest' from JSON`, ); }