コード例 #1
0
        /// <summary>
        /// Check if sentence is spelled correctly Checks whether the sentence is spelled correctly and returns the result as JSON
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.NLP.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="value">Input sentence</param>
        /// <returns>Task of CheckSentenceResponse</returns>
        public async System.Threading.Tasks.Task <CheckSentenceResponse> SpellcheckCheckSentenceAsync(CheckSentenceRequest value)
        {
            ApiResponse <CheckSentenceResponse> localVarResponse = await SpellcheckCheckSentenceAsyncWithHttpInfo(value);

            return(localVarResponse.Data);
        }
コード例 #2
0
        /// <summary>
        /// Check if sentence is spelled correctly Checks whether the sentence is spelled correctly and returns the result as JSON
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.NLP.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="value">Input sentence</param>
        /// <returns>Task of ApiResponse (CheckSentenceResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <CheckSentenceResponse> > SpellcheckCheckSentenceAsyncWithHttpInfo(CheckSentenceRequest value)
        {
            // verify the required parameter 'value' is set
            if (value == null)
            {
                throw new ApiException(400, "Missing required parameter 'value' when calling SpellcheckApi->SpellcheckCheckSentence");
            }

            var    localVarPath         = "./nlp-v2/spellcheck/check/sentence";
            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 (value != null && value.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(value); // http body (model) parameter
            }
            else
            {
                localVarPostBody = value; // 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("SpellcheckCheckSentence", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <CheckSentenceResponse>(localVarStatusCode,
                                                           localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
                                                           (CheckSentenceResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckSentenceResponse))));
        }
コード例 #3
0
        /// <summary>
        /// Check if sentence is spelled correctly Checks whether the sentence is spelled correctly and returns the result as JSON
        /// </summary>
        /// <exception cref="Cloudmersive.APIClient.NETCore.NLP.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="value">Input sentence</param>
        /// <returns>CheckSentenceResponse</returns>
        public CheckSentenceResponse SpellcheckCheckSentence(CheckSentenceRequest value)
        {
            ApiResponse <CheckSentenceResponse> localVarResponse = SpellcheckCheckSentenceWithHttpInfo(value);

            return(localVarResponse.Data);
        }