/* * 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 OrderServiceGetOrderRequest = { /** * The account id. */ accountId: string; /** * The order id. */ orderId: string; }; export type OrderServiceGetOrderResponse = { httpMeta: components.HTTPMetadata; /** * OK */ order?: components.Order | undefined; /** * INVALID_ARGUMENT: The account_id or the order_id could not be determined for the request. */ status?: components.Status | undefined; }; /** @internal */ export const OrderServiceGetOrderRequest$inboundSchema: z.ZodType< OrderServiceGetOrderRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), order_id: z.string(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "order_id": "orderId", }); }); /** @internal */ export type OrderServiceGetOrderRequest$Outbound = { account_id: string; order_id: string; }; /** @internal */ export const OrderServiceGetOrderRequest$outboundSchema: z.ZodType< OrderServiceGetOrderRequest$Outbound, z.ZodTypeDef, OrderServiceGetOrderRequest > = z.object({ accountId: z.string(), orderId: z.string(), }).transform((v) => { return remap$(v, { accountId: "account_id", orderId: "order_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OrderServiceGetOrderRequest$ { /** @deprecated use `OrderServiceGetOrderRequest$inboundSchema` instead. */ export const inboundSchema = OrderServiceGetOrderRequest$inboundSchema; /** @deprecated use `OrderServiceGetOrderRequest$outboundSchema` instead. */ export const outboundSchema = OrderServiceGetOrderRequest$outboundSchema; /** @deprecated use `OrderServiceGetOrderRequest$Outbound` instead. */ export type Outbound = OrderServiceGetOrderRequest$Outbound; } export function orderServiceGetOrderRequestToJSON( orderServiceGetOrderRequest: OrderServiceGetOrderRequest, ): string { return JSON.stringify( OrderServiceGetOrderRequest$outboundSchema.parse( orderServiceGetOrderRequest, ), ); } export function orderServiceGetOrderRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderServiceGetOrderRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderServiceGetOrderRequest' from JSON`, ); } /** @internal */ export const OrderServiceGetOrderResponse$inboundSchema: z.ZodType< OrderServiceGetOrderResponse, 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 OrderServiceGetOrderResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; Order?: components.Order$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const OrderServiceGetOrderResponse$outboundSchema: z.ZodType< OrderServiceGetOrderResponse$Outbound, z.ZodTypeDef, OrderServiceGetOrderResponse > = 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 OrderServiceGetOrderResponse$ { /** @deprecated use `OrderServiceGetOrderResponse$inboundSchema` instead. */ export const inboundSchema = OrderServiceGetOrderResponse$inboundSchema; /** @deprecated use `OrderServiceGetOrderResponse$outboundSchema` instead. */ export const outboundSchema = OrderServiceGetOrderResponse$outboundSchema; /** @deprecated use `OrderServiceGetOrderResponse$Outbound` instead. */ export type Outbound = OrderServiceGetOrderResponse$Outbound; } export function orderServiceGetOrderResponseToJSON( orderServiceGetOrderResponse: OrderServiceGetOrderResponse, ): string { return JSON.stringify( OrderServiceGetOrderResponse$outboundSchema.parse( orderServiceGetOrderResponse, ), ); } export function orderServiceGetOrderResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderServiceGetOrderResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderServiceGetOrderResponse' from JSON`, ); }