Esempio n. 1
0
        public static bool Create(string subscriptionKey, string hostURI, string name, string description, string gender, string locale)
        {
            var properties = new Dictionary <string, string>();

            properties.Add("Gender", gender.Substring(0, 1).ToUpper() + gender.Substring(1));

            var projectDefinition = ProjectDefinition.Create(
                name,
                name,
                description,
                locale,
                properties,
                "TextToSpeech");

            var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(projectDefinition);

            var response = APIHelper.Submit(subscriptionKey, hostURI + API_V3.VoiceProject_Create, jsonString);


            if (response.StatusCode != HttpStatusCode.Accepted && response.StatusCode != HttpStatusCode.Created)
            {
                APIHelper.PrintErrorMessage(response);
                return(false);
            }

            System.Console.WriteLine(response.Headers.Location);
            return(true);
        }
Esempio n. 2
0
        public static bool Create(string subscriptionKey, string hostURI, string name, string description, string gender, string locale)
        {
            var properties = new Dictionary <string, string>();

            properties.Add("Gender", gender.Substring(0, 1).ToUpper() + gender.Substring(1));

            var projectDefinition = ProjectDefinition.Create(
                name,
                description,
                locale,
                properties,
                "TextToSpeech");
            var response = APIHelper.Submit <ProjectDefinition>(subscriptionKey, hostURI + API_V3.VoiceProject_Create, projectDefinition);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                APIHelper.PrintErrorMessage(response);
                return(false);
            }
            return(true);
        }