Exemple #1
0
 internal static ApiClientStreamingCall <TRequest, TResponse> Create <TRequest, TResponse>(
     string methodName,
     Func <CallOptions, AsyncClientStreamingCall <TRequest, TResponse> > grpcCall,
     CallSettings baseCallSettings,
     ClientStreamingSettings streamingSettings,
     IClock clock) =>
 new ApiClientStreamingCall <TRequest, TResponse>(
     methodName,
     cs => grpcCall(cs.ValidateNoRetry().ToCallOptions(clock)),
     baseCallSettings,
     streamingSettings);
        /// <summary>
        /// Builds an <see cref="ApiClientStreamingCall"/> given a suitable underlying client streaming call.
        /// </summary>
        /// <typeparam name="TRequest">Request type, which must be a protobuf message.</typeparam>
        /// <typeparam name="TResponse">Response type, which must be a protobuf message.</typeparam>
        /// <param name="methodName">The underlying method name, for diagnostic purposes.</param>
        /// <param name="grpcCall">The underlying gRPC client streaming call.</param>
        /// <param name="perMethodCallSettings">The default method call settings.</param>
        /// <param name="streamingSettings">The default streaming settings.</param>
        /// <returns>An API call to proxy to the RPC calls</returns>
        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>
        {
            CallSettings baseCallSettings = _clientCallSettings.MergedWith(perMethodCallSettings);

            return(ApiClientStreamingCall.Create(methodName, grpcCall, baseCallSettings, streamingSettings, Clock)
                   .WithLogging(_logger)
                   .WithMergedBaseCallSettings(_versionCallSettings));
        }