feat(todoist): add app, authentication, docs (#826)
This commit is contained in:
5
packages/backend/src/apps/todoist/dynamic-data/index.ts
Normal file
5
packages/backend/src/apps/todoist/dynamic-data/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import listProjects from './list-projects';
|
||||
import listSections from './list-sections';
|
||||
import listLabels from './list-labels';
|
||||
|
||||
export default [listProjects, listSections, listLabels];
|
||||
@@ -0,0 +1,19 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List labels',
|
||||
key: 'listLabels',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const response = await $.http.get('/labels');
|
||||
|
||||
response.data = response.data.map((label: { name: string }) => {
|
||||
return {
|
||||
value: label.name,
|
||||
name: label.name,
|
||||
};
|
||||
});
|
||||
|
||||
return response;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List projects',
|
||||
key: 'listProjects',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const response = await $.http.get('/projects');
|
||||
|
||||
response.data = response.data.map((project: { id: string, name: string }) => {
|
||||
return {
|
||||
value: project.id,
|
||||
name: project.name,
|
||||
};
|
||||
});
|
||||
|
||||
return response;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List sections',
|
||||
key: 'listSections',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const params = {
|
||||
project_id: ($.step.parameters.projectId as string),
|
||||
};
|
||||
|
||||
const response = await $.http.get('/sections', {params});
|
||||
|
||||
response.data = response.data.map((section: { id: string, name: string }) => {
|
||||
return {
|
||||
value: section.id,
|
||||
name: section.name,
|
||||
};
|
||||
});
|
||||
|
||||
return response;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user