2020-02-07 14:09:42 +01:00
|
|
|
import ../types
|
2020-02-07 18:29:03 +01:00
|
|
|
import ../parse/journeys_response
|
2020-02-07 14:09:42 +01:00
|
|
|
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)
|
2020-02-07 18:29:03 +01:00
|
|
|
return parseJourneysResponse(data, true).journeys[0]
|