Class ClientServiceRequest<TResponse> (1.50.0)

public abstract class ClientServiceRequest<TResponse> : ClientServiceRequest, IClientServiceRequest<TResponse>, IClientServiceRequest

Represents an abstract, strongly typed request base class to make requests to a service. Supports a strongly typed response.

Inheritance

Object > ClientServiceRequest > ClientServiceRequest<TResponse>

Namespace

Google.Apis.Requests

Assembly

Google.Apis.dll

Type Parameter

NameDescription
TResponse

The type of the response object

Constructors

ClientServiceRequest(IClientService)

protected ClientServiceRequest(IClientService service)

Creates a new service request.

Parameter
NameDescription
serviceIClientService

Properties

ETagAction

public ETagAction ETagAction { get; set; }

Defines whether the E-Tag will be used in a specified way or be ignored.

Property Value
TypeDescription
ETagAction

HttpMethod

public abstract string HttpMethod { get; }

Gets the HTTP method of this request.

Property Value
TypeDescription
String

MethodName

public abstract string MethodName { get; }

Gets the name of the method to which this request belongs.

Property Value
TypeDescription
String

ModifyRequest

public Action<HttpRequestMessage> ModifyRequest { get; set; }

Gets or sets the callback for modifying HTTP requests made by this service request.

Property Value
TypeDescription
Action<HttpRequestMessage>

RequestParameters

public IDictionary<string, IParameter> RequestParameters { get; }

Gets the parameters information for this specific request.

Property Value
TypeDescription
IDictionary<String, IParameter>

RestPath

public abstract string RestPath { get; }

Gets the rest path of this request.

Property Value
TypeDescription
String

Service

public IClientService Service { get; }

Gets the service which is related to this request.

Property Value
TypeDescription
IClientService

ValidateParameters

public bool? ValidateParameters { get; set; }

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.

Property Value
TypeDescription
Nullable<Boolean>

Methods

CreateRequest(Nullable<Boolean>)

public HttpRequestMessage CreateRequest(Nullable<bool> overrideGZipEnabled = null)

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

Parameter
NameDescription
overrideGZipEnabledNullable<Boolean>

If null use the service default GZip behavior. Otherwise indicates if GZip is enabled or disabled.

Returns
TypeDescription
HttpRequestMessage

Execute()

public TResponse Execute()

Executes the request and returns the result object.

Returns
TypeDescription
TResponse

ExecuteAsStream()

public Stream ExecuteAsStream()

Executes the request and returns the result stream.

Returns
TypeDescription
Stream

ExecuteAsStreamAsync()

public Task<Stream> ExecuteAsStreamAsync()

Executes the request asynchronously and returns the result stream.

Returns
TypeDescription
Task<Stream>

ExecuteAsStreamAsync(CancellationToken)

public Task<Stream> ExecuteAsStreamAsync(CancellationToken cancellationToken)

Executes the request asynchronously and returns the result stream.

Parameter
NameDescription
cancellationTokenCancellationToken

A cancellation token to cancel operation.

Returns
TypeDescription
Task<Stream>

ExecuteAsync()

public Task<TResponse> ExecuteAsync()

Executes the request asynchronously and returns the result object.

Returns
TypeDescription
Task<TResponse>

ExecuteAsync(CancellationToken)

public Task<TResponse> ExecuteAsync(CancellationToken cancellationToken)

Executes the request asynchronously and returns the result object.

Parameter
NameDescription
cancellationTokenCancellationToken

A cancellation token to cancel operation.

Returns
TypeDescription
Task<TResponse>

GenerateRequestUri()

protected string GenerateRequestUri()

Generates the right URL for this request.

Returns
TypeDescription
String

GetBody()

protected virtual object GetBody()

Returns the body of this request.

Returns
TypeDescription
Object

The body of this request.

GetDefaultETagAction(String)

public static ETagAction GetDefaultETagAction(string httpMethod)

Returns the default ETagAction for a specific HTTP verb.

Parameter
NameDescription
httpMethodString
Returns
TypeDescription
ETagAction

InitParameters()

protected virtual void InitParameters()

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

Extension Methods