예제 #1
0
        public SpeechClientImpl(Speech.SpeechClient grpcClient, SpeechSettings settings)
        {
            this.GrpcClient = grpcClient;
            SpeechSettings effectiveSettings = settings ?? SpeechSettings.GetDefault();

            _clientHelper = new ClientHelper(effectiveSettings);
            _callNonStreamingRecognize = _clientHelper.BuildApiCall <RecognizeRequest, NonStreamingRecognizeResponse>(
                GrpcClient.NonStreamingRecognizeAsync, GrpcClient.NonStreamingRecognize, effectiveSettings.NonStreamingRecognizeSettings);
        }
예제 #2
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();
            ClientHelper   clientHelper      = new ClientHelper(effectiveSettings);

            LongRunningRecognizeOperationsClient = new OperationsClientImpl(
                grpcClient.CreateOperationsClient(), effectiveSettings.LongRunningRecognizeOperationsSettings);
            _callRecognize = clientHelper.BuildApiCall <RecognizeRequest, RecognizeResponse>(
                GrpcClient.RecognizeAsync, GrpcClient.Recognize, effectiveSettings.RecognizeSettings);
            _callLongRunningRecognize = clientHelper.BuildApiCall <LongRunningRecognizeRequest, Operation>(
                GrpcClient.LongRunningRecognizeAsync, GrpcClient.LongRunningRecognize, effectiveSettings.LongRunningRecognizeSettings);
            _callStreamingRecognize = clientHelper.BuildApiCall <StreamingRecognizeRequest, StreamingRecognizeResponse>(
                GrpcClient.StreamingRecognize, effectiveSettings.StreamingRecognizeSettings, effectiveSettings.StreamingRecognizeStreamingSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }