wili
TypeScript icon, indicating that this package has built-in type declarations

0.7.1 • Public • Published

wili

License Version Build

English | Deutsch

A Node wrapper for the Wiener Linien public transport API

Installation

npm install wili

Usage

Example usage in script:

import { createWienerLinien } from 'wili';

const wili = createWienerLinien();

const options = {
  relatedLine: ['U2', 'U4', 'U6']
};

// Promise API
wili.trafficInfoList(options)
  .then( data => {
    console.log(data.trafficInfos);
  })
  .catch( error => {
    console.error(error);
  });

// async/await
try {
  const data = await wili.trafficInfoList(options);
  console.log(data.trafficInfos);
} catch (output) {
  console.error(error);
}

⚠️ For NodeJS versions lower than v18, the class needs to be instantiated with a fetch-implementation

Example

import { createWienerLinien } from 'wili';
import fetch from 'isomorphic-fetch';

const wili = createWienerLinien(fetch);

API

monitor

Usage: monitor(rbl, [options])

Returns real-time data for a station, including train information such as identifier or accessibility features.

Parameters:

rbl

Type: String, Integer, Array

RBL number (Rechnergestütztes Betriebsleitsystem - computer-aided operations control system), can be found this website

options.activeTrafficInfo

Type: String, Array

Disruption type (stoerungkurz, stoerunglang, or aufzugsinfo)

newsList

Usage: newsList(options)

Returns news, elevator maintenance and other information

Options

options.relatedLine

Type: String, Integer, Array

Train or bus number, e.g. U1, S7, 59A (case-insensitive)

options.relatedStop

Type: String, Integer, Array

Station ID

options.name

Type: String, Array

Information category, e.g news or aufzugsservice

trafficInfoList

Usage: trafficInfoList([options])

Returns interruption of operations and elevator outage

Options

options.relatedLine

Type: String, Integer, Array

Train or bus number, e.g. U1, S7, 59A (case-insensitive)

options.relatedStop

Type: String, Integer, Array

Station ID

options.name

Type: String, Array

Disruption type (stoerungkurz, stoerunglang, or aufzugsinfo)

License

This work is licensed under The MIT License

Package Sidebar

Install

npm i wili

Weekly Downloads

1

Version

0.7.1

License

MIT

Unpacked Size

15.5 kB

Total Files

8

Last publish

Collaborators

  • idleberg