getCallLogList method
dynamic
getCallLogList(
- dynamic onSuccess(),
- dynamic onError(
- CometChatCallsException excep
- String response
Processes the response from a getCallLogList
request.
onSuccess: A function to be called when the call logs are successfully retrieved. onError: A function to be called when there is an exception. response: The raw response from the API call.
Implementation
getCallLogList(Function(List<CallLog> callLogs) onSuccess,
Function(CometChatCallsException excep) onError, String response) {
List<CallLog> data = <CallLog>[];
try {
totalPages = jsonDecode(response)['meta']['pagination']["total_pages"];
currentPage = jsonDecode(response)['meta']['pagination']["current_page"];
if (jsonDecode(response)["data"] != null) {
data = <CallLog>[];
jsonDecode(response)["data"].forEach((v) {
data.add(CallLog.fromJson(v));
});
onSuccess(data);
}
} catch (e) {
CometChatCallsUtils.showLog(_tag, "Error: $e");
onError(CometChatCallsException(
CometChatCallsConstants.codeError, e.toString(), e.toString()));
}
}