feat(todoist): add app, authentication, docs (#826)

This commit is contained in:
Ian Levesque
2023-01-07 09:09:39 -05:00
committed by GitHub
parent ff0bde059a
commit 1a4a1f7f8b
19 changed files with 418 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import { IGlobalVariable } from '@automatisch/types';
const getActiveTasks = async ($: IGlobalVariable) => {
const params = {
project_id: ($.step.parameters.projectId as string)?.trim(),
section_id: ($.step.parameters.sectionId as string)?.trim(),
label: ($.step.parameters.label as string)?.trim(),
filter: ($.step.parameters.filter as string)?.trim(),
};
const response = await $.http.get('/tasks', { params });
// todoist api doesn't offer sorting, so we inverse sort on id here
response.data.sort((a: { id: number; }, b: { id: number; }) => {
return b.id - a.id;
})
for (const task of response.data) {
$.pushTriggerItem({
raw: task,
meta:{
internalId: task.id as string,
}
});
}
};
export default getActiveTasks;