Base class for facade engine.
Beispiel #1
0
        /// <summary>
        /// Query the Google Maps API using the provided request and timeout period.
        /// </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 an AggregateException will be thrown with an InnerException of type TimeoutException.</param>
        /// <returns>The response that was received.</returns>
        /// <exception cref="ArgumentNullException">Thrown when a null value is passed to the request parameter.</exception>
        /// <exception cref="TaskCanceledException">Thrown when the provided Google client ID or signing key are invalid.</exception>
        public virtual TResponse Query(TRequest request, TimeSpan timeout)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            return(GenericEngine <TRequest, TResponse> .Query(request, timeout));
        }
Beispiel #2
0
        /// <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));
        }
Beispiel #3
0
        internal static TResponse Query(TRequest request, TimeSpan timeout)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            return(GenericEngine <TRequest, TResponse> .QueryAsync(request, timeout).Result);
        }
Beispiel #4
0
 /// <summary>
 /// Query the Google Maps API using the provided request and timeout period.
 /// </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 an AggregateException will be thrown with an InnerException of type TimeoutException.</param>
 /// <returns>The response that was received.</returns>
 /// <exception cref="ArgumentNullException">Thrown when a null value is passed to the request parameter.</exception>
 /// <exception cref="AuthenticationException">Thrown when the provided Google client ID or signing key are invalid.</exception>
 /// <exception cref="TimeoutException">Thrown when the operation has exceeded the allotted time.</exception>
 /// <exception cref="WebException">Thrown when an error occurred while downloading data.</exception>
 public TResponse Query(TRequest _request, TimeSpan _timeout)
 {
     return(GenericEngine <TRequest, TResponse> .QueryGoogleApi(_request, _timeout));
 }
Beispiel #5
0
 /// <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 Task <TResponse> QueryAsync(TRequest _request, TimeSpan _timeout, CancellationToken _token)
 {
     return(GenericEngine <TRequest, TResponse> .QueryGoogleApiAsync(_request, _timeout, _token));
 }
Beispiel #6
0
 /// <summary>
 /// Asynchronously query the Google Maps API using the provided request.
 /// </summary>
 /// <param name="_request">The request that will be sent.</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>
 public Task <TResponse> QueryAsync(TRequest _request, CancellationToken _token)
 {
     return(GenericEngine <TRequest, TResponse> .QueryGoogleApiAsync(_request, TimeSpan.FromMilliseconds(Timeout.Infinite), _token));
 }