コード例 #1
0
ファイル: StatsRequests.cs プロジェクト: Skippeh/SiegeApi
        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
ファイル: ProfileRequests.cs プロジェクト: Skippeh/SiegeApi
        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
ファイル: ProfileRequests.cs プロジェクト: Skippeh/SiegeApi
        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);
        }