/// <summary> /// Asynchronously query the Google Maps API using the provided request. /// </summary> /// <param name="request">The request that will be sent.</param> /// <param name="timeout">A TimeSpan specifying the amount of time to wait for a response before aborting the request. /// The specify an infinite timeout, pass a TimeSpan with a TotalMillisecond value of Timeout.Infinite. /// When a request is aborted due to a timeout the returned task will transition to the Faulted state with a TimeoutException.</param> /// <param name="token">A cancellation token that can be used to cancel the pending asynchronous task.</param> /// <returns>A Task with the future value of the response.</returns> /// <exception cref="ArgumentNullException">Thrown when a null value is passed to the request parameter.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown when the value of timeout is neither a positive value or infinite.</exception> public virtual Task <TResponse> QueryAsync(TRequest request, TimeSpan timeout, CancellationToken token) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return(GenericEngine <TRequest, TResponse> .QueryAsync(request, timeout, token)); }
internal static TResponse Query(TRequest request, TimeSpan timeout) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return(GenericEngine <TRequest, TResponse> .QueryAsync(request, timeout).Result); }