//native
type Codat = {
encodedKey: string
}
/**
* Delete connection
* Revoke and remove a connection from a company.
This operation is not reversible. The end user would need to reauthorize a new data connection if you wish to view new data for this company.
*/
export async function main(auth: Codat, companyId: string, connectionId: string) {
const url = new URL(`https://api.codat.io/companies/${companyId}/connections/${connectionId}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: `Basic ${auth.encodedKey}`
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago