Class ClientServiceRequest<TResponse>
Represents an abstract, strongly typed request base class to make requests to a service.
Supports a strongly typed response.
Inheritance
System.Object
ClientServiceRequest<TResponse>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Google.Apis.dll
Syntax
public abstract class ClientServiceRequest<TResponse> : ClientServiceRequest, IClientServiceRequest<TResponse>, IClientServiceRequest
Type Parameters
Name |
Description |
TResponse |
The type of the response object
|
Constructors
ClientServiceRequest(IClientService)
Creates a new service request.
Declaration
protected ClientServiceRequest(IClientService service)
Parameters
Properties
ETagAction
Defines whether the E-Tag will be used in a specified way or be ignored.
Declaration
public ETagAction ETagAction { get; set; }
Property Value
HttpMethod
Gets the HTTP method of this request.
Declaration
public abstract string HttpMethod { get; }
Property Value
Type |
Description |
System.String |
|
MethodName
Gets the name of the method to which this request belongs.
Declaration
public abstract string MethodName { get; }
Property Value
Type |
Description |
System.String |
|
ModifyRequest
Gets or sets the callback for modifying HTTP requests made by this service request.
Declaration
public Action<HttpRequestMessage> ModifyRequest { get; set; }
Property Value
Type |
Description |
System.Action<System.Net.Http.HttpRequestMessage> |
|
RequestParameters
Gets the parameters information for this specific request.
Declaration
public IDictionary<string, IParameter> RequestParameters { get; }
Property Value
Type |
Description |
System.Collections.Generic.IDictionary<System.String, IParameter> |
|
RestPath
Gets the rest path of this request.
Declaration
public abstract string RestPath { get; }
Property Value
Type |
Description |
System.String |
|
Service
Gets the service which is related to this request.
Declaration
public IClientService Service { get; }
Property Value
Methods
CreateRequest(Nullable<Boolean>)
Creates a HTTP request message with all path and query parameters, ETag, etc.
Declaration
public HttpRequestMessage CreateRequest(bool? overrideGZipEnabled = default(bool? ))
Parameters
Type |
Name |
Description |
System.Nullable<System.Boolean> |
overrideGZipEnabled |
If null use the service default GZip behavior. Otherwise indicates if GZip is enabled or disabled.
|
Returns
Type |
Description |
System.Net.Http.HttpRequestMessage |
|
Execute()
Declaration
public TResponse Execute()
Returns
Type |
Description |
TResponse |
|
ExecuteAsStream()
Executes the request and returns the result stream.
Declaration
public Stream ExecuteAsStream()
Returns
Type |
Description |
System.IO.Stream |
|
ExecuteAsStreamAsync()
Executes the request asynchronously and returns the result stream.
Declaration
public Task<Stream> ExecuteAsStreamAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.IO.Stream> |
|
ExecuteAsStreamAsync(CancellationToken)
Executes the request asynchronously and returns the result stream.
Declaration
public Task<Stream> ExecuteAsStreamAsync(CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
A cancellation token to cancel operation.
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.IO.Stream> |
|
ExecuteAsync()
Declaration
public Task<TResponse> ExecuteAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<TResponse> |
|
ExecuteAsync(CancellationToken)
Declaration
public Task<TResponse> ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<TResponse> |
|
GenerateRequestUri()
Generates the right URL for this request.
Declaration
protected string GenerateRequestUri()
Returns
Type |
Description |
System.String |
|
GetBody()
Returns the body of this request.
Declaration
protected virtual object GetBody()
Returns
Type |
Description |
System.Object |
The body of this request.
|
GetDefaultETagAction(String)
Returns the default ETagAction for a specific HTTP verb.
Declaration
public static ETagAction GetDefaultETagAction(string httpMethod)
Parameters
Type |
Name |
Description |
System.String |
httpMethod |
|
Returns
InitParameters()
Initializes request's parameters. Inherited classes MUST override this method to add parameters to the
RequestParameters dictionary.
Declaration
protected virtual void InitParameters()
Implements