updated endpoint for device

This commit is contained in:
hannathkadher
2025-04-14 10:30:48 +04:00
parent 9472390284
commit 5fedf37421
2 changed files with 26 additions and 18 deletions

View File

@ -111,9 +111,9 @@ abstract class ApiEndpoints {
//POST //POST
static const String addDeviceToRoom = '/device/room'; static const String addDeviceToRoom = '/device/room';
static const String addDeviceToGroup = '/device/group'; static const String addDeviceToGroup = '/device/group';
static const String controlDevice = '/device/{deviceUuid}/control'; static const String controlDevice = '/devices/{deviceUuid}/command';
static const String firmwareDevice = static const String firmwareDevice =
'/device/{deviceUuid}/firmware/{firmwareVersion}'; '/devices/{deviceUuid}/firmware/{firmwareVersion}';
static const String getDevicesByUserId = '/device/user/{userId}'; static const String getDevicesByUserId = '/device/user/{userId}';
static const String getDevicesByUnitId = '/device/unit/{unitUuid}'; static const String getDevicesByUnitId = '/device/unit/{unitUuid}';
static const String openDoorLock = '/door-lock/open/{doorLockUuid}'; static const String openDoorLock = '/door-lock/open/{doorLockUuid}';
@ -121,13 +121,13 @@ abstract class ApiEndpoints {
//GET //GET
static const String deviceByRoom = static const String deviceByRoom =
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices';
static const String deviceByUuid = '/device/{deviceUuid}'; static const String deviceByUuid = '/devices/{deviceUuid}';
static const String deviceFunctions = '/device/{deviceUuid}/functions'; static const String deviceFunctions = '/devices/{deviceUuid}/functions';
static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices'; static const String gatewayApi = '/devices/gateway/{gatewayUuid}/devices';
static const String deviceFunctionsStatus = static const String deviceFunctionsStatus =
'/device/{deviceUuid}/functions/status'; '/devices/{deviceUuid}/functions/status';
static const String powerClamp = static const String powerClamp =
'/device/{powerClampUuid}/power-clamp/status'; '/devices/{deviceUuid}/functions/status';
///Device Permission Module ///Device Permission Module
//POST //POST
@ -153,7 +153,8 @@ abstract class ApiEndpoints {
static const String getScene = '/scene/tap-to-run/{sceneId}'; static const String getScene = '/scene/tap-to-run/{sceneId}';
static const String getIconScene = '/scene/icon'; static const String getIconScene = '/scene/icon';
static const String getUnitAutomation = '/projects/{projectId}/communities/{communityId}/spaces/{unitUuid}/automations'; static const String getUnitAutomation =
'/projects/{projectId}/communities/{communityId}/spaces/{unitUuid}/automations';
static const String getAutomationDetails = static const String getAutomationDetails =
'/projects/{projectId}/automations/{automationId}'; '/projects/{projectId}/automations/{automationId}';
@ -161,7 +162,8 @@ abstract class ApiEndpoints {
/// PUT /// PUT
static const String updateScene = '/scene/tap-to-run/{sceneId}'; static const String updateScene = '/scene/tap-to-run/{sceneId}';
static const String updateAutomation = '/projects/{projectId}/automations/{automationId}'; static const String updateAutomation =
'/projects/{projectId}/automations/{automationId}';
static const String updateAutomationStatus = static const String updateAutomationStatus =
'/projects/{projectId}/automations/{automationId}'; '/projects/{projectId}/automations/{automationId}';
@ -169,7 +171,8 @@ abstract class ApiEndpoints {
/// DELETE /// DELETE
static const String deleteScene = '/scene/tap-to-run/{sceneId}'; static const String deleteScene = '/scene/tap-to-run/{sceneId}';
static const String deleteAutomation = '/projects/{projectId}/automations/{automationId}'; static const String deleteAutomation =
'/projects/{projectId}/automations/{automationId}';
//////////////////////Door Lock ////////////////////// //////////////////////Door Lock //////////////////////
//online //online
@ -213,18 +216,18 @@ abstract class ApiEndpoints {
static const String changeSchedule = '/schedule/enable/{deviceUuid}'; static const String changeSchedule = '/schedule/enable/{deviceUuid}';
static const String deleteSchedule = '/schedule/{deviceUuid}/{scheduleId}'; static const String deleteSchedule = '/schedule/{deviceUuid}/{scheduleId}';
static const String reportLogs = static const String reportLogs =
'/device/report-logs/{deviceUuid}?code={code}&startTime={startTime}&endTime={endTime}'; '/devices/report-logs/{deviceUuid}?code={code}&startTime={startTime}&endTime={endTime}';
static const String controlBatch = '/device/control/batch'; static const String controlBatch = '/devices/batch';
static const String statusBatch = '/device/status/batch'; static const String statusBatch = '/devices/batch';
static const String deviceScene = '/device/{deviceUuid}/scenes'; static const String deviceScene = '/devices/{deviceUuid}/scenes';
static const String fourSceneByName = static const String fourSceneByName =
'/device/{deviceUuid}/scenes?switchName={switchName}'; '/devices/{deviceUuid}/scenes?switchName={switchName}';
static const String resetDevice = '/factory/reset/{deviceUuid}'; static const String resetDevice = '/factory/reset/{deviceUuid}';
static const String unAssignScenesDevice = static const String unAssignScenesDevice =
'/device/{deviceUuid}/scenes?switchName={switchName}'; '/devices/{deviceUuid}/scenes?switchName={switchName}';
static const String getDeviceLogs = '/device/report-logs/{uuid}?code={code}'; static const String getDeviceLogs = '/devices/report-logs/{uuid}?code={code}';
static const String terms = '/terms'; static const String terms = '/terms';
static const String policy = '/policy'; static const String policy = '/policy';
static const String getPermission = '/permission/{roleUuid}'; static const String getPermission = '/permission/{roleUuid}';

View File

@ -491,7 +491,12 @@ class DevicesAPI {
}) async { }) async {
final response = await _httpService.post( final response = await _httpService.post(
path: ApiEndpoints.controlBatch, path: ApiEndpoints.controlBatch,
body: {"devicesUuid": devicesUuid, "code": code, "value": value}, body: {
"devicesUuid": devicesUuid,
"code": code,
"value": value,
"operationType": 'COMMAND',
},
showServerMessage: true, showServerMessage: true,
expectedResponseModel: (json) { expectedResponseModel: (json) {
return json; return json;