/* * 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 BookingGetTradeAllocationRequest = { /** * The account id. */ accountId: string; /** * The tradeAllocation id. */ tradeAllocationId: string; }; export type BookingGetTradeAllocationResponse = { 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 BookingGetTradeAllocationRequest$inboundSchema: z.ZodType< BookingGetTradeAllocationRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), tradeAllocation_id: z.string(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "tradeAllocation_id": "tradeAllocationId", }); }); /** @internal */ export type BookingGetTradeAllocationRequest$Outbound = { account_id: string; tradeAllocation_id: string; }; /** @internal */ export const BookingGetTradeAllocationRequest$outboundSchema: z.ZodType< BookingGetTradeAllocationRequest$Outbound, z.ZodTypeDef, BookingGetTradeAllocationRequest > = z.object({ accountId: z.string(), tradeAllocationId: z.string(), }).transform((v) => { return remap$(v, { accountId: "account_id", tradeAllocationId: "tradeAllocation_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingGetTradeAllocationRequest$ { /** @deprecated use `BookingGetTradeAllocationRequest$inboundSchema` instead. */ export const inboundSchema = BookingGetTradeAllocationRequest$inboundSchema; /** @deprecated use `BookingGetTradeAllocationRequest$outboundSchema` instead. */ export const outboundSchema = BookingGetTradeAllocationRequest$outboundSchema; /** @deprecated use `BookingGetTradeAllocationRequest$Outbound` instead. */ export type Outbound = BookingGetTradeAllocationRequest$Outbound; } export function bookingGetTradeAllocationRequestToJSON( bookingGetTradeAllocationRequest: BookingGetTradeAllocationRequest, ): string { return JSON.stringify( BookingGetTradeAllocationRequest$outboundSchema.parse( bookingGetTradeAllocationRequest, ), ); } export function bookingGetTradeAllocationRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingGetTradeAllocationRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingGetTradeAllocationRequest' from JSON`, ); } /** @internal */ export const BookingGetTradeAllocationResponse$inboundSchema: z.ZodType< BookingGetTradeAllocationResponse, 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 BookingGetTradeAllocationResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; TradeAllocation?: components.TradeAllocation$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BookingGetTradeAllocationResponse$outboundSchema: z.ZodType< BookingGetTradeAllocationResponse$Outbound, z.ZodTypeDef, BookingGetTradeAllocationResponse > = 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 BookingGetTradeAllocationResponse$ { /** @deprecated use `BookingGetTradeAllocationResponse$inboundSchema` instead. */ export const inboundSchema = BookingGetTradeAllocationResponse$inboundSchema; /** @deprecated use `BookingGetTradeAllocationResponse$outboundSchema` instead. */ export const outboundSchema = BookingGetTradeAllocationResponse$outboundSchema; /** @deprecated use `BookingGetTradeAllocationResponse$Outbound` instead. */ export type Outbound = BookingGetTradeAllocationResponse$Outbound; } export function bookingGetTradeAllocationResponseToJSON( bookingGetTradeAllocationResponse: BookingGetTradeAllocationResponse, ): string { return JSON.stringify( BookingGetTradeAllocationResponse$outboundSchema.parse( bookingGetTradeAllocationResponse, ), ); } export function bookingGetTradeAllocationResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingGetTradeAllocationResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingGetTradeAllocationResponse' from JSON`, ); }