Esempio n. 1
0
        /// <summary>
        /// List custom models. Lists metadata such as the name and description for all custom voice models that are owned by an instance of the service. Specify a language to list the voice models for that language only. To see the words in addition to the metadata for a specific voice model, use the **List a custom model** method. You must use credentials for the instance of the service that owns a model to list information about it.  **Note:** This method is currently a beta release.
        /// </summary>
        /// <param name="language">The language for which custom voice models that are owned by the requesting service credentials are to be returned. Omit the parameter to see all custom voice models that are owned by the requester. (optional)</param>
        /// <param name="customData">Custom data object to pass data including custom request headers.</param>
        /// <returns><see cref="VoiceModels" />VoiceModels</returns>
        public VoiceModels ListVoiceModels(string language = null, Dictionary <string, object> customData = null)
        {
            VoiceModels result = null;

            try
            {
                var request = this.Client.WithAuthentication(this.UserName, this.Password)
                              .GetAsync($"{this.Endpoint}/v1/customizations");
                if (!string.IsNullOrEmpty(language))
                {
                    request.WithArgument("language", language);
                }
                if (customData != null)
                {
                    request.WithCustomData(customData);
                }
                result = request.As <VoiceModels>().Result;
                if (result == null)
                {
                    result = new VoiceModels();
                }
                result.CustomData = request.CustomData;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }
Esempio n. 2
0
        public IEnumerator TestListVoiceModels()
        {
            Log.Debug("TextToSpeechServiceV1IntegrationTests", "Attempting to ListVoiceModels...");
            VoiceModels listVoiceModelsResponse = null;

            service.ListVoiceModels(
                callback: (DetailedResponse <VoiceModels> response, IBMError error) =>
            {
                Log.Debug("TextToSpeechServiceV1IntegrationTests", "ListVoiceModels result: {0}", response.Response);
                listVoiceModelsResponse = response.Result;
                Assert.IsNotNull(listVoiceModelsResponse);
                Assert.IsNotNull(listVoiceModelsResponse.Customizations);
                Assert.IsTrue(listVoiceModelsResponse.Customizations.Count > 0);
                Assert.IsNull(error);
            },
                language: voiceModelLanguage
                );

            while (listVoiceModelsResponse == null)
            {
                yield return(null);
            }
        }