/*
* 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 * as components from "../components/index.js";
export type ListOrdersGlobals = {
/**
* Optional string used to pick a non-default API version to use. See our API version guide.
*/
shippoApiVersion?: string | undefined;
};
export type ListOrdersRequest = {
/**
* The page number you want to select
*/
page?: number | undefined;
/**
* The number of results to return per page (max 100)
*/
results?: number | undefined;
/**
* Filter orders by order status
*/
orderStatus?: Array | undefined;
/**
* Filter orders by shop app
*/
shopApp?: components.OrderShopAppEnum | undefined;
/**
* Filter orders created after the input date and time (ISO 8601 UTC format). This is based on the
*
* @remarks
* `placed_at` field, meaning when the order has been placed, not when the order object was created.
*/
startDate?: string | undefined;
/**
* Filter orders created before the input date and time (ISO 8601 UTC format). This is based on the
*
* @remarks
* `placed_at` field, meaning when the order has been placed, not when the order object was created.
*/
endDate?: string | undefined;
};
/** @internal */
export type ListOrdersRequest$Outbound = {
page: number;
results: number;
"order_status[]"?: Array | undefined;
shop_app?: string | undefined;
start_date?: string | undefined;
end_date?: string | undefined;
};
/** @internal */
export const ListOrdersRequest$outboundSchema: z.ZodMiniType<
ListOrdersRequest$Outbound,
ListOrdersRequest
> = z.pipe(
z.object({
page: z._default(z.int(), 1),
results: z._default(z.int(), 25),
orderStatus: z.optional(z.array(components.OrderStatusEnum$outboundSchema)),
shopApp: z.optional(components.OrderShopAppEnum$outboundSchema),
startDate: z.optional(z.string()),
endDate: z.optional(z.string()),
}),
z.transform((v) => {
return remap$(v, {
orderStatus: "order_status[]",
shopApp: "shop_app",
startDate: "start_date",
endDate: "end_date",
});
}),
);
export function listOrdersRequestToJSON(
listOrdersRequest: ListOrdersRequest,
): string {
return JSON.stringify(
ListOrdersRequest$outboundSchema.parse(listOrdersRequest),
);
}