ShipmentPlan
ShipmentPlan describes one shipment in the current result (assigned or unassigned).
Get it from:
RoutePlannerResult.getShipmentPlan(shipmentIdOrIndex)RoutePlannerResult.getShipmentPlans()
Methods
| Method | Signature | Purpose |
|---|---|---|
getShipmentIndex |
getShipmentIndex(): number |
Get shipment index in input shipments[] |
getShipmentId |
getShipmentId(): string \| undefined |
Get shipment id from input |
getShipmentInputData |
getShipmentInputData(): ShipmentData |
Get original shipment payload |
getAgentIndex |
getAgentIndex(): number \| undefined |
Get assigned agent index |
getAgentId |
getAgentId(): string \| undefined |
Get assigned agent id |
getAgentPlan |
getAgentPlan(): AgentPlan \| undefined |
Get assigned AgentPlan |
getRouteActions |
getRouteActions(): RouteAction[] |
Get shipment pickup/delivery actions |
getShipmentIndex()
Returns shipment index from input shipments[].
getShipmentId()
Returns shipment ID (if defined in input).
getShipmentInputData()
Returns original ShipmentData payload.
getAgentIndex()
Returns assigned agent index or undefined if unassigned.
getAgentId()
Returns assigned agent id or undefined if unassigned.
getAgentPlan()
Returns assigned AgentPlan or undefined if unassigned.
getRouteActions()
Returns actions linked to this shipment.
Example
const shipmentPlan = result.getShipmentPlan('shipment-1');
if (shipmentPlan) {
console.log(shipmentPlan.getAgentId());
console.log(shipmentPlan.getRouteActions().map((a) => a.getType()));
}
ShipmentData Interface
This is the original plain data object shape used in API payloads (request/response), not the SDK wrapper class.
ShipmentPlan references ShipmentData from input:
interface ShipmentData {
id?: string;
pickup?: ShipmentStepData;
delivery?: ShipmentStepData;
requirements: string[];
priority?: number;
description?: string;
amount?: number;
}