import {z} from 'zod' export type AccessorialService = {code?: string | undefined}; export type AccessorialServiceConfiguration = {allowUnacceptedAccessorials?: boolean | undefined, fetchAllGuaranteed?: boolean | undefined, fetchAllInsideDelivery?: boolean | undefined, fetchAllServiceLevels?: boolean | undefined}; export type RateQuoteApiConfiguration = {accessorialServiceConfiguration?: AccessorialServiceConfiguration | undefined, enableUnitConversion?: boolean | undefined, fallBackToDefaultAccountGroup?: boolean | undefined, timeout?: number | undefined}; export type CapacityProviderAccount = {code?: string | undefined}; export type CapacityProviderAccountGroup = {accounts?: Array | undefined, code?: string | undefined}; export type LocalDateTimeWindow = {date?: string | undefined, endTime?: string | undefined, startTime?: string | undefined}; export type CountryCode = 'US' | 'CA' | 'MX' | 'AG' | 'BB' | 'BS' | 'BZ' | 'CR' | 'CU' | 'DM' | 'DO' | 'GD' | 'GT' | 'HN' | 'HT' | 'JM' | 'KN' | 'LC' | 'NI' | 'PA' | 'SV' | 'TT' | 'VC' | 'AI' | 'AW' | 'BL' | 'BM' | 'BQ' | 'CW' | 'GL' | 'GP' | 'KY' | 'MF' | 'MQ' | 'MS' | 'PM' | 'PR' | 'SX' | 'TC' | 'UM' | 'VG' | 'VI' | 'AT' | 'BE' | 'BG' | 'CY' | 'CZ' | 'DK' | 'DE' | 'EE' | 'ES' | 'FI' | 'FR' | 'GB' | 'GR' | 'HR' | 'HU' | 'IE' | 'IT' | 'LT' | 'LU' | 'LV' | 'MT' | 'NL' | 'PL' | 'PT' | 'RO' | 'SE' | 'SK' | 'SI' | 'CH' | 'IS' | 'LI' | 'NO' | 'AL' | 'ME' | 'MK' | 'RS' | 'TR' | 'AD' | 'AX' | 'BA' | 'BV' | 'BY' | 'FO' | 'GG' | 'GI' | 'IM' | 'IO' | 'JE' | 'MC' | 'MD' | 'SJ' | 'SM' | 'TF' | 'UA' | 'VA' | 'AE' | 'AF' | 'AM' | 'AZ' | 'BD' | 'BH' | 'BN' | 'BT' | 'CN' | 'GE' | 'HK' | 'ID' | 'IL' | 'IN' | 'IQ' | 'IR' | 'JO' | 'JP' | 'KG' | 'KH' | 'KP' | 'KR' | 'KW' | 'KZ' | 'LA' | 'LB' | 'LK' | 'MM' | 'MN' | 'MO' | 'MV' | 'MY' | 'NP' | 'OM' | 'PH' | 'PK' | 'PS' | 'QA' | 'RU' | 'SA' | 'SG' | 'SY' | 'TH' | 'TJ' | 'TL' | 'TM' | 'TW' | 'UZ' | 'VN' | 'YE' | 'AO' | 'BF' | 'BI' | 'BJ' | 'BW' | 'CD' | 'CF' | 'CG' | 'CI' | 'CM' | 'CV' | 'DJ' | 'DZ' | 'EG' | 'EH' | 'ER' | 'ET' | 'GA' | 'GH' | 'GM' | 'GN' | 'GQ' | 'GW' | 'HM' | 'KE' | 'KM' | 'LR' | 'LS' | 'LY' | 'MA' | 'MG' | 'ML' | 'MR' | 'MU' | 'MW' | 'MZ' | 'NA' | 'NE' | 'NG' | 'RE' | 'RW' | 'SC' | 'SD' | 'SH' | 'SL' | 'SN' | 'SO' | 'SS' | 'ST' | 'SZ' | 'TD' | 'TG' | 'TN' | 'TZ' | 'UG' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'AR' | 'BO' | 'BR' | 'CL' | 'CO' | 'EC' | 'FK' | 'GF' | 'GS' | 'GY' | 'PE' | 'PY' | 'SR' | 'UY' | 'VE' | 'AS' | 'AU' | 'CC' | 'CK' | 'CX' | 'FJ' | 'FM' | 'GU' | 'KI' | 'MH' | 'MP' | 'NC' | 'NF' | 'NR' | 'NU' | 'NZ' | 'PF' | 'PG' | 'PN' | 'PW' | 'SB' | 'TK' | 'TO' | 'TV' | 'VU' | 'WF' | 'WS' | 'AQ' | 'EL' | 'UK' | 'XK' | 'XS' | 'XI'; export type Address = {addressLines?: Array | undefined, city?: string | undefined, country?: CountryCode | undefined, postalCode?: string | undefined, state?: string | undefined}; export type Contact = {companyName?: string | undefined, contactName?: string | undefined, email?: string | undefined, faxNumber?: string | undefined, faxNumberCountryCode?: string | undefined, phoneNumber?: string | undefined, phoneNumber2?: string | undefined, phoneNumber2CountryCode?: string | undefined, phoneNumberCountryCode?: string | undefined}; export type CubicDimension = {height?: number | undefined, length?: number | undefined, width?: number | undefined}; export type NmfcCode = {code?: string | undefined}; export type PartyAddress = {addressLines?: Array | undefined, addressLabel?: string | undefined, city?: string | undefined, country?: CountryCode | undefined, id?: string | undefined, postalCode?: string | undefined, state?: string | undefined}; export type BookingContact = {companyName?: string | undefined, email?: string | undefined, familyName?: string | undefined, givenName?: string | undefined, mobilePhoneNumber?: string | undefined, phoneNumber?: string | undefined}; export type CodeListProvider = 'WAVE' | 'CARX' | 'ESSD' | 'IDT' | 'BOLE' | 'EDOX' | 'IQAX' | 'SECR' | 'TRGO' | 'ETEU' | 'TRAC' | 'BRIT' | 'GSBN' | 'WISE' | 'GLEIF' | 'W3C' | 'DNB' | 'FMC' | 'DCSA' | 'ZZZ'; export type CodeListName = 'DID' | 'LEI' | 'DUNS'; export type IdentifyingCodes = {codeListProvider?: CodeListProvider | undefined, codeListName?: CodeListName | undefined, partyCode?: string | undefined}; export type LocationIdentifierType = 'UNKNOWN' | 'AIRPORT_IATA' | 'AIRPORT_ICAO' | 'PORT_UN_LOCODE' | 'RAIL_SPLC' | 'DATA_PROVIDER_LOCATION_CODE' | 'LOCODE'; export type RatingLocationIdentifier = {type?: LocationIdentifierType | undefined, value?: string | undefined}; export type PartyType = 'SHIPPER' | 'CONSIGNEE' | 'BILL_TO' | 'NOTIFY_PARTY' | 'BOOKING_AGENT' | 'CARRIER_BOOKING_OFFICE'; export type Party = {addressInfo?: PartyAddress | undefined, contactInfo?: BookingContact | undefined, identifyingCodes?: IdentifyingCodes | undefined, locationIdentifiers?: Array | undefined, partyType?: PartyType | undefined, vatNumber?: string | undefined}; export type HazmatDetails = {code?: string | undefined, emergencyContact?: Contact | undefined, identificationNumber?: string | undefined, packingGroup?: ('I' | 'II' | 'III' | 'NONE') | undefined, properShippingName?: string | undefined}; export type PackageContentIdentifier = {type?: ('PURCHASE_ORDER_NUMBER' | 'SKU_NUMBER' | 'DELIVERY_NUMBER') | undefined, value?: string | undefined}; export type PackageContents = {countryOfManufacture?: ('US' | 'CA' | 'MX' | 'AG' | 'BB' | 'BS' | 'BZ' | 'CR' | 'CU' | 'DM' | 'DO' | 'GD' | 'GT' | 'HN' | 'HT' | 'JM' | 'KN' | 'LC' | 'NI' | 'PA' | 'SV' | 'TT' | 'VC' | 'AI' | 'AW' | 'BL' | 'BM' | 'BQ' | 'CW' | 'GL' | 'GP' | 'KY' | 'MF' | 'MQ' | 'MS' | 'PM' | 'PR' | 'SX' | 'TC' | 'UM' | 'VG' | 'VI' | 'AT' | 'BE' | 'BG' | 'CY' | 'CZ' | 'DK' | 'DE' | 'EE' | 'ES' | 'FI' | 'FR' | 'GB' | 'GR' | 'HR' | 'HU' | 'IE' | 'IT' | 'LT' | 'LU' | 'LV' | 'MT' | 'NL' | 'PL' | 'PT' | 'RO' | 'SE' | 'SK' | 'SI' | 'CH' | 'IS' | 'LI' | 'NO' | 'AL' | 'ME' | 'MK' | 'RS' | 'TR' | 'AD' | 'AX' | 'BA' | 'BV' | 'BY' | 'FO' | 'GG' | 'GI' | 'IM' | 'IO' | 'JE' | 'MC' | 'MD' | 'SJ' | 'SM' | 'TF' | 'UA' | 'VA' | 'AE' | 'AF' | 'AM' | 'AZ' | 'BD' | 'BH' | 'BN' | 'BT' | 'CN' | 'GE' | 'HK' | 'ID' | 'IL' | 'IN' | 'IQ' | 'IR' | 'JO' | 'JP' | 'KG' | 'KH' | 'KP' | 'KR' | 'KW' | 'KZ' | 'LA' | 'LB' | 'LK' | 'MM' | 'MN' | 'MO' | 'MV' | 'MY' | 'NP' | 'OM' | 'PH' | 'PK' | 'PS' | 'QA' | 'RU' | 'SA' | 'SG' | 'SY' | 'TH' | 'TJ' | 'TL' | 'TM' | 'TW' | 'UZ' | 'VN' | 'YE' | 'AO' | 'BF' | 'BI' | 'BJ' | 'BW' | 'CD' | 'CF' | 'CG' | 'CI' | 'CM' | 'CV' | 'DJ' | 'DZ' | 'EG' | 'EH' | 'ER' | 'ET' | 'GA' | 'GH' | 'GM' | 'GN' | 'GQ' | 'GW' | 'HM' | 'KE' | 'KM' | 'LR' | 'LS' | 'LY' | 'MA' | 'MG' | 'ML' | 'MR' | 'MU' | 'MW' | 'MZ' | 'NA' | 'NE' | 'NG' | 'RE' | 'RW' | 'SC' | 'SD' | 'SH' | 'SL' | 'SN' | 'SO' | 'SS' | 'ST' | 'SZ' | 'TD' | 'TG' | 'TN' | 'TZ' | 'UG' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'AR' | 'BO' | 'BR' | 'CL' | 'CO' | 'EC' | 'FK' | 'GF' | 'GS' | 'GY' | 'PE' | 'PY' | 'SR' | 'UY' | 'VE' | 'AS' | 'AU' | 'CC' | 'CK' | 'CX' | 'FJ' | 'FM' | 'GU' | 'KI' | 'MH' | 'MP' | 'NC' | 'NF' | 'NR' | 'NU' | 'NZ' | 'PF' | 'PG' | 'PN' | 'PW' | 'SB' | 'TK' | 'TO' | 'TV' | 'VU' | 'WF' | 'WS' | 'AQ' | 'EL' | 'UK' | 'XK' | 'XS' | 'XI') | undefined, description?: string | undefined, hazmatDetails?: Array | undefined, packageContentIdentifiers?: Array | undefined, packageContentQuantity?: number | undefined}; export type Package = {contact?: Contact | undefined, description?: string | undefined, freightClass?: ('50' | '55' | '60' | '65' | '70' | '77.5' | '85' | '92.5' | '100' | '110' | '125' | '150' | '175' | '200' | '250' | '300' | '400' | '500') | undefined, involvedParties?: Array | undefined, nmfcCodes?: Array | undefined, packageContainerType?: ('BAG' | 'BALE' | 'BOX' | 'BUCKET' | 'PAIL' | 'BUNDLE' | 'CAN' | 'CARTON' | 'CASE' | 'COIL' | 'CRATE' | 'CYLINDER' | 'EACH' | 'FLAT' | 'LOOSE' | 'ROLL' | 'TUBE') | undefined, packageContents?: Array | undefined, packageDimensions?: CubicDimension | undefined, packageQuantity?: number | undefined, weightPerPackage?: number | undefined}; export type Currency = 'USD' | 'CAD' | 'MXN' | 'EUR'; export type MonetaryValue = {amount?: number | undefined, currency?: Currency | undefined}; export type HandlingUnit = {commodityType?: string | undefined, contact?: Contact | undefined, deliveryStopNumber?: number | undefined, description?: string | undefined, freightClasses?: (Array<'50' | '55' | '60' | '65' | '70' | '77.5' | '85' | '92.5' | '100' | '110' | '125' | '150' | '175' | '200' | '250' | '300' | '400' | '500'>) | undefined, handlingUnitDimensions?: CubicDimension | undefined, handlingUnitQuantity?: number | undefined, handlingUnitType?: ('BAG' | 'BALE' | 'BARREL' | 'BOX' | 'BUCKET' | 'BUNDLE' | 'CAN' | 'CARTON' | 'CASE' | 'COIL' | 'CRATE' | 'CYLINDER' | 'DRUM' | 'PACK' | 'PAIL' | 'PALLET' | 'PIECES' | 'REEL' | 'ROLL' | 'SKID' | 'TOTE' | 'TRAY' | 'TUBE') | undefined, harmonizedCode?: string | undefined, nmfcCodes?: Array | undefined, packages?: Array | undefined, pickupStopNumber?: number | undefined, stackable?: boolean | undefined, totalValue?: MonetaryValue | undefined, weightPerHandlingUnit?: number | undefined}; export type LineItemHazmatDetail = {hazardClass?: string | undefined, identificationNumber?: string | undefined, packingGroup?: ('I' | 'II' | 'III' | 'NONE') | undefined, properShippingName?: string | undefined}; export type LineItem = {commodityType?: string | undefined, countryOfManufacture?: ('US' | 'CA' | 'MX' | 'AG' | 'BB' | 'BS' | 'BZ' | 'CR' | 'CU' | 'DM' | 'DO' | 'GD' | 'GT' | 'HN' | 'HT' | 'JM' | 'KN' | 'LC' | 'NI' | 'PA' | 'SV' | 'TT' | 'VC' | 'AI' | 'AW' | 'BL' | 'BM' | 'BQ' | 'CW' | 'GL' | 'GP' | 'KY' | 'MF' | 'MQ' | 'MS' | 'PM' | 'PR' | 'SX' | 'TC' | 'UM' | 'VG' | 'VI' | 'AT' | 'BE' | 'BG' | 'CY' | 'CZ' | 'DK' | 'DE' | 'EE' | 'ES' | 'FI' | 'FR' | 'GB' | 'GR' | 'HR' | 'HU' | 'IE' | 'IT' | 'LT' | 'LU' | 'LV' | 'MT' | 'NL' | 'PL' | 'PT' | 'RO' | 'SE' | 'SK' | 'SI' | 'CH' | 'IS' | 'LI' | 'NO' | 'AL' | 'ME' | 'MK' | 'RS' | 'TR' | 'AD' | 'AX' | 'BA' | 'BV' | 'BY' | 'FO' | 'GG' | 'GI' | 'IM' | 'IO' | 'JE' | 'MC' | 'MD' | 'SJ' | 'SM' | 'TF' | 'UA' | 'VA' | 'AE' | 'AF' | 'AM' | 'AZ' | 'BD' | 'BH' | 'BN' | 'BT' | 'CN' | 'GE' | 'HK' | 'ID' | 'IL' | 'IN' | 'IQ' | 'IR' | 'JO' | 'JP' | 'KG' | 'KH' | 'KP' | 'KR' | 'KW' | 'KZ' | 'LA' | 'LB' | 'LK' | 'MM' | 'MN' | 'MO' | 'MV' | 'MY' | 'NP' | 'OM' | 'PH' | 'PK' | 'PS' | 'QA' | 'RU' | 'SA' | 'SG' | 'SY' | 'TH' | 'TJ' | 'TL' | 'TM' | 'TW' | 'UZ' | 'VN' | 'YE' | 'AO' | 'BF' | 'BI' | 'BJ' | 'BW' | 'CD' | 'CF' | 'CG' | 'CI' | 'CM' | 'CV' | 'DJ' | 'DZ' | 'EG' | 'EH' | 'ER' | 'ET' | 'GA' | 'GH' | 'GM' | 'GN' | 'GQ' | 'GW' | 'HM' | 'KE' | 'KM' | 'LR' | 'LS' | 'LY' | 'MA' | 'MG' | 'ML' | 'MR' | 'MU' | 'MW' | 'MZ' | 'NA' | 'NE' | 'NG' | 'RE' | 'RW' | 'SC' | 'SD' | 'SH' | 'SL' | 'SN' | 'SO' | 'SS' | 'ST' | 'SZ' | 'TD' | 'TG' | 'TN' | 'TZ' | 'UG' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'AR' | 'BO' | 'BR' | 'CL' | 'CO' | 'EC' | 'FK' | 'GF' | 'GS' | 'GY' | 'PE' | 'PY' | 'SR' | 'UY' | 'VE' | 'AS' | 'AU' | 'CC' | 'CK' | 'CX' | 'FJ' | 'FM' | 'GU' | 'KI' | 'MH' | 'MP' | 'NC' | 'NF' | 'NR' | 'NU' | 'NZ' | 'PF' | 'PG' | 'PN' | 'PW' | 'SB' | 'TK' | 'TO' | 'TV' | 'VU' | 'WF' | 'WS' | 'AQ' | 'EL' | 'UK' | 'XK' | 'XS' | 'XI') | undefined, description?: string | undefined, freightClass?: ('50' | '55' | '60' | '65' | '70' | '77.5' | '85' | '92.5' | '100' | '110' | '125' | '150' | '175' | '200' | '250' | '300' | '400' | '500') | undefined, harmonizedCode?: string | undefined, hazmatDetail?: LineItemHazmatDetail | undefined, id?: number | undefined, insuranceAmount?: number | undefined, nmfcItemCode?: string | undefined, nmfcSubCode?: string | undefined, packageDimensions?: CubicDimension | undefined, packageType?: ('BAG' | 'BALE' | 'BOX' | 'BUCKET' | 'BUNDLE' | 'CAN' | 'CARTON' | 'CASE' | 'COIL' | 'CRATE' | 'CYLINDER' | 'DRUM' | 'PAIL' | 'PLT' | 'PIECES' | 'REEL' | 'ROLL' | 'SKID' | 'TOTE' | 'TUBE' | 'EACH' | 'FLAT' | 'LOOSE') | undefined, stackable?: boolean | undefined, totalPackages?: number | undefined, totalPieces?: number | undefined, totalValue?: number | undefined, totalWeight?: number | undefined}; export type RateQuoteQuery = {accessorialServices?: Array | undefined, apiConfiguration?: RateQuoteApiConfiguration | undefined, capacityProviderAccountGroup?: CapacityProviderAccountGroup | undefined, deliveryWindow?: LocalDateTimeWindow | undefined, destinationAddress?: Address | undefined, directionOverride?: ('SHIPPER' | 'CONSIGNEE' | 'THIRD_PARTY') | undefined, enhancedHandlingUnits?: Array | undefined, lengthUnit?: ('IN' | 'CM' | 'FT' | 'M') | undefined, lineItems?: Array | undefined, originAddress?: Address | undefined, paymentTermsOverride?: ('PREPAID' | 'COLLECT' | 'THIRD_PARTY') | undefined, pickupWindow?: LocalDateTimeWindow | undefined, preferredCurrency?: ('USD' | 'CAD' | 'MXN') | undefined, preferredSystemOfMeasurement?: ('METRIC' | 'IMPERIAL') | undefined, totalLinearFeet?: number | undefined, weightUnit?: ('LB' | 'KG') | undefined}; export type CreateApiApiV4LtlQuotesRatesQueryArgs = {body: RateQuoteQuery}; export type CreateApiApiV4LtlQuotesRatesQueryOptions = {baseUrl?: string | undefined, oAuth2?: string | undefined, fetch?: typeof fetch | undefined}; export const charge = z.object({amount: z.number().optional(), amountInPreferredCurrency: z.number().optional(), code: z.string().optional(), description: z.string().optional(), itemFreightClass: z.string().optional(), itemWeight: z.number().optional(), itemWeightUnit: z.enum(["LB", "KG"]).optional(), rate: z.number().optional()}); export const rateQuoteDetail = z.object({charges: z.array(charge).optional(), subtotal: z.number().optional(), subtotalInPreferredCurrency: z.number().optional(), total: z.number().optional(), totalInPreferredCurrency: z.number().optional()}); export const serviceLevel = z.object({code: z.enum(["STD", "EXPEDITE", "EXPEDITE17", "EXPEDITEAM", "GURWIN", "GSSING", "GSMUL", "GSFM", "GS8", "GS9", "GS10", "GS11", "GSAM", "GS14", "GS15", "GS1530", "GUR", "ACCELERATED", "CAPLOAD", "UNKNOWN"]).optional(), description: z.string().optional()}); export const integerRange = z.object({max: z.number().int().optional(), min: z.number().int().optional()}); export const alternateRateQuote = z.object({capacityProviderQuoteNumber: z.string().optional(), deliveryDateTime: z.string().optional(), rateQuoteDetail: rateQuoteDetail.optional(), serviceLevel: serviceLevel.optional(), transitDays: z.number().int().optional(), transitDaysRange: integerRange.optional()}); export const capacityProviderAccount = z.object({code: z.string().optional()}); export const capacityProviderAccountGroup = z.object({accounts: z.array(capacityProviderAccount).optional(), code: z.string().optional()}); export const currencyConversionAuditInfo = z.object({conversionRate: z.number().optional(), conversionTimestamp: z.string().optional()}); export const errorMessage = z.object({diagnostic: z.string().optional(), message: z.string().optional(), severity: z.enum(["ERROR", "WARNING", "INFO"]).optional(), source: z.enum(["SYSTEM", "CAPACITY_PROVIDER"]).optional(), errorCode: z.string().optional()}); export const message = z.object({diagnostic: z.string().optional(), message: z.string().optional(), severity: z.enum(["ERROR", "WARNING", "INFO"]).optional(), source: z.enum(["SYSTEM", "CAPACITY_PROVIDER"]).optional()}); export const requestedAccessorialService = z.object({code: z.string().optional(), status: z.enum(["ACCEPTED", "ACCEPTED_UNITEMIZED", "UNACCEPTED"]).optional()}); export const rateQuote = z.object({alternateRateQuotes: z.array(alternateRateQuote).optional(), capacityProviderAccountGroup: capacityProviderAccountGroup.optional(), capacityProviderQuoteNumber: z.string().optional(), carrierCode: z.string().optional(), contractId: z.string().optional(), currencyCode: z.enum(["USD", "CAD", "MXN", "EUR"]).optional(), currencyConversionAuditInfo: currencyConversionAuditInfo.optional(), deliveryDateTime: z.string().optional(), errorMessages: z.array(errorMessage).optional(), id: z.string().optional(), infoMessages: z.array(message).optional(), laneType: z.enum(["DIRECT", "INTERLINE", "UNSPECIFIED"]).optional(), preferredCurrencyCode: z.enum(["USD", "CAD", "MXN", "EUR"]).optional(), preferredSystemOfMeasurement: z.enum(["METRIC", "IMPERIAL"]).optional(), quoteEffectiveDateTime: z.string().optional(), quoteExpirationDateTime: z.string().optional(), rateQuoteDetail: rateQuoteDetail.optional(), requestedAccessorialServices: z.array(requestedAccessorialService).optional(), serviceLevel: serviceLevel.optional(), transitDays: z.number().int().optional(), transitDaysRange: integerRange.optional()}); export const rateQuoteCollection = z.object({rateQuotes: z.array(rateQuote).optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Query for rate quotes. * * POST /api/v4/ltl/quotes/rates/query */ export const createApiApiV4LtlQuotesRatesQuery = async (args: CreateApiApiV4LtlQuotesRatesQueryArgs, options?: CreateApiApiV4LtlQuotesRatesQueryOptions) => { const {baseUrl = "https://na12.api.project44.com", fetch: fetchFn = fetch, oAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (oAuth2 !== undefined) headers.set('authorization', `Bearer ${oAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v4/ltl/quotes/rates/query${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(rateQuoteCollection, await res.json()) };