/* * 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 OrderServiceCreateOrderRequest = { /** * The account id. */ accountId: string; orderCreate: components.OrderCreate; }; export type OrderServiceCreateOrderResponse = { httpMeta: components.HTTPMetadata; /** * OK */ order?: components.Order | 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 OrderServiceCreateOrderRequest$inboundSchema: z.ZodType< OrderServiceCreateOrderRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), OrderCreate: components.OrderCreate$inboundSchema, }).transform((v) => { return remap$(v, { "account_id": "accountId", "OrderCreate": "orderCreate", }); }); /** @internal */ export type OrderServiceCreateOrderRequest$Outbound = { account_id: string; OrderCreate: components.OrderCreate$Outbound; }; /** @internal */ export const OrderServiceCreateOrderRequest$outboundSchema: z.ZodType< OrderServiceCreateOrderRequest$Outbound, z.ZodTypeDef, OrderServiceCreateOrderRequest > = z.object({ accountId: z.string(), orderCreate: components.OrderCreate$outboundSchema, }).transform((v) => { return remap$(v, { accountId: "account_id", orderCreate: "OrderCreate", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OrderServiceCreateOrderRequest$ { /** @deprecated use `OrderServiceCreateOrderRequest$inboundSchema` instead. */ export const inboundSchema = OrderServiceCreateOrderRequest$inboundSchema; /** @deprecated use `OrderServiceCreateOrderRequest$outboundSchema` instead. */ export const outboundSchema = OrderServiceCreateOrderRequest$outboundSchema; /** @deprecated use `OrderServiceCreateOrderRequest$Outbound` instead. */ export type Outbound = OrderServiceCreateOrderRequest$Outbound; } export function orderServiceCreateOrderRequestToJSON( orderServiceCreateOrderRequest: OrderServiceCreateOrderRequest, ): string { return JSON.stringify( OrderServiceCreateOrderRequest$outboundSchema.parse( orderServiceCreateOrderRequest, ), ); } export function orderServiceCreateOrderRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderServiceCreateOrderRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderServiceCreateOrderRequest' from JSON`, ); } /** @internal */ export const OrderServiceCreateOrderResponse$inboundSchema: z.ZodType< OrderServiceCreateOrderResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, Order: components.Order$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "Order": "order", "Status": "status", }); }); /** @internal */ export type OrderServiceCreateOrderResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; Order?: components.Order$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const OrderServiceCreateOrderResponse$outboundSchema: z.ZodType< OrderServiceCreateOrderResponse$Outbound, z.ZodTypeDef, OrderServiceCreateOrderResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, order: components.Order$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", order: "Order", 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 OrderServiceCreateOrderResponse$ { /** @deprecated use `OrderServiceCreateOrderResponse$inboundSchema` instead. */ export const inboundSchema = OrderServiceCreateOrderResponse$inboundSchema; /** @deprecated use `OrderServiceCreateOrderResponse$outboundSchema` instead. */ export const outboundSchema = OrderServiceCreateOrderResponse$outboundSchema; /** @deprecated use `OrderServiceCreateOrderResponse$Outbound` instead. */ export type Outbound = OrderServiceCreateOrderResponse$Outbound; } export function orderServiceCreateOrderResponseToJSON( orderServiceCreateOrderResponse: OrderServiceCreateOrderResponse, ): string { return JSON.stringify( OrderServiceCreateOrderResponse$outboundSchema.parse( orderServiceCreateOrderResponse, ), ); } export function orderServiceCreateOrderResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderServiceCreateOrderResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderServiceCreateOrderResponse' from JSON`, ); }