Node GBFS Client (CitiBike and others)
Lightweight client for General Bikeshare Feed Specification (GBFS) feeds, with a Promise-based API and full type definitions (Typescript).
Compatible with the CitiBike NYC API.
Installation
npm install gbfs-client --save
Usage
const GbfsClient = ;const gbfsClient = 'https://gbfs.citibikenyc.com/gbfs/en/'; gbfsClient ; /* { system_id: 'NYC', language: 'en', name: 'Citi Bike', ... */ gbfsClient ; /* [ { station_id: '72', name: 'W 52 St & 11 Ave', short_name: '6926.01', lat: 40.76727216, lon: -73.99392888, ... ] */gbfsClient ; /* { station_id: '72', name: 'W 52 St & 11 Ave', short_name: '6926.01', lat: 40.76727216, lon: -73.99392888, ... */ gbfsClient ; /* { station_id: '72', num_bikes_available: 12, num_docks_available: 26, ... */
new GbfsClient(baseUrl)
baseUrl
: optional url for the GBFS API. Defaults to'https://gbfs.citibikenyc.com/gbfs/en/'
, for NYC's CitiBike.
gbfsClient.system()
- Returns a promise for a JSON object with system information. See the GBFS system information spec for a list of the JSON fields.
gbfsClient.stationInfo(stationId)
stationId
: optional id for a specific station. If this parameter is not provided, an array of info for all stations will be returned.- Returns a promise for a JSON object with station information for one or all stations. See the GBFS station information spec for a list of the JSON fields.
gbfsClient.stationStatus(stationId)
stationId
: optional id for a specific station. If this parameter is not provided, an array of status for all stations will be returned.- Returns a promise for a JSON object with station status for one or all stations. See the GBFS station status spec for a list of the JSON fields.