Skip to content

TransitAdapterInterface

Derek Leung edited this page Aug 23, 2017 · 5 revisions

Describes the interface for the adapters to be used with the Transit service.

Methods

.getAllStops()

Gets every stop. This method should minimize the number of requests to the API.

Returns: Promise An array of StopLiteral.

.getBusInformation(String busId)

Gets information of a bus with busId as id.

Returns: Promise A BusLiteral. The promise should reject if a bus with such id cannot be found.

.getConfig()

Get adapter configurations.

Returns: TransitAdapterConfigLiteral

.getStopsByLocation(Location location)

Get an array of stops that are near the location.

Returns: Promise An array of StopId.

.getUpcomingDepartures(StopId stopId)

Get an array of upcoming departures of the stop with id stopId.

Returns: Promise An array of DepartureLiteral.

.searchStops(String input)

Get an array of stops that best match the input string. This method should be quick and lightweight as it may be used for autocompletion purposes.

Returns: Promise An array of StopId.