import { ApiClientFactory } from '../core/api.client.factory'; import { DeviceConfigListModel, DeviceTypeModel, DevicesOrganizationsModel } from '../model/zlDevicesConfig.model'; import { DeviceTypeParams, DeviceParams } from '../model/customDeviceConfig.model'; export class CustomDevicesConfigService { constructor(private factory: ApiClientFactory) {} // 自定义设备类型列表 async getDeviceTypeList(projectId: string): Promise { const data = await this.factory.entity.get(`/api/web/projects/${projectId}/customDeviceTypes`); return data; } // 新增设备类型 async addDeviceType(projectId: string, params: DeviceTypeParams): Promise { const data = await this.factory.entity.post(`/api/web/projects/${projectId}/customDeviceTypes`, params); return data; } // 修改设备类型 async editDeviceType(projectId: string, id: string, params: DeviceTypeParams): Promise { const data = await this.factory.entity.put(`/api/web/projects/${projectId}/customDeviceTypes/${id}`, params); return data; } // 删除设备类型 async deleteDeviceType(projectId: string, id: string): Promise { const data = await this.factory.entity.delete(`/api/web/projects/${projectId}/customDeviceTypes/${id}`); return data; } // 获取某个设备类型 async getDeviceTypeContent(projectId: string, id: string): Promise { const data = await this.factory.entity.get(`/api/web/projects/${projectId}/customDeviceTypes/${id}`); return data; } // 自定义设备列表 async getDeviceListByDeviceId(projectId: string, id: string): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/customDeviceInfos/deviceTypes/${id}` ); return data; } // 所有自定义设备列表 async getAllDeviceList(projectId: string): Promise { const data = await this.factory.entity.get(`/api/web/projects/${projectId}/customDeviceInfos`); return data; } // 新增设备 async addDevice(projectId: string, deviceParams: DeviceParams): Promise { const data = await this.factory.entity.post(`/api/web/projects/${projectId}/customDeviceInfos`, deviceParams); return data; } // 修改设备 async editDevice(projectId: string, id: string, deviceParams: DeviceParams): Promise { const data = await this.factory.entity.put( `/api/web/projects/${projectId}/customDeviceInfos/${id}`, deviceParams ); return data; } // 删除设备 async deleteDevice(projectId: string, id: string): Promise { const data = await this.factory.entity.delete(`/api/web/projects/${projectId}/customDeviceInfos/${id}`); return data; } }