UNPKG

@geoapify/route-planner-sdk

Version:

A TypeScript SDK for the Geoapify Route Planner API that simplifies route optimization requests, and helps visualize and edit resulting routes.

79 lines (78 loc) 2.56 kB
import { RoutePlannerOptions } from "../interfaces/route-planner-options"; import { RoutePlannerResultData } 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 { TravelMode } from "../types"; import { RouteActionInfo } from "./nested/result/route-action-info"; /** * Provides convenient methods for reading Route Planner API results. */ export declare class RoutePlannerResult { private readonly rawData; private readonly options; constructor(options: RoutePlannerOptions, rawData: RoutePlannerResultData); /** * Returns the raw API response. */ getRaw(): RoutePlannerResultData; /** * Returns a list of all assigned agent solutions. */ getAgentSolutions(): AgentSolution[]; /** * Finds an agent's solution by their ID. */ getAgentSolution(agentId: string): 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): string[]; /** * Retrieves all shipments assigned to a specific agent. */ getAgentShipments(agentId: string): string[]; /** * Retrieves unassigned agents. */ getUnassignedAgents(): number[]; /** * Retrieves unassigned jobs. */ getUnassignedJobs(): number[]; /** * Retrieves unassigned shipments. */ getUnassignedShipments(): number[]; /** * 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 the route for a specific agent. * @param agentId - The ID of the agent. * @param mode */ getAgentRoute(agentId: string, mode: TravelMode): Promise<any | undefined>; }