2019-10-31 20:08:56 +01:00
|
|
|
const formatStationBoardReq = (ctx, station, type) => {
|
2024-02-06 22:58:49 +01:00
|
|
|
const {profile, opt} = ctx;
|
2019-10-31 20:08:56 +01:00
|
|
|
|
|
|
|
return {
|
2024-12-07 22:46:04 +00:00
|
|
|
endpoint: profile.boardEndpoint,
|
|
|
|
path: type+'/'+station,
|
|
|
|
query: {
|
|
|
|
// TODO direction
|
|
|
|
filterTransports: 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),
|
|
|
|
maxViaStops: opt.stopovers ? undefined : 0,
|
|
|
|
includeStationGroup: opt.includeRelatedStations,
|
|
|
|
maxTransportsPerType: opt.results === Infinity ? undefined : opt.results,
|
|
|
|
includeMessagesDisruptions: opt.remarks,
|
|
|
|
sortBy: 'TIME_SCHEDULE'
|
|
|
|
},
|
|
|
|
method: 'get',
|
|
|
|
headers: {
|
|
|
|
'Db-Client-Id': process.env.DB_CLIENT_ID,
|
|
|
|
'Db-Api-Key': process.env.DB_API_KEY,
|
|
|
|
'Accept': 'application/vnd.de.db.ris+json'
|
|
|
|
}
|
2024-02-06 22:58:49 +01:00
|
|
|
};
|
|
|
|
};
|
2019-10-31 20:08:56 +01:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
export {
|
|
|
|
formatStationBoardReq,
|
2024-02-06 22:58:49 +01:00
|
|
|
};
|