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

Name Description
TResponse

The type of the response object

Constructors

ClientServiceRequest(IClientService)

protected ClientServiceRequest(IClientService service)

Creates a new service request.

Parameter
Name Description
service IClientService

Properties

ApiVersion

public virtual string ApiVersion { get; }

The precise API version represented by this request. Subclasses generated from a specific known version should override this property, which will result in an x-api-version header being sent on the HTTP request.

Property Value
Type Description
string

ETagAction

public ETagAction ETagAction { get; set; }

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

Property Value
Type Description
ETagAction

HttpMethod

public abstract string HttpMethod { get; }

Gets the HTTP method of this request.

Property Value
Type Description
string

MethodName

public abstract string MethodName { get; }

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

Property Value
Type Description
string

ModifyRequest

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

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

Property Value
Type Description
ActionHttpRequestMessage

RequestParameters

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

Gets the parameters information for this specific request.

Property Value
Type Description
IDictionarystringIParameter

RestPath

public abstract string RestPath { get; }

Gets the rest path of this request.

Property Value
Type Description
string

Service

public IClientService Service { get; }

Gets the service which is related to this request.

Property Value
Type Description
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
Type Description
bool

Methods

CreateRequest(bool?)

public HttpRequestMessage CreateRequest(bool? overrideGZipEnabled = null)

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

Parameter
Name Description
overrideGZipEnabled bool

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

Returns
Type Description
HttpRequestMessage

Execute()

public TResponse Execute()

Executes the request and returns the result object.

Returns
Type Description
TResponse

ExecuteAsStream()

public Stream ExecuteAsStream()

Executes the request and returns the result stream.

Returns
Type Description
Stream

ExecuteAsStreamAsync()

public Task<Stream> ExecuteAsStreamAsync()

Executes the request asynchronously and returns the result stream.

Returns
Type Description
TaskStream

ExecuteAsStreamAsync(CancellationToken)

public Task<Stream> ExecuteAsStreamAsync(CancellationToken cancellationToken)

Executes the request asynchronously and returns the result stream.

Parameter
Name Description
cancellationToken CancellationToken

A cancellation token to cancel operation.

Returns
Type Description
TaskStream

ExecuteAsync()

public Task<TResponse> ExecuteAsync()

Executes the request asynchronously and returns the result object.

Returns
Type Description
Task

ExecuteAsync(CancellationToken)

public Task<TResponse> ExecuteAsync(CancellationToken cancellationToken)

Executes the request asynchronously and returns the result object.

Parameter
Name Description
cancellationToken CancellationToken

A cancellation token to cancel operation.

Returns
Type Description
Task

GenerateRequestUri()

protected string GenerateRequestUri()

Generates the right URL for this request.

Returns
Type Description
string

GetBody()

protected virtual object GetBody()

Returns the body of this request.

Returns
Type Description
object

The body of this request.

GetDefaultETagAction(string)

public static ETagAction GetDefaultETagAction(string httpMethod)

Returns the default ETagAction for a specific HTTP verb.

Parameter
Name Description
httpMethod string
Returns
Type Description
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