/// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>TextSimilarityDto</c> populated with the result of the call </returns>
        /// <seealso cref="TextSimilarityDto"/>
        public Task <TextSimilarityDto> CallTextSimilaritiesAsync(TextSimilarityParameters parameters)
        {
            EntityExtractionService.ValidateParameters(parameters);
            var source = SourceValidationService.verifyMultipleSources(parameters);

            return(_apiClient.CallApiAsync <TextSimilarityDto>(ApiClient.TextSimilarityUriBuilder(), ApiClient.TextSimilarityContentBuilder(source, parameters), parameters.HttpMethod));
        }
        public Task <LanguageDetectionDto> CallLanguageDetectionAsync(LanguageDetectionParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            var source = SourceValidationService.verifySingleSource(parameters);

            return(_apiClient.CallApiAsync <LanguageDetectionDto>(ApiClient.LanguageDetectionUriBuilder(), ApiClient.LanguageDetectionContentBuilder(source, parameters), parameters.HttpMethod));
        }
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>EntityExtractionDto</c> populated with the result of the call </returns>
        /// <seealso cref="EntityExtractionDto"/>
        public Task <EntityExtractionDto> CallEntityExtractionAsync(EntityExtractionParameters parameters)
        {
            ValidateParameters(parameters);
            var source = SourceValidationService.verifySingleSource(parameters);

            return(_apiClient.CallApiAsync <EntityExtractionDto>(ApiClient.EntityExtractionUriBuilder(), ApiClient.EntityExtractionContentBuilder(source, parameters), parameters.HttpMethod));
        }
Esempio n. 4
0
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>SentimentAnalysisDto</c> populated with the result of the call </returns>
        /// <seealso cref="SentimentAnalysisDto"/>
        public Task <SentimentAnalysisDto> CallSentimentAnalysisAsync(SentimentAnalysisParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            if (parameters.Lang != LanguageOption.en && parameters.Lang != LanguageOption.it && parameters.Lang != LanguageOption.auto)
            {
                throw new ArgumentException(ErrorMessages.WrongLang1, ErrorMessages.Lang);
            }
            var source = SourceValidationService.verifySingleSource(parameters);

            return(_apiClient.CallApiAsync <SentimentAnalysisDto>(ApiClient.SentimentAnalysisUriBuilder(), ApiClient.SentimentAnalysisContentBuilder(source, parameters), parameters.HttpMethod));
        }
Esempio n. 5
0
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>TextClassificationDto</c> populated with the result of the call </returns>
        /// <seealso cref="TextClassificationDto"/>
        public Task <TextClassificationDto> CallTextClassificationAsync(TextClassificationParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            if (parameters.MinScore < 0.0 || parameters.MinScore > 1.0)
            {
                throw new ArgumentException(ErrorMessages.WrongMinScore, ErrorMessages.MinScore);
            }
            if (parameters.MaxAnnotations < 1)
            {
                throw new ArgumentException(ErrorMessages.WrongMaxAnnotations, ErrorMessages.MaxAnnotations);
            }
            if (parameters.Include != null)
            {
                if (parameters.Include.FindAll(x => x != IncludeOption.score_details).ToList().Count > 0)
                {
                    throw new ArgumentException(ErrorMessages.WrongInclude2, ErrorMessages.Include);
                }
            }
            var source = SourceValidationService.verifySingleSource(parameters);

            return(_apiClient.CallApiAsync <TextClassificationDto>(ApiClient.TextClassificationUriBuilder(), ApiClient.TextClassificationContentBuilder(source, parameters), parameters.HttpMethod));
        }
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>WikisearchDto</c> populated with the result of the call </returns>
        /// <seealso cref="WikisearchDto"/>
        public Task <WikisearchDto> CallWikisearchAsync(WikisearchParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            if (parameters.Include != null)
            {
                if (parameters.Include.FindAll(x => x == IncludeOption.score_details).ToList().Count > 0)
                {
                    throw new ArgumentException(ErrorMessages.WrongInclude1, ErrorMessages.Include);
                }
            }
            if (parameters.Lang == LanguageOption.auto)
            {
                throw new ArgumentException(ErrorMessages.WrongLang2, ErrorMessages.Lang);
            }
            if (parameters.Limit < 1 || parameters.Limit > 50)
            {
                throw new ArgumentException(ErrorMessages.WrongLimit, ErrorMessages.Limit);
            }

            var source = SourceValidationService.verifySingleSource(parameters);

            return(_apiClient.CallApiAsync <WikisearchDto>(ApiClient.WikisearchUriBuilder(), ApiClient.WikisearchContentBuilder(source, parameters), parameters.HttpMethod));
        }