0

Update Task

by
Published Jun 6, 2022

Updates a task. [See the docs here](https://developer.todoist.com/rest/v2/#update-a-task)

Script todoist Verified

The script

Submitted by hugo697 Bun
Verified 398 days ago
1
import { TodoistApi } from '@doist/todoist-api-typescript'
2
import { v9 as Todoist } from 'todoist'
3

4
type Todoist = {
5
	Token: string
6
}
7

8
export async function main(
9
	resource: Todoist,
10
	task: {
11
		Id: string
12
		args: {
13
			content?: string
14
			description?: string
15
			labels?: string[]
16
			priority?: number
17
			dueLang?: string | null
18
			assigneeId?: string | null
19
			dueString?: string
20
			dueDate?: string
21
			dueDatetime?: string
22
			duration?: number
23
			durationUnit?: 'minute' | 'day'
24
		}
25
		requestId?: string
26
	}
27
) {
28
	const api = new TodoistApi(resource.Token)
29
	// @ts-ignore
30
	const taskResponse = await api.updateTask(task.Id, task.args)
31
	return taskResponse
32
}
33