/* * 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 GetForexPricesRequest = { /** * Forex code */ code: string; /** * Start of forex data window (YYYY-MM-DD) */ startDate?: string | null | undefined; /** * End of forex data window (YYYY-MM-DD) */ endDate?: string | null | undefined; /** * Return prices as foreign currency per USD. If false, prices will be returned as USD per foreign currency. */ foreignPerUsd?: boolean | undefined; }; /** @internal */ export const GetForexPricesRequest$inboundSchema: z.ZodType< GetForexPricesRequest, z.ZodTypeDef, unknown > = z.object({ code: z.string(), start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), foreign_per_usd: z.boolean().default(true), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "foreign_per_usd": "foreignPerUsd", }); }); /** @internal */ export type GetForexPricesRequest$Outbound = { code: string; start_date?: string | null | undefined; end_date?: string | null | undefined; foreign_per_usd: boolean; }; /** @internal */ export const GetForexPricesRequest$outboundSchema: z.ZodType< GetForexPricesRequest$Outbound, z.ZodTypeDef, GetForexPricesRequest > = z.object({ code: z.string(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), foreignPerUsd: z.boolean().default(true), }).transform((v) => { return remap$(v, { startDate: "start_date", endDate: "end_date", foreignPerUsd: "foreign_per_usd", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetForexPricesRequest$ { /** @deprecated use `GetForexPricesRequest$inboundSchema` instead. */ export const inboundSchema = GetForexPricesRequest$inboundSchema; /** @deprecated use `GetForexPricesRequest$outboundSchema` instead. */ export const outboundSchema = GetForexPricesRequest$outboundSchema; /** @deprecated use `GetForexPricesRequest$Outbound` instead. */ export type Outbound = GetForexPricesRequest$Outbound; } export function getForexPricesRequestToJSON( getForexPricesRequest: GetForexPricesRequest, ): string { return JSON.stringify( GetForexPricesRequest$outboundSchema.parse(getForexPricesRequest), ); } export function getForexPricesRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetForexPricesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetForexPricesRequest' from JSON`, ); }