import { ApiClientFactory } from '../core/api.client.factory'; import { HelmetConfigParams, HelmetDeviceModel } from '../model/HemetConfig.model'; export class HelmetConfigService { constructor(private api: ApiClientFactory) {} async setConfig(params: object | HelmetConfigParams) { const result = await this.api.entity.post('/api/device/ludingji/config', params); return result; } async getConfig(projectId: string) { const result = await this.api.entity.get('/api/device/ludingji/config', { projectId }); return result; } async syncDevices(projectId: string) { const result = await this.api.entity.put(`/api/device/ludingji/syncDevices?projectId=${projectId}`); return result; } async fetchDevices(projectId: string) { const result = await this.api.entity.get('/api/device/ludingji/list', { projectId }); return result; } async fetchFileUrl() { const result = await this.api.entity.get('/api/device/ludingji/download/getUrl'); return result; } // 删除单条数据 async fetchDeleteItem(deviceId: string) { const result = await this.api.entity.delete(`/api/device/ludingji/${deviceId}`); return result; } /** * @function 监控全部 */ async aqmaddAllMonitor(projectId: string) { return await this.api.entity.put(`/api/device/ludingji/${projectId}/monitor`); } /** * @function 取消监控全部 */ async aqmcancelAllMonitor(projectId: string) { return await this.api.entity.put(`/api/device/ludingji/${projectId}/cancelMonitor`); } /** * @function 加入监控 */ async aqmaddMonitor(projectId: string, deviceId: string) { return await this.api.entity.put(`/api/device/ludingji/${projectId}/${deviceId}/monitor`); } /** * @function 取消监控 */ async aqmcancelMonitor(projectId: string, deviceId: string) { return await this.api.entity.put(`/api/device/ludingji/${projectId}/${deviceId}/cancelMonitor`); } /** * @function 删除账户 */ async deleteAccount(id: string) { return await this.api.entity.delete(`/api/device/ludingji/body`, { id, }); } }