/* * 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"; export type UPSReferenceFields = { /** * Custom prefix text. */ prefix?: string | undefined; /** * Label reference text. 35 character limit. */ 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 UPSReferenceFields$inboundSchema: z.ZodMiniType< UPSReferenceFields, 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 UPSReferenceFields$Outbound = { prefix?: string | undefined; value?: string | undefined; ref_sort?: number | undefined; }; /** @internal */ export const UPSReferenceFields$outboundSchema: z.ZodMiniType< UPSReferenceFields$Outbound, UPSReferenceFields > = 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 upsReferenceFieldsToJSON( upsReferenceFields: UPSReferenceFields, ): string { return JSON.stringify( UPSReferenceFields$outboundSchema.parse(upsReferenceFields), ); } export function upsReferenceFieldsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UPSReferenceFields$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UPSReferenceFields' from JSON`, ); }