/* * 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 { AddressCompleteCreateRequest, AddressCompleteCreateRequest$Outbound, AddressCompleteCreateRequest$outboundSchema, } from "./addresscompletecreaterequest.js"; import { LineItem, LineItem$Outbound, LineItem$outboundSchema, } from "./lineitem.js"; import { Parcel, Parcel$Outbound, Parcel$outboundSchema } from "./parcel.js"; /** * The sender address, which includes your name, company name, street address, city, state, zip code, * * @remarks * country, phone number, and email address (strings). Special characters should not be included in * any address element, especially name, company, and email. */ export type LiveRateCreateRequestAddressFrom = | AddressCompleteCreateRequest | string; /** * The recipient address, which includes the recipient's name, company name, street address, city, state, zip code, * * @remarks * country, phone number, and email address (strings). Special characters should not be included in * any address element, especially name, company, and email. */ export type LiveRateCreateRequestAddressTo = | AddressCompleteCreateRequest | string; /** * Object ID for an existing User Parcel Template OR a fully formed Parcel object. */ export type LiveRateCreateRequestParcel = Parcel | string; export type LiveRateCreateRequest = { /** * The sender address, which includes your name, company name, street address, city, state, zip code, * * @remarks * country, phone number, and email address (strings). Special characters should not be included in * any address element, especially name, company, and email. */ addressFrom?: AddressCompleteCreateRequest | string | undefined; /** * The recipient address, which includes the recipient's name, company name, street address, city, state, zip code, * * @remarks * country, phone number, and email address (strings). Special characters should not be included in * any address element, especially name, company, and email. */ addressTo: AddressCompleteCreateRequest | string; /** * Array of Line Item objects */ lineItems: Array; /** * Object ID for an existing User Parcel Template OR a fully formed Parcel object. */ parcel?: Parcel | string | undefined; }; /** @internal */ export type LiveRateCreateRequestAddressFrom$Outbound = | AddressCompleteCreateRequest$Outbound | string; /** @internal */ export const LiveRateCreateRequestAddressFrom$outboundSchema: z.ZodMiniType< LiveRateCreateRequestAddressFrom$Outbound, LiveRateCreateRequestAddressFrom > = z.union([AddressCompleteCreateRequest$outboundSchema, z.string()]); export function liveRateCreateRequestAddressFromToJSON( liveRateCreateRequestAddressFrom: LiveRateCreateRequestAddressFrom, ): string { return JSON.stringify( LiveRateCreateRequestAddressFrom$outboundSchema.parse( liveRateCreateRequestAddressFrom, ), ); } /** @internal */ export type LiveRateCreateRequestAddressTo$Outbound = | AddressCompleteCreateRequest$Outbound | string; /** @internal */ export const LiveRateCreateRequestAddressTo$outboundSchema: z.ZodMiniType< LiveRateCreateRequestAddressTo$Outbound, LiveRateCreateRequestAddressTo > = z.union([AddressCompleteCreateRequest$outboundSchema, z.string()]); export function liveRateCreateRequestAddressToToJSON( liveRateCreateRequestAddressTo: LiveRateCreateRequestAddressTo, ): string { return JSON.stringify( LiveRateCreateRequestAddressTo$outboundSchema.parse( liveRateCreateRequestAddressTo, ), ); } /** @internal */ export type LiveRateCreateRequestParcel$Outbound = Parcel$Outbound | string; /** @internal */ export const LiveRateCreateRequestParcel$outboundSchema: z.ZodMiniType< LiveRateCreateRequestParcel$Outbound, LiveRateCreateRequestParcel > = z.union([Parcel$outboundSchema, z.string()]); export function liveRateCreateRequestParcelToJSON( liveRateCreateRequestParcel: LiveRateCreateRequestParcel, ): string { return JSON.stringify( LiveRateCreateRequestParcel$outboundSchema.parse( liveRateCreateRequestParcel, ), ); } /** @internal */ export type LiveRateCreateRequest$Outbound = { address_from?: AddressCompleteCreateRequest$Outbound | string | undefined; address_to: AddressCompleteCreateRequest$Outbound | string; line_items: Array; parcel?: Parcel$Outbound | string | undefined; }; /** @internal */ export const LiveRateCreateRequest$outboundSchema: z.ZodMiniType< LiveRateCreateRequest$Outbound, LiveRateCreateRequest > = z.pipe( z.object({ addressFrom: z.optional( z.union([AddressCompleteCreateRequest$outboundSchema, z.string()]), ), addressTo: z.union([ AddressCompleteCreateRequest$outboundSchema, z.string(), ]), lineItems: z.array(LineItem$outboundSchema), parcel: z.optional(z.union([Parcel$outboundSchema, z.string()])), }), z.transform((v) => { return remap$(v, { addressFrom: "address_from", addressTo: "address_to", lineItems: "line_items", }); }), ); export function liveRateCreateRequestToJSON( liveRateCreateRequest: LiveRateCreateRequest, ): string { return JSON.stringify( LiveRateCreateRequest$outboundSchema.parse(liveRateCreateRequest), ); }