getUserByIMId method

Future<VIUserEvent> getUserByIMId(
  1. int userId
)

Get information for the user specified by the IM user id.

It's possible to get any user of the main Voximplant developer account or its child accounts.

userId - IM User id

Throws VIException, if operation failed, otherwise returns VIUserEvent instance. For all possible errors see VIMessagingError

Implementation

Future<VIUserEvent> getUserByIMId(int userId) async {
  try {
    Map<String, dynamic>? data = await _methodChannel
        .invokeMapMethod('Messaging.getUserByIMId', {'id': userId});
    if (data == null) {
      _VILog._e('VIMessenger: getUserByIMId: data was null, skipping');
      throw VIException(
        VIMessagingError.ERROR_INTERNAL,
        'VIMessenger:getUserByIMId: data was null',
      );
    }
    return VIUserEvent._fromMap(data);
  } on PlatformException catch (e) {
    throw VIException(e.code, e.message);
  }
}