//native
type Xero = {
token: string
}
/**
* Deletes a specific employee's earnings template record
*
*/
export async function main(
auth: Xero,
EmployeeID: string,
PayTemplateEarningID: string,
Xero_Tenant_Id: string
) {
const url = new URL(
`https://api.xero.com/payroll.xro/2.0/Employees/${EmployeeID}/PayTemplates/earnings/${PayTemplateEarningID}`
)
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.text()
}
Submitted by hugo697 515 days ago