1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json
import asyncdispatch
import sequtils
import options
import ../types
import ../parse/point
import ../util
proc suggestions*(params: SuggestionsParams): Future[seq[Point]] {.async.} =
let req = %* {
"cfg": {
"polyEnc": "GPA"
},
"meth": "LocMatch",
"req": {
"input": {
"loc": {
"type": "ALL",
"name": params.query & "?"
},
"maxLoc": params.results.get(10),
"field": "S"
}
}
}
let data = await request(req)
let locs = data["res"]["match"]["locL"].getElems()
return locs.map(parsePoint)