add createIndex

This commit is contained in:
mr-bonerman 2023-03-08 03:36:13 +01:00
parent 348d886cd4
commit 01b5c272c8

View file

@ -87,6 +87,8 @@ proc newMeili*(host, apiKey:string):Meili=
host:parseUrl(host), host:parseUrl(host),
apiKey:apiKey apiKey:apiKey
) )
proc createIndex*(meili:Meili, uid:string, primaryKey="id")=
discard fetchc(meili, @["indexes"], "post", $(%* {"uid":uid, "primaryKey":primaryKey}))
proc getIndex*[T](meili:Meili, name:string):MeiliIndex[T]= proc getIndex*[T](meili:Meili, name:string):MeiliIndex[T]=
let resp = meili.fetch([name]) let resp = meili.fetch([name])