//native
/**
* Cancel time-off request
* Cancels a time-off request regardless of its current status. This endpoint provides a simplified approach to time-off management by always setting the request status to CANCELED.
**Token scopes**: `time-off:write`
*/
export async function main(auth: RT.Deel, time_off_id: string) {
const url = new URL(`https://api.letsdeel.com/rest/v2/time_offs/${time_off_id}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago