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.
1
import
'../../../../core/api/api_client.dart';
2
import
'../../../../core/api/api_endpoints.dart';
3
import
'../../../../core/services/service_locator.dart';
4
import
'../../../../core/common/models/collection_model.dart';
5
6
class
HistoryRemoteDatasource
{
7
final
apiClient
=
sl<ApiClient>
();
8
9
Future<List<CollectionModel>>
getPendingCollections
({required
int
userId
}) async {
10
final
response = await
apiClient
.get(
11
path
: ApiEndpoints.getCollections(
12
userId
:
userId
,
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
,
28
String
?
period
,
29
DateTime? dateStart,
30
DateTime? dateEnd,
31
}) async {
32
final
response = await
apiClient
.get(
33
path
: ApiEndpoints.getHistoryCollections(
34
userId
:
userId
,
35
period
:
period
,
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
}
userId
sealed class CheckInOutEvent extends Equatable userId
Definition
collections_event.dart:48
HistoryRemoteDatasource
Definition
history_remote_datasource.dart:6
HistoryRemoteDatasource::getHistoryCollections
Future< List< CollectionModel > > getHistoryCollections({ required int userId, String? period, DateTime? dateStart, DateTime? dateEnd, }) async
Definition
history_remote_datasource.dart:26
HistoryRemoteDatasource::apiClient
final apiClient
Definition
history_remote_datasource.dart:7
HistoryRemoteDatasource::getPendingCollections
Future< List< CollectionModel > > getPendingCollections({required int userId}) async
Definition
history_remote_datasource.dart:9
type
final String type
Definition
collections_event.dart:13
notForToday
final bool notForToday
Definition
collections_event.dart:12
collections
sealed class CollectionsState extends Equatable collections
path
final String path
Definition
dashboard_card.dart:231
String
class Partner String
period
abstract class PeriodEvent extends Equatable period
Definition
period_event.dart:31
sl
final sl
Definition
service_locator.dart:77
lib
features
history
data
datasources
history_remote_datasource.dart
Generated by
1.16.1