public PlayerSummaries(PlayerSummariesResponse response) { Players = new Player[response.players.Length]; for (int i = 0; i < response.players.Length; i++) { Players[i] = new Player(response.players[i]); } }
//////////////////////////////////////////////////////////////////////////////// /// Player Summaries //////////////////////////////////////////////////////////////////////////////// /// <summary> /// Returns basic profile information for a list of 64-bit Steam IDs. /// Some data associated with a Steam account may be hidden if the user /// has their profile visibility set to "Friends Only" or "Private". /// In that case, only public data will be returned. /// </summary> public async Task <Result <List <Player> > > GetPlayerSummariesAsync(IEnumerable <string> steamids) { var players = new List <Player>(); var splitSteamids = steamids.Split(MaxSteamBatchRequestCount); foreach (var steamidGroup in splitSteamids) { var response = new PlayerSummariesResponse(await SendRequestAsync(new PlayerSummariesRequest(APIKey, steamidGroup))); if (response.Result.IsOk) { players.AddRange(response.Result.Value); } else { return(Result <List <Player> > .Err(response.Result.ErrorMessage)); } } return(Result <List <Player> > .Ok(players)); }
//////////////////////////////////////////////////////////////////////////////// /// Player Summaries //////////////////////////////////////////////////////////////////////////////// /// <summary> /// Returns basic profile information for a list of 64-bit Steam IDs. /// Some data associated with a Steam account may be hidden if the user /// has their profile visibility set to "Friends Only" or "Private". /// In that case, only public data will be returned. /// </summary> public async Task<Result<List<Player>>> GetPlayerSummariesAsync(IEnumerable<string> steamids) { var players = new List<Player>(); var splitSteamids = steamids.Split(MaxSteamBatchRequestCount); foreach(var steamidGroup in splitSteamids) { var response = new PlayerSummariesResponse(await SendRequestAsync(new PlayerSummariesRequest(APIKey, steamidGroup))); if(response.Result.IsOk) players.AddRange(response.Result.Value); else return Result<List<Player>>.Err(response.Result.ErrorMessage); } return Result<List<Player>>.Ok(players); }