db-vendo-client/format/station-board-req.js

25 lines
670 B
JavaScript
Raw Normal View History

2019-10-31 20:08:56 +01:00
const formatStationBoardReq = (ctx, station, type) => {
const {profile, opt} = ctx;
2019-10-31 20:08:56 +01:00
2025-03-21 20:49:38 +00:00
if (opt.moreStops) {
station += ',' + opt.moreStops.join(',');
}
2024-12-10 17:51:20 +00:00
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',
};
};
2022-05-07 16:17:37 +02:00
export {
formatStationBoardReq,
};