getUsersByName method

Future<List<VIUserEvent>> getUsersByName(
  1. List<String> users
)

Get information for the users specified by the list of the Voximplant user names. Maximum 50 users.

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

users - List of Voximplant user identifiers, e.g., 'username@appname.accname'

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

Implementation

Future<List<VIUserEvent>> getUsersByName(List<String> users) async {
  try {
    List<dynamic>? data = await _methodChannel
        .invokeListMethod('Messaging.getUsersByName', {'users': users});
    if (data == null) {
      _VILog._e('VIMessenger: getUsersByName: data was null, skipping');
      throw VIException(
        VIMessagingError.ERROR_INTERNAL,
        'VIMessenger:getUsersByName: data was null',
      );
    }
    return data.map((e) => VIUserEvent._fromMap(e)).toList();
  } on PlatformException catch (e) {
    throw VIException(e.code, e.message);
  }
}