Пример #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);
        }
Пример #2
0
 partial void OnConstruction(Speech.SpeechClient grpcClient, SpeechSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);
 /// <summary>
 /// Creates a <see cref="SpeechClient"/> which uses the specified channel for remote operations.
 /// </summary>
 /// <param name="channel">The <see cref="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(Channel channel, SpeechSettings settings = null)
 {
     GaxPreconditions.CheckNotNull(channel, nameof(channel));
     Speech.SpeechClient grpcClient = new Speech.SpeechClient(channel);
     return(new SpeechClientImpl(grpcClient, settings));
 }
Пример #4
0
 /// <summary>
 /// Wrap a GRPC Speech client for more convenient use.
 /// </summary>
 /// <param name="grpcClient">A GRPC client to wrap.</param>
 /// <param name="settings">
 /// An optional <see cref="SpeechSettings"/> to configure this wrapper.
 /// If null or not specified, then the default settings are used.
 /// </param>
 /// <returns>A <see cref="SpeechClient"/> that wraps the specified GRPC client.</returns>
 public static SpeechClient ToClient(
     this Speech.SpeechClient grpcClient,
     SpeechSettings settings = null
     ) => new SpeechClientImpl(grpcClient, settings);
Пример #5
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));
 }