UNPKG

@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

118 lines (117 loc) 4.1 kB
import { RoutePlannerOptions } from "../interfaces/route-planner-options"; import { AgentData, JobData, RoutePlannerResultData, RoutePlannerResultResponseData, ShipmentData } from "../interfaces"; import { AgentSolution } from "./nested/result/agent-solution"; import { Waypoint } from "./nested/result/waypoint"; import { RouteAction } from "./nested/result/route-action"; import { RouteLeg } from "./nested/result/route-leg"; import { RouteActionInfo } from "./nested/result/route-action-info"; import { JobSolution } from "./nested/result/job-solution"; import { ShipmentSolution } from "./nested/result/shipment-solution"; import { RoutingOptions } from "../interfaces/routing-options"; /** * Provides convenient methods for reading Route Planner API results. */ export declare class RoutePlannerResult { private readonly rawData; private readonly options; constructor(options: RoutePlannerOptions, rawData: RoutePlannerResultResponseData); /** * Returns the data returned by the Route Planner API. */ getData(): RoutePlannerResultData; /** * Returns the raw data returned by the Route Planner API. */ getRawData(): RoutePlannerResultResponseData; /** * Returns a list of all assigned agent solutions. */ getAgentSolutions(): AgentSolution[]; /** * Returns a list of all agent solutions by index. (if it's not assigned, then it will be undefined) */ getAgentSolutionsByIndex(): (AgentSolution | undefined)[]; /** * Finds an agent's solution by their ID. */ getAgentSolution(agentId: string): AgentSolution | undefined; /** * Finds an agent's solution by their index. */ getAgentSolutionByIndex(agentIndex: number): AgentSolution | undefined; /** * Retrieves all waypoints of a specific agent. */ getAgentWaypoints(agentId: string): Waypoint[]; /** * Retrieves all route actions of a specific agent. */ getAgentRouteActions(agentId: string): RouteAction[]; /** * Retrieves all route legs of a specific agent. */ getAgentRouteLegs(agentId: string): RouteLeg[]; /** * Retrieves the options used to generate the result. */ getOptions(): RoutePlannerOptions; /** * Retrieves all jobs assigned to a specific agent. */ getAgentJobs(agentId: string): number[]; /** * Retrieves all shipments assigned to a specific agent. */ getAgentShipments(agentId: string): number[]; /** * Retrieves unassigned agents. */ getUnassignedAgents(): AgentData[]; /** * Retrieves unassigned jobs. */ getUnassignedJobs(): JobData[]; /** * Retrieves unassigned shipments. */ getUnassignedShipments(): ShipmentData[]; /** * Returns a list of all assigned jobs */ getJobSolutions(): JobSolution[]; /** * Finds job solution by their ID. */ getJobSolution(jobId: string): JobSolution | undefined; /** * Returns a list of all assigned shipments */ getShipmentSolutions(): ShipmentSolution[]; /** * Finds shipment solution by their ID. */ getShipmentSolution(jobId: string): ShipmentSolution | undefined; /** * Retrieves detailed information about a specific job. */ getJobInfo(jobId: string): RouteActionInfo | undefined; /** * Retrieves detailed information about a specific shipment. */ getShipmentInfo(shipmentId: string): RouteActionInfo | undefined; /** * Retrieves detailed information about a specific job. */ getJobInfoByIndex(jobIndex: number): RouteActionInfo | undefined; /** * Retrieves detailed information about a specific shipment. */ getShipmentInfoByIndex(shipmentIndex: number): RouteActionInfo | undefined; /** * Retrieves the route for a specific agent. * @param agentId - The ID of the agent. * @param options - The routing options. */ getAgentRoute(agentId: string, options: RoutingOptions): Promise<any | undefined>; private constructRoutingRequest; }