getChannelMemberList static method
Implementation
static Future<List<TPUser>?> getChannelMemberList(
TPChannel tpChannel,
TPUser? lastUser,
{
Function(int? errorCode, String? errorMessage)? errorCallback
}) async
{
if (!_isInitialized(errorCallback: errorCallback)) { return null; }
if (!_checkAuthInfo(errorCallback: errorCallback)) { return null; }
try {
String url = "/channels/${tpChannel.getChannelId()}/members";
if (lastUser != null) { url += "?lastUserId=${lastUser.getUserId()}"; }
Map<String, dynamic> response = await HttpUtil.get(url);
List<dynamic> userArray = response["members"];
List<TPUser> list = List.from([]);
for (Map<String, dynamic> element in userArray) { list.add(TPUser(element)); }
return list;
} on TPException catch(e) {
Logger.log("$e");
if(errorCallback != null) { errorCallback(e.getCode(), e.getMessage()); }
} catch(e){
Logger.log("$e");
if(errorCallback != null) { errorCallback(-1, e.toString()); }
}
return null;
}