Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a client wrapper for the Speech service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="SpeechSettings"/> used within this client.</param>
        public SpeechClientImpl(Speech.SpeechClient grpcClient, SpeechSettings settings)
        {
            GrpcClient = grpcClient;
            SpeechSettings        effectiveSettings = settings ?? SpeechSettings.GetDefault();
            gaxgrpc::ClientHelper clientHelper      = new gaxgrpc::ClientHelper(effectiveSettings);

            LongRunningRecognizeOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.LongRunningRecognizeOperationsSettings);
            _callRecognize = clientHelper.BuildApiCall <RecognizeRequest, RecognizeResponse>(grpcClient.RecognizeAsync, grpcClient.Recognize, effectiveSettings.RecognizeSettings);
            Modify_ApiCall(ref _callRecognize);
            Modify_RecognizeApiCall(ref _callRecognize);
            _callLongRunningRecognize = clientHelper.BuildApiCall <LongRunningRecognizeRequest, lro::Operation>(grpcClient.LongRunningRecognizeAsync, grpcClient.LongRunningRecognize, effectiveSettings.LongRunningRecognizeSettings);
            Modify_ApiCall(ref _callLongRunningRecognize);
            Modify_LongRunningRecognizeApiCall(ref _callLongRunningRecognize);
            _callStreamingRecognize = clientHelper.BuildApiCall <StreamingRecognizeRequest, StreamingRecognizeResponse>(grpcClient.StreamingRecognize, effectiveSettings.StreamingRecognizeSettings, effectiveSettings.StreamingRecognizeStreamingSettings);
            Modify_ApiCall(ref _callStreamingRecognize);
            Modify_StreamingRecognizeApiCall(ref _callStreamingRecognize);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
Ejemplo n.º 2
0
 partial void OnConstruction(Speech.SpeechClient grpcClient, SpeechSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a <see cref="SpeechClient"/> which uses the specified call invoker for remote operations.
 /// </summary>
 /// <param name="callInvoker">The <see cref="grpccore::CallInvoker"/> for remote operations. Must not be null.</param>
 /// <param name="settings">Optional <see cref="SpeechSettings"/>.</param>
 /// <returns>The created <see cref="SpeechClient"/>.</returns>
 public static SpeechClient Create(grpccore::CallInvoker callInvoker, SpeechSettings settings = null)
 {
     gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
     Speech.SpeechClient grpcClient = new Speech.SpeechClient(callInvoker);
     return(new SpeechClientImpl(grpcClient, settings));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a <see cref="SpeechClient"/> which uses the specified channel for remote operations.
 /// </summary>
 /// <param name="channel">The <see cref="grpccore::Channel"/> for remote operations. Must not be null.</param>
 /// <param name="settings">Optional <see cref="SpeechSettings"/>.</param>
 /// <returns>The created <see cref="SpeechClient"/>.</returns>
 public static SpeechClient Create(grpccore::Channel channel, SpeechSettings settings = null)
 {
     gax::GaxPreconditions.CheckNotNull(channel, nameof(channel));
     Speech.SpeechClient grpcClient = new Speech.SpeechClient(channel);
     return(new SpeechClientImpl(grpcClient, settings));
 }