import {z} from 'zod' export type TruckloadShipmentApiConfiguration = {enableIntelligentMatching?: boolean | undefined, fallBackToDefaultAccountGroup?: boolean | undefined, webhookEndpointConfigName?: string | undefined}; export type ShipmentAttribute = {name?: string | undefined, predefined?: boolean | undefined, value?: string | undefined, values?: Array | undefined}; export type CapacityProviderAccount = {code?: string | undefined}; export type CapacityProviderAccountGroup = {accounts?: Array | undefined, code?: string | undefined}; export type CapacityProviderIdentifier = {type?: ('SCAC' | 'DOT_NUMBER' | 'MC_NUMBER' | 'P44_EU' | 'SYSTEM' | 'P44_GLOBAL' | 'VAT') | undefined, value?: string | undefined}; export type TruckloadShipmentContent = {maxTemperatureThreshold?: number | undefined, minTemperatureThreshold?: number | undefined, temperatureSetPoint?: number | undefined}; export type TruckloadEquipmentIdentifierChange = {timestamp?: string | undefined, type?: ('MOBILE_PHONE_NUMBER' | 'VEHICLE_ID' | 'LICENSE_PLATE' | 'SENSITECH_DEVICE_ID' | 'EMERSON_DEVICE_ID' | 'TIVE_DEVICE_ID' | 'CONTAINER_ID') | undefined, value?: string | undefined}; export type TruckloadEquipmentIdentifier = {shouldDelete?: boolean | undefined, type?: ('MOBILE_PHONE_NUMBER' | 'VEHICLE_ID' | 'LICENSE_PLATE' | 'SENSITECH_DEVICE_ID' | 'TIVE_DEVICE_ID') | undefined, value?: string | undefined}; export type GeoCoordinates = {latitude?: number | undefined, longitude?: number | 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 Location = {address?: Address | undefined, contact?: Contact | undefined}; export type LocationIdentifier = {type?: ('EXTERNAL' | 'SYSTEM') | undefined, value?: string | undefined}; export type TruckloadShipmentPointOfInterest = {geoCoordinates?: GeoCoordinates | undefined, location?: Location | undefined, locationIdentifiers?: Array | undefined, pointOfInterestDescription?: string | undefined, pointOfInterestId?: string | undefined, pointOfInterestName?: string | undefined, pointOfInterestType?: ('GENERAL' | 'TRUCK_CHANGE') | undefined, shouldDelete?: boolean | undefined}; export type TruckloadShipmentSensorIdentifier = {type?: 'TEMPERATURE' | undefined, value?: string | undefined}; export type TruckloadShipmentSensor = {identifier?: TruckloadShipmentSensorIdentifier | undefined, max?: number | undefined, min?: number | undefined, target?: number | 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 LineItemIdentifier = {type?: ('PURCHASE_ORDER' | 'SKU' | 'CONTAINER_NUMBER' | 'PALLET_NUMBER' | 'DELIVERY_NUMBER' | 'PICKUP_NUMBER' | 'VIN') | undefined, value?: string | undefined}; export type Currency = 'USD' | 'CAD' | 'MXN' | 'EUR'; export type MonetaryValue = {amount?: number | undefined, currency?: Currency | undefined}; export type Weight = {weight?: number | undefined, weightUnit?: ('LB' | 'KG') | undefined}; export type TruckloadShipmentSubLineItem = {commodityCode?: string | undefined, 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, itemIdentifiers?: Array | undefined, itemPackageType?: ('BAG' | 'BALE' | 'BOX' | 'BUCKET' | 'BUNDLE' | 'CAN' | 'CARTON' | 'CASE' | 'COIL' | 'CRATE' | 'CYLINDER' | 'DRUM' | 'PAIL' | 'PLT' | 'PIECES' | 'REEL' | 'ROLL' | 'SKID' | 'TOTE' | 'TUBE' | 'EACH' | 'FLAT' | 'LOOSE') | undefined, itemQuantity?: number | undefined, monetaryValue?: MonetaryValue | undefined, totalWeight?: Weight | undefined}; export type TruckloadShipmentLineItem = {commodityCode?: string | undefined, contact?: Contact | undefined, deliveryStopNumber?: number | 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, handlingUnitPackageType?: ('PLT' | 'BALE' | 'BOX' | 'BUNDLE' | 'CASE' | 'CRATE' | 'DRUM' | 'REEL' | 'ROLL' | 'SKID' | 'CONTAINER') | undefined, handlingUnitQuantity?: number | undefined, involvedParties?: Array | undefined, itemIdentifiers?: Array | undefined, itemPackageType?: ('BAG' | 'BALE' | 'BOX' | 'BUCKET' | 'BUNDLE' | 'CAN' | 'CARTON' | 'CASE' | 'COIL' | 'CRATE' | 'CYLINDER' | 'DRUM' | 'PAIL' | 'PLT' | 'PIECES' | 'REEL' | 'ROLL' | 'SKID' | 'TOTE' | 'TUBE' | 'EACH' | 'FLAT' | 'LOOSE') | undefined, itemQuantity?: number | undefined, monetaryValue?: MonetaryValue | undefined, pickupStopNumber?: number | undefined, subLineItems?: Array | undefined, totalWeight?: Weight | undefined}; export type TruckloadTrackingShipmentDetails = {lineItems?: Array | undefined}; export type TruckloadShipmentIdentifier = {type?: ('BILL_OF_LADING' | 'ORDER') | undefined, value?: string | undefined}; export type ZonedDateTimeWindow = {endDateTime?: string | undefined, localTimeZoneIdentifier?: string | undefined, startDateTime?: string | undefined}; export type AdditionalAppointmentWindowIdentifier = {type?: ('DOCK' | 'BOOKING_ID') | undefined, value?: string | undefined}; export type TruckloadAdditionalAppointmentWindow = {appointmentStatus?: ('PENDING' | 'REJECTED' | 'BOOKED' | 'CANCELLED' | 'COMPLETED' | 'PENDING_CARRIER' | 'PENDING_INTERNAL' | 'NONE_AVAILABLE') | undefined, appointmentWindow?: ZonedDateTimeWindow | undefined, identifiers?: Array | undefined, type?: ('STRATEGIC' | 'SLOT_BOOKING_PICKUP' | 'SLOT_BOOKING_DELIVERY' | 'SLOT_BOOKING_PICKUP_DELIVERY') | undefined}; export type TruckloadExternalArrivalEstimate = {dateTime?: string | undefined, source?: ('SHIPPER' | 'CARRIER' | 'UNKNOWN') | undefined}; export type TruckloadShipmentStop = {additionalAppointmentWindows?: Array | undefined, appointmentWindow?: ZonedDateTimeWindow | undefined, externalArrivalEstimate?: TruckloadExternalArrivalEstimate | undefined, geoCoordinates?: GeoCoordinates | undefined, involvedParties?: Array | undefined, location?: Location | undefined, locationIdentifiers?: Array | undefined, stopDescription?: string | undefined, stopName?: string | undefined, stopNumber?: number | undefined, stopType?: ('PICKUP' | 'DELIVERY' | 'DELIVERY_PICKUP') | undefined, uuid?: string | undefined}; export type TruckloadShipmentHazmatDetails = {hazardClasses?: Array | undefined}; export type TruckloadShipmentTruckDimensions = {height?: number | undefined, length?: number | undefined, unitOfMeasure?: ('IN' | 'CM' | 'FT' | 'M') | undefined, width?: number | undefined}; export type TruckloadShipmentTruckDetails = {truckDimensions?: TruckloadShipmentTruckDimensions | undefined, truckType?: ('AUTO_CARRIER' | 'B_TRAIN' | 'CONESTOGA' | 'CONTAINER' | 'CONTAINER_INSULATED' | 'CONTAINER_REFRIGERATED' | 'CONVEYOR' | 'DOUBLE_DROP' | 'DROP_DECK_LANDOLL' | 'DUMP_TRAILER' | 'FLAT_BED' | 'FLATBED_AIR_RIDE' | 'FLATBED_CONESTOGA' | 'FLATBED_DOUBLE' | 'FLATBED_HAZMAT' | 'FLATBED_HOTSHOT' | 'FLATBED_MAXI' | 'FLATBED_STEP_DECK' | 'FLATBED_OVERDOMENSION' | 'FLATBED_OVERDIMENSION' | 'FLATBED_CHAINS' | 'FLATBED_SIDES' | 'FLATBED_TARPS' | 'FLATBED_TEAM' | 'FLATBED_VAN_REEFER' | 'HOPPER_BOTTOM' | 'INSULATED_VAN_REEFER' | 'LOWBOY' | 'LOWBOY_REM_GOOSENECK' | 'LOWBOY_OVERDIMENSION' | 'MOVING_VAN' | 'PNEUMATIC' | 'POWER_ONLY' | 'REEFER' | 'REEFER_AIR_RIDE' | 'REEFER_DOUBLE' | 'REEFER_HAZMAT' | 'REEFER_INTERMODAL' | 'REEFER_LOGISTICS' | 'REEFER_VENTED_VAN' | 'REEFER_PALLET_EXCHANGE' | 'REEFER_TEAM' | 'REMOVABLE_GOOSENECK' | 'STEP_DECK' | 'STEP_DECK_REM_GOOSENECK' | 'STEP_DECK_CONESTOGA' | 'STRAIGHT_BOX_TRUCK' | 'STRETCH_TRAILER' | 'TANKER_ALUMINUM' | 'TANKER_INTERMODAL' | 'TANKER_STEEL' | 'TRUCK_AND_TRAILER' | 'DRY_VAN' | 'VAN' | 'VAN_AIR_RIDE' | 'VAN_BLANKET_WRAP' | 'VAN_CONESTOGA' | 'VAN_DOUBLE' | 'VAN_HAZMAT' | 'VAN_HOTSHOT' | 'VAN_INSULATED' | 'VAN_INTERMODAL' | 'VAN_LIFT_GATE' | 'VAN_LOGISTICS' | 'VAN_OPEN_TOP' | 'VAN_FLATBED' | 'VAN_FLATBED_TARPS' | 'VAN_FLATBET' | 'VAN_FLATBET_TARPS' | 'VAN_REEFER' | 'VAN_PALLET_EXCHANGE' | 'VAN_ROLLER_BED' | 'VAN_TRIPLE' | 'VAN_VENTED' | 'VAN_CURTAINS' | 'VAN_TEAM') | undefined, weight?: number | undefined, weightUnitOfMeasure?: ('LB' | 'KG') | undefined}; export type TruckloadShippingDetails = {hazmatDetails?: TruckloadShipmentHazmatDetails | undefined, multipleDrivers?: boolean | undefined, truckDetails?: TruckloadShipmentTruckDetails | undefined}; export type TruckloadTrackingMethodDetails = {equipmentIdentifier?: TruckloadEquipmentIdentifier | undefined, equipmentIdentifierSource?: ('CUSTOMER' | 'CARRIER' | 'AUTOMATIC') | undefined, trackingType?: ('MOBILE_PHONE' | 'TELEMATICS' | 'API') | undefined}; export type TruckloadShipment = {apiConfiguration?: TruckloadShipmentApiConfiguration | undefined, attributes?: Array | undefined, capacityProviderAccountGroup?: CapacityProviderAccountGroup | undefined, carrierIdentifier?: CapacityProviderIdentifier | undefined, contents?: Array | undefined, equipmentIdentifierChanges?: Array | undefined, equipmentIdentifiers?: Array | undefined, id?: number | undefined, idleDuration?: number | undefined, masterShipmentId?: string | undefined, pointsOfInterest?: Array | undefined, sensors?: Array | undefined, scope?: (Array<'RISK_MANAGEMENT' | 'ROUTE_DEVIATION' | 'IDLING'>) | undefined, shipmentDetails?: TruckloadTrackingShipmentDetails | undefined, shipmentIdentifiers?: Array | undefined, shipmentLegId?: string | undefined, shipmentStops?: Array | undefined, shippingDetails?: TruckloadShippingDetails | undefined, trackingDetails?: Array | undefined}; export type CreateApiApiV4TlShipmentsArgs = {body: TruckloadShipment}; export type CreateApiApiV4TlShipmentsOptions = {baseUrl?: string | undefined, oAuth2?: string | undefined, fetch?: typeof fetch | undefined}; 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 truckloadShipmentApiConfiguration = z.object({enableIntelligentMatching: z.boolean().optional(), fallBackToDefaultAccountGroup: z.boolean().optional(), webhookEndpointConfigName: z.string().optional()}); export const shipmentAttribute = z.object({name: z.string().optional(), predefined: z.boolean().optional(), value: z.string().optional(), values: z.array(z.string()).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 capacityProviderIdentifier = z.object({type: z.enum(["SCAC", "DOT_NUMBER", "MC_NUMBER", "P44_EU", "SYSTEM", "P44_GLOBAL", "VAT"]).optional(), value: z.string().optional()}); export const truckloadShipmentContent = z.object({maxTemperatureThreshold: z.number().optional(), minTemperatureThreshold: z.number().optional(), temperatureSetPoint: z.number().optional()}); export const truckloadEquipmentIdentifierChange = z.object({timestamp: z.string().optional(), type: z.enum(["MOBILE_PHONE_NUMBER", "VEHICLE_ID", "LICENSE_PLATE", "SENSITECH_DEVICE_ID", "EMERSON_DEVICE_ID", "TIVE_DEVICE_ID", "CONTAINER_ID"]).optional(), value: z.string().optional()}); export const truckloadEquipmentIdentifier = z.object({shouldDelete: z.boolean().optional(), type: z.enum(["MOBILE_PHONE_NUMBER", "VEHICLE_ID", "LICENSE_PLATE", "SENSITECH_DEVICE_ID", "TIVE_DEVICE_ID"]).optional(), value: z.string().optional()}); export const geoCoordinates = z.object({latitude: z.number().optional(), longitude: z.number().optional()}); export const countryCode = z.enum(["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 const address = z.object({addressLines: z.array(z.string()).optional(), city: z.string().optional(), country: countryCode.optional(), postalCode: z.string().optional(), state: z.string().optional()}); export const contact = z.object({companyName: z.string().optional(), contactName: z.string().optional(), email: z.string().optional(), faxNumber: z.string().optional(), faxNumberCountryCode: z.string().optional(), phoneNumber: z.string().optional(), phoneNumber2: z.string().optional(), phoneNumber2CountryCode: z.string().optional(), phoneNumberCountryCode: z.string().optional()}); export const location = z.object({address: address.optional(), contact: contact.optional()}); export const locationIdentifier = z.object({type: z.enum(["EXTERNAL", "SYSTEM"]).optional(), value: z.string().optional()}); export const truckloadShipmentPointOfInterest = z.object({geoCoordinates: geoCoordinates.optional(), location: location.optional(), locationIdentifiers: z.array(locationIdentifier).optional(), pointOfInterestDescription: z.string().optional(), pointOfInterestId: z.string().optional(), pointOfInterestName: z.string().optional(), pointOfInterestType: z.enum(["GENERAL", "TRUCK_CHANGE"]).optional(), shouldDelete: z.boolean().optional()}); export const truckloadShipmentSensorIdentifier = z.object({type: z.literal("TEMPERATURE").optional(), value: z.string().optional()}); export const truckloadShipmentSensor = z.object({identifier: truckloadShipmentSensorIdentifier.optional(), max: z.number().optional(), min: z.number().optional(), target: z.number().optional()}); export const partyAddress = z.object({addressLines: z.array(z.string()).optional(), addressLabel: z.string().optional(), city: z.string().optional(), country: countryCode.optional(), id: z.string().optional(), postalCode: z.string().optional(), state: z.string().optional()}); export const bookingContact = z.object({companyName: z.string().optional(), email: z.string().optional(), familyName: z.string().optional(), givenName: z.string().optional(), mobilePhoneNumber: z.string().optional(), phoneNumber: z.string().optional()}); export const codeListProvider = z.enum(["WAVE", "CARX", "ESSD", "IDT", "BOLE", "EDOX", "IQAX", "SECR", "TRGO", "ETEU", "TRAC", "BRIT", "GSBN", "WISE", "GLEIF", "W3C", "DNB", "FMC", "DCSA", "ZZZ"]); export const codeListName = z.enum(["DID", "LEI", "DUNS"]); export const identifyingCodes = z.object({codeListProvider: codeListProvider.optional(), codeListName: codeListName.optional(), partyCode: z.string().optional()}); export const locationIdentifierType = z.enum(["UNKNOWN", "AIRPORT_IATA", "AIRPORT_ICAO", "PORT_UN_LOCODE", "RAIL_SPLC", "DATA_PROVIDER_LOCATION_CODE", "LOCODE"]); export const ratingLocationIdentifier = z.object({type: locationIdentifierType.optional(), value: z.string().optional()}); export const partyType = z.enum(["SHIPPER", "CONSIGNEE", "BILL_TO", "NOTIFY_PARTY", "BOOKING_AGENT", "CARRIER_BOOKING_OFFICE"]); export const party = z.object({addressInfo: partyAddress.optional(), contactInfo: bookingContact.optional(), identifyingCodes: identifyingCodes.optional(), locationIdentifiers: z.array(ratingLocationIdentifier).optional(), partyType: partyType.optional(), vatNumber: z.string().optional()}); export const lineItemIdentifier = z.object({type: z.enum(["PURCHASE_ORDER", "SKU", "CONTAINER_NUMBER", "PALLET_NUMBER", "DELIVERY_NUMBER", "PICKUP_NUMBER", "VIN"]).optional(), value: z.string().optional()}); export const currency = z.enum(["USD", "CAD", "MXN", "EUR"]); export const monetaryValue = z.object({amount: z.number().optional(), currency: currency.optional()}); export const weight = z.object({weight: z.number().optional(), weightUnit: z.enum(["LB", "KG"]).optional()}); export const truckloadShipmentSubLineItem = z.object({commodityCode: z.string().optional(), contact: contact.optional(), description: z.string().optional(), freightClass: z.enum(["50", "55", "60", "65", "70", "77.5", "85", "92.5", "100", "110", "125", "150", "175", "200", "250", "300", "400", "500"]).optional(), involvedParties: z.array(party).optional(), itemIdentifiers: z.array(lineItemIdentifier).optional(), itemPackageType: z.enum(["BAG", "BALE", "BOX", "BUCKET", "BUNDLE", "CAN", "CARTON", "CASE", "COIL", "CRATE", "CYLINDER", "DRUM", "PAIL", "PLT", "PIECES", "REEL", "ROLL", "SKID", "TOTE", "TUBE", "EACH", "FLAT", "LOOSE"]).optional(), itemQuantity: z.number().int().optional(), monetaryValue: monetaryValue.optional(), totalWeight: weight.optional()}); export const truckloadShipmentLineItem = z.object({commodityCode: z.string().optional(), contact: contact.optional(), deliveryStopNumber: z.number().int().optional(), description: z.string().optional(), freightClass: z.enum(["50", "55", "60", "65", "70", "77.5", "85", "92.5", "100", "110", "125", "150", "175", "200", "250", "300", "400", "500"]).optional(), handlingUnitPackageType: z.enum(["PLT", "BALE", "BOX", "BUNDLE", "CASE", "CRATE", "DRUM", "REEL", "ROLL", "SKID", "CONTAINER"]).optional(), handlingUnitQuantity: z.number().int().optional(), involvedParties: z.array(party).optional(), itemIdentifiers: z.array(lineItemIdentifier).optional(), itemPackageType: z.enum(["BAG", "BALE", "BOX", "BUCKET", "BUNDLE", "CAN", "CARTON", "CASE", "COIL", "CRATE", "CYLINDER", "DRUM", "PAIL", "PLT", "PIECES", "REEL", "ROLL", "SKID", "TOTE", "TUBE", "EACH", "FLAT", "LOOSE"]).optional(), itemQuantity: z.number().int().optional(), monetaryValue: monetaryValue.optional(), pickupStopNumber: z.number().int().optional(), subLineItems: z.array(truckloadShipmentSubLineItem).optional(), totalWeight: weight.optional()}); export const truckloadTrackingShipmentDetails = z.object({lineItems: z.array(truckloadShipmentLineItem).optional()}); export const truckloadShipmentIdentifier = z.object({type: z.enum(["BILL_OF_LADING", "ORDER"]).optional(), value: z.string().optional()}); export const zonedDateTimeWindow = z.object({endDateTime: z.string().optional(), localTimeZoneIdentifier: z.string().optional(), startDateTime: z.string().optional()}); export const additionalAppointmentWindowIdentifier = z.object({type: z.enum(["DOCK", "BOOKING_ID"]).optional(), value: z.string().optional()}); export const truckloadAdditionalAppointmentWindow = z.object({appointmentStatus: z.enum(["PENDING", "REJECTED", "BOOKED", "CANCELLED", "COMPLETED", "PENDING_CARRIER", "PENDING_INTERNAL", "NONE_AVAILABLE"]).optional(), appointmentWindow: zonedDateTimeWindow.optional(), identifiers: z.array(additionalAppointmentWindowIdentifier).optional(), type: z.enum(["STRATEGIC", "SLOT_BOOKING_PICKUP", "SLOT_BOOKING_DELIVERY", "SLOT_BOOKING_PICKUP_DELIVERY"]).optional()}); export const truckloadExternalArrivalEstimate = z.object({dateTime: z.string().optional(), source: z.enum(["SHIPPER", "CARRIER", "UNKNOWN"]).optional()}); export const truckloadShipmentStop = z.object({additionalAppointmentWindows: z.array(truckloadAdditionalAppointmentWindow).optional(), appointmentWindow: zonedDateTimeWindow.optional(), externalArrivalEstimate: truckloadExternalArrivalEstimate.optional(), geoCoordinates: geoCoordinates.optional(), involvedParties: z.array(party).optional(), location: location.optional(), locationIdentifiers: z.array(locationIdentifier).optional(), stopDescription: z.string().optional(), stopName: z.string().optional(), stopNumber: z.number().int().optional(), stopType: z.enum(["PICKUP", "DELIVERY", "DELIVERY_PICKUP"]).optional(), uuid: z.string().optional()}); export const truckloadShipmentHazmatDetails = z.object({hazardClasses: z.array(z.string()).optional()}); export const truckloadShipmentTruckDimensions = z.object({height: z.number().optional(), length: z.number().optional(), unitOfMeasure: z.enum(["IN", "CM", "FT", "M"]).optional(), width: z.number().optional()}); export const truckloadShipmentTruckDetails = z.object({truckDimensions: truckloadShipmentTruckDimensions.optional(), truckType: z.enum(["AUTO_CARRIER", "B_TRAIN", "CONESTOGA", "CONTAINER", "CONTAINER_INSULATED", "CONTAINER_REFRIGERATED", "CONVEYOR", "DOUBLE_DROP", "DROP_DECK_LANDOLL", "DUMP_TRAILER", "FLAT_BED", "FLATBED_AIR_RIDE", "FLATBED_CONESTOGA", "FLATBED_DOUBLE", "FLATBED_HAZMAT", "FLATBED_HOTSHOT", "FLATBED_MAXI", "FLATBED_STEP_DECK", "FLATBED_OVERDOMENSION", "FLATBED_OVERDIMENSION", "FLATBED_CHAINS", "FLATBED_SIDES", "FLATBED_TARPS", "FLATBED_TEAM", "FLATBED_VAN_REEFER", "HOPPER_BOTTOM", "INSULATED_VAN_REEFER", "LOWBOY", "LOWBOY_REM_GOOSENECK", "LOWBOY_OVERDIMENSION", "MOVING_VAN", "PNEUMATIC", "POWER_ONLY", "REEFER", "REEFER_AIR_RIDE", "REEFER_DOUBLE", "REEFER_HAZMAT", "REEFER_INTERMODAL", "REEFER_LOGISTICS", "REEFER_VENTED_VAN", "REEFER_PALLET_EXCHANGE", "REEFER_TEAM", "REMOVABLE_GOOSENECK", "STEP_DECK", "STEP_DECK_REM_GOOSENECK", "STEP_DECK_CONESTOGA", "STRAIGHT_BOX_TRUCK", "STRETCH_TRAILER", "TANKER_ALUMINUM", "TANKER_INTERMODAL", "TANKER_STEEL", "TRUCK_AND_TRAILER", "DRY_VAN", "VAN", "VAN_AIR_RIDE", "VAN_BLANKET_WRAP", "VAN_CONESTOGA", "VAN_DOUBLE", "VAN_HAZMAT", "VAN_HOTSHOT", "VAN_INSULATED", "VAN_INTERMODAL", "VAN_LIFT_GATE", "VAN_LOGISTICS", "VAN_OPEN_TOP", "VAN_FLATBED", "VAN_FLATBED_TARPS", "VAN_FLATBET", "VAN_FLATBET_TARPS", "VAN_REEFER", "VAN_PALLET_EXCHANGE", "VAN_ROLLER_BED", "VAN_TRIPLE", "VAN_VENTED", "VAN_CURTAINS", "VAN_TEAM"]).optional(), weight: z.number().int().optional(), weightUnitOfMeasure: z.enum(["LB", "KG"]).optional()}); export const truckloadShippingDetails = z.object({hazmatDetails: truckloadShipmentHazmatDetails.optional(), multipleDrivers: z.boolean().optional(), truckDetails: truckloadShipmentTruckDetails.optional()}); export const truckloadTrackingMethodDetails = z.object({equipmentIdentifier: truckloadEquipmentIdentifier.optional(), equipmentIdentifierSource: z.enum(["CUSTOMER", "CARRIER", "AUTOMATIC"]).optional(), trackingType: z.enum(["MOBILE_PHONE", "TELEMATICS", "API"]).optional()}); export const truckloadShipment = z.object({apiConfiguration: truckloadShipmentApiConfiguration.optional(), attributes: z.array(shipmentAttribute).optional(), capacityProviderAccountGroup: capacityProviderAccountGroup.optional(), carrierIdentifier: capacityProviderIdentifier.optional(), contents: z.array(truckloadShipmentContent).optional(), equipmentIdentifierChanges: z.array(truckloadEquipmentIdentifierChange).optional(), equipmentIdentifiers: z.array(truckloadEquipmentIdentifier).optional(), id: z.number().int().optional(), idleDuration: z.number().int().optional(), masterShipmentId: z.string().optional(), pointsOfInterest: z.array(truckloadShipmentPointOfInterest).optional(), sensors: z.array(truckloadShipmentSensor).optional(), scope: z.array(z.enum(["RISK_MANAGEMENT", "ROUTE_DEVIATION", "IDLING"])).optional(), shipmentDetails: truckloadTrackingShipmentDetails.optional(), shipmentIdentifiers: z.array(truckloadShipmentIdentifier).optional(), shipmentLegId: z.string().optional(), shipmentStops: z.array(truckloadShipmentStop).optional(), shippingDetails: truckloadShippingDetails.optional(), trackingDetails: z.array(truckloadTrackingMethodDetails).optional()}); export const truckloadShipmentConfirmation = z.object({infoMessages: z.array(message).optional(), shipment: truckloadShipment.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 }; /** * start tracking a truckload shipment * * POST /api/v4/tl/shipments */ export const createApiApiV4TlShipments = async (args: CreateApiApiV4TlShipmentsArgs, options?: CreateApiApiV4TlShipmentsOptions) => { 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/tl/shipments${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(truckloadShipmentConfirmation, await res.json()) };