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