Hey all, just a quick one I made to pull in Vikunja tasks:
local baseUrl = "https://vikunja.your.domain"
function getVikunjaTasks()
local token = "Your-Vikunja-API-Token"
local apiUrl = (baseUrl .. "api/v1/tasks/all?filter=done=false")
local response = http.request(
apiUrl, {
method = "GET",
headers = {
Authorization = "Bearer " .. token,
Accept = "application/json",
}
})
if response.ok then
return response.body
else
return "Not OK response"
end
end
templates.vikunjaRecurringTasks = function(task)
local function convert_date(date)
return date:sub(1,10)
end
return string.format("* [Link](" .. baseUrl .. "tasks/%s) [due: %s] %s", task.id, convert_date(task.due_date), task.title ) .. "\n"
end
Result
${template.each(
query[[
from getVikunjaTasks()
where due_date <= date.nextmonth()
order by due_date
]], templates.vikunjaRecurringTasks
)}
The result of templates.vikunjaRecurringTasks looks like this:
