mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Merge branch 'dev' into Roles_&_Permissions
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/community_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/selected_product_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/space_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/space_response_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_response_model.dart';
|
||||
import 'package:syncrow_web/services/api/http_service.dart';
|
||||
import 'package:syncrow_web/utils/constants/api_const.dart';
|
||||
import 'package:syncrow_web/utils/constants/temp_const.dart';
|
||||
|
||||
class CommunitySpaceManagementApi {
|
||||
// Community Management APIs
|
||||
@ -15,7 +16,8 @@ class CommunitySpaceManagementApi {
|
||||
|
||||
while (hasNext) {
|
||||
await HTTPService().get(
|
||||
path: ApiEndpoints.getCommunityList,
|
||||
path: ApiEndpoints.getCommunityList
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
queryParameters: {'page': page},
|
||||
expectedResponseModel: (json) {
|
||||
List<dynamic> jsonData = json['data'];
|
||||
@ -59,7 +61,8 @@ class CommunitySpaceManagementApi {
|
||||
String name, String description) async {
|
||||
try {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.createCommunity,
|
||||
path: ApiEndpoints.createCommunity
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
body: {
|
||||
'name': name,
|
||||
'description': description,
|
||||
@ -79,7 +82,8 @@ class CommunitySpaceManagementApi {
|
||||
try {
|
||||
final response = await HTTPService().put(
|
||||
path: ApiEndpoints.updateCommunity
|
||||
.replaceAll('{communityId}', communityId),
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
body: {
|
||||
'name': name,
|
||||
},
|
||||
@ -98,7 +102,8 @@ class CommunitySpaceManagementApi {
|
||||
try {
|
||||
final response = await HTTPService().delete(
|
||||
path: ApiEndpoints.deleteCommunity
|
||||
.replaceAll('{communityId}', communityId),
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
expectedResponseModel: (json) {
|
||||
return json['success'] ?? false;
|
||||
},
|
||||
@ -113,7 +118,9 @@ class CommunitySpaceManagementApi {
|
||||
Future<SpacesResponse> fetchSpaces(String communityId) async {
|
||||
try {
|
||||
final response = await HTTPService().get(
|
||||
path: ApiEndpoints.listSpaces.replaceAll('{communityId}', communityId),
|
||||
path: ApiEndpoints.listSpaces
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
expectedResponseModel: (json) {
|
||||
return SpacesResponse.fromJson(json);
|
||||
},
|
||||
@ -139,7 +146,8 @@ class CommunitySpaceManagementApi {
|
||||
final response = await HTTPService().get(
|
||||
path: ApiEndpoints.getSpace
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{spaceId}', spaceId),
|
||||
.replaceAll('{spaceId}', spaceId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
expectedResponseModel: (json) {
|
||||
return SpaceModel.fromJson(json);
|
||||
},
|
||||
@ -175,7 +183,9 @@ class CommunitySpaceManagementApi {
|
||||
body['parentUuid'] = parentId;
|
||||
}
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.createSpace.replaceAll('{communityId}', communityId),
|
||||
path: ApiEndpoints.createSpace
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
body: body,
|
||||
expectedResponseModel: (json) {
|
||||
return SpaceModel.fromJson(json['data']);
|
||||
@ -216,7 +226,8 @@ class CommunitySpaceManagementApi {
|
||||
final response = await HTTPService().put(
|
||||
path: ApiEndpoints.updateSpace
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{spaceId}', spaceId),
|
||||
.replaceAll('{spaceId}', spaceId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
body: body,
|
||||
expectedResponseModel: (json) {
|
||||
return SpaceModel.fromJson(json['data']);
|
||||
@ -234,7 +245,8 @@ class CommunitySpaceManagementApi {
|
||||
final response = await HTTPService().delete(
|
||||
path: ApiEndpoints.deleteSpace
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{spaceId}', spaceId),
|
||||
.replaceAll('{spaceId}', spaceId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
expectedResponseModel: (json) {
|
||||
return json['success'] ?? false;
|
||||
},
|
||||
@ -250,7 +262,8 @@ class CommunitySpaceManagementApi {
|
||||
try {
|
||||
final response = await HTTPService().get(
|
||||
path: ApiEndpoints.getSpaceHierarchy
|
||||
.replaceAll('{communityId}', communityId),
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
expectedResponseModel: (json) {
|
||||
print(json);
|
||||
final spaceModels = (json['data'] as List)
|
||||
|
Reference in New Issue
Block a user