feat(google-tasks): add find task action
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Find task',
|
||||
key: 'findTask',
|
||||
description: 'Looking for an incomplete task.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Task List',
|
||||
key: 'taskListId',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The list to be searched.',
|
||||
variables: true,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listTaskLists',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Title',
|
||||
key: 'title',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: '',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const taskListId = $.step.parameters.taskListId;
|
||||
const title = $.step.parameters.title;
|
||||
|
||||
const { data } = await $.http.get(`/tasks/v1/lists/${taskListId}/tasks`);
|
||||
|
||||
const filteredTask = data.items?.filter((task) =>
|
||||
task.title.includes(title)
|
||||
);
|
||||
|
||||
$.setActionItem({
|
||||
raw: filteredTask[0],
|
||||
});
|
||||
},
|
||||
});
|
3
packages/backend/src/apps/google-tasks/actions/index.js
Normal file
3
packages/backend/src/apps/google-tasks/actions/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import findTask from './find-task/index.js';
|
||||
|
||||
export default [findTask];
|
@@ -0,0 +1,3 @@
|
||||
import listTaskLists from './list-task-lists/index.js';
|
||||
|
||||
export default [listTaskLists];
|
@@ -0,0 +1,33 @@
|
||||
export default {
|
||||
name: 'List task lists',
|
||||
key: 'listTaskLists',
|
||||
|
||||
async run($) {
|
||||
const taskLists = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const params = {
|
||||
maxResults: 100,
|
||||
pageToken: undefined,
|
||||
};
|
||||
|
||||
do {
|
||||
const { data } = await $.http.get('/tasks/v1/users/@me/lists', {
|
||||
params,
|
||||
});
|
||||
params.pageToken = data.nextPageToken;
|
||||
|
||||
if (data.items) {
|
||||
for (const taskList of data.items) {
|
||||
taskLists.data.push({
|
||||
value: taskList.id,
|
||||
name: taskList.title,
|
||||
});
|
||||
}
|
||||
}
|
||||
} while (params.pageToken);
|
||||
|
||||
return taskLists;
|
||||
},
|
||||
};
|
@@ -1,6 +1,8 @@
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import actions from './actions/index.js';
|
||||
import dynamicData from './dynamic-data/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Google Tasks',
|
||||
@@ -13,4 +15,6 @@ export default defineApp({
|
||||
supportsConnections: true,
|
||||
beforeRequest: [addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
dynamicData,
|
||||
});
|
||||
|
@@ -174,6 +174,7 @@ export default defineConfig({
|
||||
collapsible: true,
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: 'Actions', link: '/apps/google-tasks/actions' },
|
||||
{ text: 'Connection', link: '/apps/google-tasks/connection' },
|
||||
],
|
||||
},
|
||||
|
12
packages/docs/pages/apps/google-tasks/actions.md
Normal file
12
packages/docs/pages/apps/google-tasks/actions.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
favicon: /favicons/google-tasks.svg
|
||||
items:
|
||||
- name: Find task
|
||||
desc: Looking for an incomplete task.
|
||||
---
|
||||
|
||||
<script setup>
|
||||
import CustomListing from '../../components/CustomListing.vue'
|
||||
</script>
|
||||
|
||||
<CustomListing />
|
@@ -17,6 +17,7 @@ The following integrations are currently supported by Automatisch.
|
||||
- [Google Drive](/apps/google-drive/triggers)
|
||||
- [Google Forms](/apps/google-forms/triggers)
|
||||
- [Google Sheets](/apps/google-sheets/triggers)
|
||||
- [Google Tasks](/apps/google-tasks/actions)
|
||||
- [HTTP Request](/apps/http-request/actions)
|
||||
- [HubSpot](/apps/hubspot/actions)
|
||||
- [Invoice Ninja](/apps/invoice-ninja/triggers)
|
||||
|
Reference in New Issue
Block a user