/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Specify the reference field on the label (FedEx and UPS only). */ export type CustomerReference = { /** * Custom prefix for customer reference field (ZPL labels only). Up to 11 characters, including trailing * * @remarks * spaces. Empty string indicates removal of default prefix. To use the default prefix, do not include * this property. */ prefix?: string | undefined; /** * Optional text to be printed on the shipping label for customer reference. Up to 40 characters. If * * @remarks * this is provided, reference_1 will be ignored. */ value?: string | undefined; /** * Order UPS reference fields are printed on ZPL labels. For UPS shipments, if you choose to set `ref_sort` for one reference, you must set `ref_sort` for all other supported UPS references using unique integers. */ refSort?: number | undefined; }; /** @internal */ export const CustomerReference$inboundSchema: z.ZodMiniType< CustomerReference, unknown > = z.pipe( z.object({ prefix: z.optional(z.string()), value: z.optional(z.string()), ref_sort: z.optional(z.int()), }), z.transform((v) => { return remap$(v, { "ref_sort": "refSort", }); }), ); /** @internal */ export type CustomerReference$Outbound = { prefix?: string | undefined; value?: string | undefined; ref_sort?: number | undefined; }; /** @internal */ export const CustomerReference$outboundSchema: z.ZodMiniType< CustomerReference$Outbound, CustomerReference > = z.pipe( z.object({ prefix: z.optional(z.string()), value: z.optional(z.string()), refSort: z.optional(z.int()), }), z.transform((v) => { return remap$(v, { refSort: "ref_sort", }); }), ); export function customerReferenceToJSON( customerReference: CustomerReference, ): string { return JSON.stringify( CustomerReference$outboundSchema.parse(customerReference), ); } export function customerReferenceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerReference$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerReference' from JSON`, ); }