Shipment
Shipment defines a pickup+delivery pair that must be executed by the same agent.
Constructor
Signature: new Shipment(raw?: ShipmentData)
Creates a shipment instance. If raw is omitted, empty requirements are initialized.
Methods
| Method | Signature | Purpose |
|---|---|---|
getRaw |
getRaw(): ShipmentData |
Return current raw payload |
setRaw |
setRaw(value: ShipmentData): this |
Replace raw payload |
setId |
setId(id: string): this |
Set shipment ID |
setPickup |
setPickup(value: ShipmentStep): this |
Set pickup step |
setDelivery |
setDelivery(value: ShipmentStep): this |
Set delivery step |
addRequirement |
addRequirement(value: string): this |
Add required capability |
setPriority |
setPriority(value: number): this |
Set priority |
setDescription |
setDescription(value: string): this |
Set description |
setAmount |
setAmount(value: number): this |
Set amount for capacity calculations |
getRaw()
Returns current ShipmentData.
setRaw(value)
Replaces whole shipment payload.
shipment.setRaw({ requirements: [], pickup: { location: [13.38, 52.52] }, delivery: { location: [13.40, 52.50] } });
setId(id)
Sets shipment ID.
setPickup(value)
Sets pickup step.
setDelivery(value)
Sets delivery step.
addRequirement(value)
Adds required capability tag.
setPriority(value)
Sets shipment priority.
setDescription(value)
Sets human-readable description.
setAmount(value)
Sets shipment amount for capacity tracking.
Example
import { Shipment, ShipmentStep } from '@geoapify/route-planner-sdk';
const pickup = new ShipmentStep()
.setLocation(13.38, 52.52)
.setDuration(180)
.addTimeWindow(0, 14400);
const delivery = new ShipmentStep()
.setLocation(13.40, 52.50)
.setDuration(180)
.addTimeWindow(3600, 21600);
const shipment = new Shipment()
.setId('order-1')
.setPickup(pickup)
.setDelivery(delivery)
.setAmount(20)
.setPriority(80)
.addRequirement('cooled');
ShipmentData Interface
This is the original plain data object shape used in API payloads (request/response), not the SDK wrapper class.
interface ShipmentData {
id?: string;
pickup?: ShipmentStepData;
delivery?: ShipmentStepData;
requirements: string[];
priority?: number;
description?: string;
amount?: number;
}
Referenced nested interface: ShipmentStepData.