add intents docs and samples

This commit is contained in:
Evgeny
2022-07-22 09:50:33 +03:00
parent 8f51666265
commit 6eb0de8264
5 changed files with 121 additions and 4 deletions

26
samples/shttp-text.lua Normal file
View File

@@ -0,0 +1,26 @@
-- name = "Chuck Norris jokes (experimental)"
-- description = "icndb.com"
-- data_source = "icndb.com"
-- type = "widget"
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
-- version = "1.0"
function on_alarm()
local response = shttp:get("http://api.icndb.com/jokes/random")
if response.error ~= nil then
ui:show_text(response.error)
return
end
if response.code >= 200 and response.code < 300 then
joke = ajson:get_value(response.body, "object object:value string:joke")
ui:show_text(joke)
end
end
function on_click()
if joke ~= nil then
system:copy_to_clipboard(joke)
end
end