feat(google-tasks): add new task lists trigger
This commit is contained in:
3
packages/backend/src/apps/google-tasks/triggers/index.js
Normal file
3
packages/backend/src/apps/google-tasks/triggers/index.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import newTaskLists from './new-task-lists/index.js';
|
||||||
|
|
||||||
|
export default [newTaskLists];
|
@@ -0,0 +1,31 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New task lists',
|
||||||
|
key: 'newTaskLists',
|
||||||
|
pollInterval: 15,
|
||||||
|
description: 'Triggers when a new task list is created.',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const params = {
|
||||||
|
maxResults: 100,
|
||||||
|
pageToken: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
do {
|
||||||
|
const { data } = await $.http.get('/tasks/v1/users/@me/lists');
|
||||||
|
params.pageToken = data.nextPageToken;
|
||||||
|
|
||||||
|
if (data.items?.length) {
|
||||||
|
for (const taskList of data.items.reverse()) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: taskList,
|
||||||
|
meta: {
|
||||||
|
internalId: taskList.etag,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (params.pageToken);
|
||||||
|
},
|
||||||
|
});
|
@@ -174,6 +174,7 @@ export default defineConfig({
|
|||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
|
{ text: 'Triggers', link: '/apps/google-tasks/triggers' },
|
||||||
{ text: 'Actions', link: '/apps/google-tasks/actions' },
|
{ text: 'Actions', link: '/apps/google-tasks/actions' },
|
||||||
{ text: 'Connection', link: '/apps/google-tasks/connection' },
|
{ text: 'Connection', link: '/apps/google-tasks/connection' },
|
||||||
],
|
],
|
||||||
|
12
packages/docs/pages/apps/google-tasks/triggers.md
Normal file
12
packages/docs/pages/apps/google-tasks/triggers.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
favicon: /favicons/google-tasks.svg
|
||||||
|
items:
|
||||||
|
- name: New task lists
|
||||||
|
desc: Triggers when a new task list is created.
|
||||||
|
---
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import CustomListing from '../../components/CustomListing.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<CustomListing />
|
Reference in New Issue
Block a user