//native
type Xero = {
token: string
}
/**
* Deletes a leave record for a specific employee
*
*/
export async function main(
auth: Xero,
EmployeeID: string,
LeaveID: string,
Xero_Tenant_Id: string
) {
const url = new URL(
`https://api.xero.com/payroll.xro/2.0/Employees/${EmployeeID}/Leave/${LeaveID}`
)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Accept: 'application/json',
'Xero-Tenant-Id': Xero_Tenant_Id,
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 448 days ago