/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Only relevant for CAT reporting when clients have Apex do CAT reporting on their behalf. A value may be provided for non-Equity orders, and will be remembered, but the value will have no impact on how they are processed. Cancel requests without this field set will default to CLIENT */ export enum RemoveOrderRequestCreateCancelInitiator { InitiatorUnspecified = "INITIATOR_UNSPECIFIED", Firm = "FIRM", Client = "CLIENT", } /** * Only relevant for CAT reporting when clients have Apex do CAT reporting on their behalf. A value may be provided for non-Equity orders, and will be remembered, but the value will have no impact on how they are processed. Cancel requests without this field set will default to CLIENT */ export type RemoveOrderRequestCreateCancelInitiatorOpen = OpenEnum< typeof RemoveOrderRequestCreateCancelInitiator >; /** * The message to remove a basket order by client order ID with optional CAT reporting data. */ export type RemoveOrderRequestCreate = { /** * Only relevant for CAT reporting when clients have Apex do CAT reporting on their behalf. A value may be provided for non-Equity orders, and will be remembered, but the value will have no impact on how they are processed. Cancel requests without this field set will default to CLIENT */ cancelInitiator?: RemoveOrderRequestCreateCancelInitiatorOpen | undefined; /** * Related to CAT reporting when Apex reports for the client. A value may be provided for non-Equity orders, and will be remembered, but valid timestamps will have no impact on how they are processed. */ clientCancelReceivedTime?: Date | null | undefined; /** * Related to CAT reporting when Apex reports for the client. Denotes the time the client sent the cancel request to Apex. A value may be provided for non-Equity orders, and will be remembered, but valid timestamps will have no impact on how they are processed. */ clientCancelSentTime?: Date | null | undefined; /** * The client order ID of the basket order to remove. */ clientOrderId: string; }; /** @internal */ export const RemoveOrderRequestCreateCancelInitiator$inboundSchema: z.ZodType< RemoveOrderRequestCreateCancelInitiatorOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(RemoveOrderRequestCreateCancelInitiator), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const RemoveOrderRequestCreateCancelInitiator$outboundSchema: z.ZodType< RemoveOrderRequestCreateCancelInitiatorOpen, z.ZodTypeDef, RemoveOrderRequestCreateCancelInitiatorOpen > = z.union([ z.nativeEnum(RemoveOrderRequestCreateCancelInitiator), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RemoveOrderRequestCreateCancelInitiator$ { /** @deprecated use `RemoveOrderRequestCreateCancelInitiator$inboundSchema` instead. */ export const inboundSchema = RemoveOrderRequestCreateCancelInitiator$inboundSchema; /** @deprecated use `RemoveOrderRequestCreateCancelInitiator$outboundSchema` instead. */ export const outboundSchema = RemoveOrderRequestCreateCancelInitiator$outboundSchema; } /** @internal */ export const RemoveOrderRequestCreate$inboundSchema: z.ZodType< RemoveOrderRequestCreate, z.ZodTypeDef, unknown > = z.object({ cancel_initiator: RemoveOrderRequestCreateCancelInitiator$inboundSchema .optional(), client_cancel_received_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), client_cancel_sent_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), client_order_id: z.string(), }).transform((v) => { return remap$(v, { "cancel_initiator": "cancelInitiator", "client_cancel_received_time": "clientCancelReceivedTime", "client_cancel_sent_time": "clientCancelSentTime", "client_order_id": "clientOrderId", }); }); /** @internal */ export type RemoveOrderRequestCreate$Outbound = { cancel_initiator?: string | undefined; client_cancel_received_time?: string | null | undefined; client_cancel_sent_time?: string | null | undefined; client_order_id: string; }; /** @internal */ export const RemoveOrderRequestCreate$outboundSchema: z.ZodType< RemoveOrderRequestCreate$Outbound, z.ZodTypeDef, RemoveOrderRequestCreate > = z.object({ cancelInitiator: RemoveOrderRequestCreateCancelInitiator$outboundSchema .optional(), clientCancelReceivedTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), clientCancelSentTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), clientOrderId: z.string(), }).transform((v) => { return remap$(v, { cancelInitiator: "cancel_initiator", clientCancelReceivedTime: "client_cancel_received_time", clientCancelSentTime: "client_cancel_sent_time", clientOrderId: "client_order_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RemoveOrderRequestCreate$ { /** @deprecated use `RemoveOrderRequestCreate$inboundSchema` instead. */ export const inboundSchema = RemoveOrderRequestCreate$inboundSchema; /** @deprecated use `RemoveOrderRequestCreate$outboundSchema` instead. */ export const outboundSchema = RemoveOrderRequestCreate$outboundSchema; /** @deprecated use `RemoveOrderRequestCreate$Outbound` instead. */ export type Outbound = RemoveOrderRequestCreate$Outbound; } export function removeOrderRequestCreateToJSON( removeOrderRequestCreate: RemoveOrderRequestCreate, ): string { return JSON.stringify( RemoveOrderRequestCreate$outboundSchema.parse(removeOrderRequestCreate), ); } export function removeOrderRequestCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RemoveOrderRequestCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RemoveOrderRequestCreate' from JSON`, ); }