public sealed class ApiCall<TRequest, TResponse> where TRequest : class, IMessage<TRequest> where TResponse : class, IMessage<TResponse>
Bridge between an RPC method (with synchronous and asynchronous variants) and higher level abstractions, applying call settings as required.
Namespace
Google.Api.Gax.GrpcAssembly
Google.Api.Gax.Grpc.dll
Type Parameters
TRequest
RPC request type
TResponse
RPC response type
Properties
BaseCallSettings
public CallSettings BaseCallSettings { get; }
The base CallSettings
for this API call; these can be further overridden by providing
a CallSettings
to Async(TRequest, CallSettings)
or Sync(TRequest, CallSettings)
.
Methods
Async(TRequest, CallSettings)
public Task<TResponse> Async(TRequest request, CallSettings perCallCallSettings)
Performs an RPC call asynchronously.
request
TRequest
The RPC request.
perCallCallSettings
A task representing the asynchronous operation. The result of the completed task will be the RPC response.
Sync(TRequest, CallSettings)
public TResponse Sync(TRequest request, CallSettings perCallCallSettings)
Performs an RPC call synchronously.
request
TRequest
The RPC request.
perCallCallSettings
TResponse
The RPC response.
WithCallSettingsOverlay(Func<TRequest, CallSettings>)
public ApiCall<TRequest, TResponse> WithCallSettingsOverlay(Func<TRequest, CallSettings> callSettingsOverlayFn)
Constructs a new ApiCall<TRequest, TResponse> that applies an overlay to the underlying CallSettings . If a value exists in both the original and the overlay, the overlay takes priority.
callSettingsOverlayFn
WithExtractedGoogleRequestParam(RoutingHeaderExtractor<TRequest>)
public ApiCall<TRequest, TResponse> WithExtractedGoogleRequestParam(RoutingHeaderExtractor<TRequest> extractor)
Constructs a new ApiCall<TRequest, TResponse> that applies an x-goog-request-params header to each request, using the RoutingHeaderExtractor<TRequest> .
extractor
RoutingHeaderExtractor
The RoutingHeaderExtractor<TRequest> that extracts the value of the routing header from a request.
A new ApiCall<TRequest, TResponse> which applies the header on each request.
Values produced by the function are URL-encoded.
WithGoogleRequestParam(string, Func<TRequest, string>)
public ApiCall<TRequest, TResponse> WithGoogleRequestParam(string parameterName, Func<TRequest, string> valueSelector)
Constructs a new ApiCall<TRequest, TResponse> that applies an x-goog-request-params header to each request, using the specified parameter name and a value derived from the request.
A new ApiCall<TRequest, TResponse> which applies the header on each request.
Values produced by the function are URL-encoded; it is expected that parameterName
is already URL-encoded.