128 lines
4.5 KiB
Dart
128 lines
4.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/Feed%20Module/Main_Screens/ProfileTab/Model/accountSessionModel.dart';
|
|
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/certificateModel.dart';
|
|
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/editTimelineModel.dart';
|
|
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/faqModel.dart';
|
|
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/followersModel.dart';
|
|
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/followingModel.dart';
|
|
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/privacyPolicyModel.dart';
|
|
import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/termsconditionsModel.dart';
|
|
// import 'package:regroup/Feed%20Module/Main_Screens/ProfileTab/Model/timelineabilityModel.dart';
|
|
|
|
FaqModel? faqobj;
|
|
PrivacypolicyModel? privacyobj;
|
|
TermsConditionsModel? termsobj;
|
|
FollowersModel? followersobj;
|
|
FollowingModel? followingobj;
|
|
GetEditTimelineModel? edittimelineobj;
|
|
GetAccountSessionsModel? accountsessionobj;
|
|
CertificateuserModel? certificateobj;
|
|
|
|
|
|
|
|
class Profilegetmethod {
|
|
// Profilegetmethod();
|
|
Future<ResponseData<dynamic>> getFaqs() async {
|
|
final response = await NetworkApiServices().getApi(
|
|
ApiUrls.getfaqs,
|
|
// optionalpar: false
|
|
);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
faqobj = FaqModel.fromJson(response.data);
|
|
log(faqobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getPrivacypolicy() async {
|
|
final response = await NetworkApiServices().getApi(
|
|
ApiUrls.getprivacypolicy,
|
|
// optionalpar: false
|
|
);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
privacyobj = PrivacypolicyModel.fromJson(response.data);
|
|
log(privacyobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getTermsConditions() async {
|
|
final response = await NetworkApiServices().getApi(
|
|
ApiUrls.gettermsconditios,
|
|
// optionalpar: false
|
|
);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
termsobj = TermsConditionsModel.fromJson(response.data);
|
|
log(termsobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getFollowers(updata,
|
|
{required StreamController<FollowersModel> streamController}) async {
|
|
final response = await NetworkApiServices().getApi(
|
|
"${ApiUrls.getfollowers}?search=$updata",
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
followersobj = FollowersModel.fromJson(response.data);
|
|
if (!streamController.isClosed) streamController.sink.add(followersobj!);
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getFollowing(updata,
|
|
{required StreamController<FollowingModel> streamController}) async {
|
|
final response = await NetworkApiServices().getApi(
|
|
"${ApiUrls.getfollowing}?search=$updata",
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
followingobj = FollowingModel.fromJson(response.data);
|
|
if (!streamController.isClosed) streamController.sink.add(followingobj!);
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getEditTimeline(int data) async {
|
|
final response = await NetworkApiServices().getApi(ApiUrls.getedittimeline + "/?timeline_id=${data}");
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
edittimelineobj = GetEditTimelineModel.fromJson(response.data);
|
|
log(edittimelineobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getAccountSessions() async {
|
|
final response = await NetworkApiServices().getApi(
|
|
ApiUrls.getaccountsessions,
|
|
// optionalpar: false
|
|
);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
accountsessionobj = GetAccountSessionsModel.fromJson(response.data);
|
|
log(accountsessionobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getUserCertificates(updata) async {
|
|
final response =
|
|
await NetworkApiServices().getApi(
|
|
"${ApiUrls.getusercertificates}?user_id=$updata",
|
|
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
certificateobj = CertificateuserModel.fromJson(response.data);
|
|
log(certificateobj!.data.toString());
|
|
}
|
|
return response;
|
|
}
|
|
}
|