Пример #1
0
        public static async Task <StatsResponse> GetStats(SiegeApiClient client, Platform platform, params Guid[] userIds)
        {
            var request = new RestRequest(UbiUrls.GetStatsUrl(platform, Stats.Data.Concat(Operators.Data.SelectMany(op => op.Gadgets)).ToArray(), userIds));

            request.AddHeader("Authorization", client.GetAuthorizationHeader());

            return(await client.RestClient.GetAsync <StatsResponse>(request));
        }
Пример #2
0
        public static async Task <ProfileResponse> FindProfilesAsync(SiegeApiClient client, Guid userId)
        {
            var request = new RestRequest(UbiUrls.GetReverseUrl(userId));

            request.AddHeader("Authorization", client.GetAuthorizationHeader());

            var response = await client.RestClient.ExecuteGetTaskAsync <ProfileResponse>(request);

            return(response.Data);
        }
Пример #3
0
        public static async Task <ProfileResponse> FindProfileAsync(SiegeApiClient client, string username, Platform platform)
        {
            var request = new RestRequest(UbiUrls.GetProfileUrl(platform, username));

            request.AddHeader("Authorization", client.GetAuthorizationHeader());

            var response = await client.RestClient.ExecuteGetTaskAsync <ProfileResponse>(request);

            return(response.Data);
        }
Пример #4
0
        public static async Task <RankResponse> GetRank(SiegeApiClient client, Platform platform, Region region, Season season, params Guid[] userIds)
        {
            var request = new RestRequest(UbiUrls.GetRankUrl(platform, region, season.Id, userIds));

            request.AddHeader("Authorization", client.GetAuthorizationHeader());

            var response = await client.RestClient.GetAsync <RankResponse>(request);

            return(response);
        }
Пример #5
0
        public static async Task <ProgressionResponse> GetProgression(SiegeApiClient apiClient, Platform platform, params Guid[] profileIds)
        {
            var request = new RestRequest(UbiUrls.GetLevelUrl(platform, profileIds));

            request.AddHeader("Authorization", apiClient.GetAuthorizationHeader());

            var response = await apiClient.RestClient.ExecuteGetTaskAsync <ProgressionResponse>(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new UnexpectedHttpStatusCodeException(response.StatusCode);
            }

            if (response.ErrorException != null)
            {
                throw response.ErrorException;
            }

            return(response.Data);
        }