mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
add VKG profile
This commit is contained in:
parent
2853fb0408
commit
0690724d1e
4 changed files with 161 additions and 0 deletions
47
p/vkg/example.js
Normal file
47
p/vkg/example.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
'use strict'
|
||||
|
||||
const createClient = require('../..')
|
||||
const vosProfile = require('.')
|
||||
|
||||
const client = createClient(vosProfile, 'hafas-client-example')
|
||||
|
||||
const spittalMittelschule = '420512200'
|
||||
const klagenfurtSteingasse = '420649500'
|
||||
|
||||
// client.journeys(spittalMittelschule, klagenfurtSteingasse, {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(spittalMittelschule, {duration: 1})
|
||||
// client.arrivals(spittalMittelschule, {duration: 10, linesOfStops: true})
|
||||
|
||||
client.locations('steingasse', {results: 3})
|
||||
// client.stop(spittalMittelschule, {linesOfStops: true})
|
||||
// client.nearby({
|
||||
// type: 'location',
|
||||
// latitude: 46.617968,
|
||||
// longitude: 14.297595,
|
||||
// }, {distance: 500})
|
||||
// client.reachableFrom({
|
||||
// type: 'location',
|
||||
// id: '980025809',
|
||||
// address: 'Eckengasse 9, 9020 Klagenfurt am Wörthersee',
|
||||
// latitude: 46.617968,
|
||||
// longitude: 14.297595,
|
||||
// }, {
|
||||
// maxDuration: 8,
|
||||
// })
|
||||
|
||||
.then((data) => {
|
||||
console.log(require('util').inspect(data, {depth: null, colors: true}))
|
||||
})
|
||||
.catch(console.error)
|
100
p/vkg/index.js
Normal file
100
p/vkg/index.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
'use strict'
|
||||
|
||||
const products = [{ // todo: what is `8`?
|
||||
id: 'trains',
|
||||
mode: 'train',
|
||||
bitmasks: [1, 2],
|
||||
name: 'Bahn & S-Bahn',
|
||||
short: 'Bahn & S',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'subway',
|
||||
mode: 'train',
|
||||
bitmasks: [4],
|
||||
name: 'U-Bahn',
|
||||
short: 'U',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'tram',
|
||||
mode: 'train',
|
||||
bitmasks: [16],
|
||||
name: 'Straßenbahn',
|
||||
short: 'Straßenbahn',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'city-bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [128],
|
||||
name: 'Stadtbus',
|
||||
short: 'Stadtbus',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'regional-bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [64],
|
||||
name: 'Regionalbus',
|
||||
short: 'Regionalbus',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'long-distance-bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [32],
|
||||
name: 'Fernbus',
|
||||
short: 'Fernbus',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'other-bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [2048],
|
||||
name: 'sonstige Busse',
|
||||
short: 'sonstige Busse',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'aerial-lift',
|
||||
mode: 'gondola',
|
||||
bitmasks: [256],
|
||||
name: 'Seil-/Zahnradbahn',
|
||||
short: 'Seil-/Zahnradbahn',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'ferry',
|
||||
mode: 'watercraft',
|
||||
bitmasks: [512],
|
||||
name: 'Schiff',
|
||||
short: 'Schiff',
|
||||
default: true,
|
||||
}, {
|
||||
id: 'on-call',
|
||||
mode: 'taxi',
|
||||
bitmasks: [1024],
|
||||
name: 'Anrufsammeltaxi',
|
||||
short: 'AST',
|
||||
default: true,
|
||||
}]
|
||||
|
||||
const vosProfile = {
|
||||
locale: 'at-DE',
|
||||
timezone: 'Europe/Vienna',
|
||||
endpoint: 'https://routenplaner.kaerntner-linien.at/bin/mgate.exe',
|
||||
|
||||
auth: {
|
||||
type: 'AID',
|
||||
aid: 'wf7mcf9bv3nv8g5f',
|
||||
},
|
||||
client: {
|
||||
id: 'VAO',
|
||||
type: 'WEB',
|
||||
name: 'webapp',
|
||||
l: 'vs_vkg',
|
||||
},
|
||||
ver: '1.32',
|
||||
// todo: lang
|
||||
|
||||
products,
|
||||
|
||||
trip: true,
|
||||
refreshJourney: false, // todo: depends on 8615b85 from #204
|
||||
reachableFrom: true,
|
||||
}
|
||||
|
||||
module.exports = vosProfile
|
13
p/vkg/readme.md
Normal file
13
p/vkg/readme.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# VKG profile for `hafas-client`
|
||||
|
||||
[*Kärntner Linien/Verkehrsverbund Kärnten (VKG/VVK)*](https://de.wikipedia.org/wiki/Verkehrsverbund_Kärnten) is the local transport provider of [Carinthia](https://en.wikipedia.org/wiki/Carinthia). This profile adds *VKG* support to `hafas-client`.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const createClient = require('hafas-client')
|
||||
const vkgProfile = require('hafas-client/p/vkg')
|
||||
|
||||
// create a client with VKG profile
|
||||
const client = createClient(vkgProfile, 'my-awesome-program')
|
||||
```
|
|
@ -236,6 +236,7 @@ HAFAS endpoint | wrapper library | docs | example code | source code
|
|||
[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)
|
||||
[Verkehrsverbund Tirol (VVT)](https://de.wikipedia.org/wiki/Verkehrsverbund_Tirol) | - | [docs](p/vvt/readme.md) | [example code](p/vvt/example.js) | [src](p/vvt/index.js)
|
||||
[*Kärntner Linien/Verkehrsverbund Kärnten (VKG/VVK)*](https://de.wikipedia.org/wiki/Verkehrsverbund_Kärnten) | - | [docs](p/vkg/readme.md) | [example code](p/vkg/example.js) | [src](p/vkg/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)
|
||||
|
||||
There are also libraries that use `hafas-client` and pass their own profile in:
|
||||
|
|
Loading…
Add table
Reference in a new issue