/// <summary> /// Gets the sentiment for a collection asynchronously. /// </summary> /// <param name="request">The request.</param> /// <see cref="Microsoft.ProjectOxford.Text.Sentiment.SentimentResponse"/> /// <returns>Returns a SentimentResponse object from the Sentiment Analysis API.</returns> public async Task <SentimentResponse> GetSentimentAsync(SentimentRequest request) { request.Validate(); var url = this.Url; var json = JsonConvert.SerializeObject(request); var responseJson = await this.SendPostAsync(url, json); var response = JsonConvert.DeserializeObject <SentimentResponse>(responseJson); return(response); }
/// <summary> /// Gets the sentiment for a collection of documents. /// </summary> /// <param name="request">The request.</param> /// <see cref="Microsoft.ProjectOxford.Text.Sentiment.SentimentResponse"/> /// <returns>Returns a SentimentResponse object from the Sentiment Analysis API.</returns> public SentimentResponse GetSentiment(SentimentRequest request) { return(GetSentimentAsync(request).Result); }