0

Task delete assignees

by
Published Nov 5, 2024

Remove assignee from a task

Script taskade Verified

The script

Submitted by hugo697 Bun
Verified 581 days ago
1
//native
2
type Taskade = {
3
	token: string
4
}
5

6
export async function main(
7
	auth: Taskade,
8
	projectId: string,
9
	taskId: string,
10
	assigneeHandle: string
11
) {
12
	const url = new URL(
13
		`https://www.taskade.com/api/v1/projects/${projectId}/tasks/${taskId}/assignees/${assigneeHandle}`
14
	)
15

16
	const response = await fetch(url, {
17
		method: 'DELETE',
18
		headers: {
19
			Authorization: 'Bearer ' + auth.token
20
		},
21
		body: undefined
22
	})
23

24
	if (!response.ok) {
25
		const text = await response.text()
26
		throw new Error(`${response.status} ${text}`)
27
	}
28

29
	return await response.json()
30
}
31