//native
type Xero = {
token: string
}
/**
* Deletes an existing file association
* By passing in the appropriate options, you can create a new folder
*/
export async function main(auth: Xero, FileId: string, ObjectId: string, xero_tenant_id: string) {
const url = new URL(
`https://api.xero.com/files.xro/1.0//Files/${FileId}/Associations/${ObjectId}`
)
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