30 lines
602 B
Nim
30 lines
602 B
Nim
import ../../../types
|
|
import ../parse/point
|
|
import ../util
|
|
import json
|
|
import asyncdispatch
|
|
import sequtils
|
|
import options
|
|
|
|
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)
|