Class ClientHelper (4.2.0)

public class ClientHelper

Common helper code shared by clients.

Inheritance

Object > ClientHelper

Namespace

Google.Api.Gax.Grpc

Assembly

Google.Api.Gax.Grpc.dll

Constructors

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
NameDescription
settingsServiceSettingsBase

The service settings.

loggerILogger

The logger to use for API calls

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 instance.

Property Value
TypeDescription
IClock

Logger

public ILogger Logger { get; }

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

Property Value
TypeDescription
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 instance.

Property Value
TypeDescription
IScheduler

Methods

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 Google.Api.Gax.Grpc.ApiServerStreamingCall given a suitable underlying server streaming call.

Parameters
NameDescription
methodNameString

The underlying method name, for diagnostic purposes.

grpcCallFunc<TRequest, CallOptions, AsyncServerStreamingCall<TResponse>>

The underlying gRPC server streaming call.

perMethodCallSettingsCallSettings

The default method call settings.

Returns
TypeDescription
ApiServerStreamingCall<TRequest, TResponse>

An API call to proxy to the RPC calls

Type Parameters
NameDescription
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 Google.Api.Gax.Grpc.ApiCall given suitable underlying async and sync calls.

Parameters
NameDescription
methodNameString

The underlying method name, for diagnostic purposes.

asyncGrpcCallFunc<TRequest, CallOptions, AsyncUnaryCall<TResponse>>

The underlying synchronous gRPC call.

syncGrpcCallFunc<TRequest, CallOptions, TResponse>

The underlying asynchronous gRPC call.

perMethodCallSettingsCallSettings

The default method call settings.

Returns
TypeDescription
ApiCall<TRequest, TResponse>

An API call to proxy to the RPC calls

Type Parameters
NameDescription
TRequest

Request type, which must be a protobuf message.

TResponse

Response type, which must be a protobuf message.

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 Google.Api.Gax.Grpc.ApiClientStreamingCall given a suitable underlying client streaming call.

Parameters
NameDescription
methodNameString

The underlying method name, for diagnostic purposes.

grpcCallFunc<CallOptions, AsyncClientStreamingCall<TRequest, TResponse>>

The underlying gRPC client streaming call.

perMethodCallSettingsCallSettings

The default method call settings.

streamingSettingsClientStreamingSettings

The default streaming settings.

Returns
TypeDescription
ApiClientStreamingCall<TRequest, TResponse>

An API call to proxy to the RPC calls

Type Parameters
NameDescription
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 Google.Api.Gax.Grpc.ApiBidirectionalStreamingCall given a suitable underlying duplex call.

Parameters
NameDescription
methodNameString

The underlying method name, for diagnostic purposes.

grpcCallFunc<CallOptions, AsyncDuplexStreamingCall<TRequest, TResponse>>

The underlying gRPC duplex streaming call.

perMethodCallSettingsCallSettings

The default method call settings.

streamingSettingsBidirectionalStreamingSettings

The default streaming settings.

Returns
TypeDescription
ApiBidirectionalStreamingCall<TRequest, TResponse>

An API call to proxy to the RPC calls

Type Parameters
NameDescription
TRequest

Request type, which must be a protobuf message.

TResponse

Response type, which must be a protobuf message.