24 lines
579 B
Nim
24 lines
579 B
Nim
import ../types
|
|
import ../parse/journeys_response
|
|
import ../util
|
|
import json
|
|
import asyncdispatch
|
|
import options
|
|
|
|
proc refreshJourney*(params: RefreshJourneyParams): Future[Journey] {.async.} =
|
|
let req = %* {
|
|
"cfg": {
|
|
},
|
|
"meth": "Reconstruction",
|
|
"req": {
|
|
"ctxRecon": params.refreshToken,
|
|
"getIST": true,
|
|
"getPasslist": params.stopovers.get(false),
|
|
"getPolyline": params.polylines.get(false),
|
|
"getTariff": params.tickets.get(false),
|
|
}
|
|
}
|
|
|
|
let data = await request(req)
|
|
return parseJourneysResponse(data, true).journeys[0]
|