elCaribe app - customization and branding
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import 'package:news/utils/api.dart';
|
||||
import 'package:news/utils/strings.dart';
|
||||
|
||||
class SurveyQuestionRemoteDataSource {
|
||||
Future<dynamic> getSurveyQuestions({required String langId}) async {
|
||||
try {
|
||||
final body = {LANGUAGE_ID: langId};
|
||||
final result = await Api.sendApiRequest(body: body, url: Api.getQueApi);
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
throw ApiMessageAndCodeException(errorMessage: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:news/data/models/NewsModel.dart';
|
||||
import 'package:news/data/repositories/SurveyQuestion/surveyQueRemoteDataSource.dart';
|
||||
import 'package:news/utils/strings.dart';
|
||||
|
||||
class SurveyQuestionRepository {
|
||||
static final SurveyQuestionRepository _surveyQuestionRepository = SurveyQuestionRepository._internal();
|
||||
|
||||
late SurveyQuestionRemoteDataSource _surveyQuestionRemoteDataSource;
|
||||
|
||||
factory SurveyQuestionRepository() {
|
||||
_surveyQuestionRepository._surveyQuestionRemoteDataSource = SurveyQuestionRemoteDataSource();
|
||||
return _surveyQuestionRepository;
|
||||
}
|
||||
|
||||
SurveyQuestionRepository._internal();
|
||||
|
||||
Future<Map<String, dynamic>> getSurveyQuestion({required String langId}) async {
|
||||
final result = await _surveyQuestionRemoteDataSource.getSurveyQuestions(langId: langId);
|
||||
|
||||
return {"SurveyQuestion": (result[DATA] as List).map((e) => NewsModel.fromSurvey(e)).toList()};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user