/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Filter by organization ID. */ export type OrdersExportQueryParamOrganizationIDFilter = string | Array; /** * Filter by product ID. */ export type OrdersExportQueryParamProductIDFilter = string | Array; export type OrdersExportRequest = { /** * Filter by organization ID. */ organizationId?: string | Array | null | undefined; /** * Filter by product ID. */ productId?: string | Array | null | undefined; }; export type OrdersExportResponse = any | string; /** @internal */ export type OrdersExportQueryParamOrganizationIDFilter$Outbound = | string | Array; /** @internal */ export const OrdersExportQueryParamOrganizationIDFilter$outboundSchema: z.ZodMiniType< OrdersExportQueryParamOrganizationIDFilter$Outbound, OrdersExportQueryParamOrganizationIDFilter > = smartUnion([z.string(), z.array(z.string())]); export function ordersExportQueryParamOrganizationIDFilterToJSON( ordersExportQueryParamOrganizationIDFilter: OrdersExportQueryParamOrganizationIDFilter, ): string { return JSON.stringify( OrdersExportQueryParamOrganizationIDFilter$outboundSchema.parse( ordersExportQueryParamOrganizationIDFilter, ), ); } /** @internal */ export type OrdersExportQueryParamProductIDFilter$Outbound = | string | Array; /** @internal */ export const OrdersExportQueryParamProductIDFilter$outboundSchema: z.ZodMiniType< OrdersExportQueryParamProductIDFilter$Outbound, OrdersExportQueryParamProductIDFilter > = smartUnion([z.string(), z.array(z.string())]); export function ordersExportQueryParamProductIDFilterToJSON( ordersExportQueryParamProductIDFilter: OrdersExportQueryParamProductIDFilter, ): string { return JSON.stringify( OrdersExportQueryParamProductIDFilter$outboundSchema.parse( ordersExportQueryParamProductIDFilter, ), ); } /** @internal */ export type OrdersExportRequest$Outbound = { organization_id?: string | Array | null | undefined; product_id?: string | Array | null | undefined; }; /** @internal */ export const OrdersExportRequest$outboundSchema: z.ZodMiniType< OrdersExportRequest$Outbound, OrdersExportRequest > = z.pipe( z.object({ organizationId: z.optional( z.nullable(smartUnion([z.string(), z.array(z.string())])), ), productId: z.optional( z.nullable(smartUnion([z.string(), z.array(z.string())])), ), }), z.transform((v) => { return remap$(v, { organizationId: "organization_id", productId: "product_id", }); }), ); export function ordersExportRequestToJSON( ordersExportRequest: OrdersExportRequest, ): string { return JSON.stringify( OrdersExportRequest$outboundSchema.parse(ordersExportRequest), ); } /** @internal */ export const OrdersExportResponse$inboundSchema: z.ZodMiniType< OrdersExportResponse, unknown > = smartUnion([z.any(), z.string()]); export function ordersExportResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrdersExportResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrdersExportResponse' from JSON`, ); }