//native
type Segment = {
token: string;
baseUrl: string;
};
/**
* Remove Source Connection from Warehouse
* Disconnects a Source from a Warehouse.
*/
export async function main(
auth: Segment,
warehouseId: string,
sourceId: string,
) {
const url = new URL(
`${auth.baseUrl}/warehouses/${warehouseId}/connected-sources/${sourceId}`,
);
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