/* * 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 BookingGetExecutionRequest = { /** * The account id. */ accountId: string; /** * The trade id. */ tradeId: string; /** * The execution id. */ executionId: string; }; export type BookingGetExecutionResponse = { httpMeta: components.HTTPMetadata; /** * OK */ execution?: components.Execution | undefined; /** * INVALID_ARGUMENT: The request is not valid. */ status?: components.Status | undefined; }; /** @internal */ export const BookingGetExecutionRequest$inboundSchema: z.ZodType< BookingGetExecutionRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), trade_id: z.string(), execution_id: z.string(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "trade_id": "tradeId", "execution_id": "executionId", }); }); /** @internal */ export type BookingGetExecutionRequest$Outbound = { account_id: string; trade_id: string; execution_id: string; }; /** @internal */ export const BookingGetExecutionRequest$outboundSchema: z.ZodType< BookingGetExecutionRequest$Outbound, z.ZodTypeDef, BookingGetExecutionRequest > = z.object({ accountId: z.string(), tradeId: z.string(), executionId: z.string(), }).transform((v) => { return remap$(v, { accountId: "account_id", tradeId: "trade_id", executionId: "execution_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingGetExecutionRequest$ { /** @deprecated use `BookingGetExecutionRequest$inboundSchema` instead. */ export const inboundSchema = BookingGetExecutionRequest$inboundSchema; /** @deprecated use `BookingGetExecutionRequest$outboundSchema` instead. */ export const outboundSchema = BookingGetExecutionRequest$outboundSchema; /** @deprecated use `BookingGetExecutionRequest$Outbound` instead. */ export type Outbound = BookingGetExecutionRequest$Outbound; } export function bookingGetExecutionRequestToJSON( bookingGetExecutionRequest: BookingGetExecutionRequest, ): string { return JSON.stringify( BookingGetExecutionRequest$outboundSchema.parse(bookingGetExecutionRequest), ); } export function bookingGetExecutionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingGetExecutionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingGetExecutionRequest' from JSON`, ); } /** @internal */ export const BookingGetExecutionResponse$inboundSchema: z.ZodType< BookingGetExecutionResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, Execution: components.Execution$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Execution": "execution", "Status": "status", }); }); /** @internal */ export type BookingGetExecutionResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; Execution?: components.Execution$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BookingGetExecutionResponse$outboundSchema: z.ZodType< BookingGetExecutionResponse$Outbound, z.ZodTypeDef, BookingGetExecutionResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, execution: components.Execution$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", execution: "Execution", 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 BookingGetExecutionResponse$ { /** @deprecated use `BookingGetExecutionResponse$inboundSchema` instead. */ export const inboundSchema = BookingGetExecutionResponse$inboundSchema; /** @deprecated use `BookingGetExecutionResponse$outboundSchema` instead. */ export const outboundSchema = BookingGetExecutionResponse$outboundSchema; /** @deprecated use `BookingGetExecutionResponse$Outbound` instead. */ export type Outbound = BookingGetExecutionResponse$Outbound; } export function bookingGetExecutionResponseToJSON( bookingGetExecutionResponse: BookingGetExecutionResponse, ): string { return JSON.stringify( BookingGetExecutionResponse$outboundSchema.parse( bookingGetExecutionResponse, ), ); } export function bookingGetExecutionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingGetExecutionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingGetExecutionResponse' from JSON`, ); }