/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type BookingCreateTradeAllocationRequest = { /** * The account id. */ accountId: string; /** * A globally unique UUID that is specific to the request. This id is used to prevent duplicate requests from being processed. */ requestId?: string | undefined; tradeAllocationCreate: components.TradeAllocationCreate; }; export type BookingCreateTradeAllocationResponse = { httpMeta: components.HTTPMetadata; /** * OK */ tradeAllocation?: components.TradeAllocation | undefined; /** * INVALID_ARGUMENT: The request is not valid. * * @remarks * FAILED_PRECONDITION: The operation was rejected because the system is not in a state required for the operation's processing. */ status?: components.Status | undefined; }; /** @internal */ export const BookingCreateTradeAllocationRequest$inboundSchema: z.ZodType< BookingCreateTradeAllocationRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), request_id: z.string().optional(), TradeAllocationCreate: components.TradeAllocationCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "request_id": "requestId", "TradeAllocationCreate": "tradeAllocationCreate", }); }); /** @internal */ export type BookingCreateTradeAllocationRequest$Outbound = { account_id: string; request_id?: string | undefined; TradeAllocationCreate: components.TradeAllocationCreate$Outbound; }; /** @internal */ export const BookingCreateTradeAllocationRequest$outboundSchema: z.ZodType< BookingCreateTradeAllocationRequest$Outbound, z.ZodTypeDef, BookingCreateTradeAllocationRequest > = z.object({ accountId: z.string(), requestId: z.string().optional(), tradeAllocationCreate: components.TradeAllocationCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", requestId: "request_id", tradeAllocationCreate: "TradeAllocationCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingCreateTradeAllocationRequest$ { /** @deprecated use `BookingCreateTradeAllocationRequest$inboundSchema` instead. */ export const inboundSchema = BookingCreateTradeAllocationRequest$inboundSchema; /** @deprecated use `BookingCreateTradeAllocationRequest$outboundSchema` instead. */ export const outboundSchema = BookingCreateTradeAllocationRequest$outboundSchema; /** @deprecated use `BookingCreateTradeAllocationRequest$Outbound` instead. */ export type Outbound = BookingCreateTradeAllocationRequest$Outbound; } export function bookingCreateTradeAllocationRequestToJSON( bookingCreateTradeAllocationRequest: BookingCreateTradeAllocationRequest, ): string { return JSON.stringify( BookingCreateTradeAllocationRequest$outboundSchema.parse( bookingCreateTradeAllocationRequest, ), ); } export function bookingCreateTradeAllocationRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCreateTradeAllocationRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCreateTradeAllocationRequest' from JSON`, ); } /** @internal */ export const BookingCreateTradeAllocationResponse$inboundSchema: z.ZodType< BookingCreateTradeAllocationResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, TradeAllocation: components.TradeAllocation$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "TradeAllocation": "tradeAllocation", "Status": "status", }); }); /** @internal */ export type BookingCreateTradeAllocationResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; TradeAllocation?: components.TradeAllocation$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BookingCreateTradeAllocationResponse$outboundSchema: z.ZodType< BookingCreateTradeAllocationResponse$Outbound, z.ZodTypeDef, BookingCreateTradeAllocationResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, tradeAllocation: components.TradeAllocation$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", tradeAllocation: "TradeAllocation", status: "Status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingCreateTradeAllocationResponse$ { /** @deprecated use `BookingCreateTradeAllocationResponse$inboundSchema` instead. */ export const inboundSchema = BookingCreateTradeAllocationResponse$inboundSchema; /** @deprecated use `BookingCreateTradeAllocationResponse$outboundSchema` instead. */ export const outboundSchema = BookingCreateTradeAllocationResponse$outboundSchema; /** @deprecated use `BookingCreateTradeAllocationResponse$Outbound` instead. */ export type Outbound = BookingCreateTradeAllocationResponse$Outbound; } export function bookingCreateTradeAllocationResponseToJSON( bookingCreateTradeAllocationResponse: BookingCreateTradeAllocationResponse, ): string { return JSON.stringify( BookingCreateTradeAllocationResponse$outboundSchema.parse( bookingCreateTradeAllocationResponse, ), ); } export function bookingCreateTradeAllocationResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCreateTradeAllocationResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCreateTradeAllocationResponse' from JSON`, ); }