@geoapify/route-planner-sdk
Version:
TypeScript SDK for the Geoapify Route Planner API. Supports route optimization, delivery planning, and timeline visualization in browser and Node.js
66 lines (65 loc) • 1.48 kB
JavaScript
export class Agent {
constructor(raw) {
if (raw) {
this.raw = raw;
}
else {
this.raw = {
capabilities: [],
time_windows: [],
breaks: []
};
}
}
getRaw() {
return this.raw;
}
setRaw(value) {
this.raw = value;
return this;
}
setStartLocation(lon, lat) {
this.raw.start_location = [lon, lat];
return this;
}
setStartLocationIndex(value) {
this.raw.start_location_index = value;
return this;
}
setEndLocation(lon, lat) {
this.raw.end_location = [lon, lat];
return this;
}
setEndLocationIndex(value) {
this.raw.end_location_index = value;
return this;
}
setPickupCapacity(value) {
this.raw.pickup_capacity = value;
return this;
}
setDeliveryCapacity(value) {
this.raw.delivery_capacity = value;
return this;
}
addCapability(value) {
this.raw.capabilities.push(value);
return this;
}
addTimeWindow(start, end) {
this.raw.time_windows.push([start, end]);
return this;
}
addBreak(value) {
this.raw.breaks.push(value.getRaw());
return this;
}
setId(value) {
this.raw.id = value;
return this;
}
setDescription(value) {
this.raw.description = value;
return this;
}
}