db-vendo-client/docs/refresh-journey.md
Traines 3c7227635a docs fixes
[skip ci]
2025-01-14 22:35:19 +00:00

1.4 KiB

refreshJourney(refreshToken, [opt])

refreshToken must be a string, taken from journey.refreshToken.

With opt, you can override the default options, which look like this:

{
	stopovers: false, // return stations on the way?
	polylines: false, // return a shape for each leg? mutually exclusive with tickets
	tickets: false, // return tickets? mutually exclusive with polylines
	subStops: true, // not supported
	entrances: true, // not supported
	remarks: true, // parse & expose hints & warnings?
	language: 'en' // language to get results in
}

Response

import {createClient} from 'db-vendo-client'
import {profile as dbProfile} from 'db-vendo-client/p/db/index.js'

const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
const client = createClient(dbProfile, userAgent)

const {journeys} = await client.journeys('8000105', '8000096', {results: 1})

// later, fetch up-to-date info on the journey
const {
	journey,
	realtimeDataUpdatedAt,
} = await client.refreshJourney(journeys[0].refreshToken, {stopovers: true, remarks: true})

journey is a single Friendly Public Transport Format v2 draft journey, in the same format as returned by journeys().

realtimeDataUpdatedAt is currently not set in db-vendo-client, because the upstream APIs don't provide it.