Exemplo n.º 1
0
        /// <summary>
        /// Detect language of text Automatically determine which language a text string is written in.  Supports Danish (DAN), German (DEU), English (ENG), French (FRA), Italian (ITA), Japanese (JPN), Korean (KOR), Dutch (NLD), Norwegian (NOR), Portuguese (POR), Russian (RUS), Spanish (SPA), Swedish (SWE), Chinese (ZHO).
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.NLP.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="input"></param>
        /// <returns>Task of LanguageDetectionResponse</returns>
        public async System.Threading.Tasks.Task <LanguageDetectionResponse> LanguageDetectionGetLanguageAsync(LanguageDetectionRequest input)
        {
            ApiResponse <LanguageDetectionResponse> localVarResponse = await LanguageDetectionGetLanguageAsyncWithHttpInfo(input);

            return(localVarResponse.Data);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Detect language of text Automatically determine which language a text string is written in.  Supports Danish (DAN), German (DEU), English (ENG), French (FRA), Italian (ITA), Japanese (JPN), Korean (KOR), Dutch (NLD), Norwegian (NOR), Portuguese (POR), Russian (RUS), Spanish (SPA), Swedish (SWE), Chinese (ZHO).
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.NLP.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="input"></param>
        /// <returns>Task of ApiResponse (LanguageDetectionResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <LanguageDetectionResponse> > LanguageDetectionGetLanguageAsyncWithHttpInfo(LanguageDetectionRequest input)
        {
            // verify the required parameter 'input' is set
            if (input == null)
            {
                throw new ApiException(400, "Missing required parameter 'input' when calling LanguageDetectionApi->LanguageDetectionGetLanguage");
            }

            var    localVarPath         = "./nlp-v2/language/detect";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml",
                "application/x-www-form-urlencoded"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (input != null && input.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(input); // http body (model) parameter
            }
            else
            {
                localVarPostBody = input; // byte array
            }

            // authentication (Apikey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Apikey")))
            {
                localVarHeaderParams["Apikey"] = this.Configuration.GetApiKeyWithPrefix("Apikey");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("LanguageDetectionGetLanguage", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <LanguageDetectionResponse>(localVarStatusCode,
                                                               localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
                                                               (LanguageDetectionResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(LanguageDetectionResponse))));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Detect language of text Automatically determine which language a text string is written in.  Supports Danish (DAN), German (DEU), English (ENG), French (FRA), Italian (ITA), Japanese (JPN), Korean (KOR), Dutch (NLD), Norwegian (NOR), Portuguese (POR), Russian (RUS), Spanish (SPA), Swedish (SWE), Chinese (ZHO).
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.NLP.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="input"></param>
        /// <returns>LanguageDetectionResponse</returns>
        public LanguageDetectionResponse LanguageDetectionGetLanguage(LanguageDetectionRequest input)
        {
            ApiResponse <LanguageDetectionResponse> localVarResponse = LanguageDetectionGetLanguageWithHttpInfo(input);

            return(localVarResponse.Data);
        }