/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DecimalCreate, DecimalCreate$inboundSchema, DecimalCreate$Outbound, DecimalCreate$outboundSchema, } from "./decimalcreate.js"; /** * The position or amount of the asset */ export type PositionCreate = { /** * 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 */ quantity: DecimalCreate; }; /** @internal */ export const PositionCreate$inboundSchema: z.ZodType< PositionCreate, z.ZodTypeDef, unknown > = z.object({ quantity: DecimalCreate$inboundSchema, }); /** @internal */ export type PositionCreate$Outbound = { quantity: DecimalCreate$Outbound; }; /** @internal */ export const PositionCreate$outboundSchema: z.ZodType< PositionCreate$Outbound, z.ZodTypeDef, PositionCreate > = z.object({ quantity: DecimalCreate$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PositionCreate$ { /** @deprecated use `PositionCreate$inboundSchema` instead. */ export const inboundSchema = PositionCreate$inboundSchema; /** @deprecated use `PositionCreate$outboundSchema` instead. */ export const outboundSchema = PositionCreate$outboundSchema; /** @deprecated use `PositionCreate$Outbound` instead. */ export type Outbound = PositionCreate$Outbound; } export function positionCreateToJSON(positionCreate: PositionCreate): string { return JSON.stringify(PositionCreate$outboundSchema.parse(positionCreate)); } export function positionCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PositionCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PositionCreate' from JSON`, ); }