/* * 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 { WeightUnitEnum, WeightUnitEnum$outboundSchema, } from "./weightunitenum.js"; export type LineItemBase = { /** * Currency of the total_price amount. */ currency?: string | undefined; /** * Country the item was manufactured in. In the Shippo dashboard, this value will be used ot pre-fill the customs declaration when creating a label for this order. */ manufactureCountry?: string | undefined; /** * The date and time this item needs to be delivered by, i.e. by when the carrier delivers it to the buyer. * * @remarks * This value is used by some platforms such as eBay to measure a seller's shipping time and performance. * It will be displayed in the Shippo dashboard. */ maxDeliveryTime?: Date | undefined; /** * The date and time this item needs to be fulfilled by, i.e. by when the shipping label needs to be * * @remarks * created and handed over to the carrier. This value is used by some platforms such as eBay to measure * a seller's handling time and performance. It will be displayed in the Shippo dashboard. */ maxShipTime?: Date | undefined; /** * The quantity of this item in this order. */ quantity?: number | undefined; /** * The stock keeping unit value of this item. */ sku?: string | undefined; /** * Title of the line item. */ title?: string | undefined; /** * Total price paid by the buyer for this item (or these items, if quantity > 1). */ totalPrice?: string | undefined; /** * A variant is a specific variation of an item (e.g. `size M` or `color blue`). * * @remarks * Variants might be exposed as a separate resource in the future too. * Currently the variant title is a free text field describing the variant. */ variantTitle?: string | undefined; /** * Total weight of this/these item(s). Instead of specifying the weight of all items, * * @remarks * you can also set the total_weight value of the order object. */ weight?: string | undefined; /** * The unit used for weight. */ weightUnit?: WeightUnitEnum | undefined; }; /** @internal */ export type LineItemBase$Outbound = { currency?: string | undefined; manufacture_country?: string | undefined; max_delivery_time?: string | undefined; max_ship_time?: string | undefined; quantity?: number | undefined; sku?: string | undefined; title?: string | undefined; total_price?: string | undefined; variant_title?: string | undefined; weight?: string | undefined; weight_unit?: string | undefined; }; /** @internal */ export const LineItemBase$outboundSchema: z.ZodMiniType< LineItemBase$Outbound, LineItemBase > = z.pipe( z.object({ currency: z.optional(z.string()), manufactureCountry: z.optional(z.string()), maxDeliveryTime: z.optional( z.pipe(z.date(), z.transform(v => v.toISOString())), ), maxShipTime: z.optional( z.pipe(z.date(), z.transform(v => v.toISOString())), ), quantity: z.optional(z.int()), sku: z.optional(z.string()), title: z.optional(z.string()), totalPrice: z.optional(z.string()), variantTitle: z.optional(z.string()), weight: z.optional(z.string()), weightUnit: z.optional(WeightUnitEnum$outboundSchema), }), z.transform((v) => { return remap$(v, { manufactureCountry: "manufacture_country", maxDeliveryTime: "max_delivery_time", maxShipTime: "max_ship_time", totalPrice: "total_price", variantTitle: "variant_title", weightUnit: "weight_unit", }); }), ); export function lineItemBaseToJSON(lineItemBase: LineItemBase): string { return JSON.stringify(LineItemBase$outboundSchema.parse(lineItemBase)); }