//native
type Telnyx = {
apiKey: string
}
/**
* Deletes an External Connection
* Permanently deletes an External Connection. Deletion may be prevented if the application is in use by phone numbers, is active, or if it is an Operator Connect connection. To remove an Operator Connect integration please contact Telnyx support.
*/
export async function main(auth: Telnyx, id: string) {
const url = new URL(`https://api.telnyx.com/v2/external_connections/${id}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago