예제 #1
0
        public static Uri GetTransitoEstacionamientosUri(UserSessionData userSessionData, MiUbicacionParameters miUbicacion)
        {
            if (!Uri.TryCreate(BaseInstagramUri, GobiernoApiConstants.TRANSITOESTACIONAMIENTO_URL, out var instaUri))
            {
                throw new Exception("Cant create URI for set account private");
            }

            instaUri = instaUri.AddQuery("client_id", userSessionData.ClientId)
                       .AddQuery("client_secret", userSessionData.ClientSecret)
                       .AddQuery("x", miUbicacion.X)
                       .AddQuery("y", miUbicacion.Y)
                       .AddQuery("radio", miUbicacion.Radio.ToString())
                       .AddQuery("orden", miUbicacion.Orden)
                       .AddQuery("fullInfo", miUbicacion.FullInfo.ToString())
            ;


            var prueba = instaUri;

            return(instaUri);
        }
        public async Task <EstacionamientoCercaListResponse> GetTransitoEstacionamientosAsync(MiUbicacionParameters miUbicacion)
        {
            try
            {
                var transitoEstacionamientosUri = UriCreator.GetTransitoEstacionamientosUri(_user, miUbicacion);


                var request  = _httpHelper.GetDefaultRequest(HttpMethod.Get, transitoEstacionamientosUri);
                var response = await _httpRequestProcessor.SendAsync(request);

                var json = await response.Content.ReadAsStringAsync();

                //if (response.StatusCode != HttpStatusCode.OK)
                //    return Result.UnExpectedResponse<GobiernoCommentList>(response, json);


                var EstacionamientosResponse = JsonConvert.DeserializeObject <EstacionamientoCercaListResponse>(json);

                Expression <Func <int, int, int> > asd = (a, b) => a * b;


                //var converter = ConvertersFabric.Gobiernonce.GetCommentListConverter(commentListResponse);
                //return Result.Success(converter.Convert());

                return(EstacionamientosResponse);
            }
            catch (HttpRequestException httpException)
            {
                throw httpException;
                //    _logger?.LogException(httpException);
                //    return Result.Fail(httpException, default(GobiernoCommentList), ResponseType.NetworkProblem);
                //}
                //catch (Exception exception)
                //{
                //    _logger?.LogException(exception);
                //    return Result.Fail<GobiernoCommentList>(exception);
            }
        }