elCaribe app - customization and branding

This commit is contained in:
2025-12-12 19:09:42 -04:00
parent 9e5d0d8ebf
commit ba7deac9f3
402 changed files with 31833 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import 'package:news/utils/api.dart';
import 'package:news/utils/strings.dart';
class CategoryRemoteDataSource {
Future<dynamic> getCategory({required String limit, required String offset, required String langId}) async {
try {
final body = {LIMIT: limit, OFFSET: offset, LANGUAGE_ID: langId};
final result = await Api.sendApiRequest(body: body, url: Api.getCatApi);
return result;
} catch (e) {
throw ApiMessageAndCodeException(errorMessage: e.toString());
}
}
}

View File

@@ -0,0 +1,24 @@
import 'package:news/data/models/CategoryModel.dart';
import 'package:news/data/repositories/Category/categoryRemoteDataSource.dart';
import 'package:news/utils/strings.dart';
class CategoryRepository {
static final CategoryRepository _notificationRepository = CategoryRepository._internal();
late CategoryRemoteDataSource _notificationRemoteDataSource;
factory CategoryRepository() {
_notificationRepository._notificationRemoteDataSource = CategoryRemoteDataSource();
return _notificationRepository;
}
CategoryRepository._internal();
Future<Map<String, dynamic>> getCategory({required String offset, required String limit, required String langId}) async {
final result = await _notificationRemoteDataSource.getCategory(limit: limit, offset: offset, langId: langId);
return (result[ERROR])
? {ERROR: result[ERROR], MESSAGE: result[MESSAGE]}
: {ERROR: result[ERROR], "total": result[TOTAL], "Category": (result[DATA] as List).map((e) => CategoryModel.fromJson(e)).toList()};
}
}