@stockholm-transit/departures
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

🇸🇪 Storstockholms Lokaltrafiks (SL) Departures 🚆

  • With this API, you can get real-time information regarding bus, metro, commuter train and local train.
  • Trafiklab documentation is available here.

Usage

import * as departures from '@stockholm-transit/departures';
import { DepartureParameters } from '@stockholm-transit/departures';

departures.init({ apiKey: process.env.STOCKHOLM_DEPARTURES_API_KEY });

const params: DepartureParameters = { siteId: '9001' };
departures.query(params).then((data) => res.send(data.ResponseData));

Functions

init

(config: StockholmBaseConfig) => void

query

(params: DepartureParameters) => Promise<DepartureResponse | undefined>

Types

StockholmBaseConfig

Parameter Type Required Description
apiKey string true Trafiklab API key.
  • Read how to generate Trafiklab API keys here.

DepartureParameters

Parameter Type Required Description Default
siteId string true Unique identification number for the place.
timeWindow boolean false Pick up departures within the desired time window. 60

Building

Run npx nx build @stockholm-transit/departures to build the library.

Running unit tests

Run npx nx test @stockholm-transit/departures to execute the unit tests via Jest.

Related APIs

Package Sidebar

Install

npm i @stockholm-transit/departures

Weekly Downloads

5

Version

1.0.4

License

MIT

Unpacked Size

14.2 kB

Total Files

14

Last publish

Collaborators

  • rebelliard