js-sl-api
The @happycoderse/js-sl-api
library provides a client for communication with some of the SL API published by TrafikLab.se
Installation
This module is distributed via npm which is bundled with node and
should be installed as one of your project's dependencies
:
npm install @happycoderse/js-sl-api
or
for installation with yarn package manager.
yarn add @happycoderse/js-sl-api
Usage
Import @happycoderse/js-sl-api
and you're good to go:
import SlApiClient from "@happycoderse/js-sl-api";
Instantiate the client and supply API keys obtained from TrafikLab.se.
Example
const client = new SlApiClient({apiKey_realtimeInfo: <key>, apiKey_nearMe: <key>, apiKey_location: <key>});
UpdateStopInfo
UpdateStopInfo({latitude: string, longitude: string)
This fetches nearby stops. Max 900 metres from given lat/long.
LookupPlaces
LookupPlaces(address: string)
This fetches address and place information by giving part of address name.
GetNextDeparture
GetNextDeparture(SiteId: string)
This fetches departures for the next 60 minuts for the given siteId.