add AVV profile

This commit is contained in:
Jannis R 2021-01-14 23:34:48 +01:00
parent d69d2530ef
commit 2ae6a9a4ea
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
4 changed files with 175 additions and 0 deletions

53
p/avv/example.js Normal file
View file

@ -0,0 +1,53 @@
'use strict'
const createClient = require('../..')
const vosProfile = require('.')
const client = createClient(vosProfile, 'hafas-client-example')
const rwth = '1057'
const kronenberg = '1397'
// client.journeys(rwth, kronenberg, {results: 1, stopovers: true})
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
// .then(({journeys}) => {
// const [journey] = journeys
// const leg = journey.legs[0]
// return client.trip(leg.tripId, leg.line.name, {polyline: true})
// })
// client.departures(rwth, {duration: 1})
// client.arrivals(rwth, {duration: 10, linesOfStops: true})
// client.radar({
// north: 50.78141,
// west: 6.06031,
// south: 50.75022,
// east: 6.10316,
// }, {results: 10})
client.locations('kronenberg', {results: 3})
// client.stop(rwth, {linesOfStops: true})
// client.nearby({
// type: 'location',
// latitude: 50.770607,
// longitude: 6.104637,
// }, {distance: 500})
// client.reachableFrom({
// type: 'location',
// id: '990000745',
// address: 'Aachen, Charlottenstraße 11',
// latitude: 50.770607,
// longitude: 6.104637,
// }, {
// maxDuration: 8,
// })
.then((data) => {
console.log(require('util').inspect(data, {depth: null, colors: true}))
})
.catch(console.error)

108
p/avv/index.js Normal file
View file

@ -0,0 +1,108 @@
'use strict'
const products = [{
id: 'regional-train',
mode: 'train',
bitmasks: [1],
name: 'Regionalzug',
short: 'Regionalzug',
default: true,
}, {
id: 'long-distance-train',
mode: 'train',
bitmasks: [2],
name: 'Fernzug',
short: 'Fernzug',
default: true,
}, {
id: 'express-train',
mode: 'train',
bitmasks: [4],
name: 'ICE/Thalys',
short: 'ICE/Thalys',
default: true,
}, {
id: 'fernbus',
mode: 'bus',
bitmasks: [8],
name: 'Fernbus',
short: 'Fernbus',
default: true,
}, {
id: 'suburban-train',
mode: 'train',
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
default: true,
}, {
id: 'subway',
mode: 'train',
bitmasks: [32],
name: 'U-Bahn',
short: 'U',
default: true,
}, {
id: 'tram',
mode: 'train',
bitmasks: [64],
name: 'Straßenbahn',
short: 'Straßenbahn',
default: true,
}, {
id: 'bus',
mode: 'bus',
bitmasks: [128],
name: 'Bus',
short: 'Bus',
default: true,
}, {
id: 'added-bus',
mode: 'bus',
bitmasks: [256],
name: 'Bus, Verstärkerfahrt',
short: 'Bus V',
default: true,
}, {
id: 'on-call',
mode: 'taxi',
bitmasks: [512],
name: 'Bedarfsverkehr',
short: 'Bedarfsverkehr',
default: true,
}, {
id: 'ferry',
mode: 'watercraft',
bitmasks: [1024],
name: 'Fähre',
short: 'Fähre',
default: true,
}]
const avvProfile = {
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://auskunft.avv.de/bin/mgate.exe',
auth: {
type: 'AID',
aid: '4vV1AcH3N511icH',
},
client: {
id: 'AVV_AACHEN',
type: 'WEB',
name: 'webapp',
l: 'vs_avv',
},
ver: '1.18',
products,
trip: true,
radar: true,
reachableFrom: true,
remarks: true,
remarksGetPolyline: false,
}
module.exports = avvProfile

13
p/avv/readme.md Normal file
View file

@ -0,0 +1,13 @@
# AVV profile for `hafas-client`
[*Aachener Verkehrsverbund (AVV)*](https://de.wikipedia.org/wiki/Aachener_Verkehrsverbund) is the local transport provider of [Aachen](https://en.wikipedia.org/wiki/Aachen). This profile adds *AVV* support to `hafas-client`.
## Usage
```js
const createClient = require('hafas-client')
const avvProfile = require('hafas-client/p/AVV')
// create a client with AVV profile
const client = createClient(avvProfile, 'my-awesome-program')
```

View file

@ -232,6 +232,7 @@ HAFAS endpoint | wrapper library | docs | example code | source code
[Rostocker Straßenbahn AG (RSAG)](https://de.wikipedia.org/wiki/Rostocker_Straßenbahn_AG) | - | [docs](p/rsag/readme.md) | [example code](p/rsag/example.js) | [src](p/rsag/index.js)
[Verkehrsverbund Mittelthüringen (VMT)](https://en.wikipedia.org/wiki/Verkehrsverbund_Mittelthüringen) | - | [docs](p/vmt/readme.md) | [example code](p/vmt/example.js) | [src](p/vmt/index.js)
[Verkehrsgemeinschaft Osnabrück (VOS)](https://de.wikipedia.org/wiki/Verkehrsgemeinschaft_Osnabrück) | - | [docs](p/vos/readme.md) | [example code](p/vos/example.js) | [src](p/vos/index.js)
[Aachener Verkehrsverbund (AVV)](https://de.wikipedia.org/wiki/Verkehrsgemeinschaft_Osnabrück) | - | [docs](p/avv/readme.md) | [example code](p/avv/example.js) | [src](p/avv/index.js)
[Salzburg public transport (SVV)](https://de.wikipedia.org/wiki/Salzburger_Verkehrsverbund) | - | [docs](p/svv/readme.md) | [example code](p/svv/example.js) | [src](p/svv/index.js)
[Zürich public transport (ZVV)](https://en.wikipedia.org/wiki/Zürcher_Verkehrsverbund) | - | [docs](p/zvv/readme.md) | [example code](p/zvv/example.js) | [src](p/zvv/index.js)