//native
type Segment = {
token: string;
baseUrl: string;
};
/**
* Update Warehouse
* Updates an existing Warehouse.
• When called, this endpoint may generate one or more of the following audit trail events:* Storage Destination Modified
* Storage Destination Enabled
*/
export async function main(
auth: Segment,
warehouseId: string,
body: { name?: string; enabled?: false | true; settings: {} },
) {
const url = new URL(`${auth.baseUrl}/warehouses/${warehouseId}`);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago