/// <summary> /// Search for a player on Rainbow 6 Siege. /// </summary> /// <param name="players"> /// The player names to search for. /// </param> /// <param name="platform"> /// The platform the player is on.d /// </param> /// <returns> /// A list of players that matched the terms. /// </returns> public async Task <List <Profile> > GetProfileAsync(string[] players, Platform platform) { var queries = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("nameOnPlatform", HttpUtility.UrlEncode(string.Join(',', players))), new KeyValuePair <string, string>("platformType", Constant.PlatformToString(platform)) }; var ticket = await _sessionHandler.GetTicketAsync().ConfigureAwait(false); var results = await ApiHelper.GetDataAsync(Endpoints.Search, null, queries, ticket).ConfigureAwait(false); var deserialised = JsonSerializer.Deserialize <ProfileSearch>(results); return(deserialised.Profiles); }
/// <summary> /// Get a list of ranked profiles (like <see cref="BoardInfo.SkillMean"/> or <see cref="BoardInfo.MMR"/>). /// </summary> /// <param name="uuids"> /// The UUIDs matching the player profiles./> beforehand). /// </param> /// <param name="platform"> /// The platform <paramref name="uuids"/> belong to. /// </param> /// <param name="region"> /// The region <paramref name="uuids"/> belong to. /// </param> /// <param name="season"> /// The seasonal stats to search for. /// </param> /// <returns> /// A list of players matching the request terms in a dictionary (to be referenced with the player UUID as key). /// </returns> public async Task <Dictionary <string, BoardInfo> > GetRankedAsync(Guid[] uuids, Platform platform, Region region, int season) { var queries = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("profile_ids", string.Join(',', uuids)), new KeyValuePair <string, string>("board_id", "pvp_ranked"), new KeyValuePair <string, string>("region_id", Constant.RegionToString(region)), new KeyValuePair <string, string>("season_id", season.ToString()) }; var ticket = await _sessionHandler.GetTicketAsync().ConfigureAwait(false); var results = await ApiHelper.GetDataAsync(Endpoints.Players, platform, queries, ticket).ConfigureAwait(false); var deserialised = JsonSerializer.Deserialize <BoardInfoFetch>(results); return(deserialised.Players); }
private async Task <string> FetchStatisticsAsync(Guid[] uuids, Platform platform, params string[] variables) { var queries = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("populations", string.Join(',', uuids)), new KeyValuePair <string, string>("statistics", string.Join(',', variables)) }; var ticket = await _sessionHandler.GetTicketAsync().ConfigureAwait(false); var results = await ApiHelper.GetDataAsync(Endpoints.Statistics, platform, queries, ticket).ConfigureAwait(false); return(results); }
/// <summary> /// Get a list of basic profiles (like <see cref="PlayerProgression.XP"/> and <see cref="PlayerProgression.Level"/>). /// </summary> /// <param name="uuids"> /// The UUIDs matching the player profiles (should be searched with <see cref="GetProfileAsync(string, Platform)"/> beforehand). /// </param> /// <param name="platform"> /// The platform <paramref name="uuids"/> belong to. /// </param> /// <returns> /// A list of basic profiles matching the request terms. /// </returns> public async Task <List <PlayerProgression> > GetPlayerProgressionAsync(Guid[] uuids, Platform platform) { var queries = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("profile_ids", string.Join(',', uuids)) }; var ticket = await _sessionHandler.GetTicketAsync().ConfigureAwait(false); var results = await ApiHelper.GetDataAsync(Endpoints.Progressions, platform, queries, ticket).ConfigureAwait(false); var deserialised = JsonSerializer.Deserialize <PlayerProgressionFetch>(results); foreach (var result in deserialised.PlayerProgressions) { // Attach link to player profile icon url result.ProfileIcon = new Uri(string.Format(Endpoints.Avatar, result.ProfileId, Constant.Rainbow6S)); } return(deserialised.PlayerProgressions); }