/// <summary>
        /// Gets the languages in a collection of documents asynchronously.
        /// </summary>
        /// <param name="request">The request containing the collection fo documents.</param>
        /// <see cref="Microsoft.ProjectOxford.Text.Language.LanguageResponse"/>
        /// <returns>Returns a LanguageResponse object from the Text Analytics API.</returns>
        public async Task <LanguageResponse> GetLanguagesAsync(LanguageRequest request)
        {
            request.Validate();

            var url = this.Url;

            if (request.NumberOfLanguagesToDetect > 1)
            {
                url = string.Format("{0}?numberOfLanguagesToDetect={1}", url, request.NumberOfLanguagesToDetect);
            }

            var json         = JsonConvert.SerializeObject(request);
            var responseJson = await this.SendPostAsync(url, json);

            var response = JsonConvert.DeserializeObject <LanguageResponse>(responseJson);

            return(response);
        }
 /// <summary>
 /// Gets the languages in a collection of documents.
 /// </summary>
 /// <param name="request">The request containing the collection fo documents.</param>
 /// <see cref="Microsoft.ProjectOxford.Text.Language.LanguageResponse"/>
 /// <returns>Returns a LanguageResponse object from the Text Analytics API.</returns>
 public LanguageResponse GetLanguages(LanguageRequest request)
 {
     return(GetLanguagesAsync(request).Result);
 }