@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
61 lines (60 loc) • 1.3 kB
JavaScript
export class Job {
constructor(raw) {
if (raw) {
this.raw = raw;
}
else {
this.raw = {
requirements: [],
time_windows: []
};
}
}
getRaw() {
return this.raw;
}
setRaw(value) {
this.raw = value;
return this;
}
setLocation(lon, lat) {
this.raw.location = [lon, lat];
return this;
}
setLocationIndex(value) {
this.raw.location_index = value;
return this;
}
setPriority(value) {
this.raw.priority = value;
return this;
}
setDuration(value) {
this.raw.duration = value;
return this;
}
setPickupAmount(value) {
this.raw.pickup_amount = value;
return this;
}
setDeliveryAmount(value) {
this.raw.delivery_amount = value;
return this;
}
addRequirement(value) {
this.raw.requirements.push(value);
return this;
}
addTimeWindow(start, end) {
this.raw.time_windows.push([start, end]);
return this;
}
setId(value) {
this.raw.id = value;
return this;
}
setDescription(value) {
this.raw.description = value;
return this;
}
}