Show / Hide Table of Contents

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
ClientServiceRequest<TResponse>
Implements
IClientServiceRequest<TResponse>
IClientServiceRequest
Inherited Members
ClientServiceRequest._unsuccessfulResponseHandlers
ClientServiceRequest._exceptionHandlers
ClientServiceRequest._executeInterceptors
ClientServiceRequest.Credential
ClientServiceRequest.AddUnsuccessfulResponseHandler(IHttpUnsuccessfulResponseHandler)
ClientServiceRequest.AddExceptionHandler(IHttpExceptionHandler)
ClientServiceRequest.AddExecuteInterceptor(IHttpExecuteInterceptor)
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()
Namespace: Google.Apis.Requests
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
Type Name Description
IClientService service

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
Type Description
ETagAction

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
Type Description
IClientService

ValidateParameters

Override for service-wide validation configuration in ValidateParameters. If this is null (the default) then the value from the service initializer is used to determine whether or not parameters should be validated client-side. If this is non-null, it overrides whatever value is specified in the service.

Declaration
public bool? ValidateParameters { get; set; }
Property Value
Type Description
System.Nullable<System.Boolean>

Methods

CreateRequest(Nullable<Boolean>)

Creates a HTTP request message with all path and query parameters, ETag, etc.

Declaration
public HttpRequestMessage CreateRequest(bool? overrideGZipEnabled = null)
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()

Executes the request and returns the result object.

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 async 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 async 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()

Executes the request asynchronously and returns the result object.

Declaration
public async Task<TResponse> ExecuteAsync()
Returns
Type Description
System.Threading.Tasks.Task<TResponse>

ExecuteAsync(CancellationToken)

Executes the request asynchronously and returns the result object.

Declaration
public async Task<TResponse> ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

A cancellation token to cancel operation.

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
Type Description
ETagAction

InitParameters()

Initializes request's parameters. Inherited classes MUST override this method to add parameters to the RequestParameters dictionary.

Declaration
protected virtual void InitParameters()

Implements

IClientServiceRequest<TResponse>
IClientServiceRequest

Extension Methods

ClientServiceRequestExtensions.Configure<TRequest>(TRequest, Action<TRequest>)
In This Article
Back to top