feat(google-tasks): add create task action

This commit is contained in:
Rıdvan Akca
2024-01-16 16:39:38 +03:00
parent a90b58b6db
commit bd43a6021a
3 changed files with 74 additions and 1 deletions

View File

@@ -0,0 +1,70 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create task',
key: 'createTask',
description: 'Creates a new task.',
arguments: [
{
label: 'Task List',
key: 'taskListId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listTaskLists',
},
],
},
},
{
label: 'Title',
key: 'title',
type: 'string',
required: true,
description: '',
variables: true,
},
{
label: 'Notes',
key: 'notes',
type: 'string',
required: false,
description: '',
variables: true,
},
{
label: 'Due Date',
key: 'due',
type: 'string',
required: false,
description: 'RFC 3339 timestamp.',
variables: true,
},
],
async run($) {
const { taskListId, title, notes, due } = $.step.parameters;
const body = {
title,
notes,
due,
};
const { data } = await $.http.post(
`/tasks/v1/lists/${taskListId}/tasks`,
body
);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,4 +1,5 @@
import createTask from './create-task/index.js';
import findTask from './find-task/index.js';
import updateTask from './update-task/index.js';
export default [findTask, updateTask];
export default [createTask, findTask, updateTask];

View File

@@ -1,6 +1,8 @@
---
favicon: /favicons/google-tasks.svg
items:
- name: Create task
desc: Creates a new task.
- name: Find task
desc: Looking for an incomplete task.
- name: Update task