/* * 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"; import { TradeAllocationCreate, TradeAllocationCreate$inboundSchema, TradeAllocationCreate$Outbound, TradeAllocationCreate$outboundSchema, } from "./tradeallocationcreate.js"; /** * Used to correct a trade allocation. */ export type RebookTradeAllocationRequestCreate = { /** * The name of the original trade allocation to rebook. */ name: string; /** * A globally unique UUID that is specific to the request. This id is used to prevent duplicate requests from being processed. */ requestId: string; /** * A TradeAllocation represents the movement of positions between two ascend accounts. */ tradeAllocation: TradeAllocationCreate; }; /** @internal */ export const RebookTradeAllocationRequestCreate$inboundSchema: z.ZodType< RebookTradeAllocationRequestCreate, z.ZodTypeDef, unknown > = z.object({ name: z.string(), request_id: z.string(), trade_allocation: TradeAllocationCreate$inboundSchema, }).transform((v) => { return remap$(v, { "request_id": "requestId", "trade_allocation": "tradeAllocation", }); }); /** @internal */ export type RebookTradeAllocationRequestCreate$Outbound = { name: string; request_id: string; trade_allocation: TradeAllocationCreate$Outbound; }; /** @internal */ export const RebookTradeAllocationRequestCreate$outboundSchema: z.ZodType< RebookTradeAllocationRequestCreate$Outbound, z.ZodTypeDef, RebookTradeAllocationRequestCreate > = z.object({ name: z.string(), requestId: z.string(), tradeAllocation: TradeAllocationCreate$outboundSchema, }).transform((v) => { return remap$(v, { requestId: "request_id", tradeAllocation: "trade_allocation", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RebookTradeAllocationRequestCreate$ { /** @deprecated use `RebookTradeAllocationRequestCreate$inboundSchema` instead. */ export const inboundSchema = RebookTradeAllocationRequestCreate$inboundSchema; /** @deprecated use `RebookTradeAllocationRequestCreate$outboundSchema` instead. */ export const outboundSchema = RebookTradeAllocationRequestCreate$outboundSchema; /** @deprecated use `RebookTradeAllocationRequestCreate$Outbound` instead. */ export type Outbound = RebookTradeAllocationRequestCreate$Outbound; } export function rebookTradeAllocationRequestCreateToJSON( rebookTradeAllocationRequestCreate: RebookTradeAllocationRequestCreate, ): string { return JSON.stringify( RebookTradeAllocationRequestCreate$outboundSchema.parse( rebookTradeAllocationRequestCreate, ), ); } export function rebookTradeAllocationRequestCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RebookTradeAllocationRequestCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RebookTradeAllocationRequestCreate' from JSON`, ); }