/// <summary>
        /// Classifies batch of texts.
        /// </summary>
        /// <param name="request">Request. <see cref="ClassifyBatchRequest" /></param>
        /// <returns><see cref="BatchResponse"/></returns>
        public BatchResponse ClassifyBatch(ClassifyBatchRequest request)
        {
            // verify the required parameter 'request' is set
            if (request.Request == null)
            {
                throw new ApiException(400, "Missing required parameter 'request' when calling ClassifyBatch");
            }

            // create path and map variables
            var resourcePath = this.configuration.GetApiRootUrl() + "/classification/classify/batch";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "bestClassesCount", request.BestClassesCount);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "taxonomy", request.Taxonomy);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "precisionRecallBalance", request.PrecisionRecallBalance);
            var postBody = SerializationHelper.Serialize(request.Request); // http body (model) parameter

            try
            {
                var response = this.apiInvoker.InvokeApi(
                    resourcePath,
                    "POST",
                    postBody,
                    null,
                    null);
                if (response != null)
                {
                    return((BatchResponse)SerializationHelper.Deserialize(response, typeof(BatchResponse)));
                }

                return(null);
            }
            catch (ApiException ex)
            {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }

                throw;
            }
        }
        public static void Main(string[] args)
        {
            // TODO: Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud/ (free registration is required).
            var configuration = new Configuration
            {
                ClientId     = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
                ClientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            };

            // Set timeout if necessary.
            // var apiInstance = new ClassificationApi(configuration,  10000);
            var apiInstance = new ClassificationApi(configuration);

            ClassifyRequest        request;
            ClassificationResponse response;

            // Classify text with IAB-2 taxonomy in try-catch.
            try
            {
                request = new ClassifyRequest(new BaseRequest {
                    Description = "Try Text classification"
                }, "3");

                // Get classification results.
                response = apiInstance.Classify(request);
                Debug.Print(response.ToString());
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ClassificationApi.Classify: " + e.Message);
            }

            // Classify text with Documents taxonomy.
            request = new ClassifyRequest(new BaseRequest {
                Description = "Try Text classification"
            }, taxonomy: "documents");
            // Get classification results.
            response = apiInstance.Classify(request);
            Debug.Print(response.ToString());

            // Classify text with Sentiment taxonomy.
            request = new ClassifyRequest(new BaseRequest {
                Description = "Try sentiment classification. This product is good."
            }, taxonomy: "sentiment");
            // Get classification results.
            response = apiInstance.Classify(request);
            Debug.Print(response.ToString());

            // Classify text with Sentiment3 taxonomy.
            request = new ClassifyRequest(new BaseRequest {
                Description = "Try sentiment classification. This product is good."
            }, taxonomy: "sentiment3");
            // Get classification results.
            response = apiInstance.Classify(request);
            Debug.Print(response.ToString());

            // Classify batch of texts with Sentiment3 taxonomy.
            var batchRequest = new ClassifyBatchRequest(new BatchRequest {
                Batch = new List <string> {
                    { "Try sentiment classification. This product is good." }
                }
            }, taxonomy: "sentiment3");
            // Get classification results.
            var batchResponse = apiInstance.ClassifyBatch(batchRequest);

            Debug.Print(batchResponse.ToString());
        }