/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Party to be billed. (Leave blank for DHL Germany.) */ export const Type = { Sender: "SENDER", Recipient: "RECIPIENT", ThirdParty: "THIRD_PARTY", ThirdPartyConsignee: "THIRD_PARTY_CONSIGNEE", Collect: "COLLECT", } as const; /** * Party to be billed. (Leave blank for DHL Germany.) */ export type Type = ClosedEnum; /** * Specify billing details (UPS, FedEx, and DHL Germany only). */ export type Billing = { /** * Account number to be billed. (For DHL Germany, leave this field blank.) */ account?: string | undefined; /** * Country iso2 code of account number to be billed (required for UPS third party billing only). */ country?: string | undefined; /** * 2 digit code used to override your default participation code associated with your DHL Germany account. */ participationCode?: string | undefined; /** * Party to be billed. (Leave blank for DHL Germany.) */ type?: Type | undefined; /** * ZIP code of account number to be billed (required for UPS if there is a zip on the billing account). */ zip?: string | undefined; }; /** @internal */ export const Type$inboundSchema: z.ZodMiniEnum = z.enum(Type); /** @internal */ export const Type$outboundSchema: z.ZodMiniEnum = Type$inboundSchema; /** @internal */ export const Billing$inboundSchema: z.ZodMiniType = z.pipe( z.object({ account: z.optional(z.string()), country: z.optional(z.string()), participation_code: z.optional(z.string()), type: z.optional(Type$inboundSchema), zip: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { "participation_code": "participationCode", }); }), ); /** @internal */ export type Billing$Outbound = { account?: string | undefined; country?: string | undefined; participation_code?: string | undefined; type?: string | undefined; zip?: string | undefined; }; /** @internal */ export const Billing$outboundSchema: z.ZodMiniType = z.pipe( z.object({ account: z.optional(z.string()), country: z.optional(z.string()), participationCode: z.optional(z.string()), type: z.optional(Type$outboundSchema), zip: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { participationCode: "participation_code", }); }), ); export function billingToJSON(billing: Billing): string { return JSON.stringify(Billing$outboundSchema.parse(billing)); } export function billingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Billing$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Billing' from JSON`, ); }