Dim Response As BANanoFetchResponse
Dim Data As BANanoJSONParser
Dim Error As BANanoJSONParser
Dim options As BANanoFetchOptions
options.Initialize
Dim params As Map = CreateMap()
params.put("q", plan)
params.Put("app_id", "5b6623d5")
params.put("app_key", "46674aa2193dbb7b88ffd897331e661a")
params.put("from", 0)
params.put("to", 9)
options.Body = BANano.ToJson(params)
options.Mode = "no-cors"
'options.Headers = CreateMap("Content-type": "application/json; charset=UTF-8")
'options.Headers = CreateMap("Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "*")
' list (GET is default, and we do not need extra options so we pass Null for the options)
Dim fetch1 As BANanoFetch
'execute the fetch
fetch1.Initialize("https://api.edamam.com/search", options)
'we got a promise response
fetch1.Then(Response)
' so resolve it to a json
fetch1.Return(Response.Json)
fetch1.Then(Data)
'Dim res As Map = Data.NextObject
Log(Data)
fetch1.Else(Error)
fetch1.Finally
fetch1.End