/// <summary> /// Gathers the list of all users in given clan and their <see cref="ClanUserState"/> (<see cref="IGroupUserListGroupUser.State"/>). /// </summary> public static async Task <List <IGroupUserListGroupUser> > GetClanUsersAsync(Client client, ISession session, IApiGroup clan) { try { IApiGroupUserList userEnumeration = await client.ListGroupUsersAsync(session, clan.Id); List <IGroupUserListGroupUser> userList = userEnumeration.GroupUsers.ToList(); return(userList); } catch (Exception e) { Debug.LogWarning("An error has occured when getting clan user list: " + e); return(null); } }
/// <summary> /// Retrieves all user ids from <paramref name="clan"/> and filters all records from global leaderboard to show only filtered users. /// </summary> public static async Task <IApiLeaderboardRecordList> GetClanLeaderboarsAsync(Client client, ISession session, IApiGroup clan, int limit = 1, string cursor = null) { try { IApiGroupUserList users = await client.ListGroupUsersAsync(session, clan.Id); IEnumerable <string> ids = users.GroupUsers.Select(x => x.User.Id); IApiLeaderboardRecordList list = await client.ListLeaderboardRecordsAsync(session, "global", ids, limit, cursor); return(list); } catch (Exception e) { Debug.LogWarning("An error has occured while showing clan leaderboards: " + e); return(null); } }