|
|
|
|
@ -35,6 +35,7 @@ import 'model/user_chat_history_model.dart';
|
|
|
|
|
// import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as user;
|
|
|
|
|
// import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' as fav;
|
|
|
|
|
|
|
|
|
|
//Need to refector this remove unused code.
|
|
|
|
|
class ChatApiClient {
|
|
|
|
|
static final ChatApiClient _instance = ChatApiClient._internal();
|
|
|
|
|
|
|
|
|
|
@ -97,47 +98,17 @@ class ChatApiClient {
|
|
|
|
|
|
|
|
|
|
Future<bool> resetCountApi(int moduleCode, int referenceNumber, String? employeeNumber) async {
|
|
|
|
|
final Map<String, dynamic> payload = {
|
|
|
|
|
'moduleCode': moduleCode,
|
|
|
|
|
'ReferenceNumber': referenceNumber,
|
|
|
|
|
'moduleCode': "$moduleCode",
|
|
|
|
|
'ReferenceNumber': "$referenceNumber",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// final headers = chatAckHeaders(
|
|
|
|
|
// apiKey: URLs.chatApiKey,
|
|
|
|
|
// employeeNumber: employeeNumber.toString(),
|
|
|
|
|
// origin: 'http://localhost:4400',
|
|
|
|
|
// referer: 'http://localhost:4400/',
|
|
|
|
|
// userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
final Response response = await ApiClient().postJsonForResponse(
|
|
|
|
|
URLs.resetMessageCount,
|
|
|
|
|
payload,
|
|
|
|
|
token: chatLoginResponse!.token,
|
|
|
|
|
// headers: headers,
|
|
|
|
|
);
|
|
|
|
|
// Response response = await ApiClient().postJsonForResponse(
|
|
|
|
|
// "${URLs.resetMessageCount}?moduleCode=$moduleCode&ReferenceNumber=$referenceNumber", {"moduleCode": moduleCode.toString(), "ReferenceNumber": referenceNumber.toString()},
|
|
|
|
|
// token: chatLoginResponse!.token);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return response.statusCode == 200;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, String> chatAckHeaders({
|
|
|
|
|
required String apiKey,
|
|
|
|
|
required String employeeNumber,
|
|
|
|
|
required String origin,
|
|
|
|
|
required String referer,
|
|
|
|
|
required String userAgent,
|
|
|
|
|
String acceptLanguage = 'en-US,en;q=0.9',
|
|
|
|
|
}) {
|
|
|
|
|
return {
|
|
|
|
|
'Accept': 'application/json, text/plain, */*',
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
// 'X-API-Key': apiKey,
|
|
|
|
|
// 'X-Employee-Number': employeeNumber,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<List<ChatAttachment>> viewAllDocuments(int moduleId, int referenceId) async {
|
|
|
|
|
Response response = await ApiClient().getJsonForResponse("${URLs.chatHubUrlApi}/attachments/conversation?referenceId=$referenceId&moduleCode=$moduleId", token: chatLoginResponse!.token);
|
|
|
|
|
|