db-vendo-client/p/sbb/index.js
Norwin Roosen 7444e08819 add SBB profile
closes #198
2020-12-26 21:54:04 +01:00

36 lines
759 B
JavaScript

'use strict'
const products = require('./products')
const transformReqBody = (ctx, body) => {
// sourced from https://github.com/marudor/BahnhofsAbfahrten/blob/1c99d8b/packages/server/HAFAS/profiles.ts#L344-L361
body.client = {
type: 'AND',
id: 'DBZUGRADARNETZ',
v: '',
}
body.ver = '1.18'
body.auth = { aid: 'hf7mcf9bv3nv8g5f', type:'AID' }
body.lang = 'deu'
return body
}
const sbbProfile = {
locale: 'de-CH',
timezone: 'Europe/Zurich',
// todo: find a way to use https:
endpoint: 'http://fahrplan.sbb.ch/bin/mgate.exe',
transformReqBody,
products: products,
trip: true,
radar: true,
reachableFrom: true,
}
const withLocale = (locale) => ({...sbbProfile, locale})
sbbProfile.withLocale = withLocale
module.exports = sbbProfile