/* * 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 { TradeCreate, TradeCreate$inboundSchema, TradeCreate$Outbound, TradeCreate$outboundSchema, } from "./tradecreate.js"; /** * Used to correct an entire fill of trades using the activity_id that is common to all of the trades in the request */ export type RebookTradeRequestCreate = { /** * The name of the trade to rebook. */ name: string; /** * A Trade represents an entire order made by a client. Trades can hold one or many executions representing partial fills that aggregate into a whole order. */ trade: TradeCreate; }; /** @internal */ export const RebookTradeRequestCreate$inboundSchema: z.ZodType< RebookTradeRequestCreate, z.ZodTypeDef, unknown > = z.object({ name: z.string(), trade: TradeCreate$inboundSchema, }); /** @internal */ export type RebookTradeRequestCreate$Outbound = { name: string; trade: TradeCreate$Outbound; }; /** @internal */ export const RebookTradeRequestCreate$outboundSchema: z.ZodType< RebookTradeRequestCreate$Outbound, z.ZodTypeDef, RebookTradeRequestCreate > = z.object({ name: z.string(), trade: TradeCreate$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RebookTradeRequestCreate$ { /** @deprecated use `RebookTradeRequestCreate$inboundSchema` instead. */ export const inboundSchema = RebookTradeRequestCreate$inboundSchema; /** @deprecated use `RebookTradeRequestCreate$outboundSchema` instead. */ export const outboundSchema = RebookTradeRequestCreate$outboundSchema; /** @deprecated use `RebookTradeRequestCreate$Outbound` instead. */ export type Outbound = RebookTradeRequestCreate$Outbound; } export function rebookTradeRequestCreateToJSON( rebookTradeRequestCreate: RebookTradeRequestCreate, ): string { return JSON.stringify( RebookTradeRequestCreate$outboundSchema.parse(rebookTradeRequestCreate), ); } export function rebookTradeRequestCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RebookTradeRequestCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RebookTradeRequestCreate' from JSON`, ); }