You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.3 KiB
Dart
51 lines
2.3 KiB
Dart
|
3 years ago
|
import 'package:mohem_flutter_app/api/api_client.dart';
|
||
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||
|
|
import 'package:mohem_flutter_app/classes/consts.dart';
|
||
|
|
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
||
|
|
import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_details.dart';
|
||
|
|
import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_transactions.dart';
|
||
|
|
|
||
|
|
import '../../models/mowadhafhi/get_tickets_list.dart';
|
||
|
|
|
||
|
|
class MowadhafhiApiClient {
|
||
|
|
static final MowadhafhiApiClient _instance = MowadhafhiApiClient._internal();
|
||
|
|
|
||
|
|
MowadhafhiApiClient._internal();
|
||
|
|
|
||
|
|
factory MowadhafhiApiClient() => _instance;
|
||
|
|
|
||
|
|
Future<List<GetTicketsByEmployeeList>> getTicketsByEmployee() async {
|
||
|
|
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketsByEmployee";
|
||
|
|
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgPageSize": 10, "ItgPageNo": 1};
|
||
|
|
|
||
|
|
postParams.addAll(AppState().postParamsJson);
|
||
|
|
return await ApiClient().postJsonForObject((json) {
|
||
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||
|
|
return responseData.getTicketsByEmployeeList ?? [];
|
||
|
|
}, url, postParams);
|
||
|
|
}
|
||
|
|
|
||
|
|
Future<List<GetTicketDetailsByEmployee>> getTicketDetailsByEmployee(String? itgTicketID) async {
|
||
|
|
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketDetails";
|
||
|
|
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgTicketId": itgTicketID};
|
||
|
|
|
||
|
|
postParams.addAll(AppState().postParamsJson);
|
||
|
|
return await ApiClient().postJsonForObject((json) {
|
||
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||
|
|
return responseData.getTicketDetailsByEmployee ?? [];
|
||
|
|
}, url, postParams);
|
||
|
|
}
|
||
|
|
|
||
|
|
Future<List<GetTicketTransactions>> getTicketTransactions(String? itgTicketID) async {
|
||
|
|
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketTransaction";
|
||
|
|
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgTicketId": itgTicketID};
|
||
|
|
|
||
|
|
postParams.addAll(AppState().postParamsJson);
|
||
|
|
return await ApiClient().postJsonForObject((json) {
|
||
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||
|
|
return responseData.getTicketTransactions ?? [];
|
||
|
|
}, url, postParams);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|