//native
type Xero = {
token: string
}
/**
* Retrieves a specific leave type by using a unique leave type ID
*
*/
export async function main(auth: Xero, LeaveTypeID: string, Xero_Tenant_Id: string) {
const url = new URL(`https://api.xero.com/payroll.xro/2.0/LeaveTypes/${LeaveTypeID}`)
const response = await fetch(url, {
method: 'GET',
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 126 days ago