//native
type Xero = {
token: string;
};
/**
* Retrieves fixed asset by id
* By passing in the appropriate asset id, you can search for
a specific fixed asset in the system
*/
export async function main(auth: Xero, id: string, xero_tenant_id: string) {
const url = new URL(`https://api.xero.com/assets.xro/1.0/Assets/${id}`);
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 515 days ago