/* * 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 BookingCancelTradeAllocationRequest = { /** * The account id. */ accountId: string; /** * The tradeAllocation id. */ tradeAllocationId: string; cancelTradeAllocationRequestCreate: components.CancelTradeAllocationRequestCreate; }; export type BookingCancelTradeAllocationResponse = { httpMeta: components.HTTPMetadata; /** * OK */ cancelTradeAllocationResponse?: | components.CancelTradeAllocationResponse | 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 BookingCancelTradeAllocationRequest$inboundSchema: z.ZodType< BookingCancelTradeAllocationRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), tradeAllocation_id: z.string(), CancelTradeAllocationRequestCreate: components.CancelTradeAllocationRequestCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "tradeAllocation_id": "tradeAllocationId", "CancelTradeAllocationRequestCreate": "cancelTradeAllocationRequestCreate", }); }); /** @internal */ export type BookingCancelTradeAllocationRequest$Outbound = { account_id: string; tradeAllocation_id: string; CancelTradeAllocationRequestCreate: components.CancelTradeAllocationRequestCreate$Outbound; }; /** @internal */ export const BookingCancelTradeAllocationRequest$outboundSchema: z.ZodType< BookingCancelTradeAllocationRequest$Outbound, z.ZodTypeDef, BookingCancelTradeAllocationRequest > = z.object({ accountId: z.string(), tradeAllocationId: z.string(), cancelTradeAllocationRequestCreate: components.CancelTradeAllocationRequestCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", tradeAllocationId: "tradeAllocation_id", cancelTradeAllocationRequestCreate: "CancelTradeAllocationRequestCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingCancelTradeAllocationRequest$ { /** @deprecated use `BookingCancelTradeAllocationRequest$inboundSchema` instead. */ export const inboundSchema = BookingCancelTradeAllocationRequest$inboundSchema; /** @deprecated use `BookingCancelTradeAllocationRequest$outboundSchema` instead. */ export const outboundSchema = BookingCancelTradeAllocationRequest$outboundSchema; /** @deprecated use `BookingCancelTradeAllocationRequest$Outbound` instead. */ export type Outbound = BookingCancelTradeAllocationRequest$Outbound; } export function bookingCancelTradeAllocationRequestToJSON( bookingCancelTradeAllocationRequest: BookingCancelTradeAllocationRequest, ): string { return JSON.stringify( BookingCancelTradeAllocationRequest$outboundSchema.parse( bookingCancelTradeAllocationRequest, ), ); } export function bookingCancelTradeAllocationRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCancelTradeAllocationRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCancelTradeAllocationRequest' from JSON`, ); } /** @internal */ export const BookingCancelTradeAllocationResponse$inboundSchema: z.ZodType< BookingCancelTradeAllocationResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CancelTradeAllocationResponse: components .CancelTradeAllocationResponse$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CancelTradeAllocationResponse": "cancelTradeAllocationResponse", "Status": "status", }); }); /** @internal */ export type BookingCancelTradeAllocationResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CancelTradeAllocationResponse?: | components.CancelTradeAllocationResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BookingCancelTradeAllocationResponse$outboundSchema: z.ZodType< BookingCancelTradeAllocationResponse$Outbound, z.ZodTypeDef, BookingCancelTradeAllocationResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, cancelTradeAllocationResponse: components .CancelTradeAllocationResponse$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", cancelTradeAllocationResponse: "CancelTradeAllocationResponse", 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 BookingCancelTradeAllocationResponse$ { /** @deprecated use `BookingCancelTradeAllocationResponse$inboundSchema` instead. */ export const inboundSchema = BookingCancelTradeAllocationResponse$inboundSchema; /** @deprecated use `BookingCancelTradeAllocationResponse$outboundSchema` instead. */ export const outboundSchema = BookingCancelTradeAllocationResponse$outboundSchema; /** @deprecated use `BookingCancelTradeAllocationResponse$Outbound` instead. */ export type Outbound = BookingCancelTradeAllocationResponse$Outbound; } export function bookingCancelTradeAllocationResponseToJSON( bookingCancelTradeAllocationResponse: BookingCancelTradeAllocationResponse, ): string { return JSON.stringify( BookingCancelTradeAllocationResponse$outboundSchema.parse( bookingCancelTradeAllocationResponse, ), ); } export function bookingCancelTradeAllocationResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCancelTradeAllocationResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCancelTradeAllocationResponse' from JSON`, ); }