Class ClientServiceRequest<TResponse> (1.60.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

GoogleApisRequests

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
ActionHttpRequestMessage

RequestParameters

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

Gets the parameters information for this specific request.

Property Value
TypeDescription
IDictionarystringIParameter

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
bool

Methods

CreateRequest(bool?)

public HttpRequestMessage CreateRequest(bool? overrideGZipEnabled = null)

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

Parameter
NameDescription
overrideGZipEnabledbool

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
TaskStream

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
TaskStream

ExecuteAsync()

public Task<TResponse> ExecuteAsync()

Executes the request asynchronously and returns the result object.

Returns
TypeDescription
Task

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

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