db-vendo-client/p/dbregioguide/station-board-req.js
2025-03-21 21:13:20 +00:00

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,
};