Example #1
0
        //Methods

        //Private Methods
        private async Task <GoogleMapsGeoCodingApiResponse> RequestGoogleMapsGeoCodeApi(string rawAddressToGeocode)
        {
            var googleMapsGeoCodeRestionRequest = new RestionRequest()
                                                  .WithHttpMethod(HttpMethod.Get)
                                                  .AddParameter("address", rawAddressToGeocode)
                                                  .AddParameter("key", _apiKey);

            var googleMapsGeoCodeRestionResponse = await _restionClient.ExecuteRequestAsync <GoogleMapsGeoCodingApiResponse>(googleMapsGeoCodeRestionRequest);

            if (googleMapsGeoCodeRestionResponse.Exception != null)
            {
                throw googleMapsGeoCodeRestionResponse.Exception;
            }

            if (googleMapsGeoCodeRestionResponse.HttpStatusCode == HttpStatusCode.OK)
            {
                return(googleMapsGeoCodeRestionResponse.Content);
            }

            return(null);
        }