# Class ClientServiceRequest&lt;TResponse&gt; (1.73.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.73.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest-1)
- [1.69.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.69.0/Google.Apis.Requests.ClientServiceRequest-1)
- [1.68.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Requests.ClientServiceRequest-1)
- [1.60.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Requests.ClientServiceRequest-1)
- [1.59.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Requests.ClientServiceRequest-1)
- [1.55.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Requests.ClientServiceRequest-1)
- [1.50.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Requests.ClientServiceRequest-1)

    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](https://learn.microsoft.com/dotnet/api/system.object) \> [ClientServiceRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest) \> ClientServiceRequest\<TResponse\>

## Implements

[IClientServiceRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.IClientServiceRequest-1), [IClientServiceRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.IClientServiceRequest)

## Inherited Members

[ClientServiceRequest._unsuccessfulResponseHandlers](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest#Google_Apis_Requests_ClientServiceRequest__unsuccessfulResponseHandlers) [ClientServiceRequest._exceptionHandlers](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest#Google_Apis_Requests_ClientServiceRequest__exceptionHandlers) [ClientServiceRequest._executeInterceptors](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest#Google_Apis_Requests_ClientServiceRequest__executeInterceptors) [ClientServiceRequest.Credential](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest#Google_Apis_Requests_ClientServiceRequest_Credential) [ClientServiceRequest.AddUnsuccessfulResponseHandler(IHttpUnsuccessfulResponseHandler)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest#Google_Apis_Requests_ClientServiceRequest_AddUnsuccessfulResponseHandler_Google_Apis_Http_IHttpUnsuccessfulResponseHandler_) [ClientServiceRequest.AddExceptionHandler(IHttpExceptionHandler)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest#Google_Apis_Requests_ClientServiceRequest_AddExceptionHandler_Google_Apis_Http_IHttpExceptionHandler_) [ClientServiceRequest.AddExecuteInterceptor(IHttpExecuteInterceptor)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest#Google_Apis_Requests_ClientServiceRequest_AddExecuteInterceptor_Google_Apis_Http_IHttpExecuteInterceptor_) [object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Apis.Requests](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/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` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.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** |
| `https://learn.microsoft.com/dotnet/api/system.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** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.ETagAction` |   |

### HttpMethod

    public abstract string HttpMethod { get; }

Gets the HTTP method of this request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### MethodName

    public abstract string MethodName { get; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** |
| `https://learn.microsoft.com/dotnet/api/system.action-1https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage` |   |

### RequestParameters

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

Gets the parameters information for this specific request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.idictionary-2https://learn.microsoft.com/dotnet/api/system.stringhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Discovery.IParameter` |   |

### RestPath

    public abstract string RestPath { get; }

Gets the rest path of this request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Service

    public IClientService Service { get; }

Gets the service which is related to this request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.IClientService` |   |

### ValidateParameters

    public bool? ValidateParameters { get; set; }

Override for service-wide validation configuration in [ValidateParameters](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.BaseClientService.Initializer#Google_Apis_Services_BaseClientService_Initializer_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** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

## 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` | `https://learn.microsoft.com/dotnet/api/system.boolean` If `null` use the service default GZip behavior. Otherwise indicates if GZip is enabled or disabled. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.net.http.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** |
| `https://learn.microsoft.com/dotnet/api/system.io.stream` |   |

### ExecuteAsStreamAsync()

    public Task<Stream> ExecuteAsStreamAsync()

Executes the request asynchronously and returns the result stream.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://learn.microsoft.com/dotnet/api/system.io.stream` |   |

### ExecuteAsStreamAsync(CancellationToken)

    public Task<Stream> ExecuteAsStreamAsync(CancellationToken cancellationToken)

Executes the request asynchronously and returns the result stream.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A cancellation token to cancel operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://learn.microsoft.com/dotnet/api/system.io.stream` |   |

### ExecuteAsync()

    public Task<TResponse> ExecuteAsync()

Executes the request asynchronously and returns the result object.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` |   |

### ExecuteAsync(CancellationToken)

    public Task<TResponse> ExecuteAsync(CancellationToken cancellationToken)

Executes the request asynchronously and returns the result object.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A cancellation token to cancel operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` |   |

### GenerateRequestUri()

    protected string GenerateRequestUri()

Generates the right URL for this request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### GetBody()

    protected virtual object GetBody()

Returns the body of this request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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` | `https://learn.microsoft.com/dotnet/api/system.string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.ETagAction` |   |

### InitParameters()

    protected virtual void InitParameters()

Initializes request's parameters. Inherited classes MUST override this method to add parameters to the
[RequestParameters](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequest-1#Google_Apis_Requests_ClientServiceRequest_1_RequestParameters) dictionary.

## Extension Methods

[ClientServiceRequestExtensions.Configure\<TRequest\>(TRequest, Action\<TRequest\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.ClientServiceRequestExtensions#Google_Apis_Requests_ClientServiceRequestExtensions_Configure__1___0_System_Action___0__) [Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)