/* * 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 BookingCancelExecutionRequest = { /** * The account id. */ accountId: string; /** * The trade id. */ tradeId: string; /** * The execution id. */ executionId: string; cancelExecutionRequestCreate: components.CancelExecutionRequestCreate; }; export type BookingCancelExecutionResponse = { httpMeta: components.HTTPMetadata; /** * OK */ cancelExecutionResponse?: components.CancelExecutionResponse | 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 BookingCancelExecutionRequest$inboundSchema: z.ZodType< BookingCancelExecutionRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), trade_id: z.string(), execution_id: z.string(), CancelExecutionRequestCreate: components.CancelExecutionRequestCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "trade_id": "tradeId", "execution_id": "executionId", "CancelExecutionRequestCreate": "cancelExecutionRequestCreate", }); }); /** @internal */ export type BookingCancelExecutionRequest$Outbound = { account_id: string; trade_id: string; execution_id: string; CancelExecutionRequestCreate: components.CancelExecutionRequestCreate$Outbound; }; /** @internal */ export const BookingCancelExecutionRequest$outboundSchema: z.ZodType< BookingCancelExecutionRequest$Outbound, z.ZodTypeDef, BookingCancelExecutionRequest > = z.object({ accountId: z.string(), tradeId: z.string(), executionId: z.string(), cancelExecutionRequestCreate: components.CancelExecutionRequestCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", tradeId: "trade_id", executionId: "execution_id", cancelExecutionRequestCreate: "CancelExecutionRequestCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingCancelExecutionRequest$ { /** @deprecated use `BookingCancelExecutionRequest$inboundSchema` instead. */ export const inboundSchema = BookingCancelExecutionRequest$inboundSchema; /** @deprecated use `BookingCancelExecutionRequest$outboundSchema` instead. */ export const outboundSchema = BookingCancelExecutionRequest$outboundSchema; /** @deprecated use `BookingCancelExecutionRequest$Outbound` instead. */ export type Outbound = BookingCancelExecutionRequest$Outbound; } export function bookingCancelExecutionRequestToJSON( bookingCancelExecutionRequest: BookingCancelExecutionRequest, ): string { return JSON.stringify( BookingCancelExecutionRequest$outboundSchema.parse( bookingCancelExecutionRequest, ), ); } export function bookingCancelExecutionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCancelExecutionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCancelExecutionRequest' from JSON`, ); } /** @internal */ export const BookingCancelExecutionResponse$inboundSchema: z.ZodType< BookingCancelExecutionResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CancelExecutionResponse: components.CancelExecutionResponse$inboundSchema .optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CancelExecutionResponse": "cancelExecutionResponse", "Status": "status", }); }); /** @internal */ export type BookingCancelExecutionResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CancelExecutionResponse?: | components.CancelExecutionResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BookingCancelExecutionResponse$outboundSchema: z.ZodType< BookingCancelExecutionResponse$Outbound, z.ZodTypeDef, BookingCancelExecutionResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, cancelExecutionResponse: components.CancelExecutionResponse$outboundSchema .optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", cancelExecutionResponse: "CancelExecutionResponse", 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 BookingCancelExecutionResponse$ { /** @deprecated use `BookingCancelExecutionResponse$inboundSchema` instead. */ export const inboundSchema = BookingCancelExecutionResponse$inboundSchema; /** @deprecated use `BookingCancelExecutionResponse$outboundSchema` instead. */ export const outboundSchema = BookingCancelExecutionResponse$outboundSchema; /** @deprecated use `BookingCancelExecutionResponse$Outbound` instead. */ export type Outbound = BookingCancelExecutionResponse$Outbound; } export function bookingCancelExecutionResponseToJSON( bookingCancelExecutionResponse: BookingCancelExecutionResponse, ): string { return JSON.stringify( BookingCancelExecutionResponse$outboundSchema.parse( bookingCancelExecutionResponse, ), ); } export function bookingCancelExecutionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCancelExecutionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCancelExecutionResponse' from JSON`, ); }