Ejemplo n.º 1
0
        public async Task <RanksResponse> GetRanksResponseAsync(RanksRequest ranksRequest)
        {
            var regionId = ranksRequest.Region.ToStringValue();
            var spaceId  = ranksRequest.Platform.ToSpaceIdValue();
            var url      = ranksRequest.Platform.ToUrlValue();
            var route    = string.Format(ApiRoutes.Ranks, spaceId, url);

            var request = new RestRequest(route, Method.GET);

            request.AddHeaders(GetCommonHeaders(ranksRequest.Ticket, ranksRequest.UbiAppId, ranksRequest.SessionId));
            request.AddParameter("board_id", ranksRequest.BoardId);
            request.AddParameter("profile_ids", string.Join(",", ranksRequest.Profileids));
            request.AddParameter("region_id", regionId);
            request.AddParameter("season_id", ranksRequest.SeasonId);

            return(await ExecuteRequestAsync <RanksResponse>(request));
        }
Ejemplo n.º 2
0
        public async Task <IDictionary <string, Rank> > GetRanksAsync(IEnumerable <string> profileIds, ERegion region, EPlatform platform, int season = -1)
        {
            var ranksRequest = new RanksRequest
            {
                UbiAppId   = _settings.UbiAppId,
                Ticket     = _ticket,
                SessionId  = _sessionId,
                BoardId    = "pvp_ranked",
                Profileids = profileIds,
                Platform   = platform,
                Region     = region,
                SeasonId   = season
            };

            var ranksResponse = await _apiManager.GetRanksResponseAsync(ranksRequest);

            return(ranksResponse.RankContracts.ToDictionary(r => r.Key, r => ApiMapper.GetMappedRank(r.Value)));
        }