diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index c4fff35..9ab354b 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -59,11 +59,11 @@ abstract class ApiEndpoints { //GET static const String unitByUuid = '/unit/'; static const String listSubspace = - '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; + 'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; static const String unitParent = '/unit/parent/{unitUuid}'; static const String unitUser = '/unit/user/'; static const String invitationCode = - '/communities/{communityUuid}/spaces/{unitUuid}/invitation-code'; + 'projects/{projectUuid}/communities/{communityUuid}/spaces/{unitUuid}/invitation-code'; //PUT static const String renameUnit = '/unit/{unitUuid}'; @@ -71,7 +71,7 @@ abstract class ApiEndpoints { //Subspace Module //POST static const String addSubSpace = - '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; + 'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; ///Room Module //POST @@ -88,7 +88,7 @@ abstract class ApiEndpoints { //GET static const String userSpaces = '/user/{userUuid}/spaces'; static const String spaceDevices = - '/communities/{communityUuid}/spaces/{spaceUuid}/devices'; + 'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices'; ///Group Module //POST @@ -117,7 +117,7 @@ abstract class ApiEndpoints { //GET static const String deviceByRoom = - '/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 deviceFunctions = '/device/{deviceUuid}/functions'; static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices'; @@ -135,7 +135,7 @@ abstract class ApiEndpoints { static const String editDevicePermission = '/device-permission/edit/{userId}'; static const String assignDeviceToRoom = - '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices/{deviceUuid}'; + 'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices/{deviceUuid}'; /// Scene & Automation API //////////////////// /// POST @@ -145,7 +145,7 @@ abstract class ApiEndpoints { /// GET static const String getUnitScenes = - '/communities/{communityUuid}/spaces/{spaceUuid}/scenes'; + 'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/scenes'; static const String getScene = '/scene/tap-to-run/{sceneId}'; static const String getIconScene = '/scene/icon'; diff --git a/lib/services/api/devices_api.dart b/lib/services/api/devices_api.dart index 3990a65..646986d 100644 --- a/lib/services/api/devices_api.dart +++ b/lib/services/api/devices_api.dart @@ -8,6 +8,7 @@ import 'package:syncrow_app/features/devices/model/device_report_model.dart'; import 'package:syncrow_app/features/devices/model/function_model.dart'; import 'package:syncrow_app/services/api/api_links_endpoints.dart'; import 'package:syncrow_app/services/api/http_service.dart'; +import 'package:syncrow_app/utils/constants/temp_const.dart'; import '../../features/devices/model/create_temporary_password_model.dart'; class DevicesAPI { @@ -224,7 +225,8 @@ class DevicesAPI { final String path = ApiEndpoints.deviceByRoom .replaceAll('{communityUuid}', communityUuid) .replaceAll('{spaceUuid}', spaceUuid) - .replaceAll('{subSpaceUuid}', roomId); + .replaceAll('{subSpaceUuid}', roomId) + .replaceAll('{projectUuid}', TempConst.projectId); final response = await _httpService.get( path: path, diff --git a/lib/services/api/home_creation_api.dart b/lib/services/api/home_creation_api.dart index 5b2816b..351701d 100644 --- a/lib/services/api/home_creation_api.dart +++ b/lib/services/api/home_creation_api.dart @@ -1,5 +1,6 @@ import 'package:syncrow_app/services/api/api_links_endpoints.dart'; import 'package:syncrow_app/services/api/http_service.dart'; +import 'package:syncrow_app/utils/constants/temp_const.dart'; class HomeCreation { static final HTTPService _httpService = HTTPService(); @@ -148,7 +149,8 @@ class HomeCreation { try { final fullPath = ApiEndpoints.addSubSpace .replaceAll('{communityUuid}', communityId) - .replaceAll('{spaceUuid}', spaceId); + .replaceAll('{spaceUuid}', spaceId) + .replaceAll('{projectUuid}', TempConst.projectId); final response = await _httpService.post( path: fullPath, body: body, diff --git a/lib/services/api/home_management_api.dart b/lib/services/api/home_management_api.dart index 4151d0f..cd4f2c0 100644 --- a/lib/services/api/home_management_api.dart +++ b/lib/services/api/home_management_api.dart @@ -4,6 +4,7 @@ import 'package:syncrow_app/features/auth/model/user_model.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/services/api/api_links_endpoints.dart'; import 'package:syncrow_app/services/api/http_service.dart'; +import 'package:syncrow_app/utils/constants/temp_const.dart'; class HomeManagementAPI { static final HTTPService _httpService = HTTPService(); @@ -38,7 +39,9 @@ class HomeManagementAPI { // Ensure both placeholders are replaced final path = ApiEndpoints.spaceDevices .replaceAll('{communityUuid}', communityUuid) - .replaceAll('{spaceUuid}', spaceUuid); + .replaceAll('{spaceUuid}', spaceUuid) + .replaceAll('{projectUuid}', TempConst.projectId); + await _httpService.get( path: path, showServerMessage: false, @@ -78,7 +81,7 @@ class HomeManagementAPI { } } - static Future> unAssignDeviceToRoom(String communityId, + static Future> unAssignDeviceToRoom(String communityId, String spaceId, String subSpaceId, String deviceId) async { try { final response = await _httpService.delete( @@ -86,7 +89,8 @@ class HomeManagementAPI { .replaceAll('{communityUuid}', communityId) .replaceAll('{spaceUuid}', spaceId) .replaceAll('{subSpaceUuid}', subSpaceId) - .replaceAll('{deviceUuid}', deviceId), + .replaceAll('{deviceUuid}', deviceId) + .replaceAll('{projectUuid}', TempConst.projectId), expectedResponseModel: (json) { return json; }, @@ -96,5 +100,4 @@ class HomeManagementAPI { rethrow; } } - } diff --git a/lib/services/api/scene_api.dart b/lib/services/api/scene_api.dart index fe4c1ae..3eb723f 100644 --- a/lib/services/api/scene_api.dart +++ b/lib/services/api/scene_api.dart @@ -1,4 +1,3 @@ - import 'package:syncrow_app/features/scene/model/create_automation_model.dart'; import 'package:syncrow_app/features/scene/model/create_scene_model.dart'; import 'package:syncrow_app/features/scene/model/icon_model.dart'; @@ -7,6 +6,7 @@ import 'package:syncrow_app/features/scene/model/scenes_model.dart'; import 'package:syncrow_app/features/scene/model/update_automation.dart'; import 'package:syncrow_app/services/api/api_links_endpoints.dart'; import 'package:syncrow_app/services/api/http_service.dart'; +import 'package:syncrow_app/utils/constants/temp_const.dart'; class SceneApi { static final HTTPService _httpService = HTTPService(); @@ -56,7 +56,8 @@ class SceneApi { final response = await _httpService.get( path: ApiEndpoints.getUnitScenes .replaceAll('{spaceUuid}', unitId) - .replaceAll('{communityUuid}', communityId), + .replaceAll('{communityUuid}', communityId) + .replaceAll('{projectUuid}', TempConst.projectId), queryParameters: {'showInHomePage': showInDevice}, showServerMessage: false, expectedResponseModel: (json) { diff --git a/lib/services/api/spaces_api.dart b/lib/services/api/spaces_api.dart index 7a2402a..946415a 100644 --- a/lib/services/api/spaces_api.dart +++ b/lib/services/api/spaces_api.dart @@ -4,6 +4,7 @@ import 'package:syncrow_app/features/auth/model/user_model.dart'; import 'package:syncrow_app/features/devices/model/subspace_model.dart'; import 'package:syncrow_app/services/api/api_links_endpoints.dart'; import 'package:syncrow_app/services/api/http_service.dart'; +import 'package:syncrow_app/utils/constants/temp_const.dart'; class SpacesAPI { static final HTTPService _httpService = HTTPService(); @@ -35,7 +36,8 @@ class SpacesAPI { // Construct the API path final path = ApiEndpoints.listSubspace .replaceFirst('{communityUuid}', communityId) - .replaceFirst('{spaceUuid}', spaceId); + .replaceFirst('{spaceUuid}', spaceId) + .replaceAll('{projectUuid}', TempConst.projectId); final response = await _httpService.get( path: path, @@ -67,7 +69,8 @@ class SpacesAPI { final response = await _httpService.get( path: ApiEndpoints.invitationCode .replaceAll('{unitUuid}', unitId) - .replaceAll('{communityUuid}', communityId), + .replaceAll('{communityUuid}', communityId) + .replaceAll('{projectUuid}', TempConst.projectId), showServerMessage: false, expectedResponseModel: (json) { if (json != null && json['data'] != null) { diff --git a/lib/utils/constants/temp_const.dart b/lib/utils/constants/temp_const.dart new file mode 100644 index 0000000..e5847b9 --- /dev/null +++ b/lib/utils/constants/temp_const.dart @@ -0,0 +1,3 @@ +class TempConst { + static const projectId = '0e62577c-06fa-41b9-8a92-99a21fbaf51c'; +}