Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
authentication_remote_datasource.dart
Go to the documentation of this file.
1import '../../../../../core/api/api_client.dart';
2import '../../../../../core/api/api_endpoints.dart';
3import '../../../../../core/common/models/collection_model.dart';
4import '../../../../../core/services/service_locator.dart';
5import '../../../../collections/data/models/res/res_cancelation_reason_model.dart';
6import '../../../../collections/data/models/res/res_collection_contact_model.dart';
7import '../../../../collections/data/models/res/res_collection_rating_reason_model.dart';
8import '../../../../collections/data/models/res/res_partner_payment_model.dart';
9import '../../models/credentials_model.dart';
10
13 Future<Map<String, dynamic>> signInWithCredentials({
14 required CredentialsModel credentials,
15 }) async {
16 final response = await apiClient.post(
17 url: ApiEndpoints.loginurl,
18 data: {
19 "login": credentials.email,
20 "password": credentials.password,
21 "originRequest": "driver",
22 },
23 );
24
25 return response;
26 }
27
28 Future<List<CollectionModel>> getCollections({
29 required int userId,
30 required bool notForToday,
31 required String? type,
32 }) async {
33 final response = await apiClient.get(
34 path: ApiEndpoints.getCollections(
37 type: type,
38 ),
39 );
40 if (response is List) {
41 final collections = response.map(
42 (json) => CollectionModel.fromJson(json),
43 ).toList();
44 // collections.sort();
45 return collections;
46 }
47 return [];
48 }
49
50 Future<List<ResCancelationReasonModel>> getCollectionCancelationReasons() async {
51 final response = await apiClient.get(path: ApiEndpoints.getCollectionCancelationReasons);
52 if (response is List) {
53 return response.map(
54 (json) => ResCancelationReasonModel.fromJson(json),
55 ).toList();
56 }
57 return [];
58 }
59
60 Future<List<ResPartnerPaymentModel>> getCollectionPaymentModeList({
61 required int restaurentId,
62 }) async {
63 final response = await apiClient.get(
64 path: ApiEndpoints.getCollectionPaymentModeList(
66 ),
67 );
68 if (response is List) {
69 final list = response.map(
70 (json) => ResPartnerPaymentModel.fromJson(json),
71 ).toList();
72 return list;
73 }
74 return [];
75 }
76
77 Future<List<ResCollectionContactModel>> getCollectionContactList({
78 required int restaurentId,
79 }) async {
80 final response = await apiClient.get(
81 path: ApiEndpoints.getCollectionContactList(
83 ),
84 );
85 if (response is List) {
86 final list = response.map(
87 (json) => ResCollectionContactModel.fromJson(json),
88 ).toList();
89 return list;
90 }
91 return [];
92 }
93
94 Future<List<ResCollectionRatingReasonModel>> getCollectionRatingReasons() async {
95 final response = await apiClient.get(path: ApiEndpoints.ratingReasons);
96 if (response is List) {
97 return response.map(
98 (json) => ResCollectionRatingReasonModel.fromJson(json),
99 ).toList();
100 }
101 return [];
102 }
103
104 Future<List<CollectionModel>> getHistoryCollections({
105 required int userId,
106 String? period,
107 DateTime? dateStart,
108 DateTime? dateEnd,
109 }) async {
110 final response = await apiClient.get(
111 path: ApiEndpoints.getHistoryCollections(
112 userId: userId,
113 period: period,
114 dateStart: dateStart,
115 dateEnd: dateEnd,
116 ),
117 );
118 if (response is List) {
119 final collections = response.map(
120 (json) => CollectionModel.fromJson(json),
121 ).toList();
122 return collections;
123 }
124 return [];
125 }
126}
final class AuthenticatedState extends AuthenticationState credentials
sealed class CheckInOutEvent extends Equatable userId
Future< List< ResCollectionContactModel > > getCollectionContactList({ required int restaurentId, }) async
Future< List< ResPartnerPaymentModel > > getCollectionPaymentModeList({ required int restaurentId, }) async
Future< List< CollectionModel > > getCollections({ required int userId, required bool notForToday, required String? type, }) async
Future< List< ResCollectionRatingReasonModel > > getCollectionRatingReasons() async
Future< List< ResCancelationReasonModel > > getCollectionCancelationReasons() async
Future< List< CollectionModel > > getHistoryCollections({ required int userId, String? period, DateTime? dateStart, DateTime? dateEnd, }) async
Future< Map< String, dynamic > > signInWithCredentials({ required CredentialsModel credentials, }) async
final String type
final bool notForToday
class GetCollectionContactListEvent extends CollectionsInformationEvent restaurentId
sealed class CollectionsState extends Equatable collections
final String path
class Partner String
abstract class PeriodEvent extends Equatable period
ResPartnerPaymentModel({ required super.partnerId, required ResPaymentModeModel super.paymentModeId, })
final sl