/* * 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"; /** * Price of the trade lot */ export type LotPrice = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * Object containing currency/ price information for the trade lot */ export type LotMoney = { /** * Currency code of the price */ currencyCode?: string | undefined; /** * Price of the trade lot */ price?: LotPrice | null | undefined; }; /** * Quantity of the trade lot */ export type LotQuantity = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * Trade date of the trade lot */ export type LotTradeDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; export type Lot = { /** * Client supplied id */ id?: string | undefined; /** * Object containing currency/ price information for the trade lot */ money?: LotMoney | null | undefined; /** * Quantity of the trade lot */ quantity?: LotQuantity | null | undefined; /** * Trade date of the trade lot */ tradeDate?: LotTradeDate | null | undefined; }; /** @internal */ export const LotPrice$inboundSchema: z.ZodType< LotPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type LotPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const LotPrice$outboundSchema: z.ZodType< LotPrice$Outbound, z.ZodTypeDef, LotPrice > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LotPrice$ { /** @deprecated use `LotPrice$inboundSchema` instead. */ export const inboundSchema = LotPrice$inboundSchema; /** @deprecated use `LotPrice$outboundSchema` instead. */ export const outboundSchema = LotPrice$outboundSchema; /** @deprecated use `LotPrice$Outbound` instead. */ export type Outbound = LotPrice$Outbound; } export function lotPriceToJSON(lotPrice: LotPrice): string { return JSON.stringify(LotPrice$outboundSchema.parse(lotPrice)); } export function lotPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LotPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LotPrice' from JSON`, ); } /** @internal */ export const LotMoney$inboundSchema: z.ZodType< LotMoney, z.ZodTypeDef, unknown > = z.object({ currency_code: z.string().optional(), price: z.nullable(z.lazy(() => LotPrice$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "currency_code": "currencyCode", }); }); /** @internal */ export type LotMoney$Outbound = { currency_code?: string | undefined; price?: LotPrice$Outbound | null | undefined; }; /** @internal */ export const LotMoney$outboundSchema: z.ZodType< LotMoney$Outbound, z.ZodTypeDef, LotMoney > = z.object({ currencyCode: z.string().optional(), price: z.nullable(z.lazy(() => LotPrice$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { currencyCode: "currency_code", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LotMoney$ { /** @deprecated use `LotMoney$inboundSchema` instead. */ export const inboundSchema = LotMoney$inboundSchema; /** @deprecated use `LotMoney$outboundSchema` instead. */ export const outboundSchema = LotMoney$outboundSchema; /** @deprecated use `LotMoney$Outbound` instead. */ export type Outbound = LotMoney$Outbound; } export function lotMoneyToJSON(lotMoney: LotMoney): string { return JSON.stringify(LotMoney$outboundSchema.parse(lotMoney)); } export function lotMoneyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LotMoney$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LotMoney' from JSON`, ); } /** @internal */ export const LotQuantity$inboundSchema: z.ZodType< LotQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type LotQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const LotQuantity$outboundSchema: z.ZodType< LotQuantity$Outbound, z.ZodTypeDef, LotQuantity > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LotQuantity$ { /** @deprecated use `LotQuantity$inboundSchema` instead. */ export const inboundSchema = LotQuantity$inboundSchema; /** @deprecated use `LotQuantity$outboundSchema` instead. */ export const outboundSchema = LotQuantity$outboundSchema; /** @deprecated use `LotQuantity$Outbound` instead. */ export type Outbound = LotQuantity$Outbound; } export function lotQuantityToJSON(lotQuantity: LotQuantity): string { return JSON.stringify(LotQuantity$outboundSchema.parse(lotQuantity)); } export function lotQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LotQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LotQuantity' from JSON`, ); } /** @internal */ export const LotTradeDate$inboundSchema: z.ZodType< LotTradeDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type LotTradeDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const LotTradeDate$outboundSchema: z.ZodType< LotTradeDate$Outbound, z.ZodTypeDef, LotTradeDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LotTradeDate$ { /** @deprecated use `LotTradeDate$inboundSchema` instead. */ export const inboundSchema = LotTradeDate$inboundSchema; /** @deprecated use `LotTradeDate$outboundSchema` instead. */ export const outboundSchema = LotTradeDate$outboundSchema; /** @deprecated use `LotTradeDate$Outbound` instead. */ export type Outbound = LotTradeDate$Outbound; } export function lotTradeDateToJSON(lotTradeDate: LotTradeDate): string { return JSON.stringify(LotTradeDate$outboundSchema.parse(lotTradeDate)); } export function lotTradeDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LotTradeDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LotTradeDate' from JSON`, ); } /** @internal */ export const Lot$inboundSchema: z.ZodType = z .object({ id: z.string().optional(), money: z.nullable(z.lazy(() => LotMoney$inboundSchema)).optional(), quantity: z.nullable(z.lazy(() => LotQuantity$inboundSchema)).optional(), trade_date: z.nullable(z.lazy(() => LotTradeDate$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "trade_date": "tradeDate", }); }); /** @internal */ export type Lot$Outbound = { id?: string | undefined; money?: LotMoney$Outbound | null | undefined; quantity?: LotQuantity$Outbound | null | undefined; trade_date?: LotTradeDate$Outbound | null | undefined; }; /** @internal */ export const Lot$outboundSchema: z.ZodType = z .object({ id: z.string().optional(), money: z.nullable(z.lazy(() => LotMoney$outboundSchema)).optional(), quantity: z.nullable(z.lazy(() => LotQuantity$outboundSchema)).optional(), tradeDate: z.nullable(z.lazy(() => LotTradeDate$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { tradeDate: "trade_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Lot$ { /** @deprecated use `Lot$inboundSchema` instead. */ export const inboundSchema = Lot$inboundSchema; /** @deprecated use `Lot$outboundSchema` instead. */ export const outboundSchema = Lot$outboundSchema; /** @deprecated use `Lot$Outbound` instead. */ export type Outbound = Lot$Outbound; } export function lotToJSON(lot: Lot): string { return JSON.stringify(Lot$outboundSchema.parse(lot)); } export function lotFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Lot$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Lot' from JSON`, ); }