Esempio n. 1
0
 /// <summary>
 /// Creates a <see cref="TextToSpeechClient"/> 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="TextToSpeechSettings"/>.</param>
 /// <returns>The created <see cref="TextToSpeechClient"/>.</returns>
 public static TextToSpeechClient Create(grpccore::CallInvoker callInvoker, TextToSpeechSettings settings = null)
 {
     gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
     grpccore::Interceptors.Interceptor interceptor = settings?.Interceptor;
     if (interceptor != null)
     {
         callInvoker = grpccore::Interceptors.CallInvokerExtensions.Intercept(callInvoker, interceptor);
     }
     TextToSpeech.TextToSpeechClient grpcClient = new TextToSpeech.TextToSpeechClient(callInvoker);
     return(new TextToSpeechClientImpl(grpcClient, settings));
 }
Esempio n. 2
0
        /// <summary>
        /// Constructs a client wrapper for the TextToSpeech service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="TextToSpeechSettings"/> used within this client.</param>
        public TextToSpeechClientImpl(TextToSpeech.TextToSpeechClient grpcClient, TextToSpeechSettings settings)
        {
            GrpcClient = grpcClient;
            TextToSpeechSettings  effectiveSettings = settings ?? TextToSpeechSettings.GetDefault();
            gaxgrpc::ClientHelper clientHelper      = new gaxgrpc::ClientHelper(effectiveSettings);

            _callListVoices = clientHelper.BuildApiCall <ListVoicesRequest, ListVoicesResponse>(grpcClient.ListVoicesAsync, grpcClient.ListVoices, effectiveSettings.ListVoicesSettings);
            Modify_ApiCall(ref _callListVoices);
            Modify_ListVoicesApiCall(ref _callListVoices);
            _callSynthesizeSpeech = clientHelper.BuildApiCall <SynthesizeSpeechRequest, SynthesizeSpeechResponse>(grpcClient.SynthesizeSpeechAsync, grpcClient.SynthesizeSpeech, effectiveSettings.SynthesizeSpeechSettings);
            Modify_ApiCall(ref _callSynthesizeSpeech);
            Modify_SynthesizeSpeechApiCall(ref _callSynthesizeSpeech);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
 partial void OnConstruction(TextToSpeech.TextToSpeechClient grpcClient, TextToSpeechSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);
 /// <summary>
 /// Creates a <see cref="TextToSpeechClient"/> 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="TextToSpeechSettings"/>.</param>
 /// <returns>The created <see cref="TextToSpeechClient"/>.</returns>
 public static TextToSpeechClient Create(grpccore::Channel channel, TextToSpeechSettings settings = null)
 {
     gax::GaxPreconditions.CheckNotNull(channel, nameof(channel));
     TextToSpeech.TextToSpeechClient grpcClient = new TextToSpeech.TextToSpeechClient(channel);
     return(new TextToSpeechClientImpl(grpcClient, settings));
 }