import http from '../utils/http.js'; /** * 设备管理API */ export class DeviceApi { /** * 获取设备列表 * @returns {Promise} 设备列表 */ static list() { return http.get('/api/v1/devices'); } /** * 创建新设备 * @param {Object} deviceData 设备数据 * @returns {Promise} 创建结果 */ static create(deviceData) { return http.post('/api/v1/devices', deviceData); } /** * 获取设备详情 * @param {string|number} id 设备ID * @returns {Promise} 设备详情 */ static get(id) { return http.get(`/api/v1/devices/${id}`); } /** * 更新设备信息 * @param {string|number} id 设备ID * @param {Object} deviceData 设备数据 * @returns {Promise} 更新结果 */ static update(id, deviceData) { return http.put(`/api/v1/devices/${id}`, deviceData); } /** * 删除设备 * @param {string|number} id 设备ID * @returns {Promise} 删除结果 */ static delete(id) { return http.delete(`/api/v1/devices/${id}`); } } export default DeviceApi;