mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 09:27:56 +00:00
updated add to room, and verify to space
This commit is contained in:
@@ -53,14 +53,17 @@ abstract class ApiEndpoints {
|
||||
//POST
|
||||
static const String addUnit = '/unit';
|
||||
static const String addUnitToUser = '/unit/user';
|
||||
static const String verifyInvitationCode =
|
||||
'/user/{userUuid}/spaces/verify-code';
|
||||
|
||||
//GET
|
||||
static const String unitByUuid = '/unit/';
|
||||
static const String listSubspace =
|
||||
'/communities/{communityUuid}/spaces/{spaceUuid}/subspaces';
|
||||
static const String unitParent = '/unit/parent/{unitUuid}';
|
||||
static const String unitUser = '/unit/user/';
|
||||
static const String invitationCode = '/unit/{unitUuid}/invitation-code';
|
||||
static const String verifyInvitationCode = '/unit/user/verify-code';
|
||||
static const String invitationCode =
|
||||
'/communities/{communityUuid}/spaces/{unitUuid}/invitation-code';
|
||||
|
||||
//PUT
|
||||
static const String renameUnit = '/unit/{unitUuid}';
|
||||
@@ -131,7 +134,8 @@ abstract class ApiEndpoints {
|
||||
//PUT
|
||||
static const String editDevicePermission = '/device-permission/edit/{userId}';
|
||||
|
||||
static const String assignDeviceToRoom = '/device/room';
|
||||
static const String assignDeviceToRoom =
|
||||
'/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices/{deviceUuid}';
|
||||
|
||||
/// Scene & Automation API ////////////////////
|
||||
/// POST
|
||||
@@ -162,8 +166,7 @@ abstract class ApiEndpoints {
|
||||
/// DELETE
|
||||
static const String deleteScene = '/scene/tap-to-run/{sceneId}';
|
||||
|
||||
static const String deleteAutomation =
|
||||
'/automation/{automationId}';
|
||||
static const String deleteAutomation = '/automation/{automationId}';
|
||||
|
||||
//////////////////////Door Lock //////////////////////
|
||||
//online
|
||||
|
||||
@@ -59,12 +59,15 @@ class HomeManagementAPI {
|
||||
return list;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> assignDeviceToRoom(
|
||||
Map<String, String> body) async {
|
||||
static Future<Map<String, dynamic>> assignDeviceToRoom(String communityId,
|
||||
String spaceId, String subSpaceId, String deviceId) async {
|
||||
try {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.assignDeviceToRoom,
|
||||
body: body,
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.assignDeviceToRoom
|
||||
.replaceAll('{communityUuid}', communityId)
|
||||
.replaceAll('{spaceUuid}', spaceId)
|
||||
.replaceAll('{subSpaceUuid}', subSpaceId)
|
||||
.replaceAll('{deviceUuid}', deviceId),
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
@@ -74,4 +77,24 @@ class HomeManagementAPI {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> unAssignDeviceToRoom(String communityId,
|
||||
String spaceId, String subSpaceId, String deviceId) async {
|
||||
try {
|
||||
final response = await _httpService.delete(
|
||||
path: ApiEndpoints.assignDeviceToRoom
|
||||
.replaceAll('{communityUuid}', communityId)
|
||||
.replaceAll('{spaceUuid}', spaceId)
|
||||
.replaceAll('{subSpaceUuid}', subSpaceId)
|
||||
.replaceAll('{deviceUuid}', deviceId),
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,10 +79,11 @@ class SpacesAPI {
|
||||
}
|
||||
|
||||
static Future<bool> joinUnit(
|
||||
String userId,
|
||||
Map<String, String> body,
|
||||
) async {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.verifyInvitationCode,
|
||||
path: ApiEndpoints.verifyInvitationCode.replaceAll('{userUuid}', userId),
|
||||
showServerMessage: false,
|
||||
body: body,
|
||||
expectedResponseModel: (json) => json['success'],
|
||||
|
||||
Reference in New Issue
Block a user