Skip to content

Instantly share code, notes, and snippets.

@peted70
Created June 17, 2016 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peted70/4bf0584301c7d4d2750463a2da4fce12 to your computer and use it in GitHub Desktop.
Save peted70/4bf0584301c7d4d2750463a2da4fce12 to your computer and use it in GitHub Desktop.
private async Task<MSHealthUserText> ParseUserInput(string input)
{
string escaped = Uri.EscapeDataString(input);
using (var http = new HttpClient())
{
string key = Environment.GetEnvironmentVariable("MSHEALTHBOT_LUIS_API_KEY");
string id = Environment.GetEnvironmentVariable("MSHEALTHBOT_LUIS_APP_ID");
string uri = $"https://api.projectoxford.ai/luis/v1/application?id={id}&subscription-key={key}&q={escaped}";
var resp = await http.GetAsync(uri);
resp.EnsureSuccessStatusCode();
var strRes = await resp.Content.ReadAsStringAsync();
var data = JsonConvert.DeserializeObject<MSHealthUserText>(strRes);
return data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment