api-tan-wrapper
v1.1.0
Published
> Little node wrapper for Tan API.
Downloads
5
Readme
api-tan-wrapper
Little node wrapper for Tan API.
This little wrapper allow you to get all stations, can deliver similar stations name and time left for a station.
Installation
yarn add api-tan-wrapper
Usage
const TanWrapper = require('api-tan-wrapper');
const tan = new TanWrapper({
production: true, // default: false // You can use NODE_ENV = production too
locale: 'fr_FR' // default: 'fr_FR'
});
// Get all stations
await tan.getAllStations();
// Get stations in a 500m range of the location
await tan.getStationsWithLocation(latitude, longitude)
// Get all tram stations
await tan.getAllTramStations();
// Get all bus stations
await tan.getAllBusStations();
// Get waiting time at station
await tan.getWaitingTimeFromStation('beaujoire', 'name'); // or tan.getWaitingTimeFromStation('bjoi');
// Get times from station
await tan.getTimesFromStation('beaujoire', 'name', 1, 2); // or tan.getTimesFromStation('bjoi', 1, 2);
// Get array of stations name
tan.parseStationsToList(stations); // stations here is the result of tan.getAllStations();
// Get station from station name
await tan.getStationFromCode('beaujoire');
// Get station from code
await tan.getStationFromCode('bjoi');
// Get similar stations name
tan.getSimilarStationsName('beauséjour', ['beaujoire', 'commerce', ...], 2); // 2 is the number of similar stations you want to get in return
Licence
MIT @Toinane