93 lines
3.5 KiB
Dart
93 lines
3.5 KiB
Dart
import 'dart:async';
|
|
import 'dart:developer';
|
|
|
|
import 'package:regroup/Common/api_urls.dart';
|
|
import 'package:regroup/Common/base_manager.dart';
|
|
import 'package:regroup/Common/controller/data/network/network_api.dart';
|
|
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communityMebersModel.dart';
|
|
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communityaddgroupsModel.dart';
|
|
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communityeditpageModel.dart';
|
|
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communitygroupsModel.dart';
|
|
import 'package:regroup/sidemenu/Community/MyCommunity/Model/communitymanageGroupsModel.dart';
|
|
|
|
CommunityAddgroupsModel? communityaddgroupobj;
|
|
CommunitygroupsModel? communitygroupspobj;
|
|
CommunityMembersModel? communitymembersobj;
|
|
CommunityinfopageEditModel? communityeditobj;
|
|
CommunityManageGroupsModel? communitymanagegroupsobj;
|
|
|
|
|
|
|
|
|
|
class Getcommunity {
|
|
|
|
Future<ResponseData<dynamic>> getCommunityAddGroupsearch(updata,community,
|
|
{required StreamController<CommunityAddgroupsModel> streamController}) async {
|
|
final response =
|
|
await NetworkApiServices().getApi(
|
|
"${ApiUrls.getcommunityaddgroups}?manage_community_xid=$community&search=$updata",
|
|
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
communityaddgroupobj = CommunityAddgroupsModel.fromJson(response.data);
|
|
if (!streamController.isClosed) streamController.sink.add(communityaddgroupobj!);
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getCommunitygroups(updata) async {
|
|
final response = await NetworkApiServices().getApi(
|
|
"${ApiUrls.getcommunitygroups}?manage_community_xid=$updata",
|
|
// optionalpar: false
|
|
);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
communitygroupspobj = CommunitygroupsModel.fromJson(response.data);
|
|
log(communitygroupspobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getCommunityMemberssearch(updata,updata2,
|
|
{required StreamController<CommunityMembersModel> streamController}) async {
|
|
final response =
|
|
await NetworkApiServices().getApi(
|
|
"${ApiUrls.getcommunitymembers}?manage_community_xid=$updata&search=$updata2",
|
|
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
communitymembersobj = CommunityMembersModel.fromJson(response.data);
|
|
if (!streamController.isClosed) streamController.sink.add(communitymembersobj!);
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getCommunityeditpage(updata) async {
|
|
final response = await NetworkApiServices().getApi(
|
|
"${ApiUrls.geteditcommunity}?community_id=$updata",
|
|
// optionalpar: false
|
|
);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
communityeditobj = CommunityinfopageEditModel.fromJson(response.data);
|
|
log(communityeditobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getCommunityManageGroupssearch(updata,updata2,
|
|
{required StreamController<CommunityManageGroupsModel> streamController}) async {
|
|
final response =
|
|
await NetworkApiServices().getApi(
|
|
"${ApiUrls.getcommunitymanagegroups}?manage_community_xid=$updata&search=$updata2",
|
|
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
communitymanagegroupsobj = CommunityManageGroupsModel.fromJson(response.data);
|
|
if (!streamController.isClosed) streamController.sink.add(communitymanagegroupsobj!);
|
|
}
|
|
return response;
|
|
}
|
|
|
|
} |