Constructor
new BODSClient(apikey)
Creates a new Bus Open Data Service client.
Parameters:
Name | Type | Description |
---|---|---|
apikey |
String | Provide an API Key to identify your use of the API - Get one by signing in/up @ https://data.bus-data.dft.gov.uk/account/login/ |
Methods
fetchBusLocationDatafeed(opts) → {Array.<BusLocationDataset>}
Fetches the Bus Location datafeed and converts results to JSON
Parameters:
Name | Type | Description |
---|---|---|
opts |
BusLocationDatafeedOptions |
Returns:
Array of buses and their related information
- Type
- Array.<BusLocationDataset>
fetchTimetableDataset(opts) → {Promise.<TimetableDatasetResponse>}
Parameters:
Name | Type | Description |
---|---|---|
opts |
TimetableDatasetOptions | Options for the Timetable dataset query |
- Deprecated:
- ⚠️ Data fetched is in an unconverted format - Try the new TimetablesManager class instead. Performs a timetable dataset query based on the options provided.
- Source:
Returns:
The query's results.
- Type
- Promise.<TimetableDatasetResponse>
fetchTimetablePage(url)
Parameters:
Name | Type | Description |
---|---|---|
url |
String | The URL provided in the `next` or `previous` attributes of a timetable dataset API call |
- Deprecated:
- ⚠️ Data fetched is in an unconverted format - Try the new TimetablesManager class instead. Fetches the next or previous page from the URL
- Source:
(async, static) downloadTimetableData(region) → {Promise}
Downloads data for a specific region into `/.bods-data/`. Should be done no more than every 24 hours.
For use with the `TimetablesManager` class - See more info on Github.
Parameters:
Name | Type | Description |
---|---|---|
region |
'all' | 'ea' | 'em' | 'england' | 'london' | 'ne' | 'nw' | 'scotland' | 'sw' | 'se' | 'wales' | 'wm' | 'yorkshire' | The region to fetch. |
Returns:
A promise. TimetableManager instances should only
- Type
- Promise