//native
type Xero = {
token: string
}
/**
* Retrieves a file by a unique file ID
*
*/
export async function main(auth: Xero, FileId: string, xero_tenant_id: string) {
const url = new URL(`https://api.xero.com/files.xro/1.0//Files/${FileId}`)
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 127 days ago