diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index b66f061..ea4a606 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -111,9 +111,9 @@ abstract class ApiEndpoints { //POST static const String addDeviceToRoom = '/device/room'; static const String addDeviceToGroup = '/device/group'; - static const String controlDevice = '/device/{deviceUuid}/control'; + static const String controlDevice = '/devices/{deviceUuid}/command'; static const String firmwareDevice = - '/device/{deviceUuid}/firmware/{firmwareVersion}'; + '/devices/{deviceUuid}/firmware/{firmwareVersion}'; static const String getDevicesByUserId = '/device/user/{userId}'; static const String getDevicesByUnitId = '/device/unit/{unitUuid}'; static const String openDoorLock = '/door-lock/open/{doorLockUuid}'; @@ -121,13 +121,13 @@ abstract class ApiEndpoints { //GET static const String deviceByRoom = '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices'; - static const String deviceByUuid = '/device/{deviceUuid}'; - static const String deviceFunctions = '/device/{deviceUuid}/functions'; - static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices'; + static const String deviceByUuid = '/devices/{deviceUuid}'; + static const String deviceFunctions = '/devices/{deviceUuid}/functions'; + static const String gatewayApi = '/devices/gateway/{gatewayUuid}/devices'; static const String deviceFunctionsStatus = - '/device/{deviceUuid}/functions/status'; + '/devices/{deviceUuid}/functions/status'; static const String powerClamp = - '/device/{powerClampUuid}/power-clamp/status'; + '/devices/{deviceUuid}/functions/status'; ///Device Permission Module //POST @@ -153,7 +153,8 @@ abstract class ApiEndpoints { static const String getScene = '/scene/tap-to-run/{sceneId}'; 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 = '/projects/{projectId}/automations/{automationId}'; @@ -161,7 +162,8 @@ abstract class ApiEndpoints { /// PUT 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 = '/projects/{projectId}/automations/{automationId}'; @@ -169,7 +171,8 @@ abstract class ApiEndpoints { /// DELETE 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 ////////////////////// //online @@ -213,18 +216,18 @@ abstract class ApiEndpoints { static const String changeSchedule = '/schedule/enable/{deviceUuid}'; static const String deleteSchedule = '/schedule/{deviceUuid}/{scheduleId}'; static const String reportLogs = - '/device/report-logs/{deviceUuid}?code={code}&startTime={startTime}&endTime={endTime}'; - static const String controlBatch = '/device/control/batch'; - static const String statusBatch = '/device/status/batch'; - static const String deviceScene = '/device/{deviceUuid}/scenes'; + '/devices/report-logs/{deviceUuid}?code={code}&startTime={startTime}&endTime={endTime}'; + static const String controlBatch = '/devices/batch'; + static const String statusBatch = '/devices/batch'; + static const String deviceScene = '/devices/{deviceUuid}/scenes'; static const String fourSceneByName = - '/device/{deviceUuid}/scenes?switchName={switchName}'; + '/devices/{deviceUuid}/scenes?switchName={switchName}'; static const String resetDevice = '/factory/reset/{deviceUuid}'; static const String unAssignScenesDevice = - '/device/{deviceUuid}/scenes?switchName={switchName}'; - static const String getDeviceLogs = '/device/report-logs/{uuid}?code={code}'; + '/devices/{deviceUuid}/scenes?switchName={switchName}'; + static const String getDeviceLogs = '/devices/report-logs/{uuid}?code={code}'; static const String terms = '/terms'; static const String policy = '/policy'; static const String getPermission = '/permission/{roleUuid}'; diff --git a/lib/services/api/devices_api.dart b/lib/services/api/devices_api.dart index 9475ddf..f9011ce 100644 --- a/lib/services/api/devices_api.dart +++ b/lib/services/api/devices_api.dart @@ -491,7 +491,12 @@ class DevicesAPI { }) async { final response = await _httpService.post( path: ApiEndpoints.controlBatch, - body: {"devicesUuid": devicesUuid, "code": code, "value": value}, + body: { + "devicesUuid": devicesUuid, + "code": code, + "value": value, + "operationType": 'COMMAND', + }, showServerMessage: true, expectedResponseModel: (json) { return json;