ctucx.git: nimhafas

[nimlang] hafas-client library

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
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]