import axios from 'axios'; import { AlertNotifyConfig } from "../../share/monitorTypes.ts"; // 告警通知配置相关响应类型 interface AlertNotifyConfigDataResponse { data: AlertNotifyConfig[]; total: number; page: number; pageSize: number; } interface AlertNotifyConfigResponse { data: AlertNotifyConfig; message?: string; } // 告警通知配置API接口定义 export const AlertNotifyConfigAPI = { // 获取告警通知配置 getAlertNotifyConfig: async (params?: { page?: number, limit?: number, device_id?: number, alert_level?: string }): Promise => { try { const response = await axios.get(`/alert-notify-configs`, { params }); return response.data; } catch (error) { throw error; } }, // 创建告警通知配置 createAlertNotifyConfig: async (data: Partial): Promise => { try { const response = await axios.post(`/alert-notify-configs`, data); return response.data; } catch (error) { throw error; } }, // 更新告警通知配置 updateAlertNotifyConfig: async (id: number, data: Partial): Promise => { try { const response = await axios.put(`/alert-notify-configs/${id}`, data); return response.data; } catch (error) { throw error; } }, // 删除告警通知配置 deleteAlertNotifyConfig: async (id: number): Promise => { try { const response = await axios.delete(`/alert-notify-configs/${id}`); return response.data; } catch (error) { throw error; } } };