# Class ClientHelper (4.10.0)

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

- [4.10.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ClientHelper)
- [4.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.Grpc.ClientHelper)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.Grpc.ClientHelper)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.Grpc.ClientHelper)
- [4.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.Grpc.ClientHelper)
- [4.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.Grpc.ClientHelper)
- [3.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.Grpc.ClientHelper)

    public class ClientHelper

Common helper code shared by clients. This class is primarily expected to be used from generated code.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ClientHelper

## Inherited Members

[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.Api.Gax.Grpc](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc)

## Assembly

Google.Api.Gax.Grpc.dll

## Constructors

### ClientHelper(Options)

    public ClientHelper(ClientHelper.Options options)

Constructs a helper from the given options. See the properties in [ClientHelper.Options](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ClientHelper.Options)
for validity constraints.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ClientHelperhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ClientHelper.Options` The options for the helper. |

### ClientHelper(ServiceSettingsBase, ILogger)

    public ClientHelper(ServiceSettingsBase settings, ILogger logger)

Constructs a helper from the given settings.
Behavior is undefined if settings are changed after construction.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `settings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceSettingsBase` The service settings. |
| `logger` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger` The logger to use for API calls |

**Remarks** This constructor will be removed in the next major version of GAX.

## Properties

### Clock

    public IClock Clock { get; }

The clock used for timing of retries and deadlines. This is never
null; if the clock isn't specified in the settings, this property
will return the [SystemClock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.SystemClock) instance.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IClock` |   |

### Logger

    public ILogger Logger { get; }

The logger used by this instance, or null if it does not perform logging.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger` |   |

### Scheduler

    public IScheduler Scheduler { get; }

The scheduler used for delays of retries. This is never
null; if the scheduler isn't specified in the settings, this property
will return the [SystemScheduler](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.SystemScheduler) instance.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IScheduler` |   |

## Methods

### BuildApiCall\<TRequest, TResponse\>(string, Func\<CallOptions, AsyncClientStreamingCall\<TRequest, TResponse\>\>, CallSettings, ClientStreamingSettings)

    public ApiClientStreamingCall<TRequest, TResponse> BuildApiCall<TRequest, TResponse>(string methodName, Func<CallOptions, AsyncClientStreamingCall<TRequest, TResponse>> grpcCall, CallSettings perMethodCallSettings, ClientStreamingSettings streamingSettings) where TRequest : class, IMessage<TRequest> where TResponse : class, IMessage<TResponse>

Builds an [ApiClientStreamingCall](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiClientStreamingCall) given a suitable underlying client streaming call.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `methodName` | `https://learn.microsoft.com/dotnet/api/system.string` The underlying method name, for diagnostic purposes. |
| `grpcCall` | `https://learn.microsoft.com/dotnet/api/system.func-2https://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/CallOptions.cshttps://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/AsyncClientStreamingCall.cs` The underlying gRPC client streaming call. |
| `perMethodCallSettings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings` The default method call settings. |
| `streamingSettings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ClientStreamingSettings` The default streaming settings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiClientStreamingCall-2` | An API call to proxy to the RPC calls |

| **Type Parameters** ||
|---|---|
| **Name** | **Description** |
| `TRequest` | Request type, which must be a protobuf message. |
| `TResponse` | Response type, which must be a protobuf message. |

### BuildApiCall\<TRequest, TResponse\>(string, Func\<CallOptions, AsyncDuplexStreamingCall\<TRequest, TResponse\>\>, CallSettings, BidirectionalStreamingSettings)

    public ApiBidirectionalStreamingCall<TRequest, TResponse> BuildApiCall<TRequest, TResponse>(string methodName, Func<CallOptions, AsyncDuplexStreamingCall<TRequest, TResponse>> grpcCall, CallSettings perMethodCallSettings, BidirectionalStreamingSettings streamingSettings) where TRequest : class, IMessage<TRequest> where TResponse : class, IMessage<TResponse>

Builds an [ApiBidirectionalStreamingCall](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiBidirectionalStreamingCall) given a suitable underlying duplex call.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `methodName` | `https://learn.microsoft.com/dotnet/api/system.string` The underlying method name, for diagnostic purposes. |
| `grpcCall` | `https://learn.microsoft.com/dotnet/api/system.func-2https://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/CallOptions.cshttps://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/AsyncDuplexStreamingCall.cs` The underlying gRPC duplex streaming call. |
| `perMethodCallSettings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings` The default method call settings. |
| `streamingSettings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.BidirectionalStreamingSettings` The default streaming settings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiBidirectionalStreamingCall-2` | An API call to proxy to the RPC calls |

| **Type Parameters** ||
|---|---|
| **Name** | **Description** |
| `TRequest` | Request type, which must be a protobuf message. |
| `TResponse` | Response type, which must be a protobuf message. |

### BuildApiCall\<TRequest, TResponse\>(string, Func\<TRequest, CallOptions, AsyncServerStreamingCall\<TResponse\>\>, CallSettings)

    public ApiServerStreamingCall<TRequest, TResponse> BuildApiCall<TRequest, TResponse>(string methodName, Func<TRequest, CallOptions, AsyncServerStreamingCall<TResponse>> grpcCall, CallSettings perMethodCallSettings) where TRequest : class, IMessage<TRequest> where TResponse : class, IMessage<TResponse>

Builds an [ApiServerStreamingCall](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiServerStreamingCall) given a suitable underlying server streaming call.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `methodName` | `https://learn.microsoft.com/dotnet/api/system.string` The underlying method name, for diagnostic purposes. |
| `grpcCall` | `https://learn.microsoft.com/dotnet/api/system.func-3https://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/CallOptions.cshttps://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/AsyncServerStreamingCall.cs` The underlying gRPC server streaming call. |
| `perMethodCallSettings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings` The default method call settings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiServerStreamingCall-2` | An API call to proxy to the RPC calls |

| **Type Parameters** ||
|---|---|
| **Name** | **Description** |
| `TRequest` | Request type, which must be a protobuf message. |
| `TResponse` | Response type, which must be a protobuf message. |

### BuildApiCall\<TRequest, TResponse\>(string, Func\<TRequest, CallOptions, AsyncUnaryCall\<TResponse\>\>, Func\<TRequest, CallOptions, TResponse\>, CallSettings)

    public ApiCall<TRequest, TResponse> BuildApiCall<TRequest, TResponse>(string methodName, Func<TRequest, CallOptions, AsyncUnaryCall<TResponse>> asyncGrpcCall, Func<TRequest, CallOptions, TResponse> syncGrpcCall, CallSettings perMethodCallSettings) where TRequest : class, IMessage<TRequest> where TResponse : class, IMessage<TResponse>

Builds an [ApiCall](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiCall) given suitable underlying async and sync calls.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `methodName` | `https://learn.microsoft.com/dotnet/api/system.string` The underlying method name, for diagnostic purposes. |
| `asyncGrpcCall` | `https://learn.microsoft.com/dotnet/api/system.func-3https://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/CallOptions.cshttps://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/AsyncUnaryCall.cs` The underlying synchronous gRPC call. |
| `syncGrpcCall` | `https://learn.microsoft.com/dotnet/api/system.func-3https://github.com/grpc/grpc-dotnet/blob/7c43ddb5d68008782dc0dba2d0feaa3ed91a9fb2/src/Grpc.Core.Api/CallOptions.cs` The underlying asynchronous gRPC call. |
| `perMethodCallSettings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings` The default method call settings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ApiCall-2` | An API call to proxy to the RPC calls |

| **Type Parameters** ||
|---|---|
| **Name** | **Description** |
| `TRequest` | Request type, which must be a protobuf message. |
| `TResponse` | Response type, which must be a protobuf message. |