local jstr, res = https.request('https://api.opencagedata.com/geocode/v1/json?key=' .. configuration['keys']['location'] .. '&pretty=0&q=' .. url.escape(input))
if res ~= 200 then
return false, 'Connection error! [' .. res .. ']'
end
local jdat = json.decode(jstr)
if jdat.total_results == 0 then
return false, 'No results were found!'
end
local output = mattata.inline_result():type('location'):id(1):title(input):latitude(jdat.results[1].geometry.lat):longitude(jdat.results[1].geometry.lng)