oasa-telematics
v0.4.2
Published
Oasa Telematics API Wrapper made with Typescript.
Downloads
13
Maintainers
Readme
oasa-telematics
Promise based Oasa Telematics API Wrapper.
Installing
Using NPM:
npm install oasa-telematics
Example
import oasa from 'oasa-telematics'
oasa.getStopArrivals(400086)
.then(arrivals => console.log(arrivals))
/* output
[
{ routeCode: '2542', vehCode: '30756', btime2: '17' },
{ routeCode: '3029', vehCode: '40854', btime2: '23' },
{ routeCode: '2542', vehCode: '30743', btime2: '33' },
{ routeCode: '2542', vehCode: '30772', btime2: '47' },
{ routeCode: '3029', vehCode: '40915', btime2: '48' },
{ routeCode: '3029', vehCode: '40831', btime2: '73' }
]
*/
All responses are fixed with camelCase keys.
Configuration
Methods like getStopArrivals() returns null when there is no bus going to the stop at that time. You can instead return it as an empty array by enabling nullToEmptyArray (and nullToEmptyObject for methods that returns object)
oasa.config.nullToEmptyArray = true
oasa.getStopArrivals(400086).then(arrivals => console.log(arrivals)) // []
Methods
**Code = string | number
getStopArrivals(stopCode: Code)
getBusLocations(routeCode: Code)
getDailySchedule(lineCode: Code)
getScheduleDaysMasterline(lineCode: Code)
getLinesAndRoutesForMl(mlCode: Code)
getRoutesForLine(lineCode: Code)
getMLName(mlCode: Code)
getLineName(lineCode: Code)
getRouteName(routeCode: Code)
getStopNameAndXY(stopCode: Code)
getSchedLines(mlCode: Code, sdcCode: Code, lineCode: Code)
getClosestStops(lat: number, long: number)
webGetLines()
webGetLinesWithMLInfo()
webGetRoutes(lineCode: Code)
webGetStops(routeCode: Code)
webGetRouteDetails(routeCode: Code)
webGetRoutesForStop(stopCode: Code)
webGetRoutesDetailsAndStops(routeCode: Code)
webGetLangs()
webGetMasterLines()
OASA Telematics API’s documentation
License
MIT