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.32 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(agentIdOrIndex: string | number): AgentSolution | undefined; /** * Finds an agent's solution by their index. */ getAgentSolutionByIndex(agentIndex: number): AgentSolution | undefined; /** * Retrieves all waypoints of a specific agent. */ getAgentWaypoints(agentIdOrIndex: string | number): Waypoint[]; /** * Retrieves all route actions of a specific agent. */ getAgentRouteActions(agentIdOrIndex: string | number): RouteAction[]; /** * Retrieves all route legs of a specific agent. */ getAgentRouteLegs(agentIdOrIndex: string | number): RouteLeg[]; /** * Retrieves the options used to generate the result. */ getOptions(): RoutePlannerOptions; /** * Retrieves all jobs assigned to a specific agent. */ getAgentJobs(agentIdOrIndex: string | number): number[]; /** * Retrieves all shipments assigned to a specific agent. */ getAgentShipments(agentIdOrIndex: string | number): 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 or index. */ getJobSolution(jobIdOrIndex: string | number): JobSolution | undefined; /** * Returns a list of all assigned shipments */ getShipmentSolutions(): ShipmentSolution[]; /** * Finds shipment solution by their ID or index. */ getShipmentSolution(shipmentIdOrIndex: string | number): ShipmentSolution | undefined; /** * Retrieves detailed information about a specific job. */ getJobInfo(jobIdOrIndex: string | number): RouteActionInfo | undefined; /** * Retrieves detailed information about a specific shipment. */ getShipmentInfo(shipmentIdOrIndex: string | number): 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 agentIdOrIndex - The ID or index of the agent. * @param options - The routing options. */ getAgentRoute(agentIdOrIndex: string | number, options: RoutingOptions): Promise<any | undefined>; private constructRoutingRequest; }