0

Create Label

by
Published Jun 6, 2022

Creates a label. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-personal-label)

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
	label: {
11
		args: {
12
			name: string
13
			order?: number
14
			color?: string
15
			isFavorite?: boolean
16
		}
17
		requestId?: string
18
	}
19
) {
20
	const api = new TodoistApi(resource.Token)
21
	const labelResponse = await api.addLabel(label.args, label.requestId)
22
	return labelResponse
23
}
24