Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
history_remote_datasource.dart
Go to the documentation of this file.
1import '../../../../core/api/api_client.dart';
2import '../../../../core/api/api_endpoints.dart';
3import '../../../../core/services/service_locator.dart';
4import '../../../../core/common/models/collection_model.dart';
5
8
9 Future<List<CollectionModel>> getPendingCollections({required int userId}) async {
10 final response = await apiClient.get(
11 path: ApiEndpoints.getCollections(
13 notForToday: true,
14 type: 'pending',
15 ),
16 );
17 if (response is List){
18 final collections = response.map(
19 (json) => CollectionModel.fromJson(json),
20 ).toList();
21 return collections;
22 }
23 return [];
24 }
25
26 Future<List<CollectionModel>> getHistoryCollections({
27 required int userId,
29 DateTime? dateStart,
30 DateTime? dateEnd,
31 }) async {
32 final response = await apiClient.get(
33 path: ApiEndpoints.getHistoryCollections(
36 dateStart: dateStart,
37 dateEnd: dateEnd,
38 ),
39 );
40 if (response is List) {
41 final collections = response.map(
42 (json) => CollectionModel.fromJson(json),
43 ).toList();
44 return collections;
45 }
46 return [];
47 }
48}
sealed class CheckInOutEvent extends Equatable userId
Future< List< CollectionModel > > getHistoryCollections({ required int userId, String? period, DateTime? dateStart, DateTime? dateEnd, }) async
Future< List< CollectionModel > > getPendingCollections({required int userId}) async
final String type
final bool notForToday
sealed class CollectionsState extends Equatable collections
final String path
class Partner String
abstract class PeriodEvent extends Equatable period
final sl