mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
168 lines
4.0 KiB
Dart
168 lines
4.0 KiB
Dart
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
|
import 'package:syncrow_app/services/api/http_service.dart';
|
|
|
|
class HomeCreation {
|
|
static final HTTPService _httpService = HTTPService();
|
|
|
|
static Future<Map<String, dynamic>> createCommunity(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addCommunity,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> assignUserToCommunity(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addCommunityToUser,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> createBuilding(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addBuilding,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> assignUserToBuilding(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addBuildingToUser,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> createFloor(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addFloor,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> assignUserToFloor(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addBuildingToUser,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> createUnit(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addUnit,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> assignUserToUnit(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addUnitToUser,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
static Future<Map<String, dynamic>> createRoom(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addRoom,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
|
|
static Future<Map<String, dynamic>> assignUserToRoom(Map<String, String> body) async {
|
|
try {
|
|
final response = await _httpService.post(
|
|
path: ApiEndpoints.addRoomToUser,
|
|
body: body,
|
|
showServerMessage: false,
|
|
expectedResponseModel: (json) {
|
|
return json;
|
|
},
|
|
);
|
|
return response;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
}
|