//native
type Xero = {
token: string
}
/**
* Retrieves a specific pay run by using a unique pay run ID
*
*/
export async function main(auth: Xero, PayRunID: string, Xero_Tenant_Id: string) {
const url = new URL(`https://api.xero.com/payroll.xro/2.0/PayRuns/${PayRunID}`)
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 448 days ago