public async Task <GeocodeResponse> GetReverseGeocodeAsync(
            ReverseGeocodeRequest request)
        {
            if (request is null)
            {
                return(null);
            }

            var response = await GetResponseAsync(request);

            return(JsonConvert.DeserializeObject <GeocodeResponse>(response));
        }
Beispiel #2
0
        /// <summary>
        /// Reverse geocode a coordinate.
        /// </summary>
        /// <param name="request">A GeocodeRequest instance.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>GeocodeResponse</returns>
        public async Task <GeocodeResponse> ReverseGeocodeAsync(
            ReverseGeocodeRequest request,
            CancellationToken cancellationToken = default)
        {
            if (request is null)
            {
                return(InvalidResponse <GeocodeResponse>());
            }

            if (cancellationToken.IsCancellationRequested)
            {
                return(CancelledResponse2 <GeocodeResponse>());
            }

            return(await RequestAsync <GeocodeResponse>(request, cancellationToken).ConfigureAwait(false));
        }