/* * 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 BookingCreateExecutionRequest = { /** * The account id. */ accountId: string; /** * The trade id. */ tradeId: string; executionCreate: components.ExecutionCreate; }; export type BookingCreateExecutionResponse = { httpMeta: components.HTTPMetadata; /** * OK */ execution?: components.Execution | undefined; /** * FAILED_PRECONDITION: The operation was rejected because the system is not in a state required for the operation's processing. * * @remarks * INVALID_ARGUMENT: The request is not valid. */ status?: components.Status | undefined; }; /** @internal */ export const BookingCreateExecutionRequest$inboundSchema: z.ZodType< BookingCreateExecutionRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), trade_id: z.string(), ExecutionCreate: components.ExecutionCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "trade_id": "tradeId", "ExecutionCreate": "executionCreate", }); }); /** @internal */ export type BookingCreateExecutionRequest$Outbound = { account_id: string; trade_id: string; ExecutionCreate: components.ExecutionCreate$Outbound; }; /** @internal */ export const BookingCreateExecutionRequest$outboundSchema: z.ZodType< BookingCreateExecutionRequest$Outbound, z.ZodTypeDef, BookingCreateExecutionRequest > = z.object({ accountId: z.string(), tradeId: z.string(), executionCreate: components.ExecutionCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", tradeId: "trade_id", executionCreate: "ExecutionCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingCreateExecutionRequest$ { /** @deprecated use `BookingCreateExecutionRequest$inboundSchema` instead. */ export const inboundSchema = BookingCreateExecutionRequest$inboundSchema; /** @deprecated use `BookingCreateExecutionRequest$outboundSchema` instead. */ export const outboundSchema = BookingCreateExecutionRequest$outboundSchema; /** @deprecated use `BookingCreateExecutionRequest$Outbound` instead. */ export type Outbound = BookingCreateExecutionRequest$Outbound; } export function bookingCreateExecutionRequestToJSON( bookingCreateExecutionRequest: BookingCreateExecutionRequest, ): string { return JSON.stringify( BookingCreateExecutionRequest$outboundSchema.parse( bookingCreateExecutionRequest, ), ); } export function bookingCreateExecutionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCreateExecutionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCreateExecutionRequest' from JSON`, ); } /** @internal */ export const BookingCreateExecutionResponse$inboundSchema: z.ZodType< BookingCreateExecutionResponse, 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 BookingCreateExecutionResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; Execution?: components.Execution$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BookingCreateExecutionResponse$outboundSchema: z.ZodType< BookingCreateExecutionResponse$Outbound, z.ZodTypeDef, BookingCreateExecutionResponse > = 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 BookingCreateExecutionResponse$ { /** @deprecated use `BookingCreateExecutionResponse$inboundSchema` instead. */ export const inboundSchema = BookingCreateExecutionResponse$inboundSchema; /** @deprecated use `BookingCreateExecutionResponse$outboundSchema` instead. */ export const outboundSchema = BookingCreateExecutionResponse$outboundSchema; /** @deprecated use `BookingCreateExecutionResponse$Outbound` instead. */ export type Outbound = BookingCreateExecutionResponse$Outbound; } export function bookingCreateExecutionResponseToJSON( bookingCreateExecutionResponse: BookingCreateExecutionResponse, ): string { return JSON.stringify( BookingCreateExecutionResponse$outboundSchema.parse( bookingCreateExecutionResponse, ), ); } export function bookingCreateExecutionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingCreateExecutionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingCreateExecutionResponse' from JSON`, ); }