Allows you to delete a specific task
1
//native
2
type Xero = {
3
token: string
4
}
5
/**
6
* Allows you to delete a task
7
* Allows you to delete a specific task
8
*/
9
export async function main(auth: Xero, projectId: string, taskId: string, Xero_Tenant_Id: string) {
10
const url = new URL(`https://api.xero.com/projects.xro/2.0/Projects/${projectId}/Tasks/${taskId}`)
11
12
const response = await fetch(url, {
13
method: 'DELETE',
14
headers: {
15
Accept: 'application/json',
16
'Xero-Tenant-Id': Xero_Tenant_Id,
17
Authorization: 'Bearer ' + auth.token
18
},
19
body: undefined
20
})
21
if (!response.ok) {
22
const text = await response.text()
23
throw new Error(`${response.status} ${text}`)
24
25
return await response.text()
26
27