/* * 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 BookingRebookExecutionRequest = { /** * The account id. */ accountId: string; /** * The trade id. */ tradeId: string; /** * The execution id. */ executionId: string; rebookExecutionRequestCreate: components.RebookExecutionRequestCreate; }; export type BookingRebookExecutionResponse = { httpMeta: components.HTTPMetadata; /** * OK */ rebookExecutionResponse?: components.RebookExecutionResponse | 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 BookingRebookExecutionRequest$inboundSchema: z.ZodType< BookingRebookExecutionRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), trade_id: z.string(), execution_id: z.string(), RebookExecutionRequestCreate: components.RebookExecutionRequestCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "trade_id": "tradeId", "execution_id": "executionId", "RebookExecutionRequestCreate": "rebookExecutionRequestCreate", }); }); /** @internal */ export type BookingRebookExecutionRequest$Outbound = { account_id: string; trade_id: string; execution_id: string; RebookExecutionRequestCreate: components.RebookExecutionRequestCreate$Outbound; }; /** @internal */ export const BookingRebookExecutionRequest$outboundSchema: z.ZodType< BookingRebookExecutionRequest$Outbound, z.ZodTypeDef, BookingRebookExecutionRequest > = z.object({ accountId: z.string(), tradeId: z.string(), executionId: z.string(), rebookExecutionRequestCreate: components.RebookExecutionRequestCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", tradeId: "trade_id", executionId: "execution_id", rebookExecutionRequestCreate: "RebookExecutionRequestCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingRebookExecutionRequest$ { /** @deprecated use `BookingRebookExecutionRequest$inboundSchema` instead. */ export const inboundSchema = BookingRebookExecutionRequest$inboundSchema; /** @deprecated use `BookingRebookExecutionRequest$outboundSchema` instead. */ export const outboundSchema = BookingRebookExecutionRequest$outboundSchema; /** @deprecated use `BookingRebookExecutionRequest$Outbound` instead. */ export type Outbound = BookingRebookExecutionRequest$Outbound; } export function bookingRebookExecutionRequestToJSON( bookingRebookExecutionRequest: BookingRebookExecutionRequest, ): string { return JSON.stringify( BookingRebookExecutionRequest$outboundSchema.parse( bookingRebookExecutionRequest, ), ); } export function bookingRebookExecutionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingRebookExecutionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingRebookExecutionRequest' from JSON`, ); } /** @internal */ export const BookingRebookExecutionResponse$inboundSchema: z.ZodType< BookingRebookExecutionResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, RebookExecutionResponse: components.RebookExecutionResponse$inboundSchema .optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "RebookExecutionResponse": "rebookExecutionResponse", "Status": "status", }); }); /** @internal */ export type BookingRebookExecutionResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; RebookExecutionResponse?: | components.RebookExecutionResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const BookingRebookExecutionResponse$outboundSchema: z.ZodType< BookingRebookExecutionResponse$Outbound, z.ZodTypeDef, BookingRebookExecutionResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, rebookExecutionResponse: components.RebookExecutionResponse$outboundSchema .optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", rebookExecutionResponse: "RebookExecutionResponse", 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 BookingRebookExecutionResponse$ { /** @deprecated use `BookingRebookExecutionResponse$inboundSchema` instead. */ export const inboundSchema = BookingRebookExecutionResponse$inboundSchema; /** @deprecated use `BookingRebookExecutionResponse$outboundSchema` instead. */ export const outboundSchema = BookingRebookExecutionResponse$outboundSchema; /** @deprecated use `BookingRebookExecutionResponse$Outbound` instead. */ export type Outbound = BookingRebookExecutionResponse$Outbound; } export function bookingRebookExecutionResponseToJSON( bookingRebookExecutionResponse: BookingRebookExecutionResponse, ): string { return JSON.stringify( BookingRebookExecutionResponse$outboundSchema.parse( bookingRebookExecutionResponse, ), ); } export function bookingRebookExecutionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingRebookExecutionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingRebookExecutionResponse' from JSON`, ); }