export type DeleteApiV2InventoryWarehousesInventoryWarehouseIdArgs = {inventory_warehouse_id: string, remove_inventory?: ('0' | '1') | undefined}; export type DeleteApiV2InventoryWarehousesInventoryWarehouseIdOptions = {baseUrl?: string | undefined, apiKeys?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an inventory warehouse * * DELETE /v2/inventory_warehouses/{inventory_warehouse_id} */ export const deleteApiV2InventoryWarehousesInventoryWarehouseId = async (args: DeleteApiV2InventoryWarehousesInventoryWarehouseIdArgs, options?: DeleteApiV2InventoryWarehousesInventoryWarehouseIdOptions) => { const {baseUrl = "https://api.shipstation.com", fetch: fetchFn = fetch, apiKeys} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.remove_inventory != null) query.append("remove_inventory", String(args.remove_inventory)) if (apiKeys !== undefined) headers.set("api-key", apiKeys) const url = `${baseUrl.replace(/\/+$/, '')}/v2/inventory_warehouses/${encodeURIComponent(String(args.inventory_warehouse_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };