getCallDetails method
void
getCallDetails(
- String sessionId,
- String userAuthToken,
- dynamic onSuccess(),
- dynamic onError(
- CometChatCallsException error
override
Implementation
@override
void getCallDetails(sessionId, userAuthToken, onSuccess, onError) async {
CometChatCallsUtils.showLog(tag, "getCallDetails: CALLED");
try {
if (sessionId.isEmpty) {
onError(CometChatCallsException(
CometChatCallsConstants.codeSessionIdNull,
"Session ID is null",
"Session ID is null"));
} else if (userAuthToken.isEmpty) {
onError(CometChatCallsException(
CometChatCallsConstants.codeUserAuthTokenNull,
"User auth token is null",
"User auth token is null"));
} else if (ApiConnection.callAppSettings == null) {
onError(CometChatCallsException(
CometChatCallsConstants.codeCometChatCallsSDKInitError,
"CometChatCalls SDK is not initialized",
"CometChatCalls SDK is not initialized, please call CometChatCall.init() first"));
} else {
ApiConnection().getCallDetails(sessionId, userAuthToken,
(String response) {
List<CallLog> data = <CallLog>[];
jsonDecode(response)["data"].forEach((v) {
data.add(CallLog.fromJson(v));
});
onSuccess(data);
}, (CometChatCallsException e) {
CometChatCallsUtils.showLog(
tag, "getCallDetails onError: ${e.message}");
onError(e);
});
}
} on PlatformException catch (platformException) {
onError(CometChatCallsException(platformException.code,
platformException.message, platformException.details));
} catch (e) {
onError(CometChatCallsException(
CometChatCallsConstants.codeError, e.toString(), e.toString()));
}
}