//native
type Segment = {
token: string;
baseUrl: string;
};
/**
* Delete Destination
* Deletes an existing Destination.
• When called, this endpoint may generate the `Integration Deleted` event in the audit trail.
Config API omitted fields:
- `catalogId`
*/
export async function main(auth: Segment, destinationId: string) {
const url = new URL(
`${auth.baseUrl}/destinations/${destinationId}`,
);
const response = await fetch(url, {
method: "DELETE",
headers: {
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 235 days ago