/* Copyright 2011 Google Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Google.Apis.Discovery; using Google.Apis.Services; namespace Google.Apis.Requests { /// A client service request which supports both sync and async execution to get the stream. public interface IClientServiceRequest { /// Gets the name of the method to which this request belongs. string MethodName { get; } /// Gets the rest path of this request. string RestPath { get; } /// Gets the HTTP method of this request. string HttpMethod { get; } /// Gets the parameters information for this specific request. IDictionary RequestParameters { get; } /// Gets the service which is related to this request. IClientService Service { get; } /// Creates a HTTP request message with all path and query parameters, ETag, etc. /// /// If null use the service default GZip behavior. Otherwise indicates if GZip is enabled or disabled. /// HttpRequestMessage CreateRequest(Nullable overrideGZipEnabled = null); /// Executes the request asynchronously and returns the result stream. Task ExecuteAsStreamAsync(); /// Executes the request asynchronously and returns the result stream. /// A cancellation token to cancel operation. Task ExecuteAsStreamAsync(CancellationToken cancellationToken); /// Executes the request and returns the result stream. Stream ExecuteAsStream(); } /// /// A client service request which inherits from and represents a specific /// service request with the given response type. It supports both sync and async execution to get the response. /// public interface IClientServiceRequest : IClientServiceRequest { /// Executes the request asynchronously and returns the result object. Task ExecuteAsync(); /// Executes the request asynchronously and returns the result object. /// A cancellation token to cancel operation. Task ExecuteAsync(CancellationToken cancellationToken); /// Executes the request and returns the result object. TResponse Execute(); } }