https://github.com/toinane/api-tan-wrapper
Just a wrapper for the API TAN
https://github.com/toinane/api-tan-wrapper
Last synced: 5 months ago
JSON representation
Just a wrapper for the API TAN
- Host: GitHub
- URL: https://github.com/toinane/api-tan-wrapper
- Owner: Toinane
- Created: 2019-07-08T13:37:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-06T06:01:53.000Z (about 3 years ago)
- Last Synced: 2025-03-14T07:18:35.345Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
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.
[](https://nodei.co/npm/api-tan-wrapper/)
[](https://badge.fury.io/js/api-tan-wrapper)
[](https://github.com/Toinane/api-tan-wrapper)
[](https://github.com/Toinane/api-tan-wrapper)
[](https://github.com/Toinane/api-tan-wrapper)
[](https://github.com/Toinane/api-tan-wrapper)
## Installation
`yarn add api-tan-wrapper`
## Usage
```javascript
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