mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
changed endpoint
This commit is contained in:
@ -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';
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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<Map<String, dynamic>> unAssignDeviceToRoom(String communityId,
|
||||
static Future<Map<String, dynamic>> 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user