@onemedia/national-rail-data-module
v1.2.1
Published
Fetches and translates data from the TFL Unified API.
Downloads
3
Readme
National Rail Data Module
Fetches and translates data from the National Rail LDBWS API.
const Client = require('@onemedia/national-rail-data-module');
const apiClient = new Client({ apiUrl: process.env.API_URL, apiKey: process.env.API_KEY });
const departures = await apiClient.fetchDepartures({ station, filter, rows, timeOffset, timeWindow });
Table of Contents
Requirements
Paddington requires the following to run:
- [Node.js][node] 8+
- [npm][npm] (normally comes with Node.js)
Usage
national-rail-data-module is installed via [npm][npm]:
npm install @onemedia/national-rail-data-module
Then you can load the relevant module into your code with a require
call:
var Client = require('@onemedia/national-rail-data-module');
The client is required to be instantiated with the API URL and the API_KEY. A timeout value in ms can also be passed in (although defaults to 10000).
const Client = require('@onemedia/national-rail-data-module');
const apiClient = new Client({ apiUrl: process.env.API_URL, apiKey: process.env.API_KEY });
Client
apiClient.fetchDepartures({ station: 'OXF'})
Retrieves departure board information for specified station.