Exemple #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)
        {
            this.GrpcClient = grpcClient;
            SpeechSettings effectiveSettings = settings ?? SpeechSettings.GetDefault();

            _clientHelper      = new ClientHelper(effectiveSettings);
            _callSyncRecognize = _clientHelper.BuildApiCall <SyncRecognizeRequest, SyncRecognizeResponse>(
                GrpcClient.SyncRecognizeAsync, GrpcClient.SyncRecognize, effectiveSettings.SyncRecognizeSettings);
            _callAsyncRecognize = _clientHelper.BuildApiCall <AsyncRecognizeRequest, Operation>(
                GrpcClient.AsyncRecognizeAsync, GrpcClient.AsyncRecognize, effectiveSettings.AsyncRecognizeSettings);
        }
        /// <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)
        {
            this.GrpcClient = grpcClient;
            SpeechSettings effectiveSettings = settings ?? SpeechSettings.GetDefault();

            LongRunningOperationsClient = new OperationsClientImpl(
                grpcClient.CreateOperationsClient(), effectiveSettings.LongRunningOperationsSettings);
            ClientHelper clientHelper = new ClientHelper(effectiveSettings);

            _callSyncRecognize = clientHelper.BuildApiCall <SyncRecognizeRequest, SyncRecognizeResponse>(
                GrpcClient.SyncRecognizeAsync, GrpcClient.SyncRecognize, effectiveSettings.SyncRecognizeSettings);
            _callAsyncRecognize = clientHelper.BuildApiCall <AsyncRecognizeRequest, Operation>(
                GrpcClient.AsyncRecognizeAsync, GrpcClient.AsyncRecognize, effectiveSettings.AsyncRecognizeSettings);
            _callStreamingRecognize = clientHelper.BuildApiCall <StreamingRecognizeRequest, StreamingRecognizeResponse>(
                GrpcClient.StreamingRecognize, effectiveSettings.StreamingRecognizeSettings, effectiveSettings.StreamingRecognizeStreamingSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }