public void SaveWords(string modelID, params CustomWordTranslation[] translations)
        {
            if (string.IsNullOrEmpty(modelID))
            {
                throw new ArgumentNullException("Model id must not be empty");
            }
            if (translations.Length == 0)
            {
                throw new Exception("Must have at least one word to save");
            }

            CustomWordTranslations customWordTranslations = new CustomWordTranslations()
            {
                Words = translations.ToList()
            };

            var x = RepositoryClient.WithAuthentication(ApiKeys.TextToSpeechUsername, ApiKeys.TextToSpeechPassword)
                    .PostAsync($"{ApiKeys.TextToSpeechEndpoint}{customizationsUrl}{modelID}{wordsUrl}")
                    .WithBody <CustomWordTranslations>(customWordTranslations)
                    .AsMessage().Result;
        }
Beispiel #2
0
        public void SaveWords(string modelID, params CustomWordTranslation[] translations)
        {
            if (string.IsNullOrEmpty(modelID))
            {
                throw new ArgumentNullException("Model id must not be empty");
            }

            if (translations.Length == 0)
            {
                throw new Exception("Must have at least one word to save");
            }

            CustomWordTranslations customWordTranslations = new CustomWordTranslations()
            {
                Words = translations.ToList()
            };

            var x = Client.WithAuthentication(this.UserName, this.Password)
                    .PostAsync(this.Endpoint + string.Format(PATH_WORDS, modelID))
                    .WithBody <CustomWordTranslations>(customWordTranslations)
                    .AsMessage().Result;
        }