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 {
Map<String, dynamic>? queryParameters = lastUser != null ? {"lastUserId": lastUser.getUserId()} : null;
Map<String, dynamic> response = await HttpUtil.get("/channels/${tpChannel.getChannelId()}/members", queryParameters: queryParameters);
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.getCode()}, ${e.getMessage()}");
errorCallback?.call(e.getCode(), e.getMessage());
} catch(e){
Logger.log("$e");
errorCallback?.call(-1, e.toString());
}
return null;
}