Ejemplo n.º 1
0
        public SpeechToTextResponse(string jsonString, string httpError = null)
        {
            if (!string.IsNullOrEmpty(jsonString))
            {
                JsonObject jsonObject            = JsonObject.Parse(jsonString);
                Newtonsoft.Json.Linq.JObject obj = Newtonsoft.Json.Linq.JObject.Parse(jsonString);
                displayString = obj.ToString();
                version       = jsonObject.GetNamedString(versionKey, "");
                header        = new SpeechToTextHeader(jsonObject.GetNamedObject(headerKey, null));

                results = new ObservableCollection <SpeechToTextResult>();
                if (results != null)
                {
                    foreach (IJsonValue jsonValue in jsonObject.GetNamedArray(resultsKey, new JsonArray()))
                    {
                        if (jsonValue.ValueType == JsonValueType.Object)
                        {
                            results.Add(new SpeechToTextResult(jsonValue.GetObject()));
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(httpError))
            {
                HttpError = httpError;
            }
        }
Ejemplo n.º 2
0
 public SpeechToTextResponse()
 {
     HttpError = string.Empty;
     version   = "3.0";
     header    = null;
     results   = new ObservableCollection <SpeechToTextResult>();
 }