public void ListVoices()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            TextToSpeechService service = new TextToSpeechService(authenticator);

            service.SetServiceUrl("{serviceUrl}");

            var result = service.ListVoices();

            Console.WriteLine(result.Result);
        }
Exemple #2
0
        public void ListVoices_Success()
        {
            IClient  client  = Substitute.For <IClient>();
            IRequest request = Substitute.For <IRequest>();

            client.GetAsync(Arg.Any <string>())
            .Returns(request);

            TextToSpeechService service = new TextToSpeechService(client);


            var result = service.ListVoices();
        }
Exemple #3
0
        public void ListVoices()
        {
            TokenOptions tokenOptions = new TokenOptions()
            {
                IamApiKey  = apikey,
                ServiceUrl = url
            };

            TextToSpeechService service = new TextToSpeechService(tokenOptions);

            var result = service.ListVoices();

            Console.WriteLine(result.Result);
        }
Exemple #4
0
        public void ListVoices()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            TextToSpeechService service = new TextToSpeechService(config);

            service.SetEndpoint(url);

            var result = service.ListVoices();

            Console.WriteLine(result.Result);
        }
        public void Voices_Success()
        {
            service.WithHeader("X-Watson-Test", "1");
            var listVoicesResult = service.ListVoices();

            service.WithHeader("X-Watson-Test", "1");
            var getVoiceResult = service.GetVoice(
                voice: allisonVoice
                );

            Assert.IsNotNull(getVoiceResult);
            Assert.IsTrue(!string.IsNullOrEmpty(getVoiceResult.Result.Name));
            Assert.IsNotNull(listVoicesResult);
            Assert.IsNotNull(listVoicesResult.Result._Voices);
        }
Exemple #6
0
        private Voices ListVoices(Dictionary <string, object> customData = null)
        {
            Console.WriteLine("\nAttempting to ListVoices()");
            var result = service.ListVoices(customData: customData);

            if (result != null)
            {
                Console.WriteLine("ListVoices() succeeded:\n{0}", JsonConvert.SerializeObject(result, Formatting.Indented));
            }
            else
            {
                Console.WriteLine("Failed to ListVoices()");
            }

            return(result);
        }
        private Voices ListVoices()
        {
            Console.WriteLine("\nAttempting to ListVoices()");
            var result = _service.ListVoices();

            if (result != null)
            {
                Console.WriteLine("ListVoices() succeeded:\n{0}", JsonConvert.SerializeObject(result, Formatting.Indented));
            }
            else
            {
                Console.WriteLine("Failed to ListVoices()");
            }

            return(result);
        }
        public IEnumerator TestListVoices()
        {
            Log.Debug("TextToSpeechServiceV1IntegrationTests", "Attempting to ListVoices...");
            Voices listVoicesResponse = null;

            service.ListVoices(
                callback: (DetailedResponse <Voices> response, IBMError error) =>
            {
                Log.Debug("TextToSpeechServiceV1IntegrationTests", "ListVoices result: {0}", response.Response);
                listVoicesResponse = response.Result;
                Assert.IsNotNull(listVoicesResponse);
                Assert.IsNotNull(listVoicesResponse._Voices);
                Assert.IsTrue(listVoicesResponse._Voices.Count > 0);
                Assert.IsNull(error);
            }
                );

            while (listVoicesResponse == null)
            {
                yield return(null);
            }
        }
Exemple #9
0
        private async Task <List <SToSVoice> > FetchVoices(string language)
        {
            try
            {
                var voices = await voiceRepository.GetAllByService(WEB_SERVICE_ID);

                if (voices.Count == 0)
                {
                    var ibmVoices = await Task.Run(() =>
                    {
                        return(textToSpeechClient.ListVoices());
                    });

                    voiceCache = ibmVoices._Voices.Select(voice =>
                                                          new SToSVoice
                    {
                        ServiceId = WEB_SERVICE_ID,
                        Name      = voice.Name,
                        Gender    = voice.Gender,
                        Language  = voice.Language
                    }
                                                          ).ToList();
                    voiceRepository.InsertMultiple(voiceCache);
                }
                else
                {
                    voiceCache = voices;
                }
                return(voiceCache.Where(voice => voice.Language == language).ToList());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception caught: " + e);
                MessageBox.Show("Exception caught: " + e);
            }
            return(new List <SToSVoice>());
        }