/// <summary> /// Returns a list of [Voice][google.cloud.texttospeech.v1.Voice] /// supported for synthesis. /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// A Task containing the RPC response. /// </returns> public override stt::Task <ListVoicesResponse> ListVoicesAsync( ListVoicesRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_ListVoicesRequest(ref request, ref callSettings); return(_callListVoices.Async(request, callSettings)); }
/// <summary> /// Returns a list of [Voice][google.cloud.texttospeech.v1.Voice] /// supported for synthesis. /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public override ListVoicesResponse ListVoices( ListVoicesRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_ListVoicesRequest(ref request, ref callSettings); return(_callListVoices.Sync(request, callSettings)); }
/// <summary>Snippet for ListVoices</summary> public void ListVoices_RequestObject() { // Snippet: ListVoices(ListVoicesRequest,CallSettings) // Create client TextToSpeechClient textToSpeechClient = TextToSpeechClient.Create(); // Initialize request argument(s) ListVoicesRequest request = new ListVoicesRequest(); // Make the request ListVoicesResponse response = textToSpeechClient.ListVoices(request); // End snippet }
public async Task ListVoicesAsync2() { Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new Mock <TextToSpeech.TextToSpeechClient>(MockBehavior.Strict); ListVoicesRequest request = new ListVoicesRequest(); ListVoicesResponse expectedResponse = new ListVoicesResponse(); mockGrpcClient.Setup(x => x.ListVoicesAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ListVoicesResponse>(Task.FromResult(expectedResponse), null, null, null, null)); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); ListVoicesResponse response = await client.ListVoicesAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ListVoices2() { Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new Mock <TextToSpeech.TextToSpeechClient>(MockBehavior.Strict); ListVoicesRequest request = new ListVoicesRequest(); ListVoicesResponse expectedResponse = new ListVoicesResponse(); mockGrpcClient.Setup(x => x.ListVoices(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); ListVoicesResponse response = client.ListVoices(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for ListVoicesAsync</summary> public async Task ListVoicesAsync_RequestObject() { // Snippet: ListVoicesAsync(ListVoicesRequest,CallSettings) // Additional: ListVoicesAsync(ListVoicesRequest,CancellationToken) // Create client TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync(); // Initialize request argument(s) ListVoicesRequest request = new ListVoicesRequest(); // Make the request ListVoicesResponse response = await textToSpeechClient.ListVoicesAsync(request); // End snippet }
public void ListVoices() { Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new Mock <TextToSpeech.TextToSpeechClient>(MockBehavior.Strict); ListVoicesRequest expectedRequest = new ListVoicesRequest { LanguageCode = "languageCode-412800396", }; ListVoicesResponse expectedResponse = new ListVoicesResponse(); mockGrpcClient.Setup(x => x.ListVoices(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); string languageCode = "languageCode-412800396"; ListVoicesResponse response = client.ListVoices(languageCode); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ListVoices() { moq::Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new moq::Mock <TextToSpeech.TextToSpeechClient>(moq::MockBehavior.Strict); ListVoicesRequest request = new ListVoicesRequest { LanguageCode = "language_code2f6c7160", }; ListVoicesResponse expectedResponse = new ListVoicesResponse { Voices = { new Voice(), }, }; mockGrpcClient.Setup(x => x.ListVoices(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); ListVoicesResponse response = client.ListVoices(request.LanguageCode); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task ListVoicesAsync() { moq::Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new moq::Mock <TextToSpeech.TextToSpeechClient>(moq::MockBehavior.Strict); ListVoicesRequest request = new ListVoicesRequest { LanguageCode = "language_code2f6c7160", }; ListVoicesResponse expectedResponse = new ListVoicesResponse { Voices = { new Voice(), }, }; mockGrpcClient.Setup(x => x.ListVoicesAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListVoicesResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); ListVoicesResponse responseCallSettings = await client.ListVoicesAsync(request.LanguageCode, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ListVoicesResponse responseCancellationToken = await client.ListVoicesAsync(request.LanguageCode, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
private async Task <List <SToSVoice> > FetchVoices(string language) { try { var voices = await voiceRepository.GetAllByService(WEB_SERVICE_ID); if (voices.Count == 0) { var request = new ListVoicesRequest(); var response = await toSpeechClient.ListVoicesAsync(request); voiceCache = response.Voices.Select(voice => new SToSVoice { ServiceId = WEB_SERVICE_ID, Name = voice.Name, SsmlGender = voice.SsmlGender, Gender = voice.SsmlGender.ToString(), Language = string.Join(",", voice.LanguageCodes.ToArray()) } ).ToList(); voiceRepository.InsertMultiple(voiceCache); } else { voiceCache = voices; } return(voiceCache.Where(voice => voice.Language.Contains(language)).ToList()); } catch (Exception e) { Console.WriteLine("Exception caught: " + e); MessageBox.Show("Exception caught: " + e); } return(new List <SToSVoice>()); }
// Partial methods called on each request. // Allows per-RPC-call modification to the request and CallSettings objects, // before the underlying RPC is performed. partial void Modify_ListVoicesRequest(ref ListVoicesRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Returns a list of [Voice][google.cloud.texttospeech.v1.Voice] /// supported for synthesis. /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public virtual ListVoicesResponse ListVoices( ListVoicesRequest request, gaxgrpc::CallSettings callSettings = null) { throw new sys::NotImplementedException(); }
/// <summary> /// Returns a list of [Voice][google.cloud.texttospeech.v1.Voice] /// supported for synthesis. /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="cancellationToken"> /// A <see cref="st::CancellationToken"/> to use for this RPC. /// </param> /// <returns> /// A Task containing the RPC response. /// </returns> public virtual stt::Task <ListVoicesResponse> ListVoicesAsync( ListVoicesRequest request, st::CancellationToken cancellationToken) => ListVoicesAsync( request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Returns a list of [Voice][google.cloud.texttospeech.v1.Voice] /// supported for synthesis. /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// A Task containing the RPC response. /// </returns> public virtual stt::Task <ListVoicesResponse> ListVoicesAsync( ListVoicesRequest request, gaxgrpc::CallSettings callSettings = null) { throw new sys::NotImplementedException(); }