/* * 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"; import { DistanceUnitEnum, DistanceUnitEnum$inboundSchema, } from "./distanceunitenum.js"; export type CarrierParcelTemplate = { /** * The name of the carrier that provides this parcel template */ carrier?: string | undefined; /** * The measure unit used for length, width and height. */ distanceUnit?: DistanceUnitEnum | undefined; /** * The height of the package, in units specified by the distance_unit attribute */ height?: string | undefined; /** * True if the carrier parcel template allows custom dimensions, such as USPS Softpack. */ isVariableDimensions?: boolean | undefined; /** * The length of the package, in units specified by the distance_unit attribute */ length?: string | undefined; /** * The name of the carrier parcel template */ name?: string | undefined; /** * The unique string representation of the carrier parcel template */ token?: string | undefined; /** * The width of the package, in units specified by the distance_unit attribute */ width?: string | undefined; }; /** @internal */ export const CarrierParcelTemplate$inboundSchema: z.ZodMiniType< CarrierParcelTemplate, unknown > = z.pipe( z.object({ carrier: z.optional(z.string()), distance_unit: z.optional(DistanceUnitEnum$inboundSchema), height: z.optional(z.string()), is_variable_dimensions: z.optional(z.boolean()), length: z.optional(z.string()), name: z.optional(z.string()), token: z.optional(z.string()), width: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { "distance_unit": "distanceUnit", "is_variable_dimensions": "isVariableDimensions", }); }), ); export function carrierParcelTemplateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CarrierParcelTemplate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CarrierParcelTemplate' from JSON`, ); }