/* * 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"; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ export type BookingLotMoneyPrice = { /** * 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; }; /** * Deprecated; use the price field instead * * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. */ export type BookingLotMoney = { currencyCode?: string | undefined; price?: BookingLotMoneyPrice | null | undefined; }; /** * Lot price in the same currency as the trade price */ export type BookingLotPrice = { /** * 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; }; /** * Lot quantity */ export type BookingLotQuantity = { /** * 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 for this lot specifically */ export type TradeDate = { /** * 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; }; /** * For use in specifying lot matching instructions on a trade */ export type BookingLot = { /** * User-specified ID for the lot */ id?: string | undefined; /** * Deprecated; use the price field instead * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ money?: BookingLotMoney | null | undefined; /** * Lot price in the same currency as the trade price */ price?: BookingLotPrice | null | undefined; /** * Lot quantity */ quantity?: BookingLotQuantity | null | undefined; /** * Trade date for this lot specifically */ tradeDate?: TradeDate | null | undefined; }; /** @internal */ export const BookingLotMoneyPrice$inboundSchema: z.ZodType< BookingLotMoneyPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type BookingLotMoneyPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const BookingLotMoneyPrice$outboundSchema: z.ZodType< BookingLotMoneyPrice$Outbound, z.ZodTypeDef, BookingLotMoneyPrice > = 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 BookingLotMoneyPrice$ { /** @deprecated use `BookingLotMoneyPrice$inboundSchema` instead. */ export const inboundSchema = BookingLotMoneyPrice$inboundSchema; /** @deprecated use `BookingLotMoneyPrice$outboundSchema` instead. */ export const outboundSchema = BookingLotMoneyPrice$outboundSchema; /** @deprecated use `BookingLotMoneyPrice$Outbound` instead. */ export type Outbound = BookingLotMoneyPrice$Outbound; } export function bookingLotMoneyPriceToJSON( bookingLotMoneyPrice: BookingLotMoneyPrice, ): string { return JSON.stringify( BookingLotMoneyPrice$outboundSchema.parse(bookingLotMoneyPrice), ); } export function bookingLotMoneyPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingLotMoneyPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingLotMoneyPrice' from JSON`, ); } /** @internal */ export const BookingLotMoney$inboundSchema: z.ZodType< BookingLotMoney, z.ZodTypeDef, unknown > = z.object({ currency_code: z.string().optional(), price: z.nullable(z.lazy(() => BookingLotMoneyPrice$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "currency_code": "currencyCode", }); }); /** @internal */ export type BookingLotMoney$Outbound = { currency_code?: string | undefined; price?: BookingLotMoneyPrice$Outbound | null | undefined; }; /** @internal */ export const BookingLotMoney$outboundSchema: z.ZodType< BookingLotMoney$Outbound, z.ZodTypeDef, BookingLotMoney > = z.object({ currencyCode: z.string().optional(), price: z.nullable(z.lazy(() => BookingLotMoneyPrice$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 BookingLotMoney$ { /** @deprecated use `BookingLotMoney$inboundSchema` instead. */ export const inboundSchema = BookingLotMoney$inboundSchema; /** @deprecated use `BookingLotMoney$outboundSchema` instead. */ export const outboundSchema = BookingLotMoney$outboundSchema; /** @deprecated use `BookingLotMoney$Outbound` instead. */ export type Outbound = BookingLotMoney$Outbound; } export function bookingLotMoneyToJSON( bookingLotMoney: BookingLotMoney, ): string { return JSON.stringify(BookingLotMoney$outboundSchema.parse(bookingLotMoney)); } export function bookingLotMoneyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingLotMoney$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingLotMoney' from JSON`, ); } /** @internal */ export const BookingLotPrice$inboundSchema: z.ZodType< BookingLotPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type BookingLotPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const BookingLotPrice$outboundSchema: z.ZodType< BookingLotPrice$Outbound, z.ZodTypeDef, BookingLotPrice > = 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 BookingLotPrice$ { /** @deprecated use `BookingLotPrice$inboundSchema` instead. */ export const inboundSchema = BookingLotPrice$inboundSchema; /** @deprecated use `BookingLotPrice$outboundSchema` instead. */ export const outboundSchema = BookingLotPrice$outboundSchema; /** @deprecated use `BookingLotPrice$Outbound` instead. */ export type Outbound = BookingLotPrice$Outbound; } export function bookingLotPriceToJSON( bookingLotPrice: BookingLotPrice, ): string { return JSON.stringify(BookingLotPrice$outboundSchema.parse(bookingLotPrice)); } export function bookingLotPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingLotPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingLotPrice' from JSON`, ); } /** @internal */ export const BookingLotQuantity$inboundSchema: z.ZodType< BookingLotQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type BookingLotQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const BookingLotQuantity$outboundSchema: z.ZodType< BookingLotQuantity$Outbound, z.ZodTypeDef, BookingLotQuantity > = 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 BookingLotQuantity$ { /** @deprecated use `BookingLotQuantity$inboundSchema` instead. */ export const inboundSchema = BookingLotQuantity$inboundSchema; /** @deprecated use `BookingLotQuantity$outboundSchema` instead. */ export const outboundSchema = BookingLotQuantity$outboundSchema; /** @deprecated use `BookingLotQuantity$Outbound` instead. */ export type Outbound = BookingLotQuantity$Outbound; } export function bookingLotQuantityToJSON( bookingLotQuantity: BookingLotQuantity, ): string { return JSON.stringify( BookingLotQuantity$outboundSchema.parse(bookingLotQuantity), ); } export function bookingLotQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingLotQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingLotQuantity' from JSON`, ); } /** @internal */ export const TradeDate$inboundSchema: z.ZodType< TradeDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type TradeDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const TradeDate$outboundSchema: z.ZodType< TradeDate$Outbound, z.ZodTypeDef, TradeDate > = 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 TradeDate$ { /** @deprecated use `TradeDate$inboundSchema` instead. */ export const inboundSchema = TradeDate$inboundSchema; /** @deprecated use `TradeDate$outboundSchema` instead. */ export const outboundSchema = TradeDate$outboundSchema; /** @deprecated use `TradeDate$Outbound` instead. */ export type Outbound = TradeDate$Outbound; } export function tradeDateToJSON(tradeDate: TradeDate): string { return JSON.stringify(TradeDate$outboundSchema.parse(tradeDate)); } export function tradeDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TradeDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TradeDate' from JSON`, ); } /** @internal */ export const BookingLot$inboundSchema: z.ZodType< BookingLot, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), money: z.nullable(z.lazy(() => BookingLotMoney$inboundSchema)).optional(), price: z.nullable(z.lazy(() => BookingLotPrice$inboundSchema)).optional(), quantity: z.nullable(z.lazy(() => BookingLotQuantity$inboundSchema)) .optional(), trade_date: z.nullable(z.lazy(() => TradeDate$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "trade_date": "tradeDate", }); }); /** @internal */ export type BookingLot$Outbound = { id?: string | undefined; money?: BookingLotMoney$Outbound | null | undefined; price?: BookingLotPrice$Outbound | null | undefined; quantity?: BookingLotQuantity$Outbound | null | undefined; trade_date?: TradeDate$Outbound | null | undefined; }; /** @internal */ export const BookingLot$outboundSchema: z.ZodType< BookingLot$Outbound, z.ZodTypeDef, BookingLot > = z.object({ id: z.string().optional(), money: z.nullable(z.lazy(() => BookingLotMoney$outboundSchema)).optional(), price: z.nullable(z.lazy(() => BookingLotPrice$outboundSchema)).optional(), quantity: z.nullable(z.lazy(() => BookingLotQuantity$outboundSchema)) .optional(), tradeDate: z.nullable(z.lazy(() => TradeDate$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 BookingLot$ { /** @deprecated use `BookingLot$inboundSchema` instead. */ export const inboundSchema = BookingLot$inboundSchema; /** @deprecated use `BookingLot$outboundSchema` instead. */ export const outboundSchema = BookingLot$outboundSchema; /** @deprecated use `BookingLot$Outbound` instead. */ export type Outbound = BookingLot$Outbound; } export function bookingLotToJSON(bookingLot: BookingLot): string { return JSON.stringify(BookingLot$outboundSchema.parse(bookingLot)); } export function bookingLotFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingLot$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingLot' from JSON`, ); }