mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
add mobiliteit.lu profile ✨
This commit is contained in:
parent
92fb29d687
commit
013ab2d3ce
5 changed files with 144 additions and 0 deletions
48
p/mobiliteit-lu/example.js
Normal file
48
p/mobiliteit-lu/example.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
'use strict'
|
||||
|
||||
const createClient = require('../..')
|
||||
const mobiliteitProfile = require('.')
|
||||
|
||||
const client = createClient(mobiliteitProfile, 'hafas-client example')
|
||||
|
||||
const mersch = '160904001'
|
||||
const bruxellesCentral = '300000079'
|
||||
|
||||
// from Mersch to Bruxelles Central
|
||||
client.journeys(mersch, bruxellesCentral, {results: 1})
|
||||
// .then(({journeys}) => {
|
||||
// const leg = journeys[0].legs[0]
|
||||
// return client.trip(leg.id, leg.line.name, {polyline: true})
|
||||
// })
|
||||
|
||||
// client.locations('mersch', {results: 3})
|
||||
// client.stop(mersch)
|
||||
// client.nearby({
|
||||
// type: 'location',
|
||||
// latitude: 49.7523,
|
||||
// longitude: 6.1103
|
||||
// }, {distance: 500})
|
||||
|
||||
// client.departures(mersch, {duration: 5})
|
||||
// client.arrivals(mersch, {duration: 10, linesOfStops: true})
|
||||
|
||||
// client.radar({
|
||||
// north: 49.9,
|
||||
// west: 6.11,
|
||||
// south: 49.7,
|
||||
// east: 6.13
|
||||
// }, {results: 10})
|
||||
// client.reachableFrom({
|
||||
// type: 'location',
|
||||
// id: '990005227',
|
||||
// address: 'Mersch, Rue Mies 1',
|
||||
// latitude: 49.746044, longitude: 6.102228,
|
||||
// }, {
|
||||
// when: new Date('2020-10-10T10:00:00+02:00'),
|
||||
// maxDuration: 30
|
||||
// })
|
||||
|
||||
.then(data => {
|
||||
console.log(require('util').inspect(data, {depth: null, colors: true}))
|
||||
})
|
||||
.catch(console.error)
|
33
p/mobiliteit-lu/index.js
Normal file
33
p/mobiliteit-lu/index.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict'
|
||||
|
||||
const products = require('./products')
|
||||
|
||||
const transformReqBody = (ctx, body) => {
|
||||
body.client = {
|
||||
type: 'IPH',
|
||||
id: 'HAFAS',
|
||||
v: '4000200',
|
||||
name: 'mobiliteit.luPROD',
|
||||
os: 'iPhone OS 9.3.5',
|
||||
}
|
||||
body.ver = '1.15'
|
||||
body.auth = {aid: 'Aqf9kNqJLjxFx6vv'}
|
||||
body.lang = 'de'
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
const mobiliteitLuProfile = {
|
||||
locale: 'de-LU',
|
||||
timezone: 'Europe/Luxembourg',
|
||||
endpoint: 'https://travelplanner.mobiliteit.lu/hafas/mgate.exe',
|
||||
transformReqBody,
|
||||
|
||||
products: products,
|
||||
|
||||
trip: true,
|
||||
radar: true,
|
||||
reachableFrom: true,
|
||||
}
|
||||
|
||||
module.exports = mobiliteitLuProfile;
|
44
p/mobiliteit-lu/products.js
Normal file
44
p/mobiliteit-lu/products.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
'use strict'
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
id: 'express-train',
|
||||
mode: 'train',
|
||||
bitmasks: [1],
|
||||
name: 'local train (TGV/ICE)',
|
||||
short: 'TGV/ICE',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'national-train',
|
||||
mode: 'train',
|
||||
bitmasks: [6],
|
||||
name: 'national train (IC/RE/IRE)',
|
||||
short: 'IC/RE/IRE',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'local-train',
|
||||
mode: 'train',
|
||||
bitmasks: [8],
|
||||
name: 'local train (RB/TER)',
|
||||
short: 'RB/TER',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [32],
|
||||
name: 'Bus',
|
||||
short: 'Bus',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'tram',
|
||||
mode: 'train',
|
||||
bitmasks: [256],
|
||||
name: 'Tram',
|
||||
short: 'Tram',
|
||||
default: true
|
||||
}
|
||||
]
|
18
p/mobiliteit-lu/readme.md
Normal file
18
p/mobiliteit-lu/readme.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# mobiliteit.lu profile for `hafas-client`
|
||||
|
||||
[*mobiliteit.lu*](https://www.mobiliteit.lu) provides public transport data for Luxembourg. This profile adds *mobiliteit.lu*-specific customizations to `hafas-client`.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const createClient = require('hafas-client')
|
||||
const mobiliteitProfile = require('hafas-client/p/mobiliteit-lu')
|
||||
|
||||
// create a client with mobiliteit.lu profile
|
||||
const client = createClient(mobiliteitProfile, 'my-awesome-program')
|
||||
```
|
||||
|
||||
|
||||
## Customisations
|
||||
|
||||
- parses *mobiliteit.lu*-specific products
|
|
@ -212,6 +212,7 @@ HAFAS endpoint | wrapper library | docs | example code | source code
|
|||
[Berlin & Brandenburg public transport (VBB)](https://en.wikipedia.org/wiki/Verkehrsverbund_Berlin-Brandenburg) | [`vbb-hafas`](https://github.com/public-transport/vbb-hafas) | [docs](p/vbb/readme.md) | [example code](p/vbb/example.js) | [src](p/vbb/index.js)
|
||||
[Berlin public transport (BVG)](https://en.wikipedia.org/wiki/Berliner_Verkehrsbetriebe) | [`bvg-hafas`](https://github.com/public-transport/bvg-hafas) | [docs](p/bvg/readme.md) | [example code](p/bvg/example.js) | [src](p/bvg/index.js)
|
||||
[Österreichische Bundesbahnen (ÖBB)](https://en.wikipedia.org/wiki/Austrian_Federal_Railways) | [`oebb-hafas`](https://github.com/juliuste/oebb-hafas) | [docs](p/oebb/readme.md) | [example code](p/oebb/example.js) | [src](p/oebb/index.js)
|
||||
[*Mobilitéitszentral* (Luxembourg)](https://www.mobiliteit.lu/) | - | [docs](p/mobiliteit-lu/readme.md) | [example code](p/mobiliteit-lu/example.js) | [src](p/mobiliteit-lu/index.js)
|
||||
[Nahverkehr Sachsen-Anhalt (NASA)](https://de.wikipedia.org/wiki/Nahverkehrsservice_Sachsen-Anhalt)/[INSA](https://insa.de) | [`insa-hafas`](https://github.com/public-transport/insa-hafas) | [docs](p/insa/readme.md) | [example code](p/insa/example.js) | [src](p/insa/index.js)
|
||||
[Nahverkehrsverbund Schleswig-Holstein (NAH.SH)](https://de.wikipedia.org/wiki/Nahverkehrsverbund_Schleswig-Holstein) | [`nahsh-hafas`](https://github.com/juliuste/nahsh-hafas) | [docs](p/nahsh/readme.md) | [example code](p/nahsh/example.js) | [src](p/nahsh/index.js)
|
||||
[Rhein-Main-Verkehrsverbund (RMV)](https://en.wikipedia.org/wiki/Rhein-Main-Verkehrsverbund) | - | [docs](p/rmv/readme.md) | [example code](p/rmv/example.js) | [src](p/rmv/index.js)
|
||||
|
|
Loading…
Add table
Reference in a new issue