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 LiveStreamRemoteDataSource {
|
||||
Future<dynamic> getLiveStreams({required String langId}) async {
|
||||
try {
|
||||
final body = {LANGUAGE_ID: langId};
|
||||
final result = await Api.sendApiRequest(body: body, url: Api.getLiveStreamingApi);
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
throw ApiMessageAndCodeException(errorMessage: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:news/data/models/LiveStreamingModel.dart';
|
||||
import 'package:news/data/repositories/LiveStream/liveRemoteDataSource.dart';
|
||||
import 'package:news/utils/strings.dart';
|
||||
|
||||
class LiveStreamRepository {
|
||||
static final LiveStreamRepository _liveStreamRepository = LiveStreamRepository._internal();
|
||||
|
||||
late LiveStreamRemoteDataSource _liveStreamRemoteDataSource;
|
||||
|
||||
factory LiveStreamRepository() {
|
||||
_liveStreamRepository._liveStreamRemoteDataSource = LiveStreamRemoteDataSource();
|
||||
return _liveStreamRepository;
|
||||
}
|
||||
|
||||
LiveStreamRepository._internal();
|
||||
|
||||
Future<dynamic> getLiveStream({required String langId}) async {
|
||||
final result = await _liveStreamRemoteDataSource.getLiveStreams(langId: langId);
|
||||
|
||||
return (result[ERROR]) ? {ERROR: result[ERROR], MESSAGE: result[MESSAGE]} : {ERROR: result[ERROR], "LiveStream": (result[DATA] as List).map((e) => LiveStreamingModel.fromJson(e)).toList()};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user