/* * 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 OrderPriceServicePreviewOrderCostRequest = { /** * The account id. */ accountId: string; orderCostPreviewRequestCreate: components.OrderCostPreviewRequestCreate; }; export type OrderPriceServicePreviewOrderCostResponse = { httpMeta: components.HTTPMetadata; /** * OK */ orderCostPreviewResponse?: components.OrderCostPreviewResponse | undefined; /** * INVALID_ARGUMENT: There was an issue with one or more fields in the request. The message field will contain details about which field failed validation and why. */ status?: components.Status | undefined; }; /** @internal */ export const OrderPriceServicePreviewOrderCostRequest$inboundSchema: z.ZodType< OrderPriceServicePreviewOrderCostRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), OrderCostPreviewRequestCreate: components.OrderCostPreviewRequestCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "OrderCostPreviewRequestCreate": "orderCostPreviewRequestCreate", }); }); /** @internal */ export type OrderPriceServicePreviewOrderCostRequest$Outbound = { account_id: string; OrderCostPreviewRequestCreate: components.OrderCostPreviewRequestCreate$Outbound; }; /** @internal */ export const OrderPriceServicePreviewOrderCostRequest$outboundSchema: z.ZodType< OrderPriceServicePreviewOrderCostRequest$Outbound, z.ZodTypeDef, OrderPriceServicePreviewOrderCostRequest > = z.object({ accountId: z.string(), orderCostPreviewRequestCreate: components.OrderCostPreviewRequestCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", orderCostPreviewRequestCreate: "OrderCostPreviewRequestCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OrderPriceServicePreviewOrderCostRequest$ { /** @deprecated use `OrderPriceServicePreviewOrderCostRequest$inboundSchema` instead. */ export const inboundSchema = OrderPriceServicePreviewOrderCostRequest$inboundSchema; /** @deprecated use `OrderPriceServicePreviewOrderCostRequest$outboundSchema` instead. */ export const outboundSchema = OrderPriceServicePreviewOrderCostRequest$outboundSchema; /** @deprecated use `OrderPriceServicePreviewOrderCostRequest$Outbound` instead. */ export type Outbound = OrderPriceServicePreviewOrderCostRequest$Outbound; } export function orderPriceServicePreviewOrderCostRequestToJSON( orderPriceServicePreviewOrderCostRequest: OrderPriceServicePreviewOrderCostRequest, ): string { return JSON.stringify( OrderPriceServicePreviewOrderCostRequest$outboundSchema.parse( orderPriceServicePreviewOrderCostRequest, ), ); } export function orderPriceServicePreviewOrderCostRequestFromJSON( jsonString: string, ): SafeParseResult< OrderPriceServicePreviewOrderCostRequest, SDKValidationError > { return safeParse( jsonString, (x) => OrderPriceServicePreviewOrderCostRequest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'OrderPriceServicePreviewOrderCostRequest' from JSON`, ); } /** @internal */ export const OrderPriceServicePreviewOrderCostResponse$inboundSchema: z.ZodType< OrderPriceServicePreviewOrderCostResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, OrderCostPreviewResponse: components.OrderCostPreviewResponse$inboundSchema .optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "OrderCostPreviewResponse": "orderCostPreviewResponse", "Status": "status", }); }); /** @internal */ export type OrderPriceServicePreviewOrderCostResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; OrderCostPreviewResponse?: | components.OrderCostPreviewResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const OrderPriceServicePreviewOrderCostResponse$outboundSchema: z.ZodType< OrderPriceServicePreviewOrderCostResponse$Outbound, z.ZodTypeDef, OrderPriceServicePreviewOrderCostResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, orderCostPreviewResponse: components.OrderCostPreviewResponse$outboundSchema .optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", orderCostPreviewResponse: "OrderCostPreviewResponse", 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 OrderPriceServicePreviewOrderCostResponse$ { /** @deprecated use `OrderPriceServicePreviewOrderCostResponse$inboundSchema` instead. */ export const inboundSchema = OrderPriceServicePreviewOrderCostResponse$inboundSchema; /** @deprecated use `OrderPriceServicePreviewOrderCostResponse$outboundSchema` instead. */ export const outboundSchema = OrderPriceServicePreviewOrderCostResponse$outboundSchema; /** @deprecated use `OrderPriceServicePreviewOrderCostResponse$Outbound` instead. */ export type Outbound = OrderPriceServicePreviewOrderCostResponse$Outbound; } export function orderPriceServicePreviewOrderCostResponseToJSON( orderPriceServicePreviewOrderCostResponse: OrderPriceServicePreviewOrderCostResponse, ): string { return JSON.stringify( OrderPriceServicePreviewOrderCostResponse$outboundSchema.parse( orderPriceServicePreviewOrderCostResponse, ), ); } export function orderPriceServicePreviewOrderCostResponseFromJSON( jsonString: string, ): SafeParseResult< OrderPriceServicePreviewOrderCostResponse, SDKValidationError > { return safeParse( jsonString, (x) => OrderPriceServicePreviewOrderCostResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'OrderPriceServicePreviewOrderCostResponse' from JSON`, ); }