mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
24 lines
670 B
JavaScript
24 lines
670 B
JavaScript
const formatStationBoardReq = (ctx, station, type) => {
|
|
const {profile, opt} = ctx;
|
|
|
|
if (opt.moreStops) {
|
|
station += ',' + opt.moreStops.join(',');
|
|
}
|
|
|
|
return {
|
|
endpoint: profile.boardEndpoint,
|
|
path: (type == 'departures' ? 'departure' : 'arrival') + '/' + station,
|
|
query: {
|
|
// TODO direction, fields below
|
|
modeOfTransport: profile.formatProductsFilter(ctx, opt.products || {}, 'ris'),
|
|
timeStart: profile.formatTime(profile, opt.when, true),
|
|
timeEnd: profile.formatTime(profile, opt.when.getTime() + opt.duration * 60 * 1000, true),
|
|
expandTimeFrame: 'TIME_END', // TODO impact?
|
|
},
|
|
method: 'get',
|
|
};
|
|
};
|
|
|
|
export {
|
|
formatStationBoardReq,
|
|
};
|