Example #1
0
        public void VehicleEncyclopediaQueryTest()
        {
            string expectedQuery =
                $"encyclopedia/vehicles/?application_id={_configuration.ApplicationId}&language={_configuration.Language}&fields=tank_id,name,tier,nation,type,description,is_premium,cost,images";
            string request = _requestBuilder.BuildRequestUrl(RequestType.EncyclopediaVehicles,
                                                             new RequestParameter
            {
                ParameterType  = ParameterType.Fields,
                ParameterValue = "tank_id,name,tier,nation,type,description,is_premium,cost,images"
            });

            Assert.Equal(expectedQuery, request);
        }
        public IActionResult GetAuthenticationRequest([FromQuery] string redirectUrl)
        {
            string requestUrl = _requestBuilder.BuildRequestUrl(
                RequestType.Login,
                new RequestParameter {
                ParameterType = ParameterType.RedirectUri, ParameterValue = redirectUrl
            }
                );

            var authUrl = new Uri($"{_requestBuilder.WotBaseAddress}{requestUrl}");

            return(Ok(authUrl));
        }
        public async Task <List <VehicleEncyclopedia> > GetWotEncyclopediaVehiclesAsync()
        {
            var tankopedia = await _webApiClient.GetResponse <Dictionary <string, WotEncyclopediaVehiclesResponse> >(
                _requestBuilder.BaseAddress,
                _requestBuilder.BuildRequestUrl(RequestType.EncyclopediaVehicles,
                                                new RequestParameter
            {
                ParameterType  = ParameterType.Fields,
                ParameterValue = "tank_id,name,tier,nation,type,description,is_premium,cost,images,next_tanks"
            }));

            var allVehicles = tankopedia.Values.ToList();

            allVehicles.AddMarkI();
            allVehicles.AddHetzerKame();

            return(_mapper.Map <List <WotEncyclopediaVehiclesResponse>, List <VehicleEncyclopedia> >(allVehicles));
        }