diff --git a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md index fc69e50338372..69256406520cb 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md +++ b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md @@ -9,7 +9,9 @@ ### Bugs Fixed ### Other Changes - +- Integrate synchronous workflow for sync clients so that they do not block on async client APIs. + It simplifies stack traces and improves debugging experience. + ## 5.3.0-beta.1 (2022-11-18) ### Features Added diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeActionsAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeActionsUtilClient.java similarity index 90% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeActionsAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeActionsUtilClient.java index 4211057ba3a39..1414d57bad0fa 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeActionsAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeActionsUtilClient.java @@ -25,11 +25,13 @@ import com.azure.ai.textanalytics.implementation.models.AbstractiveSummarizationResult; import com.azure.ai.textanalytics.implementation.models.AbstractiveSummarizationTaskParameters; import com.azure.ai.textanalytics.implementation.models.AnalyzeBatchInput; +import com.azure.ai.textanalytics.implementation.models.AnalyzeHeaders; import com.azure.ai.textanalytics.implementation.models.AnalyzeJobState; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobState; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobsInput; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROResult; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROTask; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsSubmitJobHeaders; import com.azure.ai.textanalytics.implementation.models.CustomEntitiesLROTask; import com.azure.ai.textanalytics.implementation.models.CustomEntitiesResult; import com.azure.ai.textanalytics.implementation.models.CustomEntitiesTask; @@ -55,6 +57,7 @@ import com.azure.ai.textanalytics.implementation.models.EntityLinkingTaskParameters; import com.azure.ai.textanalytics.implementation.models.EntityRecognitionLROResult; import com.azure.ai.textanalytics.implementation.models.Error; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationLROResult; import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationLROTask; import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationResult; @@ -127,9 +130,11 @@ import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.AnalyzeActionsResultPagedFlux; import com.azure.ai.textanalytics.util.AnalyzeActionsResultPagedIterable; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.ResponseBase; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.IterableStream; @@ -138,6 +143,7 @@ import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.SyncPoller; import reactor.core.publisher.Mono; import java.util.ArrayList; @@ -146,14 +152,17 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; +import java.util.function.BiFunction; import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; import static com.azure.ai.textanalytics.implementation.Utility.DEFAULT_POLL_INTERVAL; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink; import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; @@ -175,7 +184,7 @@ import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY; -class AnalyzeActionsAsyncClient { +class AnalyzeActionsUtilClient { // Legacy Tasks private static final String ENTITY_RECOGNITION_TASKS = "entityRecognitionTasks"; private static final String ENTITY_RECOGNITION_PII_TASKS = "entityRecognitionPiiTasks"; @@ -193,7 +202,6 @@ class AnalyzeActionsAsyncClient { EXTRACTIVE_SUMMARIZATION_TASKS, CUSTOM_ENTITY_RECOGNITION_TASKS, CUSTOM_SINGLE_CLASSIFICATION_TASKS, CUSTOM_MULTI_CLASSIFICATION_TASKS); - // Language Tasks private static final String ABSTRACTIVE_SUMMARIZATION = "AbstractiveSummarization"; private static final String ENTITY_RECOGNITION = "EntityRecognition"; @@ -213,7 +221,9 @@ class AnalyzeActionsAsyncClient { SENTIMENT_ANALYSIS, EXTRACTIVE_SUMMARIZATION, HEALTHCARE, CUSTOM_ENTITY_RECOGNITION, CUSTOM_SINGLE_LABEL_CLASSIFICATION, CUSTOM_MULTI_LABEL_CLASSIFICATION); - private final ClientLogger logger = new ClientLogger(AnalyzeActionsAsyncClient.class); + private static final String HTTP_REST_PROXY_SYNC_PROXY_ENABLE = "com.azure.core.http.restproxy.syncproxy.enable"; + private static final ClientLogger LOGGER = new ClientLogger(AnalyzeActionsUtilClient.class); + private final TextAnalyticsClientImpl legacyService; private final AnalyzeTextsImpl service; @@ -226,13 +236,13 @@ class AnalyzeActionsAsyncClient { PATTERN_LANGUAGE_API = Pattern.compile(REGEX_ACTION_ERROR_TARGET_LANGUAGE_API, Pattern.MULTILINE); } - AnalyzeActionsAsyncClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { + AnalyzeActionsUtilClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - AnalyzeActionsAsyncClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { + AnalyzeActionsUtilClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; this.serviceVersion = serviceVersion; @@ -312,7 +322,7 @@ PollerFlux beginAn } } - PollerFlux beginAnalyzeActionsIterable( + SyncPoller beginAnalyzeActionsIterable( Iterable documents, TextAnalyticsActions actions, AnalyzeActionsOptions options, Context context) { try { @@ -322,7 +332,7 @@ PollerFlux beg TextAnalyticsServiceVersion.V3_1)); inputDocumentsValidation(documents); options = getNotNullAnalyzeActionsOptions(options); - final Context finalContext = getNotNullContext(context) + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)) .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); final AnalyzeBatchInput analyzeBatchInput = new AnalyzeBatchInput() @@ -332,58 +342,44 @@ PollerFlux beg final boolean finalIncludeStatistics = options.isIncludeStatistics(); if (service != null) { - return new PollerFlux<>( + return SyncPoller.createPoller( DEFAULT_POLL_INTERVAL, - activationOperation( - service.submitJobWithResponseAsync( - new AnalyzeTextJobsInput() - .setDisplayName(actions.getDisplayName()) - .setAnalysisInput(new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))) - .setTasks(getAnalyzeTextLROTasks(actions)), - finalContext) - .map(analyzeResponse -> { - final AnalyzeActionsOperationDetail operationDetail = - new AnalyzeActionsOperationDetail(); - AnalyzeActionsOperationDetailPropertiesHelper.setOperationId(operationDetail, - parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); - return operationDetail; - })), - pollingOperationLanguageApi(operationId -> service.jobStatusWithResponseAsync(operationId, + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationLanguageApiSync(documents, actions, finalContext).apply(cxt)), + pollingOperationLanguageApiSync(operationId -> service.jobStatusWithResponse(operationId, finalIncludeStatistics, null, null, finalContext)), - (activationResponse, pollingContext) -> - Mono.error(new RuntimeException("Cancellation is not supported.")), + getCancellationIsNotSupported(), fetchingOperationIterable( - operationId -> Mono.just(new AnalyzeActionsResultPagedIterable(getAnalyzeOperationFluxPage( - operationId, null, null, finalIncludeStatistics, finalContext)))) + operationId -> getAnalyzeOperationPageIterable( + operationId, null, null, finalIncludeStatistics, finalContext)) ); } throwIfTargetServiceVersionFoundForActions(this.serviceVersion, Arrays.asList(TextAnalyticsServiceVersion.V3_0, TextAnalyticsServiceVersion.V3_1), actions); - return new PollerFlux<>( + return SyncPoller.createPoller( DEFAULT_POLL_INTERVAL, - activationOperation( - legacyService.analyzeWithResponseAsync(analyzeBatchInput, finalContext) - .map(analyzeResponse -> { - final AnalyzeActionsOperationDetail operationDetail = - new AnalyzeActionsOperationDetail(); - AnalyzeActionsOperationDetailPropertiesHelper.setOperationId(operationDetail, - parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); - return operationDetail; - })), - pollingOperation(operationId -> legacyService.analyzeStatusWithResponseAsync(operationId.toString(), + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationLegacyApiSync(documents, actions, finalContext).apply(cxt)), + pollingOperationLegacyApiSync(operationId -> legacyService.analyzeStatusWithResponseSync( + operationId.toString(), finalIncludeStatistics, null, null, finalContext)), - (activationResponse, pollingContext) -> - Mono.error(new RuntimeException("Cancellation is not supported.")), + getCancellationIsNotSupported(), fetchingOperationIterable( - operationId -> Mono.just(new AnalyzeActionsResultPagedIterable(getAnalyzeOperationFluxPage( - operationId, null, null, finalIncludeStatistics, finalContext)))) - ); - } catch (RuntimeException ex) { - return PollerFlux.error(ex); + operationId -> getAnalyzeOperationPageIterable( + operationId, null, null, finalIncludeStatistics, finalContext))); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); } } + private BiFunction, + PollResponse, AnalyzeActionsOperationDetail> getCancellationIsNotSupported() { + return (pollingContext, activationResponse) -> { + throw LOGGER.logExceptionAsError(new RuntimeException("Cancellation is not supported")); + }; + } + private List getAnalyzeTextLROTasks(TextAnalyticsActions actions) { if (actions == null) { return null; @@ -805,11 +801,48 @@ private AbstractiveSummarizationTaskParameters getAbstractiveSummarizationTaskPa try { return operationResult.onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } + private Function, AnalyzeActionsOperationDetail> + activationOperationLanguageApiSync(Iterable documents, TextAnalyticsActions actions, + Context context) { + return pollingContext -> { + final ResponseBase analyzeResponse = + service.submitJobWithResponse( + new AnalyzeTextJobsInput() + .setDisplayName(actions.getDisplayName()) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))) + .setTasks(getAnalyzeTextLROTasks(actions)), + context); + final AnalyzeActionsOperationDetail operationDetail = new AnalyzeActionsOperationDetail(); + AnalyzeActionsOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }; + } + + private Function, AnalyzeActionsOperationDetail> + activationOperationLegacyApiSync(Iterable documents, TextAnalyticsActions actions, + Context context) { + return pollingContext -> { + final AnalyzeBatchInput analyzeBatchInput = + new AnalyzeBatchInput() + .setAnalysisInput(new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents))) + .setTasks(getJobManifestTasks(actions)); + analyzeBatchInput.setDisplayName(actions.getDisplayName()); + final ResponseBase analyzeResponse = + legacyService.analyzeWithResponseSync(analyzeBatchInput, context); + final AnalyzeActionsOperationDetail operationDetail = new AnalyzeActionsOperationDetail(); + AnalyzeActionsOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }; + } + private Function, Mono>> pollingOperation(Function>> pollingFunction) { return pollingContext -> { @@ -818,10 +851,11 @@ private AbstractiveSummarizationTaskParameters getAbstractiveSummarizationTaskPa pollingContext.getLatestResponse(); final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); return pollingFunction.apply(operationId) - .flatMap(modelResponse -> processAnalyzedModelResponse(modelResponse, operationResultPollResponse)) + .flatMap(modelResponse -> Mono.just( + processAnalyzedModelResponse(modelResponse, operationResultPollResponse))) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } @@ -834,15 +868,37 @@ private AbstractiveSummarizationTaskParameters getAbstractiveSummarizationTaskPa pollingContext.getLatestResponse(); final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); return pollingFunction.apply(operationId) - .flatMap(modelResponse -> processAnalyzedModelResponseLanguageApi( - modelResponse, operationResultPollResponse)) + .flatMap(modelResponse -> Mono.just(processAnalyzedModelResponseLanguageApi( + modelResponse, operationResultPollResponse))) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } + private Function, PollResponse> + pollingOperationLanguageApiSync(Function> pollingFunction) { + return pollingContext -> { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processAnalyzedModelResponseLanguageApi(pollingFunction.apply(operationId), + operationResultPollResponse); + }; + } + + private Function, PollResponse> + pollingOperationLegacyApiSync(Function> pollingFunction) { + return pollingContext -> { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processAnalyzedModelResponse(pollingFunction.apply(operationId), + operationResultPollResponse); + }; + } + private Function, Mono> fetchingOperation(Function> fetchingFunction) { return pollingContext -> { @@ -850,20 +906,16 @@ private AbstractiveSummarizationTaskParameters getAbstractiveSummarizationTaskPa final UUID operationId = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); return fetchingFunction.apply(operationId); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } - private Function, Mono> - fetchingOperationIterable(Function> fetchingFunction) { + private Function, AnalyzeActionsResultPagedIterable> + fetchingOperationIterable(Function fetchingFunction) { return pollingContext -> { - try { - final UUID operationId = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); - return fetchingFunction.apply(operationId); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + final UUID operationId = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(operationId); }; } @@ -874,6 +926,28 @@ AnalyzeActionsResultPagedFlux getAnalyzeOperationFluxPage(UUID operationId, Inte getPage(continuationToken, operationId, top, skip, showStats, context).flux()); } + AnalyzeActionsResultPagedIterable getAnalyzeOperationPageIterable(UUID operationId, Integer top, Integer skip, + boolean showStats, Context context) { + return new AnalyzeActionsResultPagedIterable( + () -> (continuationToken, pageSize) -> + getPageSync(continuationToken, operationId, top, skip, showStats, context)); + } + + PagedResponse getPageSync(String continuationToken, UUID operationId, Integer top, + Integer skip, boolean showStats, Context context) { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = (Integer) continuationTokenMap.getOrDefault("$top", null); + skip = (Integer) continuationTokenMap.getOrDefault("$skip", null); + showStats = (Boolean) continuationTokenMap.getOrDefault(showStats, false); + } + return service != null + ? toAnalyzeActionsResultPagedResponseLanguageApi(service.jobStatusWithResponse( + operationId, showStats, top, skip, context)) + : toAnalyzeActionsResultPagedResponseLegacyApi(legacyService.analyzeStatusWithResponseSync( + operationId.toString(), showStats, top, skip, context)); + } + Mono> getPage(String continuationToken, UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { if (continuationToken != null) { @@ -1039,7 +1113,7 @@ private AnalyzeActionsResult toAnalyzeActionsResultLegacyApi(AnalyzeJobState ana } else if (SENTIMENT_ANALYSIS_TASKS.equals(taskName)) { actionResult = analyzeSentimentActionResults.get(taskIndex); } else { - throw logger.logExceptionAsError(new RuntimeException( + throw LOGGER.logExceptionAsError(new RuntimeException( "Invalid task name in target reference, " + taskName)); } @@ -1242,7 +1316,7 @@ private AnalyzeActionsResult toAnalyzeActionsResultLanguageApi(AnalyzeTextJobSta abstractiveSummarizationLROResult.getLastUpdateDateTime()); abstractSummaryActionResults.add(actionResult); } else { - throw logger.logExceptionAsError(new RuntimeException( + throw LOGGER.logExceptionAsError(new RuntimeException( "Invalid Long running operation task result: " + taskResult.getClass())); } } @@ -1281,7 +1355,7 @@ private AnalyzeActionsResult toAnalyzeActionsResultLanguageApi(AnalyzeTextJobSta } else if (ABSTRACTIVE_SUMMARIZATION.equals(taskName)) { actionResult = abstractSummaryActionResults.get(taskIndex); } else { - throw logger.logExceptionAsError(new RuntimeException( + throw LOGGER.logExceptionAsError(new RuntimeException( "Invalid task name in target reference, " + taskName)); } @@ -1321,7 +1395,7 @@ private AnalyzeActionsResult toAnalyzeActionsResultLanguageApi(AnalyzeTextJobSta return analyzeActionsResult; } - private Mono> processAnalyzedModelResponse( + private PollResponse processAnalyzedModelResponse( Response analyzeJobStateResponse, PollResponse operationResultPollResponse) { @@ -1356,10 +1430,10 @@ private Mono> processAnalyzedModelRe operationResultPollResponse.getValue(), tasksResult.getCompleted()); AnalyzeActionsOperationDetailPropertiesHelper.setActionsInTotal(operationResultPollResponse.getValue(), tasksResult.getTotal()); - return Mono.just(new PollResponse<>(status, operationResultPollResponse.getValue())); + return new PollResponse<>(status, operationResultPollResponse.getValue()); } - private Mono> processAnalyzedModelResponseLanguageApi( + private PollResponse processAnalyzedModelResponseLanguageApi( Response analyzeJobStateResponse, PollResponse operationResultPollResponse) { @@ -1394,7 +1468,7 @@ private Mono> processAnalyzedModelRe operationResultPollResponse.getValue(), tasksResult.getCompleted()); AnalyzeActionsOperationDetailPropertiesHelper.setActionsInTotal(operationResultPollResponse.getValue(), tasksResult.getTotal()); - return Mono.just(new PollResponse<>(status, operationResultPollResponse.getValue())); + return new PollResponse<>(status, operationResultPollResponse.getValue()); } private Context getNotNullContext(Context context) { @@ -1410,7 +1484,7 @@ private String[] parseActionErrorTargetLegacyApi(String targetReference, String if (CoreUtils.isNullOrEmpty(errorMessage)) { errorMessage = "Expected an error with a target field referencing an action but did not get one"; } - throw logger.logExceptionAsError(new RuntimeException(errorMessage)); + throw LOGGER.logExceptionAsError(new RuntimeException(errorMessage)); } // action could be failed and the target reference is "#/tasks/keyPhraseExtractionTasks/0"; final Matcher matcher = PATTERN_LEGACY_API.matcher(targetReference); @@ -1427,7 +1501,7 @@ private String[] parseActionErrorTargetLanguageApi(String targetReference, Strin if (CoreUtils.isNullOrEmpty(errorMessage)) { errorMessage = "Expected an error with a target field referencing an action but did not get one"; } - throw logger.logExceptionAsError(new RuntimeException(errorMessage)); + throw LOGGER.logExceptionAsError(new RuntimeException(errorMessage)); } final Matcher matcher = PATTERN_LANGUAGE_API.matcher(targetReference); String[] taskNameIdPair = new String[2]; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeHealthcareEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeHealthcareEntityUtilClient.java similarity index 66% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeHealthcareEntityAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeHealthcareEntityUtilClient.java index 1b5857776757e..9c0a22475cbb1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeHealthcareEntityAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeHealthcareEntityUtilClient.java @@ -12,10 +12,14 @@ import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobState; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobsInput; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROResult; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROTask; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsCancelJobHeaders; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsSubmitJobHeaders; import com.azure.ai.textanalytics.implementation.models.CancelHealthJobHeaders; import com.azure.ai.textanalytics.implementation.models.Error; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.FhirVersion; +import com.azure.ai.textanalytics.implementation.models.HealthHeaders; import com.azure.ai.textanalytics.implementation.models.HealthcareDocumentType; import com.azure.ai.textanalytics.implementation.models.HealthcareJobState; import com.azure.ai.textanalytics.implementation.models.HealthcareLROResult; @@ -35,6 +39,7 @@ import com.azure.ai.textanalytics.util.AnalyzeHealthcareEntitiesPagedFlux; import com.azure.ai.textanalytics.util.AnalyzeHealthcareEntitiesPagedIterable; import com.azure.ai.textanalytics.util.AnalyzeHealthcareEntitiesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; @@ -47,6 +52,7 @@ import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.SyncPoller; import reactor.core.publisher.Mono; import java.util.Arrays; @@ -59,9 +65,11 @@ import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; import static com.azure.ai.textanalytics.implementation.Utility.DEFAULT_POLL_INTERVAL; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink; import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; @@ -75,21 +83,21 @@ import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY; -class AnalyzeHealthcareEntityAsyncClient { - private final ClientLogger logger = new ClientLogger(AnalyzeHealthcareEntityAsyncClient.class); +class AnalyzeHealthcareEntityUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(AnalyzeHealthcareEntityUtilClient.class); private final TextAnalyticsClientImpl legacyService; private final AnalyzeTextsImpl service; private final TextAnalyticsServiceVersion serviceVersion; - AnalyzeHealthcareEntityAsyncClient(TextAnalyticsClientImpl legacyService, - TextAnalyticsServiceVersion serviceVersion) { + AnalyzeHealthcareEntityUtilClient(TextAnalyticsClientImpl legacyService, + TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - AnalyzeHealthcareEntityAsyncClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { + AnalyzeHealthcareEntityUtilClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; this.serviceVersion = serviceVersion; @@ -180,7 +188,7 @@ class AnalyzeHealthcareEntityAsyncClient { } } - PollerFlux + SyncPoller beginAnalyzeHealthcarePagedIterable(Iterable documents, AnalyzeHealthcareEntitiesOptions options, Context context) { try { @@ -191,8 +199,8 @@ class AnalyzeHealthcareEntityAsyncClient { throwIfCallingNotAvailableFeatureInOptions(options); inputDocumentsValidation(documents); options = getNotNullAnalyzeHealthcareEntitiesOptions(options); - final Context finalContext = getNotNullContext(context) - .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); final boolean finalIncludeStatistics = options.isIncludeStatistics(); final StringIndexType finalStringIndexType = StringIndexType.UTF16CODE_UNIT; final String finalModelVersion = options.getModelVersion(); @@ -203,67 +211,44 @@ class AnalyzeHealthcareEntityAsyncClient { if (service != null) { final String displayName = options.getDisplayName(); - return new PollerFlux<>( + final HealthcareLROTask task = new HealthcareLROTask().setParameters( + new HealthcareTaskParameters() + .setFhirVersion(finalFhirVersion) + .setDocumentType(finalDocumentType) + .setStringIndexType(finalStringIndexType) + .setModelVersion(finalModelVersion) + .setLoggingOptOut(finalLoggingOptOut)); + + return SyncPoller.createPoller( DEFAULT_POLL_INTERVAL, - activationOperation( - service.submitJobWithResponseAsync( - new AnalyzeTextJobsInput() - .setDisplayName(displayName) - .setAnalysisInput( - new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))) - .setTasks(Arrays.asList( - new HealthcareLROTask().setParameters( - new HealthcareTaskParameters() - .setFhirVersion(finalFhirVersion) - .setDocumentType(finalDocumentType) - .setStringIndexType(finalStringIndexType) - .setModelVersion(finalModelVersion) - .setLoggingOptOut(finalLoggingOptOut)))), - finalContext) - .map(healthResponse -> { - final AnalyzeHealthcareEntitiesOperationDetail operationDetail = - new AnalyzeHealthcareEntitiesOperationDetail(); - AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setOperationId(operationDetail, - parseOperationId(healthResponse.getDeserializedHeaders().getOperationLocation())); - return operationDetail; - })), - pollingOperationTextJob( - operationId -> service.jobStatusWithResponseAsync(operationId, + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationLanguageApiSync(documents, task, displayName, finalContext).apply(cxt)), + pollingOperationLanguageApiSync( + operationId -> service.jobStatusWithResponse(operationId, finalIncludeStatistics, null, null, finalContext)), - cancelOperationTextJob( - operationId -> service.cancelJobWithResponseAsync(operationId, finalContext)), + cancelOperationLanguageApiSync( + operationId -> service.cancelJobWithResponse(operationId, finalContext)), fetchingOperationIterable( - operationId -> Mono.just(new AnalyzeHealthcareEntitiesPagedIterable( - getHealthcareEntitiesPagedFlux(operationId, null, null, - finalIncludeStatistics, finalContext)))) + operationId -> getHealthcareEntitiesPagedIterable(operationId, null, null, + finalIncludeStatistics, finalContext)) ); } - - return new PollerFlux<>( + return SyncPoller.createPoller( DEFAULT_POLL_INTERVAL, - activationOperation( - legacyService.healthWithResponseAsync( - new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), - finalModelVersion, - finalStringIndexType, - finalLoggingOptOut, - finalContext) - .map(healthResponse -> { - final AnalyzeHealthcareEntitiesOperationDetail operationDetail = - new AnalyzeHealthcareEntitiesOperationDetail(); - AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setOperationId(operationDetail, - parseOperationId(healthResponse.getDeserializedHeaders().getOperationLocation())); - return operationDetail; - })), - pollingOperation(operationId -> legacyService.healthStatusWithResponseAsync(operationId, null, - null, finalIncludeStatistics, finalContext)), - cancelOperation(operationId -> legacyService.cancelHealthJobWithResponseAsync(operationId, finalContext)), - fetchingOperationIterable(operationId -> Mono.just(new AnalyzeHealthcareEntitiesPagedIterable( - getHealthcareEntitiesPagedFlux(operationId, null, null, finalIncludeStatistics, - finalContext)))) + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationLegacyApiSync(documents, finalModelVersion, finalStringIndexType, + finalLoggingOptOut, finalContext).apply(cxt)), + pollingOperationLegacyApiSync( + operationId -> legacyService.healthStatusWithResponseSync(operationId, null, + null, finalIncludeStatistics, finalContext)), + cancelOperationLegacyApiSync(operationId -> + legacyService.cancelHealthJobWithResponseSync(operationId, finalContext)), + fetchingOperationIterable( + operationId -> getHealthcareEntitiesPagedIterable(operationId, null, null, + finalIncludeStatistics, finalContext)) ); - } catch (RuntimeException ex) { - return PollerFlux.error(ex); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); } } @@ -271,7 +256,14 @@ AnalyzeHealthcareEntitiesPagedFlux getHealthcareEntitiesPagedFlux( UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { return new AnalyzeHealthcareEntitiesPagedFlux( () -> (continuationToken, pageSize) -> - getPagedResult(continuationToken, operationId, top, skip, showStats, context).flux()); + getPagedResult(continuationToken, operationId, top, skip, showStats, context).flux()); + } + + AnalyzeHealthcareEntitiesPagedIterable getHealthcareEntitiesPagedIterable( + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + return new AnalyzeHealthcareEntitiesPagedIterable( + () -> (continuationToken, pageSize) -> + getPagedResultSync(continuationToken, operationId, top, skip, showStats, context)); } Mono> getPagedResult(String continuationToken, @@ -285,28 +277,44 @@ Mono> getPagedResult(St if (service != null) { return service.jobStatusWithResponseAsync(operationId, showStatsValue, topValue, skipValue, context) - .map(this::toHealthcarePagedResponse) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + .map(this::toHealthcarePagedResponse) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } - return legacyService.healthStatusWithResponseAsync(operationId, topValue, skipValue, showStatsValue, context) - .map(this::toTextAnalyticsPagedResponse) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + return legacyService.healthStatusWithResponseAsync(operationId, topValue, skipValue, showStatsValue, + context) + .map(this::toTextAnalyticsPagedResponse) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } else { if (service != null) { return service.jobStatusWithResponseAsync(operationId, showStats, top, skip, context) - .map(this::toHealthcarePagedResponse) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + .map(this::toHealthcarePagedResponse) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } return legacyService.healthStatusWithResponseAsync(operationId, top, skip, showStats, context) - .map(this::toTextAnalyticsPagedResponse) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + .map(this::toTextAnalyticsPagedResponse) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } + PagedResponse getPagedResultSync(String continuationToken, + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = (Integer) continuationTokenMap.getOrDefault("$top", null); + skip = (Integer) continuationTokenMap.getOrDefault("$skip", null); + showStats = (Boolean) continuationTokenMap.getOrDefault(showStats, false); + } + return service != null + ? toHealthcarePagedResponse(service.jobStatusWithResponse( + operationId, showStats, top, skip, context)) + : toTextAnalyticsPagedResponse(legacyService.healthStatusWithResponseSync( + operationId, top, skip, showStats, context)); + } + private PagedResponse toTextAnalyticsPagedResponse( Response response) { final HealthcareJobState healthcareJobState = response.getValue(); @@ -333,7 +341,7 @@ private PagedResponse toTextAnalytics final IterableStream textAnalyticsErrors = IterableStream.of(errors.stream().map(Utility::toTextAnalyticsError).collect(Collectors.toList())); TextAnalyticsExceptionPropertiesHelper.setErrors(textAnalyticsException, textAnalyticsErrors); - throw logger.logExceptionAsError(textAnalyticsException); + throw LOGGER.logExceptionAsError(textAnalyticsException); } return new PagedResponseBase( @@ -375,7 +383,7 @@ private PagedResponse toHealthcarePag final IterableStream textAnalyticsErrors = IterableStream.of(errors.stream().map(Utility::toTextAnalyticsError).collect(Collectors.toList())); TextAnalyticsExceptionPropertiesHelper.setErrors(textAnalyticsException, textAnalyticsErrors); - throw logger.logExceptionAsError(textAnalyticsException); + throw LOGGER.logExceptionAsError(textAnalyticsException); } return new PagedResponseBase( @@ -389,85 +397,155 @@ private PagedResponse toHealthcarePag // Activation operation private Function, - Mono> activationOperation( - Mono operationResult) { + Mono> activationOperation( + Mono operationResult) { return pollingContext -> { try { return operationResult.onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); + } + }; + } + + private Function, + AnalyzeHealthcareEntitiesOperationDetail> activationOperationLanguageApiSync( + Iterable documents, AnalyzeTextLROTask task, String displayName, + Context context) { + return pollingContext -> { + try { + final ResponseBase analyzeResponse = + service.submitJobWithResponse( + new AnalyzeTextJobsInput() + .setDisplayName(displayName) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))) + .setTasks(Arrays.asList(task)), + context); + final AnalyzeHealthcareEntitiesOperationDetail operationDetail = + new AnalyzeHealthcareEntitiesOperationDetail(); + AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + } catch (RuntimeException ex) { + throw LOGGER.logExceptionAsError(ex); } }; } + private Function, + AnalyzeHealthcareEntitiesOperationDetail> activationOperationLegacyApiSync( + Iterable documents, String modelVersion, StringIndexType stringIndexType, + boolean loggingOptOut, Context context) { + return pollingContext -> { + final ResponseBase analyzeResponse = legacyService.healthWithResponseSync( + new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + modelVersion, + stringIndexType, + loggingOptOut, + context); + final AnalyzeHealthcareEntitiesOperationDetail operationDetail = + new AnalyzeHealthcareEntitiesOperationDetail(); + AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }; + } + // Polling operation private Function, - Mono>> - pollingOperation(Function>> pollingFunction) { + Mono>> pollingOperation( + Function>> pollingFunction) { return pollingContext -> { try { final PollResponse operationResultPollResponse = pollingContext.getLatestResponse(); final UUID resultUuid = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); return pollingFunction.apply(resultUuid) - .flatMap(modelResponse -> processAnalyzeModelResponse(modelResponse, operationResultPollResponse)) + .flatMap(modelResponse -> Mono.just( + processHealthcareJobResponseLegacyApi(modelResponse, operationResultPollResponse))) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } private Function, - Mono>> - pollingOperationTextJob(Function>> pollingFunction) { + Mono>> pollingOperationTextJob( + Function>> pollingFunction) { return pollingContext -> { try { final PollResponse operationResultPollResponse = pollingContext.getLatestResponse(); final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); return pollingFunction.apply(operationId) - .flatMap(modelResponse -> - processAnalyzeTextModelResponse(modelResponse, operationResultPollResponse)) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + .flatMap(modelResponse -> + Mono.just(processHealthcareJobResponseLanguageApi(modelResponse, operationResultPollResponse))) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); + } + }; + } + + private Function, + PollResponse> pollingOperationLanguageApiSync( + Function> pollingFunction) { + return pollingContext -> { + try { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processHealthcareJobResponseLanguageApi(pollingFunction.apply(operationId), + operationResultPollResponse); + } catch (RuntimeException ex) { + throw LOGGER.logExceptionAsError((RuntimeException) mapToHttpResponseExceptionIfExists(ex)); } }; } - // Fetching operation private Function, - Mono> + PollResponse> pollingOperationLegacyApiSync( + Function> pollingFunction) { + return pollingContext -> { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processHealthcareJobResponseLegacyApi(pollingFunction.apply(operationId), + operationResultPollResponse); + }; + } + + // Fetching operation + private Function, Mono> fetchingOperation(Function> fetchingFunction) { return pollingContext -> { try { final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); return fetchingFunction.apply(resultUuid); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } - private Function, - Mono> + private Function, Mono> fetchingOperationTextJob(Function> fetchingFunction) { return pollingContext -> { try { final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); return fetchingFunction.apply(resultUuid); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } // Cancel operation private BiFunction, - PollResponse, - Mono> cancelOperation( - Function>> cancelFunction) { + PollResponse, Mono> + cancelOperation(Function>> cancelFunction) { return (activationResponse, pollingContext) -> { final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); try { @@ -480,15 +558,14 @@ Mono> cancelOperation( return operationResult; }).onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } private BiFunction, - PollResponse, - Mono> cancelOperationTextJob( - Function>> cancelFunction) { + PollResponse, Mono> + cancelOperationTextJob(Function>> cancelFunction) { return (activationResponse, pollingContext) -> { final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); try { @@ -501,26 +578,58 @@ Mono> cancelOperationTextJob( return operationResult; }).onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } - // Fetching iterable operation - private Function, - Mono> fetchingOperationIterable( - final Function> fetchingFunction) { - return pollingContext -> { + private BiFunction, + PollResponse, AnalyzeHealthcareEntitiesOperationDetail> + cancelOperationLegacyApiSync(Function> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); + final ResponseBase cancelResponse = + cancelFunction.apply(resultUuid); + final AnalyzeHealthcareEntitiesOperationDetail operationResult = + new AnalyzeHealthcareEntitiesOperationDetail(); + AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; + }; + } + + + private BiFunction, + PollResponse, AnalyzeHealthcareEntitiesOperationDetail> + cancelOperationLanguageApiSync( + Function> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); try { - final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); - return fetchingFunction.apply(resultUuid); + final ResponseBase cancelResponse = + cancelFunction.apply(resultUuid); + final AnalyzeHealthcareEntitiesOperationDetail operationResult = + new AnalyzeHealthcareEntitiesOperationDetail(); + AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; } catch (RuntimeException ex) { - return monoError(logger, ex); + throw LOGGER.logExceptionAsError((RuntimeException) mapToHttpResponseExceptionIfExists(ex)); } }; } - private Mono> processAnalyzeModelResponse( + // Fetching iterable operation + private Function, + AnalyzeHealthcareEntitiesPagedIterable> fetchingOperationIterable( + final Function fetchingFunction) { + return pollingContext -> { + final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(resultUuid); + }; + } + + private PollResponse processHealthcareJobResponseLegacyApi( Response analyzeOperationResultResponse, PollResponse operationResultPollResponse) { LongRunningOperationStatus status; @@ -542,10 +651,10 @@ private Mono> processAnal operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getLastUpdateDateTime()); AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setExpiresAt(operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getExpirationDateTime()); - return Mono.just(new PollResponse<>(status, operationResultPollResponse.getValue())); + return new PollResponse<>(status, operationResultPollResponse.getValue()); } - private Mono> processAnalyzeTextModelResponse( + private PollResponse processHealthcareJobResponseLanguageApi( Response analyzeOperationResultResponse, PollResponse operationResultPollResponse) { LongRunningOperationStatus status; @@ -568,7 +677,7 @@ private Mono> processAnal operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getLastUpdatedDateTime()); AnalyzeHealthcareEntitiesOperationDetailPropertiesHelper.setExpiresAt(operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getExpirationDateTime()); - return Mono.just(new PollResponse<>(status, operationResultPollResponse.getValue())); + return new PollResponse<>(status, operationResultPollResponse.getValue()); } private AnalyzeHealthcareEntitiesOptions getNotNullAnalyzeHealthcareEntitiesOptions( diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentUtilClient.java similarity index 58% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentUtilClient.java index a6cc08f6e6303..f1c6e2cae721e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentUtilClient.java @@ -7,6 +7,7 @@ import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; import com.azure.ai.textanalytics.implementation.Utility; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextSentimentAnalysisInput; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; import com.azure.ai.textanalytics.implementation.models.SentimentAnalysisTaskParameters; @@ -15,6 +16,7 @@ import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -24,11 +26,15 @@ import java.util.Arrays; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getDocumentCount; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; +import static com.azure.ai.textanalytics.implementation.Utility.toAnalyzeSentimentResultCollectionResponseLanguageApi; +import static com.azure.ai.textanalytics.implementation.Utility.toAnalyzeSentimentResultCollectionResponseLegacyApi; import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; @@ -37,20 +43,20 @@ /** * Helper class for managing sentiment analysis endpoint. */ -class AnalyzeSentimentAsyncClient { - private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class); +class AnalyzeSentimentUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(AnalyzeSentimentUtilClient.class); private final TextAnalyticsClientImpl legacyService; private final MicrosoftCognitiveLanguageServiceTextAnalysisImpl service; private final TextAnalyticsServiceVersion serviceVersion; - AnalyzeSentimentAsyncClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { + AnalyzeSentimentUtilClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - AnalyzeSentimentAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, + AnalyzeSentimentUtilClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; @@ -75,27 +81,7 @@ public Mono> analyzeSentimentBatch( try { return withContext(context -> getAnalyzedSentimentResponse(documents, options, context)); } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters that returns a mono {@link Response} - * which contains {@link AnalyzeSentimentResultCollection}. - * - * @param documents The list of documents to analyze sentiments for. - * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when - * analyzing sentiments. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} contains {@link AnalyzeSentimentResultCollection}. - */ - Mono> analyzeSentimentBatchWithContext( - Iterable documents, AnalyzeSentimentOptions options, Context context) { - try { - return getAnalyzedSentimentResponse(documents, options, context); - } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -117,27 +103,25 @@ private Mono> getAnalyzedSentimentRes options = options == null ? new AnalyzeSentimentOptions() : options; if (service != null) { - return service - .analyzeTextWithResponseAsync( - new AnalyzeTextSentimentAnalysisInput() - .setParameters( - new SentimentAnalysisTaskParameters() - .setStringIndexType(StringIndexType.UTF16CODE_UNIT) - .setOpinionMining(options.isIncludeOpinionMining()) - .setModelVersion(options.getModelVersion()) - .setLoggingOptOut(options.isServiceLogsDisabled())) - .setAnalysisInput( - new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), - options.isIncludeStatistics(), - getNotNullContext(context) - .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", - getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Analyzed sentiment for a batch of documents - {}", - response)) - .doOnError(error -> logger.warning("Failed to analyze sentiment - {}", error)) - .map(Utility::toAnalyzeSentimentResultCollectionResponseLanguageApi) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + return service.analyzeTextWithResponseAsync( + new AnalyzeTextSentimentAnalysisInput() + .setParameters( + new SentimentAnalysisTaskParameters() + .setStringIndexType(StringIndexType.UTF16CODE_UNIT) + .setOpinionMining(options.isIncludeOpinionMining()) + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled())) + .setAnalysisInput( + new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), + options.isIncludeStatistics(), + getNotNullContext(context).addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", + getDocumentCount(documents))) + .doOnSuccess(response -> LOGGER.info("Analyzed sentiment for a batch of documents - {}", + response)) + .doOnError(error -> LOGGER.warning("Failed to analyze sentiment - {}", error)) + .map(Utility::toAnalyzeSentimentResultCollectionResponseLanguageApi) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } return legacyService.sentimentWithResponseAsync( @@ -148,14 +132,60 @@ private Mono> getAnalyzedSentimentRes options.isIncludeOpinionMining(), StringIndexType.UTF16CODE_UNIT, getNotNullContext(context).addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Analyzed sentiment for a batch of documents - {}", response)) - .doOnError(error -> logger.warning("Failed to analyze sentiment - {}", error)) + .doOnSuccess(response -> LOGGER.info("Analyzed sentiment for a batch of documents - {}", response)) + .doOnError(error -> LOGGER.warning("Failed to analyze sentiment - {}", error)) .map(Utility::toAnalyzeSentimentResultCollectionResponseLegacyApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } + /** + * Call the service with REST response, convert to a {@link Mono} of {@link Response} which contains + * {@link AnalyzeSentimentResultCollection} from a {@link SimpleResponse} of {@link SentimentResponse}. + * + * @param documents A list of documents to be analyzed. + * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when + * analyzing sentiments. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} contains {@link AnalyzeSentimentResultCollection}. + */ + Response getAnalyzedSentimentResponseSync( + Iterable documents, AnalyzeSentimentOptions options, Context context) { + throwIfCallingNotAvailableFeatureInOptions(options); + inputDocumentsValidation(documents); + options = options == null ? new AnalyzeSentimentOptions() : options; + context = enableSyncRestProxy(getNotNullContext(context)) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); + + try { + return (service != null) + ? toAnalyzeSentimentResultCollectionResponseLanguageApi(service.analyzeTextWithResponse( + new AnalyzeTextSentimentAnalysisInput() + .setParameters( + new SentimentAnalysisTaskParameters() + .setStringIndexType(StringIndexType.UTF16CODE_UNIT) + .setOpinionMining(options.isIncludeOpinionMining()) + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled())) + .setAnalysisInput( + new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), + options.isIncludeStatistics(), + context)) + : toAnalyzeSentimentResultCollectionResponseLegacyApi(legacyService.sentimentWithResponseSync( + new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + options.getModelVersion(), + options.isIncludeStatistics(), + options.isServiceLogsDisabled(), + options.isIncludeOpinionMining(), + StringIndexType.UTF16CODE_UNIT, + context)); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); + } + } + private void throwIfCallingNotAvailableFeatureInOptions(AnalyzeSentimentOptions options) { if (options == null) { return; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageUtilClient.java similarity index 57% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageUtilClient.java index 7bd95f8dd4316..cc2f6b6e201d0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DetectLanguageUtilClient.java @@ -7,6 +7,7 @@ import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; import com.azure.ai.textanalytics.implementation.Utility; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLanguageDetectionInput; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.LanguageBatchInput; import com.azure.ai.textanalytics.implementation.models.LanguageDetectionAnalysisInput; import com.azure.ai.textanalytics.implementation.models.LanguageDetectionTaskParameters; @@ -15,6 +16,7 @@ import com.azure.ai.textanalytics.models.DetectLanguageResult; import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -24,11 +26,15 @@ import java.util.Arrays; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getDocumentCount; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; +import static com.azure.ai.textanalytics.implementation.Utility.toDetectLanguageResultCollectionLanguageApi; +import static com.azure.ai.textanalytics.implementation.Utility.toDetectLanguageResultCollectionLegacyApi; import static com.azure.ai.textanalytics.implementation.Utility.toLanguageInput; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; @@ -37,20 +43,20 @@ /** * Helper class for managing detect language endpoint. */ -class DetectLanguageAsyncClient { - private final ClientLogger logger = new ClientLogger(DetectLanguageAsyncClient.class); +class DetectLanguageUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(DetectLanguageUtilClient.class); private final TextAnalyticsClientImpl legacyService; private final MicrosoftCognitiveLanguageServiceTextAnalysisImpl service; private final TextAnalyticsServiceVersion serviceVersion; - DetectLanguageAsyncClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { + DetectLanguageUtilClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - DetectLanguageAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, + DetectLanguageUtilClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; @@ -70,25 +76,7 @@ Mono> detectLanguageBatch( try { return withContext(context -> getDetectedLanguageResponse(documents, options, context)); } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters with {@link Context}. - * - * @param documents The list of documents to detect languages for. - * @param options The {@link TextAnalyticsRequestOptions} request options. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} which contains {@link DetectLanguageResultCollection}. - */ - Mono> detectLanguageBatchWithContext( - Iterable documents, TextAnalyticsRequestOptions options, Context context) { - try { - return getDetectedLanguageResponse(documents, options, context); - } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -109,25 +97,25 @@ private Mono> getDetectedLanguageRespon options = options == null ? new TextAnalyticsRequestOptions() : options; if (service != null) { return service - .analyzeTextWithResponseAsync( - new AnalyzeTextLanguageDetectionInput() - .setParameters( - new LanguageDetectionTaskParameters() - .setModelVersion(options.getModelVersion()) - .setLoggingOptOut( - options.isServiceLogsDisabled())) - .setAnalysisInput(new LanguageDetectionAnalysisInput() - .setDocuments(toLanguageInput(documents))), - options.isIncludeStatistics(), - getNotNullContext(context) - .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", - getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Detected languages for a batch of documents - {}", - response.getValue())) - .doOnError(error -> logger.warning("Failed to detect language - {}", error)) - .map(Utility::toDetectLanguageResultCollectionResponse2) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + .analyzeTextWithResponseAsync( + new AnalyzeTextLanguageDetectionInput() + .setParameters( + new LanguageDetectionTaskParameters() + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut( + options.isServiceLogsDisabled())) + .setAnalysisInput(new LanguageDetectionAnalysisInput() + .setDocuments(toLanguageInput(documents))), + options.isIncludeStatistics(), + getNotNullContext(context) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", + getDocumentCount(documents))) + .doOnSuccess(response -> LOGGER.info("Detected languages for a batch of documents - {}", + response.getValue())) + .doOnError(error -> LOGGER.warning("Failed to detect language - {}", error)) + .map(Utility::toDetectLanguageResultCollectionLanguageApi) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } return legacyService.languagesWithResponseAsync( @@ -136,15 +124,57 @@ private Mono> getDetectedLanguageRespon options.isIncludeStatistics(), options.isServiceLogsDisabled(), getNotNullContext(context).addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Detected languages for a batch of documents - {}", + .doOnSuccess(response -> LOGGER.info("Detected languages for a batch of documents - {}", response.getValue())) - .doOnError(error -> logger.warning("Failed to detect language - {}", error)) - .map(Utility::toDetectLanguageResultCollectionResponse) + .doOnError(error -> LOGGER.warning("Failed to detect language - {}", error)) + .map(Utility::toDetectLanguageResultCollectionLegacyApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } + /** + * Call the service with REST response, convert to a {@link Response} of + * {@link DetectLanguageResult} from a {@link SimpleResponse} of {@link LanguageResult}. + * + * @param documents The list of documents to detect languages for. + * @param options The {@link TextAnalyticsRequestOptions} request options. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} that contains {@link DetectLanguageResultCollection}. + */ + Response getDetectedLanguageResponseSync( + Iterable documents, TextAnalyticsRequestOptions options, Context context) { + throwIfCallingNotAvailableFeatureInOptions(options); + inputDocumentsValidation(documents); + context = enableSyncRestProxy(getNotNullContext(context) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)); + options = options == null ? new TextAnalyticsRequestOptions() : options; + + try { + return (service != null) + ? toDetectLanguageResultCollectionLanguageApi(service.analyzeTextWithResponse( + new AnalyzeTextLanguageDetectionInput() + .setParameters( + new LanguageDetectionTaskParameters() + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut( + options.isServiceLogsDisabled())) + .setAnalysisInput(new LanguageDetectionAnalysisInput() + .setDocuments(toLanguageInput(documents))), + options.isIncludeStatistics(), + context)) + : toDetectLanguageResultCollectionLegacyApi(legacyService.languagesWithResponseSync( + new LanguageBatchInput().setDocuments(toLanguageInput(documents)), + options.getModelVersion(), + options.isIncludeStatistics(), + options.isServiceLogsDisabled(), + context)); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); + } + } + private void throwIfCallingNotAvailableFeatureInOptions(TextAnalyticsRequestOptions options) { if (options != null && options.isServiceLogsDisabled()) { throwIfTargetServiceVersionFound(this.serviceVersion, Arrays.asList(TextAnalyticsServiceVersion.V3_0), diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DynamicClassificationAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DynamicClassificationUtilClient.java similarity index 59% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DynamicClassificationAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DynamicClassificationUtilClient.java index e17b1637635c8..a2f890889faaf 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DynamicClassificationAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/DynamicClassificationUtilClient.java @@ -8,10 +8,12 @@ import com.azure.ai.textanalytics.implementation.models.AnalyzeTextDynamicClassificationInput; import com.azure.ai.textanalytics.implementation.models.ClassificationType; import com.azure.ai.textanalytics.implementation.models.DynamicClassificationTaskParameters; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; import com.azure.ai.textanalytics.models.DynamicClassificationOptions; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.DynamicClassifyDocumentResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.core.util.IterableStream; @@ -22,11 +24,14 @@ import java.util.stream.Collectors; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getDocumentCount; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; +import static com.azure.ai.textanalytics.implementation.Utility.toDynamicClassifyDocumentResultCollectionResponse; import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; @@ -35,14 +40,14 @@ /** * Helper class for managing dynamic classification endpoints. */ -class DynamicClassificationAsyncClient { - private final ClientLogger logger = new ClientLogger(DynamicClassificationAsyncClient.class); +class DynamicClassificationUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(DynamicClassificationUtilClient.class); private final MicrosoftCognitiveLanguageServiceTextAnalysisImpl service; private final TextAnalyticsServiceVersion serviceVersion; - DynamicClassificationAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, - TextAnalyticsServiceVersion serviceVersion) { + DynamicClassificationUtilClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, + TextAnalyticsServiceVersion serviceVersion) { this.service = service; this.serviceVersion = serviceVersion; } @@ -53,7 +58,7 @@ Mono> dynamicClassifyBatch( return withContext(context -> getDynamicClassifyDocumentResultCollectionResponse( documents, options, context)); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -67,7 +72,8 @@ Mono> getDynamicClassifyDocume inputDocumentsValidation(documents); options = getNotNullDynamicClassificationOptions(options); - final com.azure.ai.textanalytics.models.ClassificationType finalClassificationType = options.getClassificationType(); + final com.azure.ai.textanalytics.models.ClassificationType finalClassificationType = + options.getClassificationType(); return service.analyzeTextWithResponseAsync( new AnalyzeTextDynamicClassificationInput() @@ -82,13 +88,47 @@ Mono> getDynamicClassifyDocume options.isIncludeStatistics(), getNotNullContext(context).addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Analyze dynamic classification for a batch of documents - {}", response)) - .doOnError(error -> logger.warning("Failed to analyze dynamic classification - {}", error)) + .doOnSubscribe(ignoredValue -> + LOGGER.info("A batch of documents with count - {}", getDocumentCount(documents))) + .doOnSuccess(response -> + LOGGER.info("Analyze dynamic classification for a batch of documents - {}", response)) + .doOnError(error -> LOGGER.warning("Failed to analyze dynamic classification - {}", error)) .map(Utility::toDynamicClassifyDocumentResultCollectionResponse) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } + Response getResultCollectionResponseSync( + Iterable documents, DynamicClassificationOptions options, Context context) { + throwIfTargetServiceVersionFound(this.serviceVersion, + Arrays.asList(TextAnalyticsServiceVersion.V3_0, TextAnalyticsServiceVersion.V3_1, + TextAnalyticsServiceVersion.V2022_05_01), + getUnsupportedServiceApiVersionMessage("Dynamic Classification", serviceVersion, + TextAnalyticsServiceVersion.V2022_10_01_PREVIEW)); + inputDocumentsValidation(documents); + options = getNotNullDynamicClassificationOptions(options); + + final com.azure.ai.textanalytics.models.ClassificationType finalClassificationType = + options.getClassificationType(); + try { + return toDynamicClassifyDocumentResultCollectionResponse(service.analyzeTextWithResponse( + new AnalyzeTextDynamicClassificationInput() + .setParameters( + new DynamicClassificationTaskParameters() + .setCategories( + IterableStream.of(options.getCategories()).stream().collect(Collectors.toList())) + .setClassificationType(finalClassificationType == null ? null + : ClassificationType.fromString(finalClassificationType.toString())) + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled())) + .setAnalysisInput(new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), + options.isIncludeStatistics(), + enableSyncRestProxy(getNotNullContext(context)) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE))); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); + } + } + private DynamicClassificationOptions getNotNullDynamicClassificationOptions( DynamicClassificationOptions options) { return options == null ? new DynamicClassificationOptions() : options; diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseUtilClient.java similarity index 63% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseUtilClient.java index a84eaf7215c7d..b8408883e2192 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractKeyPhraseUtilClient.java @@ -7,6 +7,7 @@ import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl; import com.azure.ai.textanalytics.implementation.Utility; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextKeyPhraseExtractionInput; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.KeyPhraseResult; import com.azure.ai.textanalytics.implementation.models.KeyPhraseTaskParameters; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; @@ -16,6 +17,7 @@ import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -27,12 +29,16 @@ import java.util.Objects; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getDocumentCount; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; +import static com.azure.ai.textanalytics.implementation.Utility.toResultCollectionResponseLanguageApi; +import static com.azure.ai.textanalytics.implementation.Utility.toResultCollectionResponseLegacyApi; import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsException; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; @@ -41,20 +47,20 @@ /** * Helper class for managing extract key phrase endpoint. */ -class ExtractKeyPhraseAsyncClient { - private final ClientLogger logger = new ClientLogger(ExtractKeyPhraseAsyncClient.class); +class ExtractKeyPhraseUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(ExtractKeyPhraseUtilClient.class); private final TextAnalyticsClientImpl legacyService; private final MicrosoftCognitiveLanguageServiceTextAnalysisImpl service; private final TextAnalyticsServiceVersion serviceVersion; - ExtractKeyPhraseAsyncClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { + ExtractKeyPhraseUtilClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - ExtractKeyPhraseAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, + ExtractKeyPhraseUtilClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; @@ -80,16 +86,15 @@ Mono extractKeyPhrasesSingleText(String document, String l // for each loop will have only one entry inside for (ExtractKeyPhraseResult keyPhraseResult : resultCollectionResponse.getValue()) { if (keyPhraseResult.isError()) { - throw logger.logExceptionAsError(toTextAnalyticsException(keyPhraseResult.getError())); + throw LOGGER.logExceptionAsError(toTextAnalyticsException(keyPhraseResult.getError())); } keyPhrasesCollection = new KeyPhrasesCollection(keyPhraseResult.getKeyPhrases(), keyPhraseResult.getKeyPhrases().getWarnings()); } return keyPhrasesCollection; }); - } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -106,26 +111,7 @@ Mono> extractKeyPhrasesWithResponse( try { return withContext(context -> getExtractedKeyPhrasesResponse(documents, options, context)); } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters that returns a {@link Response} - * which contains {@link ExtractKeyPhrasesResultCollection}. - * - * @param documents A list of documents to extract key phrases for. - * @param options The {@link TextAnalyticsRequestOptions} request options. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} which contains {@link ExtractKeyPhrasesResultCollection}. - */ - Mono> extractKeyPhrasesBatchWithContext( - Iterable documents, TextAnalyticsRequestOptions options, Context context) { - try { - return getExtractedKeyPhrasesResponse(documents, options, context); - } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -146,24 +132,23 @@ private Mono> getExtractedKeyPhrases options = options == null ? new TextAnalyticsRequestOptions() : options; if (service != null) { - return service - .analyzeTextWithResponseAsync( - new AnalyzeTextKeyPhraseExtractionInput() - .setParameters( - new KeyPhraseTaskParameters() - .setModelVersion(options.getModelVersion()) - .setLoggingOptOut(options.isServiceLogsDisabled())) - .setAnalysisInput( - new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), - options.isIncludeStatistics(), - getNotNullContext(context) - .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", - getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("A batch of key phrases output - {}", response.getValue())) - .doOnError(error -> logger.warning("Failed to extract key phrases - {}", error)) - .map(Utility::toExtractKeyPhrasesResultCollectionResponse2) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + return service.analyzeTextWithResponseAsync( + new AnalyzeTextKeyPhraseExtractionInput() + .setParameters( + new KeyPhraseTaskParameters() + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled())) + .setAnalysisInput( + new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), + options.isIncludeStatistics(), + getNotNullContext(context) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", + getDocumentCount(documents))) + .doOnSuccess(response -> LOGGER.info("A batch of key phrases output - {}", response.getValue())) + .doOnError(error -> LOGGER.warning("Failed to extract key phrases - {}", error)) + .map(Utility::toResultCollectionResponseLanguageApi) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } return legacyService.keyPhrasesWithResponseAsync( @@ -172,14 +157,54 @@ private Mono> getExtractedKeyPhrases options.isIncludeStatistics(), options.isServiceLogsDisabled(), getNotNullContext(context).addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) - .doOnSubscribe(ignoredValue -> logger.info("A batch of document with count - {}", + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of document with count - {}", getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("A batch of key phrases output - {}", response.getValue())) - .doOnError(error -> logger.warning("Failed to extract key phrases - {}", error)) - .map(Utility::toExtractKeyPhrasesResultCollectionResponse) + .doOnSuccess(response -> LOGGER.info("A batch of key phrases output - {}", response.getValue())) + .doOnError(error -> LOGGER.warning("Failed to extract key phrases - {}", error)) + .map(Utility::toResultCollectionResponseLegacyApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } + /** + * Call the service with REST response, convert to a {@link Response} which contains + * {@link ExtractKeyPhrasesResultCollection} from a {@link SimpleResponse} of {@link KeyPhraseResult}. + * + * @param documents A list of documents to extract key phrases for. + * @param options The {@link TextAnalyticsRequestOptions} request options. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} that contains {@link ExtractKeyPhrasesResultCollection}. + */ + Response getExtractedKeyPhrasesResponseSync( + Iterable documents, TextAnalyticsRequestOptions options, Context context) { + throwIfCallingNotAvailableFeatureInOptions(options); + inputDocumentsValidation(documents); + options = options == null ? new TextAnalyticsRequestOptions() : options; + context = enableSyncRestProxy(getNotNullContext(context)) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); + try { + return (service != null) + ? toResultCollectionResponseLanguageApi(service.analyzeTextWithResponse( + new AnalyzeTextKeyPhraseExtractionInput() + .setParameters( + new KeyPhraseTaskParameters() + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled())) + .setAnalysisInput( + new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), + options.isIncludeStatistics(), + context)) + : toResultCollectionResponseLegacyApi(legacyService.keyPhrasesWithResponseSync( + new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + options.getModelVersion(), + options.isIncludeStatistics(), + options.isServiceLogsDisabled(), + context)); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); + } + } + private void throwIfCallingNotAvailableFeatureInOptions(TextAnalyticsRequestOptions options) { if (options != null && options.isServiceLogsDisabled()) { throwIfTargetServiceVersionFound(this.serviceVersion, Arrays.asList(TextAnalyticsServiceVersion.V3_0), diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/LabelClassifyAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/LabelClassifyUtilClient.java similarity index 74% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/LabelClassifyAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/LabelClassifyUtilClient.java index 79e91024900ad..cd473688058c8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/LabelClassifyAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/LabelClassifyUtilClient.java @@ -11,7 +11,9 @@ import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobState; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobsInput; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROResult; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROTask; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsCancelJobHeaders; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsSubmitJobHeaders; import com.azure.ai.textanalytics.implementation.models.CustomLabelClassificationResult; import com.azure.ai.textanalytics.implementation.models.CustomMultiLabelClassificationLROResult; import com.azure.ai.textanalytics.implementation.models.CustomMultiLabelClassificationLROTask; @@ -20,6 +22,7 @@ import com.azure.ai.textanalytics.implementation.models.CustomSingleLabelClassificationLROTask; import com.azure.ai.textanalytics.implementation.models.CustomSingleLabelClassificationTaskParameters; import com.azure.ai.textanalytics.implementation.models.Error; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; import com.azure.ai.textanalytics.implementation.models.RequestStatistics; import com.azure.ai.textanalytics.implementation.models.State; @@ -33,6 +36,7 @@ import com.azure.ai.textanalytics.util.ClassifyDocumentPagedFlux; import com.azure.ai.textanalytics.util.ClassifyDocumentPagedIterable; import com.azure.ai.textanalytics.util.ClassifyDocumentResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; @@ -45,6 +49,7 @@ import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.SyncPoller; import reactor.core.publisher.Mono; import java.util.Arrays; @@ -57,9 +62,11 @@ import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; import static com.azure.ai.textanalytics.implementation.Utility.DEFAULT_POLL_INTERVAL; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink; import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; @@ -72,13 +79,13 @@ import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY; -class LabelClassifyAsyncClient { - private static final ClientLogger LOGGER = new ClientLogger(LabelClassifyAsyncClient.class); +class LabelClassifyUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(LabelClassifyUtilClient.class); private final AnalyzeTextsImpl service; private final TextAnalyticsServiceVersion serviceVersion; - LabelClassifyAsyncClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { + LabelClassifyUtilClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { this.service = service; this.serviceVersion = serviceVersion; } @@ -136,7 +143,7 @@ PollerFlux singleLab } } - PollerFlux singleLabelClassifyPagedIterable( + SyncPoller singleLabelClassifyPagedIterable( Iterable documents, String projectName, String deploymentName, SingleLabelClassifyOptions options, Context context) { try { @@ -146,46 +153,30 @@ PollerFlux singl TextAnalyticsServiceVersion.V2022_05_01)); inputDocumentsValidation(documents); options = getNotNullSingleLabelClassifyOptions(options); - final Context finalContext = getNotNullContext(context) + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)) .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); final boolean finalIncludeStatistics = options.isIncludeStatistics(); final boolean finalLoggingOptOut = options.isServiceLogsDisabled(); final String displayName = options.getDisplayName(); - - return new PollerFlux<>( + final CustomSingleLabelClassificationLROTask task = + new CustomSingleLabelClassificationLROTask().setParameters( + new CustomSingleLabelClassificationTaskParameters() + .setProjectName(projectName) + .setDeploymentName(deploymentName) + .setLoggingOptOut(finalLoggingOptOut)); + return SyncPoller.createPoller( DEFAULT_POLL_INTERVAL, - activationOperation( - service.submitJobWithResponseAsync( - new AnalyzeTextJobsInput() - .setDisplayName(displayName) - .setAnalysisInput( - new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))) - .setTasks(Arrays.asList( - new CustomSingleLabelClassificationLROTask().setParameters( - new CustomSingleLabelClassificationTaskParameters() - .setProjectName(projectName) - .setDeploymentName(deploymentName) - .setLoggingOptOut(finalLoggingOptOut)))), - finalContext) - .map(responseBase -> { - final ClassifyDocumentOperationDetail operationDetail = - new ClassifyDocumentOperationDetail(); - ClassifyDocumentOperationDetailPropertiesHelper.setOperationId(operationDetail, - parseOperationId(responseBase.getDeserializedHeaders().getOperationLocation())); - return operationDetail; - })), - pollingOperationTextJob( - operationId -> service.jobStatusWithResponseAsync(operationId, - finalIncludeStatistics, null, null, finalContext)), - cancelOperationTextJob( - operationId -> service.cancelJobWithResponseAsync(operationId, finalContext)), - fetchingOperationIterable( - operationId -> Mono.just(new ClassifyDocumentPagedIterable( - getClassifyDocumentPagedFlux(operationId, null, null, - finalIncludeStatistics, finalContext)))) + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationSync(documents, task, displayName, finalContext).apply(cxt)), + pollingOperationTextJobSync(operationId -> service.jobStatusWithResponse(operationId, + finalIncludeStatistics, null, null, finalContext)), + cancelOperationTextJobSync(operationId -> service.cancelJobWithResponse(operationId, finalContext)), + fetchingOperationSync( + operationId -> getClassifyDocumentPagedIterable(operationId, null, null, + finalIncludeStatistics, finalContext)) ); - } catch (RuntimeException ex) { - return PollerFlux.error(ex); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); } } @@ -242,7 +233,7 @@ PollerFlux multiLabe } } - PollerFlux multiLabelClassifyPagedIterable( + SyncPoller multiLabelClassifyPagedIterable( Iterable documents, String projectName, String deploymentName, MultiLabelClassifyOptions options, Context context) { try { @@ -252,46 +243,29 @@ PollerFlux multi TextAnalyticsServiceVersion.V2022_05_01)); inputDocumentsValidation(documents); options = getNotNullMultiLabelClassifyOptions(options); - final Context finalContext = getNotNullContext(context) + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)) .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); final boolean finalIncludeStatistics = options.isIncludeStatistics(); final boolean finalLoggingOptOut = options.isServiceLogsDisabled(); final String displayName = options.getDisplayName(); - - return new PollerFlux<>( + final CustomMultiLabelClassificationLROTask task = new CustomMultiLabelClassificationLROTask() + .setParameters( + new CustomMultiLabelClassificationTaskParameters() + .setProjectName(projectName) + .setDeploymentName(deploymentName) + .setLoggingOptOut(finalLoggingOptOut)); + return SyncPoller.createPoller( DEFAULT_POLL_INTERVAL, - activationOperation( - service.submitJobWithResponseAsync( - new AnalyzeTextJobsInput() - .setDisplayName(displayName) - .setAnalysisInput( - new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))) - .setTasks(Arrays.asList( - new CustomMultiLabelClassificationLROTask().setParameters( - new CustomMultiLabelClassificationTaskParameters() - .setProjectName(projectName) - .setDeploymentName(deploymentName) - .setLoggingOptOut(finalLoggingOptOut)))), - finalContext) - .map(responseBase -> { - final ClassifyDocumentOperationDetail operationDetail = - new ClassifyDocumentOperationDetail(); - ClassifyDocumentOperationDetailPropertiesHelper.setOperationId(operationDetail, - parseOperationId(responseBase.getDeserializedHeaders().getOperationLocation())); - return operationDetail; - })), - pollingOperationTextJob( - operationId -> service.jobStatusWithResponseAsync(operationId, - finalIncludeStatistics, null, null, finalContext)), - cancelOperationTextJob( - operationId -> service.cancelJobWithResponseAsync(operationId, finalContext)), - fetchingOperationIterable( - operationId -> Mono.just(new ClassifyDocumentPagedIterable( - getClassifyDocumentPagedFlux(operationId, null, null, - finalIncludeStatistics, finalContext)))) - ); - } catch (RuntimeException ex) { - return PollerFlux.error(ex); + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationSync(documents, task, displayName, finalContext).apply(cxt)), + pollingOperationTextJobSync(operationId -> service.jobStatusWithResponse(operationId, + finalIncludeStatistics, null, null, finalContext)), + cancelOperationTextJobSync(operationId -> service.cancelJobWithResponse(operationId, finalContext)), + fetchingOperationSync( + operationId -> getClassifyDocumentPagedIterable(operationId, null, null, + finalIncludeStatistics, finalContext))); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); } } @@ -302,6 +276,13 @@ ClassifyDocumentPagedFlux getClassifyDocumentPagedFlux( getPagedResult(continuationToken, operationId, top, skip, showStats, context).flux()); } + ClassifyDocumentPagedIterable getClassifyDocumentPagedIterable( + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + return new ClassifyDocumentPagedIterable( + () -> (continuationToken, pageSize) -> + getPagedResultSync(continuationToken, operationId, top, skip, showStats, context)); + } + Mono> getPagedResult(String continuationToken, UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { try { @@ -324,6 +305,18 @@ Mono> getPagedResult(String cont } } + PagedResponse getPagedResultSync(String continuationToken, + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = (Integer) continuationTokenMap.getOrDefault("$top", null); + skip = (Integer) continuationTokenMap.getOrDefault("$skip", null); + showStats = (Boolean) continuationTokenMap.getOrDefault(showStats, false); + } + return toClassifyDocumentResultCollectionPagedResponse(service.jobStatusWithResponse( + operationId, showStats, top, skip, context)); + } + private PagedResponse toClassifyDocumentResultCollectionPagedResponse( Response response) { @@ -389,6 +382,25 @@ Mono> activationOperation( }; } + private Function, ClassifyDocumentOperationDetail> + activationOperationSync(Iterable documents, AnalyzeTextLROTask task, String displayName, + Context context) { + return pollingContext -> { + final ResponseBase analyzeResponse = + service.submitJobWithResponse( + new AnalyzeTextJobsInput() + .setDisplayName(displayName) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))) + .setTasks(Arrays.asList(task)), + context); + final ClassifyDocumentOperationDetail operationDetail = new ClassifyDocumentOperationDetail(); + ClassifyDocumentOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }; + } + // Polling operation private Function, Mono>> pollingOperationTextJob( @@ -400,7 +412,7 @@ Mono>> pollingOperationTextJob( final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); return pollingFunction.apply(operationId) .flatMap(modelResponse -> - processAnalyzeTextModelResponse(modelResponse, operationResultPollResponse)) + Mono.just(processAnalyzeTextModelResponse(modelResponse, operationResultPollResponse))) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { return monoError(LOGGER, ex); @@ -408,6 +420,17 @@ Mono>> pollingOperationTextJob( }; } + private Function, + PollResponse> pollingOperationTextJobSync( + Function> pollingFunction) { + return pollingContext -> { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processAnalyzeTextModelResponse(pollingFunction.apply(operationId), operationResultPollResponse); + }; + } + // Fetching operation private Function, Mono> fetchingOperationTextJob( @@ -422,6 +445,15 @@ Mono> fetchingOperationTextJob( }; } + private Function, + ClassifyDocumentPagedIterable> fetchingOperationSync( + final Function fetchingFunction) { + return pollingContext -> { + final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(resultUuid); + }; + } + // Cancel operation private BiFunction, PollResponse, @@ -443,21 +475,21 @@ Mono> cancelOperationTextJob( }; } - // Fetching iterable operation - private Function, - Mono> fetchingOperationIterable( - final Function> fetchingFunction) { - return pollingContext -> { - try { - final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); - return fetchingFunction.apply(resultUuid); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); - } + private BiFunction, + PollResponse, + ClassifyDocumentOperationDetail> cancelOperationTextJobSync( + Function> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); + ResponseBase cancelJobResponse = cancelFunction.apply(resultUuid); + final ClassifyDocumentOperationDetail operationResult = new ClassifyDocumentOperationDetail(); + ClassifyDocumentOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelJobResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; }; } - private Mono> processAnalyzeTextModelResponse( + private PollResponse processAnalyzeTextModelResponse( Response analyzeOperationResultResponse, PollResponse operationResultPollResponse) { LongRunningOperationStatus status; @@ -480,7 +512,7 @@ private Mono> processAnalyzeTextMo operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getLastUpdatedDateTime()); ClassifyDocumentOperationDetailPropertiesHelper.setExpiresAt(operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getExpirationDateTime()); - return Mono.just(new PollResponse<>(status, operationResultPollResponse.getValue())); + return new PollResponse<>(status, operationResultPollResponse.getValue()); } private SingleLabelClassifyOptions getNotNullSingleLabelClassifyOptions(SingleLabelClassifyOptions options) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeCustomEntitiesAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeCustomEntitiesUtilClient.java similarity index 72% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeCustomEntitiesAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeCustomEntitiesUtilClient.java index b1c398db5e4ac..e093e101135b7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeCustomEntitiesAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeCustomEntitiesUtilClient.java @@ -12,12 +12,15 @@ import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobState; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobsInput; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROResult; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROTask; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsCancelJobHeaders; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsSubmitJobHeaders; import com.azure.ai.textanalytics.implementation.models.CustomEntitiesLROTask; import com.azure.ai.textanalytics.implementation.models.CustomEntitiesResult; import com.azure.ai.textanalytics.implementation.models.CustomEntitiesTaskParameters; import com.azure.ai.textanalytics.implementation.models.CustomEntityRecognitionLROResult; import com.azure.ai.textanalytics.implementation.models.Error; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; import com.azure.ai.textanalytics.implementation.models.RequestStatistics; import com.azure.ai.textanalytics.implementation.models.State; @@ -30,6 +33,7 @@ import com.azure.ai.textanalytics.util.RecognizeCustomEntitiesPagedFlux; import com.azure.ai.textanalytics.util.RecognizeCustomEntitiesPagedIterable; import com.azure.ai.textanalytics.util.RecognizeCustomEntitiesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; @@ -42,6 +46,7 @@ import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.SyncPoller; import reactor.core.publisher.Mono; import java.util.Arrays; @@ -54,9 +59,11 @@ import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; import static com.azure.ai.textanalytics.implementation.Utility.DEFAULT_POLL_INTERVAL; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink; import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; @@ -69,14 +76,14 @@ import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY; -class RecognizeCustomEntitiesAsyncClient { - private final ClientLogger logger = new ClientLogger(RecognizeCustomEntitiesAsyncClient.class); +class RecognizeCustomEntitiesUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(RecognizeCustomEntitiesUtilClient.class); + private final AnalyzeTextsImpl service; private final TextAnalyticsServiceVersion serviceVersion; - RecognizeCustomEntitiesAsyncClient(AnalyzeTextsImpl service, - TextAnalyticsServiceVersion serviceVersion) { + RecognizeCustomEntitiesUtilClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { this.service = service; this.serviceVersion = serviceVersion; } @@ -135,7 +142,7 @@ PollerFlux + SyncPoller recognizeCustomEntitiesPagedIterable(Iterable documents, String projectName, String deploymentName, RecognizeCustomEntitiesOptions options, Context context) { try { @@ -145,48 +152,32 @@ PollerFlux( + final CustomEntitiesLROTask task = new CustomEntitiesLROTask().setParameters( + new CustomEntitiesTaskParameters() + .setStringIndexType(finalStringIndexType) + .setProjectName(projectName) + .setDeploymentName(deploymentName) + .setLoggingOptOut(finalLoggingOptOut)); + + return SyncPoller.createPoller( DEFAULT_POLL_INTERVAL, - activationOperation( - service.submitJobWithResponseAsync( - new AnalyzeTextJobsInput() - .setDisplayName(displayName) - .setAnalysisInput( - new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))) - .setTasks(Arrays.asList( - new CustomEntitiesLROTask().setParameters( - new CustomEntitiesTaskParameters() - .setStringIndexType(finalStringIndexType) - .setProjectName(projectName) - .setDeploymentName(deploymentName) - .setLoggingOptOut(finalLoggingOptOut)))), - finalContext) - .map(responseBase -> { - final RecognizeCustomEntitiesOperationDetail operationDetail = - new RecognizeCustomEntitiesOperationDetail(); - RecognizeCustomEntitiesOperationDetailPropertiesHelper.setOperationId(operationDetail, - parseOperationId(responseBase.getDeserializedHeaders().getOperationLocation())); - return operationDetail; - })), - pollingOperationTextJob( - operationId -> service.jobStatusWithResponseAsync(operationId, - finalIncludeStatistics, null, null, finalContext)), - cancelOperationTextJob( - operationId -> service.cancelJobWithResponseAsync(operationId, finalContext)), - fetchingOperationIterable( - operationId -> Mono.just(new RecognizeCustomEntitiesPagedIterable( - getRecognizeCustomEntitiesPagedFlux(operationId, null, null, - finalIncludeStatistics, finalContext)))) - ); - } catch (RuntimeException ex) { - return PollerFlux.error(ex); + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationSync(documents, task, displayName, finalContext).apply(cxt)), + pollingOperationTextJobSync(operationId -> service.jobStatusWithResponse(operationId, + finalIncludeStatistics, null, null, finalContext)), + cancelOperationTextJobSync(operationId -> service.cancelJobWithResponse(operationId, finalContext)), + fetchingOperationSync( + operationId -> getRecognizeCustomEntitiesPagedIterable(operationId, null, null, + finalIncludeStatistics, finalContext))); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); } } @@ -197,6 +188,14 @@ RecognizeCustomEntitiesPagedFlux getRecognizeCustomEntitiesPagedFlux( getPagedResult(continuationToken, operationId, top, skip, showStats, context).flux()); } + RecognizeCustomEntitiesPagedIterable getRecognizeCustomEntitiesPagedIterable( + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + return new RecognizeCustomEntitiesPagedIterable( + () -> (continuationToken, pageSize) -> + getPagedResultSync(continuationToken, operationId, top, skip, showStats, context) + ); + } + Mono> getPagedResult(String continuationToken, UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { try { @@ -215,8 +214,19 @@ Mono> getPagedResult(Stri .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); + } + } + + PagedResponse getPagedResultSync(String continuationToken, + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = (Integer) continuationTokenMap.getOrDefault("$top", null); + skip = (Integer) continuationTokenMap.getOrDefault("$skip", null); + showStats = (Boolean) continuationTokenMap.getOrDefault(showStats, false); } + return toCustomEntitiesPagedResponse(service.jobStatusWithResponse(operationId, showStats, top, skip, context)); } private PagedResponse toCustomEntitiesPagedResponse( @@ -247,7 +257,7 @@ private PagedResponse toCustomEntitiesP final IterableStream textAnalyticsErrors = IterableStream.of(errors.stream().map(Utility::toTextAnalyticsError).collect(Collectors.toList())); TextAnalyticsExceptionPropertiesHelper.setErrors(textAnalyticsException, textAnalyticsErrors); - throw logger.logExceptionAsError(textAnalyticsException); + throw LOGGER.logExceptionAsError(textAnalyticsException); } return new PagedResponseBase( @@ -267,11 +277,31 @@ Mono> activationOperation( try { return operationResult.onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } + private Function, RecognizeCustomEntitiesOperationDetail> + activationOperationSync(Iterable documents, AnalyzeTextLROTask task, String displayName, + Context context) { + return pollingContext -> { + final ResponseBase analyzeResponse = + service.submitJobWithResponse( + new AnalyzeTextJobsInput() + .setDisplayName(displayName) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))) + .setTasks(Arrays.asList(task)), + context); + final RecognizeCustomEntitiesOperationDetail operationDetail = + new RecognizeCustomEntitiesOperationDetail(); + RecognizeCustomEntitiesOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }; + } + // Polling operation private Function, Mono>> pollingOperationTextJob( @@ -283,14 +313,25 @@ Mono>> pollingOperationText final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); return pollingFunction.apply(operationId) .flatMap(modelResponse -> - processAnalyzeTextModelResponse(modelResponse, operationResultPollResponse)) + Mono.just(processAnalyzeTextModelResponse(modelResponse, operationResultPollResponse))) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } + private Function, + PollResponse> pollingOperationTextJobSync( + Function> pollingFunction) { + return pollingContext -> { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processAnalyzeTextModelResponse(pollingFunction.apply(operationId), operationResultPollResponse); + }; + } + // Fetching operation private Function, Mono> fetchingOperationTextJob( @@ -300,11 +341,20 @@ Mono> fetchingOperationTextJob( final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); return fetchingFunction.apply(resultUuid); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } + private Function, + RecognizeCustomEntitiesPagedIterable> fetchingOperationSync( + final Function fetchingFunction) { + return pollingContext -> { + final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(resultUuid); + }; + } + // Cancel operation private BiFunction, PollResponse, @@ -322,26 +372,26 @@ Mono> cancelOperationTextJob( return operationResult; }).onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } }; } - // Fetching iterable operation - private Function, - Mono> fetchingOperationIterable( - final Function> fetchingFunction) { - return pollingContext -> { - try { - final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); - return fetchingFunction.apply(resultUuid); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + private BiFunction, + PollResponse, RecognizeCustomEntitiesOperationDetail> + cancelOperationTextJobSync(Function> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); + ResponseBase cancelJobResponse = cancelFunction.apply(resultUuid); + final RecognizeCustomEntitiesOperationDetail operationResult = + new RecognizeCustomEntitiesOperationDetail(); + RecognizeCustomEntitiesOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelJobResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; }; } - private Mono> processAnalyzeTextModelResponse( + private PollResponse processAnalyzeTextModelResponse( Response analyzeOperationResultResponse, PollResponse operationResultPollResponse) { LongRunningOperationStatus status; @@ -364,7 +414,7 @@ private Mono> processAnalyz operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getLastUpdatedDateTime()); RecognizeCustomEntitiesOperationDetailPropertiesHelper.setExpiresAt(operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getExpirationDateTime()); - return Mono.just(new PollResponse<>(status, operationResultPollResponse.getValue())); + return new PollResponse<>(status, operationResultPollResponse.getValue()); } private RecognizeCustomEntitiesOptions getNotNullRecognizeCustomEntitiesOptions( diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityUtilClient.java similarity index 63% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityUtilClient.java index 7d94aa64b96af..aa45c8a4aef82 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeEntityUtilClient.java @@ -9,6 +9,7 @@ import com.azure.ai.textanalytics.implementation.models.AnalyzeTextEntityRecognitionInput; import com.azure.ai.textanalytics.implementation.models.EntitiesResult; import com.azure.ai.textanalytics.implementation.models.EntitiesTaskParameters; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; import com.azure.ai.textanalytics.implementation.models.StringIndexType; @@ -17,6 +18,7 @@ import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -28,12 +30,16 @@ import java.util.Objects; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getDocumentCount; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; +import static com.azure.ai.textanalytics.implementation.Utility.toRecognizeEntitiesResultCollectionResponseLanguageApi; +import static com.azure.ai.textanalytics.implementation.Utility.toRecognizeEntitiesResultCollectionResponseLegacyApi; import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsException; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; @@ -42,20 +48,20 @@ /** * Helper class for managing recognize entity endpoint. */ -class RecognizeEntityAsyncClient { - private final ClientLogger logger = new ClientLogger(RecognizeEntityAsyncClient.class); +class RecognizeEntityUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(RecognizeEntityUtilClient.class); private final TextAnalyticsClientImpl legacyService; private final MicrosoftCognitiveLanguageServiceTextAnalysisImpl service; private final TextAnalyticsServiceVersion serviceVersion; - RecognizeEntityAsyncClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { + RecognizeEntityUtilClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - RecognizeEntityAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, + RecognizeEntityUtilClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; @@ -82,7 +88,7 @@ Mono recognizeEntities(String document, String lang // for each loop will have only one entry inside for (RecognizeEntitiesResult entitiesResult : resultCollectionResponse.getValue()) { if (entitiesResult.isError()) { - throw logger.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); + throw LOGGER.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); } entityCollection = new CategorizedEntityCollection(entitiesResult.getEntities(), entitiesResult.getEntities().getWarnings()); @@ -90,7 +96,7 @@ Mono recognizeEntities(String document, String lang return entityCollection; }); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -107,25 +113,7 @@ Mono> recognizeEntitiesBatch( try { return withContext(context -> getRecognizedEntitiesResponse(documents, options, context)); } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters with {@link Context} is given. - * - * @param documents The list of documents to recognize entities for. - * @param options The {@link TextAnalyticsRequestOptions} request options. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} that contains {@link RecognizeEntitiesResultCollection}. - */ - Mono> recognizeEntitiesBatchWithContext( - Iterable documents, TextAnalyticsRequestOptions options, Context context) { - try { - return getRecognizedEntitiesResponse(documents, options, context); - } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -152,25 +140,24 @@ private Mono> getRecognizedEntitiesR final boolean finalIncludeStatistics = options.isIncludeStatistics(); if (service != null) { - return service - .analyzeTextWithResponseAsync( - new AnalyzeTextEntityRecognitionInput() - .setParameters( - new EntitiesTaskParameters() - .setStringIndexType(finalStringIndexType) - .setModelVersion(finalModelVersion) - .setLoggingOptOut(finalLoggingOptOut)) - .setAnalysisInput(new MultiLanguageAnalysisInput() - .setDocuments(toMultiLanguageInput(documents))), - finalIncludeStatistics, - finalContext) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", - getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Recognized entities for a batch of documents- {}", - response.getValue())) - .doOnError(error -> logger.warning("Failed to recognize entities - {}", error)) - .map(Utility::toRecognizeEntitiesResultCollectionResponseLanguageApi) - .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + return service.analyzeTextWithResponseAsync( + new AnalyzeTextEntityRecognitionInput() + .setParameters( + new EntitiesTaskParameters() + .setStringIndexType(finalStringIndexType) + .setModelVersion(finalModelVersion) + .setLoggingOptOut(finalLoggingOptOut)) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))), + finalIncludeStatistics, + finalContext) + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", + getDocumentCount(documents))) + .doOnSuccess(response -> LOGGER.info("Recognized entities for a batch of documents- {}", + response.getValue())) + .doOnError(error -> LOGGER.warning("Failed to recognize entities - {}", error)) + .map(Utility::toRecognizeEntitiesResultCollectionResponseLanguageApi) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } return legacyService.entitiesRecognitionGeneralWithResponseAsync( @@ -180,15 +167,62 @@ private Mono> getRecognizedEntitiesR finalLoggingOptOut, finalStringIndexType, finalContext) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Recognized entities for a batch of documents- {}", + .doOnSuccess(response -> LOGGER.info("Recognized entities for a batch of documents- {}", response.getValue())) - .doOnError(error -> logger.warning("Failed to recognize entities - {}", error)) - .map(Utility::toRecognizeEntitiesResultCollectionResponse) + .doOnError(error -> LOGGER.warning("Failed to recognize entities - {}", error)) + .map(Utility::toRecognizeEntitiesResultCollectionResponseLegacyApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } + /** + * Call the service with REST response, convert to a {@link Response} that contains + * {@link RecognizeEntitiesResultCollection} from a {@link SimpleResponse} of {@link EntitiesResult}. + * + * @param documents The list of documents to recognize entities for. + * @param options The {@link TextAnalyticsRequestOptions} request options. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} that contains {@link RecognizeEntitiesResultCollection}. + */ + Response getRecognizedEntitiesResponseSync( + Iterable documents, TextAnalyticsRequestOptions options, Context context) { + throwIfCallingNotAvailableFeatureInOptions(options); + inputDocumentsValidation(documents); + options = options == null ? new TextAnalyticsRequestOptions() : options; + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); + final StringIndexType finalStringIndexType = StringIndexType.UTF16CODE_UNIT; + final String finalModelVersion = options.getModelVersion(); + final boolean finalLoggingOptOut = options.isServiceLogsDisabled(); + final boolean finalIncludeStatistics = options.isIncludeStatistics(); + try { + return (service != null) + ? toRecognizeEntitiesResultCollectionResponseLanguageApi(service.analyzeTextWithResponse( + new AnalyzeTextEntityRecognitionInput() + .setParameters( + new EntitiesTaskParameters() + .setStringIndexType(finalStringIndexType) + .setModelVersion(finalModelVersion) + .setLoggingOptOut(finalLoggingOptOut)) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))), + finalIncludeStatistics, + finalContext)) + : toRecognizeEntitiesResultCollectionResponseLegacyApi( + legacyService.entitiesRecognitionGeneralWithResponseSync( + new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + finalModelVersion, + finalIncludeStatistics, + finalLoggingOptOut, + finalStringIndexType, + finalContext)); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); + } + } + private void throwIfCallingNotAvailableFeatureInOptions(TextAnalyticsRequestOptions options) { if (options != null && options.isServiceLogsDisabled()) { throwIfTargetServiceVersionFound(this.serviceVersion, Arrays.asList(TextAnalyticsServiceVersion.V3_0), diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityUtilClient.java similarity index 70% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityUtilClient.java index c0849bf93c41e..cd3089985745b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizeLinkedEntityUtilClient.java @@ -9,6 +9,7 @@ import com.azure.ai.textanalytics.implementation.models.AnalyzeTextEntityLinkingInput; import com.azure.ai.textanalytics.implementation.models.EntityLinkingResult; import com.azure.ai.textanalytics.implementation.models.EntityLinkingTaskParameters; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; import com.azure.ai.textanalytics.implementation.models.StringIndexType; @@ -17,6 +18,7 @@ import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -28,12 +30,16 @@ import java.util.Objects; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getDocumentCount; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; +import static com.azure.ai.textanalytics.implementation.Utility.toRecognizeLinkedEntitiesResultCollectionResponseLanguageApi; +import static com.azure.ai.textanalytics.implementation.Utility.toRecognizeLinkedEntitiesResultCollectionResponseLegacyApi; import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsException; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; @@ -42,21 +48,21 @@ /** * Helper class for managing recognize linked entity endpoint. */ -class RecognizeLinkedEntityAsyncClient { - private final ClientLogger logger = new ClientLogger(RecognizeLinkedEntityAsyncClient.class); +class RecognizeLinkedEntityUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(RecognizeLinkedEntityUtilClient.class); private final TextAnalyticsClientImpl legacyService; private final MicrosoftCognitiveLanguageServiceTextAnalysisImpl service; private final TextAnalyticsServiceVersion serviceVersion; - RecognizeLinkedEntityAsyncClient(TextAnalyticsClientImpl legacyService, + RecognizeLinkedEntityUtilClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - RecognizeLinkedEntityAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, + RecognizeLinkedEntityUtilClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; @@ -82,7 +88,7 @@ Mono recognizeLinkedEntities(String document, String lan // for each loop will have only one entry inside for (RecognizeLinkedEntitiesResult entitiesResult : resultCollectionResponse.getValue()) { if (entitiesResult.isError()) { - throw logger.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); + throw LOGGER.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); } linkedEntityCollection = new LinkedEntityCollection(entitiesResult.getEntities(), entitiesResult.getEntities().getWarnings()); @@ -90,7 +96,7 @@ Mono recognizeLinkedEntities(String document, String lan return linkedEntityCollection; }); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -108,27 +114,7 @@ Mono> recognizeLinkedEntitiesB try { return withContext(context -> getRecognizedLinkedEntitiesResponse(documents, options, context)); } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters that returns a mono {@link Response} - * which contains {@link RecognizeLinkedEntitiesResultCollection}. - * - * @param documents The list of documents to recognize linked entities for. - * @param options The {@link TextAnalyticsRequestOptions} request options. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} that contains {@link RecognizeLinkedEntitiesResultCollection}. - */ - Mono> - recognizeLinkedEntitiesBatchWithContext(Iterable documents, - TextAnalyticsRequestOptions options, Context context) { - try { - return getRecognizedLinkedEntitiesResponse(documents, options, context); - } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -164,11 +150,11 @@ private Mono> getRecognizedLin new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), finalIncludeStatistics, finalContext) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Recognized linked entities for a batch of documents - {}", + .doOnSuccess(response -> LOGGER.info("Recognized linked entities for a batch of documents - {}", response.getValue())) - .doOnError(error -> logger.warning("Failed to recognize linked entities - {}", error)) + .doOnError(error -> LOGGER.warning("Failed to recognize linked entities - {}", error)) .map(Utility::toRecognizeLinkedEntitiesResultCollectionResponseLanguageApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } @@ -180,15 +166,61 @@ private Mono> getRecognizedLin finalLoggingOptOut, finalStringIndexType, finalContext) - .doOnSubscribe(ignoredValue -> logger.info("A batch of documents with count - {}", + .doOnSubscribe(ignoredValue -> LOGGER.info("A batch of documents with count - {}", getDocumentCount(documents))) - .doOnSuccess(response -> logger.info("Recognized linked entities for a batch of documents - {}", + .doOnSuccess(response -> LOGGER.info("Recognized linked entities for a batch of documents - {}", response.getValue())) - .doOnError(error -> logger.warning("Failed to recognize linked entities - {}", error)) + .doOnError(error -> LOGGER.warning("Failed to recognize linked entities - {}", error)) .map(Utility::toRecognizeLinkedEntitiesResultCollectionResponseLegacyApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } + /** + * Call the service with REST response, convert to a {@link Response} which contains + * {@link RecognizeLinkedEntitiesResultCollection} from a {@link SimpleResponse} of {@link EntityLinkingResult}. + * + * @param documents The list of documents to recognize linked entities for. + * @param options The {@link TextAnalyticsRequestOptions} request options. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link Response} that contains {@link RecognizeLinkedEntitiesResultCollection}. + */ + Response getRecognizedLinkedEntitiesResponseSync( + Iterable documents, TextAnalyticsRequestOptions options, Context context) { + throwIfCallingNotAvailableFeatureInOptions(options); + inputDocumentsValidation(documents); + options = options == null ? new TextAnalyticsRequestOptions() : options; + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); + final StringIndexType finalStringIndexType = StringIndexType.UTF16CODE_UNIT; + final String finalModelVersion = options.getModelVersion(); + final boolean finalLoggingOptOut = options.isServiceLogsDisabled(); + final boolean finalIncludeStatistics = options.isIncludeStatistics(); + try { + return (service != null) + ? toRecognizeLinkedEntitiesResultCollectionResponseLanguageApi(service.analyzeTextWithResponse( + new AnalyzeTextEntityLinkingInput() + .setParameters( + new EntityLinkingTaskParameters() + .setStringIndexType(finalStringIndexType) + .setModelVersion(finalModelVersion) + .setLoggingOptOut(finalLoggingOptOut)) + .setAnalysisInput( + new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))), + finalIncludeStatistics, + finalContext)) + : toRecognizeLinkedEntitiesResultCollectionResponseLegacyApi( + legacyService.entitiesLinkingWithResponseSync( + new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + finalModelVersion, + finalIncludeStatistics, + finalLoggingOptOut, + finalStringIndexType, + finalContext)); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); + } + } + private void throwIfCallingNotAvailableFeatureInOptions(TextAnalyticsRequestOptions options) { if (options != null && options.isServiceLogsDisabled()) { throwIfTargetServiceVersionFound(this.serviceVersion, Arrays.asList(TextAnalyticsServiceVersion.V3_0), diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityUtilClient.java similarity index 69% rename from sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java rename to sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityUtilClient.java index eed37a16e0501..a4e533ede4101 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/RecognizePiiEntityUtilClient.java @@ -8,6 +8,7 @@ import com.azure.ai.textanalytics.implementation.Utility; import com.azure.ai.textanalytics.implementation.models.AnalyzeTextPiiEntitiesRecognitionInput; import com.azure.ai.textanalytics.implementation.models.EntitiesResult; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput; import com.azure.ai.textanalytics.implementation.models.PiiDomain; @@ -18,6 +19,7 @@ import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -29,12 +31,16 @@ import java.util.Objects; import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.mapToHttpResponseExceptionIfExists; import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; import static com.azure.ai.textanalytics.implementation.Utility.toCategoriesFilter; import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; +import static com.azure.ai.textanalytics.implementation.Utility.toRecognizePiiEntitiesResultCollectionResponseLanguageApi; +import static com.azure.ai.textanalytics.implementation.Utility.toRecognizePiiEntitiesResultCollectionResponseLegacyApi; import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsException; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; @@ -43,20 +49,20 @@ /** * Helper class for managing recognize Personally Identifiable Information entity endpoint. */ -class RecognizePiiEntityAsyncClient { - private final ClientLogger logger = new ClientLogger(RecognizePiiEntityAsyncClient.class); +class RecognizePiiEntityUtilClient { + private static final ClientLogger LOGGER = new ClientLogger(RecognizePiiEntityUtilClient.class); private final TextAnalyticsClientImpl legacyService; private final MicrosoftCognitiveLanguageServiceTextAnalysisImpl service; private final TextAnalyticsServiceVersion serviceVersion; - RecognizePiiEntityAsyncClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { + RecognizePiiEntityUtilClient(TextAnalyticsClientImpl legacyService, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = legacyService; this.service = null; this.serviceVersion = serviceVersion; } - RecognizePiiEntityAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, + RecognizePiiEntityUtilClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, TextAnalyticsServiceVersion serviceVersion) { this.legacyService = null; this.service = service; @@ -89,7 +95,7 @@ Mono recognizePiiEntities(String document, String language, // for each loop will have only one entry inside for (RecognizePiiEntitiesResult entitiesResult : resultCollectionResponse.getValue()) { if (entitiesResult.isError()) { - throw logger.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); + throw LOGGER.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); } entityCollection = new PiiEntityCollection(entitiesResult.getEntities(), entitiesResult.getEntities().getRedactedText(), @@ -98,7 +104,7 @@ Mono recognizePiiEntities(String document, String language, return entityCollection; }); } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -116,26 +122,7 @@ Mono> recognizePiiEntitiesBatch( try { return withContext(context -> getRecognizePiiEntitiesResponse(documents, options, context)); } catch (RuntimeException ex) { - return monoError(logger, ex); - } - } - - /** - * Helper function for calling service with max overloaded parameters with {@link Context} is given. - * - * @param documents The list of documents to recognize Personally Identifiable Information entities for. - * @param options The additional configurable {@link RecognizePiiEntitiesOptions options} that may be passed when - * recognizing PII entities. - * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A mono {@link Response} that contains {@link RecognizePiiEntitiesResultCollection}. - */ - Mono> recognizePiiEntitiesBatchWithContext( - Iterable documents, RecognizePiiEntitiesOptions options, Context context) { - try { - return getRecognizePiiEntitiesResponse(documents, options, context); - } catch (RuntimeException ex) { - return monoError(logger, ex); + return monoError(LOGGER, ex); } } @@ -183,11 +170,11 @@ private Mono> getRecognizePiiEnti .setDocuments(toMultiLanguageInput(documents))), finalIncludeStatistics, finalContext) - .doOnSubscribe(ignoredValue -> logger.info( + .doOnSubscribe(ignoredValue -> LOGGER.info( "Start recognizing Personally Identifiable Information entities for a batch of documents.")) - .doOnSuccess(response -> logger.info("Successfully recognized Personally Identifiable Information " + .doOnSuccess(response -> LOGGER.info("Successfully recognized Personally Identifiable Information " + "entities for a batch of documents.")) - .doOnError(error -> logger.warning( + .doOnError(error -> LOGGER.warning( "Failed to recognize Personally Identifiable Information entities - {}", error)) .map(Utility::toRecognizePiiEntitiesResultCollectionResponseLanguageApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); @@ -202,13 +189,74 @@ private Mono> getRecognizePiiEnti finalStringIndexType, toCategoriesFilter(options.getCategoriesFilter()), finalContext) - .doOnSubscribe(ignoredValue -> logger.info( + .doOnSubscribe(ignoredValue -> LOGGER.info( "Start recognizing Personally Identifiable Information entities for a batch of documents.")) - .doOnSuccess(response -> logger.info( + .doOnSuccess(response -> LOGGER.info( "Successfully recognized Personally Identifiable Information entities for a batch of documents.")) .doOnError(error -> - logger.warning("Failed to recognize Personally Identifiable Information entities - {}", error)) + LOGGER.warning("Failed to recognize Personally Identifiable Information entities - {}", error)) .map(Utility::toRecognizePiiEntitiesResultCollectionResponseLegacyApi) .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); } + + /** + * Call the service with REST response, convert to a {@link Response} that contains + * {@link RecognizePiiEntitiesResultCollection} from a {@link SimpleResponse} of {@link EntitiesResult}. + * + * @param documents The list of documents to recognize Personally Identifiable Information entities for. + * @param options The additional configurable {@link RecognizePiiEntitiesOptions options} that may be passed when + * recognizing PII entities. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} that contains {@link RecognizePiiEntitiesResultCollection}. + * + */ + Response getRecognizePiiEntitiesResponseSync( + Iterable documents, RecognizePiiEntitiesOptions options, Context context) { + throwIfTargetServiceVersionFound(this.serviceVersion, + Arrays.asList(TextAnalyticsServiceVersion.V3_0), + getUnsupportedServiceApiVersionMessage("recognizePiiEntitiesBatch", serviceVersion, + TextAnalyticsServiceVersion.V3_1)); + inputDocumentsValidation(documents); + options = options == null ? new RecognizePiiEntitiesOptions() : options; + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)) + .addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE); + final StringIndexType finalStringIndexType = StringIndexType.UTF16CODE_UNIT; + final String finalModelVersion = options.getModelVersion(); + final boolean finalLoggingOptOut = options.isServiceLogsDisabled(); + final boolean finalIncludeStatistics = options.isIncludeStatistics(); + + final String finalDomainFilter = options.getDomainFilter() != null + ? options.getDomainFilter().toString() : null; + try { + return (service != null) + ? toRecognizePiiEntitiesResultCollectionResponseLanguageApi( + service.analyzeTextWithResponse( + new AnalyzeTextPiiEntitiesRecognitionInput() + .setParameters( + new PiiTaskParameters() + .setDomain(PiiDomain.fromString(finalDomainFilter)) + .setPiiCategories( + toCategoriesFilter(options.getCategoriesFilter())) + .setStringIndexType(finalStringIndexType) + .setModelVersion(finalModelVersion) + .setLoggingOptOut(finalLoggingOptOut)) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))), + finalIncludeStatistics, + finalContext)) + : toRecognizePiiEntitiesResultCollectionResponseLegacyApi( + legacyService.entitiesRecognitionPiiWithResponseSync( + new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), + finalModelVersion, + finalIncludeStatistics, + finalLoggingOptOut, + finalDomainFilter, + finalStringIndexType, + toCategoriesFilter(options.getCategoriesFilter()), + finalContext)); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError((HttpResponseException) mapToHttpResponseExceptionIfExists(ex)); + } + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java index 9272ba22613e9..60c6acd45caf2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java @@ -100,18 +100,18 @@ public final class TextAnalyticsAsyncClient { // Please see here // for more information on Azure resource provider namespaces. static final String COGNITIVE_TRACING_NAMESPACE_VALUE = "Microsoft.CognitiveServices"; - final DetectLanguageAsyncClient detectLanguageAsyncClient; - final AnalyzeSentimentAsyncClient analyzeSentimentAsyncClient; - final ExtractKeyPhraseAsyncClient extractKeyPhraseAsyncClient; - final RecognizeEntityAsyncClient recognizeEntityAsyncClient; - final RecognizePiiEntityAsyncClient recognizePiiEntityAsyncClient; - final RecognizeLinkedEntityAsyncClient recognizeLinkedEntityAsyncClient; - final RecognizeCustomEntitiesAsyncClient recognizeCustomEntitiesAsyncClient; - final LabelClassifyAsyncClient labelClassifyAsyncClient; - final AnalyzeHealthcareEntityAsyncClient analyzeHealthcareEntityAsyncClient; - final AnalyzeActionsAsyncClient analyzeActionsAsyncClient; + final DetectLanguageUtilClient detectLanguageUtilClient; + final AnalyzeSentimentUtilClient analyzeSentimentUtilClient; + final ExtractKeyPhraseUtilClient extractKeyPhraseUtilClient; + final RecognizeEntityUtilClient recognizeEntityUtilClient; + final RecognizePiiEntityUtilClient recognizePiiEntityUtilClient; + final RecognizeLinkedEntityUtilClient recognizeLinkedEntityUtilClient; + final RecognizeCustomEntitiesUtilClient recognizeCustomEntitiesUtilClient; + final LabelClassifyUtilClient labelClassifyUtilClient; + final AnalyzeHealthcareEntityUtilClient analyzeHealthcareEntityUtilClient; + final AnalyzeActionsUtilClient analyzeActionsUtilClient; - final DynamicClassificationAsyncClient dynamicClassificationAsyncClient; + final DynamicClassificationUtilClient dynamicClassificationUtilClient; /** * Creates a {@link TextAnalyticsAsyncClient} that sends requests to the Text Analytics service's endpoint. Each @@ -129,17 +129,17 @@ public final class TextAnalyticsAsyncClient { this.serviceVersion = serviceVersion; this.defaultCountryHint = defaultCountryHint; this.defaultLanguage = defaultLanguage; - this.detectLanguageAsyncClient = new DetectLanguageAsyncClient(legacyService, serviceVersion); - this.analyzeSentimentAsyncClient = new AnalyzeSentimentAsyncClient(legacyService, serviceVersion); - this.extractKeyPhraseAsyncClient = new ExtractKeyPhraseAsyncClient(legacyService, serviceVersion); - this.recognizeEntityAsyncClient = new RecognizeEntityAsyncClient(legacyService, serviceVersion); - this.recognizePiiEntityAsyncClient = new RecognizePiiEntityAsyncClient(legacyService, serviceVersion); - this.recognizeLinkedEntityAsyncClient = new RecognizeLinkedEntityAsyncClient(legacyService, serviceVersion); - this.recognizeCustomEntitiesAsyncClient = new RecognizeCustomEntitiesAsyncClient(null, serviceVersion); - this.analyzeHealthcareEntityAsyncClient = new AnalyzeHealthcareEntityAsyncClient(legacyService, serviceVersion); - this.analyzeActionsAsyncClient = new AnalyzeActionsAsyncClient(legacyService, serviceVersion); - this.labelClassifyAsyncClient = new LabelClassifyAsyncClient(null, serviceVersion); - this.dynamicClassificationAsyncClient = new DynamicClassificationAsyncClient(null, serviceVersion); + this.detectLanguageUtilClient = new DetectLanguageUtilClient(legacyService, serviceVersion); + this.analyzeSentimentUtilClient = new AnalyzeSentimentUtilClient(legacyService, serviceVersion); + this.extractKeyPhraseUtilClient = new ExtractKeyPhraseUtilClient(legacyService, serviceVersion); + this.recognizeEntityUtilClient = new RecognizeEntityUtilClient(legacyService, serviceVersion); + this.recognizePiiEntityUtilClient = new RecognizePiiEntityUtilClient(legacyService, serviceVersion); + this.recognizeLinkedEntityUtilClient = new RecognizeLinkedEntityUtilClient(legacyService, serviceVersion); + this.recognizeCustomEntitiesUtilClient = new RecognizeCustomEntitiesUtilClient(null, serviceVersion); + this.analyzeHealthcareEntityUtilClient = new AnalyzeHealthcareEntityUtilClient(legacyService, serviceVersion); + this.analyzeActionsUtilClient = new AnalyzeActionsUtilClient(legacyService, serviceVersion); + this.labelClassifyUtilClient = new LabelClassifyUtilClient(null, serviceVersion); + this.dynamicClassificationUtilClient = new DynamicClassificationUtilClient(null, serviceVersion); } TextAnalyticsAsyncClient(MicrosoftCognitiveLanguageServiceTextAnalysisImpl service, @@ -149,19 +149,19 @@ public final class TextAnalyticsAsyncClient { this.serviceVersion = serviceVersion; this.defaultCountryHint = defaultCountryHint; this.defaultLanguage = defaultLanguage; - this.detectLanguageAsyncClient = new DetectLanguageAsyncClient(service, serviceVersion); - this.analyzeSentimentAsyncClient = new AnalyzeSentimentAsyncClient(service, serviceVersion); - this.extractKeyPhraseAsyncClient = new ExtractKeyPhraseAsyncClient(service, serviceVersion); - this.recognizeEntityAsyncClient = new RecognizeEntityAsyncClient(service, serviceVersion); - this.recognizePiiEntityAsyncClient = new RecognizePiiEntityAsyncClient(service, serviceVersion); - this.recognizeLinkedEntityAsyncClient = new RecognizeLinkedEntityAsyncClient(service, serviceVersion); - this.recognizeCustomEntitiesAsyncClient = new RecognizeCustomEntitiesAsyncClient( + this.detectLanguageUtilClient = new DetectLanguageUtilClient(service, serviceVersion); + this.analyzeSentimentUtilClient = new AnalyzeSentimentUtilClient(service, serviceVersion); + this.extractKeyPhraseUtilClient = new ExtractKeyPhraseUtilClient(service, serviceVersion); + this.recognizeEntityUtilClient = new RecognizeEntityUtilClient(service, serviceVersion); + this.recognizePiiEntityUtilClient = new RecognizePiiEntityUtilClient(service, serviceVersion); + this.recognizeLinkedEntityUtilClient = new RecognizeLinkedEntityUtilClient(service, serviceVersion); + this.recognizeCustomEntitiesUtilClient = new RecognizeCustomEntitiesUtilClient( new AnalyzeTextsImpl(service), serviceVersion); - this.analyzeHealthcareEntityAsyncClient = new AnalyzeHealthcareEntityAsyncClient(new AnalyzeTextsImpl(service), + this.analyzeHealthcareEntityUtilClient = new AnalyzeHealthcareEntityUtilClient(new AnalyzeTextsImpl(service), serviceVersion); - this.analyzeActionsAsyncClient = new AnalyzeActionsAsyncClient(new AnalyzeTextsImpl(service), serviceVersion); - this.labelClassifyAsyncClient = new LabelClassifyAsyncClient(new AnalyzeTextsImpl(service), serviceVersion); - this.dynamicClassificationAsyncClient = new DynamicClassificationAsyncClient(service, serviceVersion); + this.analyzeActionsUtilClient = new AnalyzeActionsUtilClient(new AnalyzeTextsImpl(service), serviceVersion); + this.labelClassifyUtilClient = new LabelClassifyUtilClient(new AnalyzeTextsImpl(service), serviceVersion); + this.dynamicClassificationUtilClient = new DynamicClassificationUtilClient(service, serviceVersion); } /** @@ -386,7 +386,7 @@ public Mono detectLanguageBatch( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> detectLanguageBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options) { - return detectLanguageAsyncClient.detectLanguageBatch(documents, options); + return detectLanguageUtilClient.detectLanguageBatch(documents, options); } // Categorized Entity @@ -466,7 +466,7 @@ public Mono recognizeEntities(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono recognizeEntities(String document, String language) { - return recognizeEntityAsyncClient.recognizeEntities(document, language); + return recognizeEntityUtilClient.recognizeEntities(document, language); } /** @@ -580,7 +580,7 @@ public Mono recognizeEntitiesBatch( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> recognizeEntitiesBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options) { - return recognizeEntityAsyncClient.recognizeEntitiesBatch(documents, options); + return recognizeEntityUtilClient.recognizeEntitiesBatch(documents, options); } // PII Entity @@ -668,7 +668,7 @@ public Mono recognizePiiEntities(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono recognizePiiEntities(String document, String language) { - return recognizePiiEntityAsyncClient.recognizePiiEntities(document, language, null); + return recognizePiiEntityUtilClient.recognizePiiEntities(document, language, null); } /** @@ -716,7 +716,7 @@ public Mono recognizePiiEntities(String document, String la @ServiceMethod(returns = ReturnType.SINGLE) public Mono recognizePiiEntities(String document, String language, RecognizePiiEntitiesOptions options) { - return recognizePiiEntityAsyncClient.recognizePiiEntities(document, language, options); + return recognizePiiEntityUtilClient.recognizePiiEntities(document, language, options); } /** @@ -844,7 +844,7 @@ public Mono recognizePiiEntitiesBatch( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> recognizePiiEntitiesBatchWithResponse( Iterable documents, RecognizePiiEntitiesOptions options) { - return recognizePiiEntityAsyncClient.recognizePiiEntitiesBatch(documents, options); + return recognizePiiEntityUtilClient.recognizePiiEntitiesBatch(documents, options); } // Linked Entities @@ -926,7 +926,7 @@ public Mono recognizeLinkedEntities(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono recognizeLinkedEntities(String document, String language) { - return recognizeLinkedEntityAsyncClient.recognizeLinkedEntities(document, language); + return recognizeLinkedEntityUtilClient.recognizeLinkedEntities(document, language); } /** @@ -1055,7 +1055,7 @@ public Mono recognizeLinkedEntitiesBatc @ServiceMethod(returns = ReturnType.SINGLE) public Mono> recognizeLinkedEntitiesBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options) { - return recognizeLinkedEntityAsyncClient.recognizeLinkedEntitiesBatch(documents, options); + return recognizeLinkedEntityUtilClient.recognizeLinkedEntitiesBatch(documents, options); } // Key Phrases @@ -1121,7 +1121,7 @@ public Mono extractKeyPhrases(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono extractKeyPhrases(String document, String language) { - return extractKeyPhraseAsyncClient.extractKeyPhrasesSingleText(document, language); + return extractKeyPhraseUtilClient.extractKeyPhrasesSingleText(document, language); } /** @@ -1237,7 +1237,7 @@ public Mono extractKeyPhrasesBatch( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> extractKeyPhrasesBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options) { - return extractKeyPhraseAsyncClient.extractKeyPhrasesWithResponse(documents, options); + return extractKeyPhraseUtilClient.extractKeyPhrasesWithResponse(documents, options); } // Sentiment @@ -1614,7 +1614,7 @@ public Mono analyzeSentimentBatch(Iterable> analyzeSentimentBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options) { - return analyzeSentimentAsyncClient.analyzeSentimentBatch(documents, new AnalyzeSentimentOptions() + return analyzeSentimentUtilClient.analyzeSentimentBatch(documents, new AnalyzeSentimentOptions() .setIncludeStatistics(options == null ? false : options.isIncludeStatistics()) .setModelVersion(options == null ? null : options.getModelVersion())); } @@ -1691,7 +1691,7 @@ public Mono> analyzeSentimentBatchWit @ServiceMethod(returns = ReturnType.SINGLE) public Mono> analyzeSentimentBatchWithResponse( Iterable documents, AnalyzeSentimentOptions options) { - return analyzeSentimentAsyncClient.analyzeSentimentBatch(documents, options); + return analyzeSentimentUtilClient.analyzeSentimentBatch(documents, options); } /** @@ -1819,7 +1819,7 @@ public Mono dynamicClassificationBatch( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> dynamicClassificationBatchWithResponse( Iterable documents, DynamicClassificationOptions options) { - return dynamicClassificationAsyncClient.dynamicClassifyBatch(documents, options); + return dynamicClassificationUtilClient.dynamicClassifyBatch(documents, options); } /** @@ -2100,7 +2100,7 @@ public Mono> dynamicClassifica public PollerFlux beginAnalyzeHealthcareEntities(Iterable documents, AnalyzeHealthcareEntitiesOptions options) { - return analyzeHealthcareEntityAsyncClient.beginAnalyzeHealthcareEntities(documents, options, Context.NONE); + return analyzeHealthcareEntityUtilClient.beginAnalyzeHealthcareEntities(documents, options, Context.NONE); } // Custom Entities Recognition @@ -2335,7 +2335,7 @@ public Mono> dynamicClassifica public PollerFlux beginRecognizeCustomEntities(Iterable documents, String projectName, String deploymentName, RecognizeCustomEntitiesOptions options) { - return recognizeCustomEntitiesAsyncClient.recognizeCustomEntities(documents, projectName, deploymentName, + return recognizeCustomEntitiesUtilClient.recognizeCustomEntities(documents, projectName, deploymentName, options, Context.NONE); } @@ -2575,7 +2575,7 @@ public PollerFlux be public PollerFlux beginSingleLabelClassify( Iterable documents, String projectName, String deploymentName, SingleLabelClassifyOptions options) { - return labelClassifyAsyncClient.singleLabelClassify(documents, projectName, deploymentName, + return labelClassifyUtilClient.singleLabelClassify(documents, projectName, deploymentName, options, Context.NONE); } @@ -2800,7 +2800,7 @@ public PollerFlux be public PollerFlux beginMultiLabelClassify( Iterable documents, String projectName, String deploymentName, MultiLabelClassifyOptions options) { - return labelClassifyAsyncClient.multiLabelClassify(documents, projectName, deploymentName, + return labelClassifyUtilClient.multiLabelClassify(documents, projectName, deploymentName, options, Context.NONE); } @@ -3042,6 +3042,6 @@ public PollerFlux @ServiceMethod(returns = ReturnType.COLLECTION) public PollerFlux beginAnalyzeActions( Iterable documents, TextAnalyticsActions actions, AnalyzeActionsOptions options) { - return analyzeActionsAsyncClient.beginAnalyzeActions(documents, actions, options, Context.NONE); + return analyzeActionsUtilClient.beginAnalyzeActions(documents, actions, options, Context.NONE); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java index 91bccea453a21..b7f036aeb1599 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java @@ -9,14 +9,16 @@ import com.azure.ai.textanalytics.models.AnalyzeHealthcareEntitiesOperationDetail; import com.azure.ai.textanalytics.models.AnalyzeHealthcareEntitiesOptions; import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions; +import com.azure.ai.textanalytics.models.AnalyzeSentimentResult; import com.azure.ai.textanalytics.models.CategorizedEntity; import com.azure.ai.textanalytics.models.CategorizedEntityCollection; import com.azure.ai.textanalytics.models.ClassifyDocumentOperationDetail; import com.azure.ai.textanalytics.models.DetectLanguageInput; +import com.azure.ai.textanalytics.models.DetectLanguageResult; import com.azure.ai.textanalytics.models.DetectedLanguage; import com.azure.ai.textanalytics.models.DocumentSentiment; import com.azure.ai.textanalytics.models.DynamicClassificationOptions; -import com.azure.ai.textanalytics.util.DynamicClassifyDocumentResultCollection; +import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; import com.azure.ai.textanalytics.models.KeyPhrasesCollection; import com.azure.ai.textanalytics.models.LinkedEntity; import com.azure.ai.textanalytics.models.LinkedEntityCollection; @@ -26,7 +28,10 @@ import com.azure.ai.textanalytics.models.RecognizeCustomEntitiesAction; import com.azure.ai.textanalytics.models.RecognizeCustomEntitiesOperationDetail; import com.azure.ai.textanalytics.models.RecognizeCustomEntitiesOptions; +import com.azure.ai.textanalytics.models.RecognizeEntitiesResult; +import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult; import com.azure.ai.textanalytics.models.RecognizePiiEntitiesOptions; +import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; import com.azure.ai.textanalytics.models.SingleLabelClassifyAction; import com.azure.ai.textanalytics.models.SingleLabelClassifyOptions; import com.azure.ai.textanalytics.models.TextAnalyticsActions; @@ -41,6 +46,7 @@ import com.azure.ai.textanalytics.util.ClassifyDocumentPagedIterable; import com.azure.ai.textanalytics.util.ClassifyDocumentResultCollection; import com.azure.ai.textanalytics.util.DetectLanguageResultCollection; +import com.azure.ai.textanalytics.util.DynamicClassifyDocumentResultCollection; import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection; import com.azure.ai.textanalytics.util.RecognizeCustomEntitiesPagedIterable; import com.azure.ai.textanalytics.util.RecognizeCustomEntitiesResultCollection; @@ -53,12 +59,15 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.SyncPoller; +import java.util.Collections; import java.util.Objects; import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; import static com.azure.ai.textanalytics.implementation.Utility.mapByIndex; +import static com.azure.ai.textanalytics.implementation.Utility.toTextAnalyticsException; /** * This class provides a synchronous client that contains all the operations that apply to Azure Text Analytics. @@ -117,6 +126,8 @@ */ @ServiceClient(builder = TextAnalyticsClientBuilder.class) public final class TextAnalyticsClient { + private static final ClientLogger LOGGER = new ClientLogger(TextAnalyticsClient.class); + private final TextAnalyticsAsyncClient client; /** @@ -206,7 +217,19 @@ public DetectedLanguage detectLanguage(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public DetectedLanguage detectLanguage(String document, String countryHint) { - return client.detectLanguage(document, countryHint).block(); + Objects.requireNonNull(document, "'document' cannot be null."); + DetectLanguageResultCollection resultCollection = + detectLanguageBatch(Collections.singletonList(document), countryHint, null); + DetectedLanguage detectedLanguage = null; + for (DetectLanguageResult detectLanguageResult : resultCollection) { + if (detectLanguageResult.isError()) { + throw LOGGER.logExceptionAsError(toTextAnalyticsException(detectLanguageResult.getError())); + } + detectedLanguage = detectLanguageResult.getPrimaryLanguage(); + } + // When the detected language result collection is empty, + // return empty result for the empty collection returned by the service. + return detectedLanguage; } /** @@ -261,7 +284,8 @@ public DetectedLanguage detectLanguage(String document, String countryHint) { public DetectLanguageResultCollection detectLanguageBatch( Iterable documents, String countryHint, TextAnalyticsRequestOptions options) { inputDocumentsValidation(documents); - return client.detectLanguageBatch(documents, countryHint, options).block(); + return detectLanguageBatchWithResponse(mapByIndex(documents, + (index, value) -> new DetectLanguageInput(index, value, countryHint)), options, Context.NONE).getValue(); } /** @@ -323,7 +347,7 @@ public DetectLanguageResultCollection detectLanguageBatch( public Response detectLanguageBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options, Context context) { inputDocumentsValidation(documents); - return client.detectLanguageAsyncClient.detectLanguageBatchWithContext(documents, options, context).block(); + return client.detectLanguageUtilClient.getDetectedLanguageResponseSync(documents, options, context); } // Categorized Entity @@ -397,7 +421,19 @@ public CategorizedEntityCollection recognizeEntities(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public CategorizedEntityCollection recognizeEntities(String document, String language) { - return client.recognizeEntities(document, language).block(); + Objects.requireNonNull(document, "'document' cannot be null."); + final RecognizeEntitiesResultCollection recognizeEntitiesResultCollectionMono = + recognizeEntitiesBatch(Collections.singletonList(document), language, null); + CategorizedEntityCollection entityCollection = null; + // for each loop will have only one entry inside + for (RecognizeEntitiesResult entitiesResult : recognizeEntitiesResultCollectionMono) { + if (entitiesResult.isError()) { + throw LOGGER.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); + } + entityCollection = new CategorizedEntityCollection(entitiesResult.getEntities(), + entitiesResult.getEntities().getWarnings()); + } + return entityCollection; } /** @@ -447,7 +483,11 @@ public CategorizedEntityCollection recognizeEntities(String document, String lan public RecognizeEntitiesResultCollection recognizeEntitiesBatch( Iterable documents, String language, TextAnalyticsRequestOptions options) { inputDocumentsValidation(documents); - return client.recognizeEntitiesBatch(documents, language, options).block(); + return recognizeEntitiesBatchWithResponse(mapByIndex(documents, (index, value) -> { + final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); + textDocumentInput.setLanguage(language); + return textDocumentInput; + }), options, Context.NONE).getValue(); } /** @@ -504,7 +544,7 @@ public RecognizeEntitiesResultCollection recognizeEntitiesBatch( public Response recognizeEntitiesBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options, Context context) { inputDocumentsValidation(documents); - return client.recognizeEntityAsyncClient.recognizeEntitiesBatchWithContext(documents, options, context).block(); + return client.recognizeEntityUtilClient.getRecognizedEntitiesResponseSync(documents, options, context); } // PII Entity @@ -586,7 +626,7 @@ public PiiEntityCollection recognizePiiEntities(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public PiiEntityCollection recognizePiiEntities(String document, String language) { - return client.recognizePiiEntities(document, language).block(); + return recognizePiiEntities(document, language, null); } /** @@ -631,7 +671,20 @@ public PiiEntityCollection recognizePiiEntities(String document, String language @ServiceMethod(returns = ReturnType.SINGLE) public PiiEntityCollection recognizePiiEntities(String document, String language, RecognizePiiEntitiesOptions options) { - return client.recognizePiiEntities(document, language, options).block(); + Objects.requireNonNull(document, "'document' cannot be null."); + final RecognizePiiEntitiesResultCollection recognizePiiEntitiesResults = + recognizePiiEntitiesBatch(Collections.singletonList(document), language, options); + PiiEntityCollection entityCollection = null; + // for each loop will have only one entry inside + for (RecognizePiiEntitiesResult entitiesResult : recognizePiiEntitiesResults) { + if (entitiesResult.isError()) { + throw LOGGER.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); + } + entityCollection = new PiiEntityCollection(entitiesResult.getEntities(), + entitiesResult.getEntities().getRedactedText(), + entitiesResult.getEntities().getWarnings()); + } + return entityCollection; } /** @@ -686,7 +739,12 @@ public PiiEntityCollection recognizePiiEntities(String document, String language @ServiceMethod(returns = ReturnType.SINGLE) public RecognizePiiEntitiesResultCollection recognizePiiEntitiesBatch( Iterable documents, String language, RecognizePiiEntitiesOptions options) { - return client.recognizePiiEntitiesBatch(documents, language, options).block(); + return recognizePiiEntitiesBatchWithResponse( + mapByIndex(documents, (index, value) -> { + final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); + textDocumentInput.setLanguage(language); + return textDocumentInput; + }), options, Context.NONE).getValue(); } /** @@ -744,8 +802,8 @@ public RecognizePiiEntitiesResultCollection recognizePiiEntitiesBatch( @ServiceMethod(returns = ReturnType.SINGLE) public Response recognizePiiEntitiesBatchWithResponse( Iterable documents, RecognizePiiEntitiesOptions options, Context context) { - return client.recognizePiiEntityAsyncClient.recognizePiiEntitiesBatchWithContext(documents, options, - context).block(); + return client.recognizePiiEntityUtilClient.getRecognizePiiEntitiesResponseSync(documents, options, + context); } // Linked Entities @@ -824,7 +882,18 @@ public LinkedEntityCollection recognizeLinkedEntities(String document) { @ServiceMethod(returns = ReturnType.SINGLE) public LinkedEntityCollection recognizeLinkedEntities(String document, String language) { Objects.requireNonNull(document, "'document' cannot be null."); - return client.recognizeLinkedEntities(document, language).block(); + final RecognizeLinkedEntitiesResultCollection resultCollectionResponse = + recognizeLinkedEntitiesBatch(Collections.singletonList(document), language, null); + LinkedEntityCollection linkedEntityCollection = null; + // for each loop will have only one entry inside + for (RecognizeLinkedEntitiesResult entitiesResult : resultCollectionResponse) { + if (entitiesResult.isError()) { + throw LOGGER.logExceptionAsError(toTextAnalyticsException(entitiesResult.getError())); + } + linkedEntityCollection = new LinkedEntityCollection(entitiesResult.getEntities(), + entitiesResult.getEntities().getWarnings()); + } + return linkedEntityCollection; } /** @@ -884,7 +953,12 @@ public LinkedEntityCollection recognizeLinkedEntities(String document, String la public RecognizeLinkedEntitiesResultCollection recognizeLinkedEntitiesBatch( Iterable documents, String language, TextAnalyticsRequestOptions options) { inputDocumentsValidation(documents); - return client.recognizeLinkedEntitiesBatch(documents, language, options).block(); + return recognizeLinkedEntitiesBatchWithResponse( + mapByIndex(documents, (index, value) -> { + final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); + textDocumentInput.setLanguage(language); + return textDocumentInput; + }), options, Context.NONE).getValue(); } /** @@ -949,8 +1023,8 @@ public RecognizeLinkedEntitiesResultCollection recognizeLinkedEntitiesBatch( public Response recognizeLinkedEntitiesBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options, Context context) { inputDocumentsValidation(documents); - return client.recognizeLinkedEntityAsyncClient.recognizeLinkedEntitiesBatchWithContext(documents, - options, context).block(); + return client.recognizeLinkedEntityUtilClient.getRecognizedLinkedEntitiesResponseSync(documents, + options, context); } // Key Phrase @@ -1014,7 +1088,18 @@ public KeyPhrasesCollection extractKeyPhrases(String document) { @ServiceMethod(returns = ReturnType.SINGLE) public KeyPhrasesCollection extractKeyPhrases(String document, String language) { Objects.requireNonNull(document, "'document' cannot be null."); - return client.extractKeyPhrases(document, language).block(); + final ExtractKeyPhrasesResultCollection resultCollectionResponse = + extractKeyPhrasesBatch(Collections.singletonList(document), language, null); + KeyPhrasesCollection keyPhrasesCollection = null; + // for each loop will have only one entry inside + for (ExtractKeyPhraseResult keyPhraseResult : resultCollectionResponse) { + if (keyPhraseResult.isError()) { + throw LOGGER.logExceptionAsError(toTextAnalyticsException(keyPhraseResult.getError())); + } + keyPhrasesCollection = new KeyPhrasesCollection(keyPhraseResult.getKeyPhrases(), + keyPhraseResult.getKeyPhrases().getWarnings()); + } + return keyPhrasesCollection; } /** @@ -1072,7 +1157,12 @@ public KeyPhrasesCollection extractKeyPhrases(String document, String language) public ExtractKeyPhrasesResultCollection extractKeyPhrasesBatch( Iterable documents, String language, TextAnalyticsRequestOptions options) { inputDocumentsValidation(documents); - return client.extractKeyPhrasesBatch(documents, language, options).block(); + return extractKeyPhrasesBatchWithResponse( + mapByIndex(documents, (index, value) -> { + final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); + textDocumentInput.setLanguage(language); + return textDocumentInput; + }), options, Context.NONE).getValue(); } /** @@ -1136,8 +1226,7 @@ public ExtractKeyPhrasesResultCollection extractKeyPhrasesBatch( public Response extractKeyPhrasesBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options, Context context) { inputDocumentsValidation(documents); - return client.extractKeyPhraseAsyncClient.extractKeyPhrasesBatchWithContext(documents, options, context) - .block(); + return client.extractKeyPhraseUtilClient.getExtractedKeyPhrasesResponseSync(documents, options, context); } // Sentiment @@ -1232,7 +1321,7 @@ public DocumentSentiment analyzeSentiment(String document) { */ @ServiceMethod(returns = ReturnType.SINGLE) public DocumentSentiment analyzeSentiment(String document, String language) { - return client.analyzeSentiment(document, language).block(); + return analyzeSentiment(document, language, null); } /** @@ -1285,7 +1374,17 @@ public DocumentSentiment analyzeSentiment(String document, String language) { */ @ServiceMethod(returns = ReturnType.SINGLE) public DocumentSentiment analyzeSentiment(String document, String language, AnalyzeSentimentOptions options) { - return client.analyzeSentiment(document, language, options).block(); + Objects.requireNonNull(document, "'document' cannot be null."); + final AnalyzeSentimentResultCollection sentimentResultCollection = + analyzeSentimentBatch(Collections.singletonList(document), language, options); + DocumentSentiment documentSentiment = null; + for (AnalyzeSentimentResult sentimentResult : sentimentResultCollection) { + if (sentimentResult.isError()) { + throw LOGGER.logExceptionAsError(toTextAnalyticsException(sentimentResult.getError())); + } + documentSentiment = sentimentResult.getDocumentSentiment(); + } + return documentSentiment; } /** @@ -1352,7 +1451,12 @@ public DocumentSentiment analyzeSentiment(String document, String language, Anal @ServiceMethod(returns = ReturnType.SINGLE) public AnalyzeSentimentResultCollection analyzeSentimentBatch( Iterable documents, String language, TextAnalyticsRequestOptions options) { - return client.analyzeSentimentBatch(documents, language, options).block(); + return analyzeSentimentBatchWithResponse( + mapByIndex(documents, (index, value) -> { + final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); + textDocumentInput.setLanguage(language); + return textDocumentInput; + }), options, Context.NONE).getValue(); } /** @@ -1417,7 +1521,12 @@ public AnalyzeSentimentResultCollection analyzeSentimentBatch( @ServiceMethod(returns = ReturnType.SINGLE) public AnalyzeSentimentResultCollection analyzeSentimentBatch(Iterable documents, String language, AnalyzeSentimentOptions options) { - return client.analyzeSentimentBatch(documents, language, options).block(); + return analyzeSentimentBatchWithResponse( + mapByIndex(documents, (index, value) -> { + final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); + textDocumentInput.setLanguage(language); + return textDocumentInput; + }), options, Context.NONE).getValue(); } /** @@ -1494,10 +1603,10 @@ public AnalyzeSentimentResultCollection analyzeSentimentBatch(Iterable d @ServiceMethod(returns = ReturnType.SINGLE) public Response analyzeSentimentBatchWithResponse( Iterable documents, TextAnalyticsRequestOptions options, Context context) { - return client.analyzeSentimentAsyncClient.analyzeSentimentBatchWithContext(documents, - new AnalyzeSentimentOptions() - .setIncludeStatistics(options == null ? false : options.isIncludeStatistics()) - .setModelVersion(options == null ? null : options.getModelVersion()), context).block(); + return analyzeSentimentBatchWithResponse(documents, + new AnalyzeSentimentOptions().setIncludeStatistics(options == null ? false : options.isIncludeStatistics()) + .setModelVersion(options == null ? null : options.getModelVersion()), + context); } /** @@ -1576,7 +1685,7 @@ public Response analyzeSentimentBatchWithRespo @ServiceMethod(returns = ReturnType.SINGLE) public Response analyzeSentimentBatchWithResponse( Iterable documents, AnalyzeSentimentOptions options, Context context) { - return client.analyzeSentimentAsyncClient.analyzeSentimentBatchWithContext(documents, options, context).block(); + return client.analyzeSentimentUtilClient.getAnalyzedSentimentResponseSync(documents, options, context); } /** @@ -1632,7 +1741,12 @@ public Response analyzeSentimentBatchWithRespo @ServiceMethod(returns = ReturnType.SINGLE) public DynamicClassifyDocumentResultCollection dynamicClassificationBatch(Iterable documents, String language, DynamicClassificationOptions options) { - return client.dynamicClassificationBatch(documents, language, options).block(); + return dynamicClassificationBatchWithResponse( + mapByIndex(documents, (index, value) -> { + final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); + textDocumentInput.setLanguage(language); + return textDocumentInput; + }), options, Context.NONE).getValue(); } /** @@ -1710,8 +1824,8 @@ public DynamicClassifyDocumentResultCollection dynamicClassificationBatch(Iterab @ServiceMethod(returns = ReturnType.SINGLE) public Response dynamicClassificationBatchWithResponse( Iterable documents, DynamicClassificationOptions options, Context context) { - return client.dynamicClassificationAsyncClient.getDynamicClassifyDocumentResultCollectionResponse( - documents, options, context).block(); + return client.dynamicClassificationUtilClient.getResultCollectionResponseSync( + documents, options, context); } /** @@ -1987,8 +2101,8 @@ public Response dynamicClassificationBa public SyncPoller beginAnalyzeHealthcareEntities(Iterable documents, AnalyzeHealthcareEntitiesOptions options, Context context) { - return client.analyzeHealthcareEntityAsyncClient.beginAnalyzeHealthcarePagedIterable(documents, options, - context).getSyncPoller(); + return client.analyzeHealthcareEntityUtilClient.beginAnalyzeHealthcarePagedIterable(documents, options, + context); } /** @@ -2185,8 +2299,8 @@ public Response dynamicClassificationBa public SyncPoller beginRecognizeCustomEntities(Iterable documents, String projectName, String deploymentName, RecognizeCustomEntitiesOptions options, Context context) { - return client.recognizeCustomEntitiesAsyncClient.recognizeCustomEntitiesPagedIterable( - documents, projectName, deploymentName, options, context).getSyncPoller(); + return client.recognizeCustomEntitiesUtilClient.recognizeCustomEntitiesPagedIterable( + documents, projectName, deploymentName, options, context); } /** @@ -2387,8 +2501,8 @@ public Response dynamicClassificationBa public SyncPoller beginSingleLabelClassify(Iterable documents, String projectName, String deploymentName, SingleLabelClassifyOptions options, Context context) { - return client.labelClassifyAsyncClient.singleLabelClassifyPagedIterable( - documents, projectName, deploymentName, options, context).getSyncPoller(); + return client.labelClassifyUtilClient.singleLabelClassifyPagedIterable( + documents, projectName, deploymentName, options, context); } /** @@ -2574,8 +2688,8 @@ public Response dynamicClassificationBa public SyncPoller beginMultiLabelClassify(Iterable documents, String projectName, String deploymentName, MultiLabelClassifyOptions options, Context context) { - return client.labelClassifyAsyncClient.multiLabelClassifyPagedIterable( - documents, projectName, deploymentName, options, context).getSyncPoller(); + return client.labelClassifyUtilClient.multiLabelClassifyPagedIterable( + documents, projectName, deploymentName, options, context); } /** @@ -2739,12 +2853,12 @@ public SyncPoller beginAnalyzeActions( Iterable documents, TextAnalyticsActions actions, String language, AnalyzeActionsOptions options) { - return client.analyzeActionsAsyncClient.beginAnalyzeActionsIterable( + return client.analyzeActionsUtilClient.beginAnalyzeActionsIterable( mapByIndex(documents, (index, value) -> { final TextDocumentInput textDocumentInput = new TextDocumentInput(index, value); textDocumentInput.setLanguage(language); return textDocumentInput; - }), actions, options, Context.NONE).getSyncPoller(); + }), actions, options, Context.NONE); } /** @@ -2826,7 +2940,6 @@ public SyncPoller beginAnalyzeActions( Iterable documents, TextAnalyticsActions actions, AnalyzeActionsOptions options, Context context) { - return client.analyzeActionsAsyncClient.beginAnalyzeActionsIterable(documents, actions, options, context) - .getSyncPoller(); + return client.analyzeActionsUtilClient.beginAnalyzeActionsIterable(documents, actions, options, context); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AnalyzeTextsImpl.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AnalyzeTextsImpl.java index f8ecba5dc21bc..1421ae0862bb3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AnalyzeTextsImpl.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AnalyzeTextsImpl.java @@ -26,6 +26,7 @@ import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.RestProxy; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import reactor.core.publisher.Mono; import java.util.UUID; @@ -66,6 +67,16 @@ Mono> submitJob( @HeaderParam("Accept") String accept, Context context); + @Post("/analyze-text/jobs") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + ResponseBase submitJobSync( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AnalyzeTextJobsInput body, + @HeaderParam("Accept") String accept, + Context context); + @Get("/analyze-text/jobs/{jobId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -79,6 +90,19 @@ Mono> jobStatus( @HeaderParam("Accept") String accept, Context context); + @Get("/analyze-text/jobs/{jobId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response jobStatusSync( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("jobId") UUID jobId, + @QueryParam("showStats") Boolean showStats, + @QueryParam("top") Integer top, + @QueryParam("skip") Integer skip, + @HeaderParam("Accept") String accept, + Context context); + @Post("/analyze-text/jobs/{jobId}:cancel") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -88,6 +112,38 @@ Mono> cancelJob( @PathParam("jobId") UUID jobId, @HeaderParam("Accept") String accept, Context context); + + @Post("/analyze-text/jobs/{jobId}:cancel") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + ResponseBase cancelJobSync( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("jobId") UUID jobId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Submit text analysis job + * + *

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a + * long-running operation. + * + * @param body Collection of documents to analyze and one or more tasks to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> submitJobWithResponseAsync( + AnalyzeTextJobsInput body) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.submitJob( + this.client.getEndpoint(), this.client.getApiVersion(), body, accept, context)); } /** @@ -110,6 +166,109 @@ public Mono> submitJobWithRespo return service.submitJob(this.client.getEndpoint(), this.client.getApiVersion(), body, accept, context); } + /** + * Submit text analysis job + * + *

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a + * long-running operation. + * + * @param body Collection of documents to analyze and one or more tasks to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono submitJobAsync(AnalyzeTextJobsInput body) { + return submitJobWithResponseAsync(body).flatMap(ignored -> Mono.empty()); + } + + /** + * Submit text analysis job + * + *

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a + * long-running operation. + * + * @param body Collection of documents to analyze and one or more tasks to execute. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono submitJobAsync(AnalyzeTextJobsInput body, Context context) { + return submitJobWithResponseAsync(body, context).flatMap(ignored -> Mono.empty()); + } + + /** + * Submit text analysis job + * + *

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a + * long-running operation. + * + * @param body Collection of documents to analyze and one or more tasks to execute. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase submitJobWithResponse( + AnalyzeTextJobsInput body, Context context) { + final String accept = "application/json"; + return service.submitJobSync(this.client.getEndpoint(), this.client.getApiVersion(), body, accept, context); + } + + /** + * Submit text analysis job + * + *

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a + * long-running operation. + * + * @param body Collection of documents to analyze and one or more tasks to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void submitJob(AnalyzeTextJobsInput body) { + submitJobWithResponse(body, Context.NONE); + } + + /** + * Get analysis status and results + * + *

Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are succeeded, the + * job will transition to the succeeded state and results will be available for each task. + * + * @param jobId Job ID. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param top The maximum number of resources to return from the collection. + * @param skip An offset into the collection of the first resource to be returned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an analysis job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> jobStatusWithResponseAsync( + UUID jobId, Boolean showStats, Integer top, Integer skip) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.jobStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + jobId, + showStats, + top, + skip, + accept, + context)); + } + /** * Get analysis status and results * @@ -134,6 +293,113 @@ public Mono> jobStatusWithResponseAsync( this.client.getEndpoint(), this.client.getApiVersion(), jobId, showStats, top, skip, accept, context); } + /** + * Get analysis status and results + * + *

Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are succeeded, the + * job will transition to the succeeded state and results will be available for each task. + * + * @param jobId Job ID. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param top The maximum number of resources to return from the collection. + * @param skip An offset into the collection of the first resource to be returned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an analysis job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono jobStatusAsync(UUID jobId, Boolean showStats, Integer top, Integer skip) { + return jobStatusWithResponseAsync(jobId, showStats, top, skip).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get analysis status and results + * + *

Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are succeeded, the + * job will transition to the succeeded state and results will be available for each task. + * + * @param jobId Job ID. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param top The maximum number of resources to return from the collection. + * @param skip An offset into the collection of the first resource to be returned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an analysis job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono jobStatusAsync( + UUID jobId, Boolean showStats, Integer top, Integer skip, Context context) { + return jobStatusWithResponseAsync(jobId, showStats, top, skip, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get analysis status and results + * + *

Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are succeeded, the + * job will transition to the succeeded state and results will be available for each task. + * + * @param jobId Job ID. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param top The maximum number of resources to return from the collection. + * @param skip An offset into the collection of the first resource to be returned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an analysis job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response jobStatusWithResponse( + UUID jobId, Boolean showStats, Integer top, Integer skip, Context context) { + final String accept = "application/json"; + return service.jobStatusSync( + this.client.getEndpoint(), this.client.getApiVersion(), jobId, showStats, top, skip, accept, context); + } + + /** + * Get analysis status and results + * + *

Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are succeeded, the + * job will transition to the succeeded state and results will be available for each task. + * + * @param jobId Job ID. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param top The maximum number of resources to return from the collection. + * @param skip An offset into the collection of the first resource to be returned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an analysis job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeTextJobState jobStatus(UUID jobId, Boolean showStats, Integer top, Integer skip) { + return jobStatusWithResponse(jobId, showStats, top, skip, Context.NONE).getValue(); + } + + /** + * Cancel a long-running Text Analysis job + * + *

Cancel a long-running Text Analysis job. + * + * @param jobId Job ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelJobWithResponseAsync(UUID jobId) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.cancelJob( + this.client.getEndpoint(), this.client.getApiVersion(), jobId, accept, context)); + } + /** * Cancel a long-running Text Analysis job * @@ -152,4 +418,70 @@ public Mono> cancelJobWithRespo final String accept = "application/json"; return service.cancelJob(this.client.getEndpoint(), this.client.getApiVersion(), jobId, accept, context); } + + /** + * Cancel a long-running Text Analysis job + * + *

Cancel a long-running Text Analysis job. + * + * @param jobId Job ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelJobAsync(UUID jobId) { + return cancelJobWithResponseAsync(jobId).flatMap(ignored -> Mono.empty()); + } + + /** + * Cancel a long-running Text Analysis job + * + *

Cancel a long-running Text Analysis job. + * + * @param jobId Job ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelJobAsync(UUID jobId, Context context) { + return cancelJobWithResponseAsync(jobId, context).flatMap(ignored -> Mono.empty()); + } + + /** + * Cancel a long-running Text Analysis job + * + *

Cancel a long-running Text Analysis job. + * + * @param jobId Job ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase cancelJobWithResponse(UUID jobId, Context context) { + final String accept = "application/json"; + return service.cancelJobSync(this.client.getEndpoint(), this.client.getApiVersion(), jobId, accept, context); + } + + /** + * Cancel a long-running Text Analysis job + * + *

Cancel a long-running Text Analysis job. + * + * @param jobId Job ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancelJob(UUID jobId) { + cancelJobWithResponse(jobId, Context.NONE); + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImpl.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImpl.java index d4ac583f3e47d..9429d4317896f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImpl.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImpl.java @@ -26,6 +26,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import com.azure.core.util.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; import reactor.core.publisher.Mono; @@ -164,6 +165,38 @@ Mono> analyzeText( @BodyParam("application/json") AnalyzeTextTask body, @HeaderParam("Accept") String accept, Context context); + + @Post("/:analyze-text") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response analyzeTextSync( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("showStats") Boolean showStats, + @BodyParam("application/json") AnalyzeTextTask body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Request text analysis over a collection of documents. + * + *

Submit a collection of text documents for analysis. Specify a single unique task to be executed immediately. + * + * @param body Collection of documents to analyze and a single task to execute. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeTextWithResponseAsync(AnalyzeTextTask body, Boolean showStats) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.analyzeText( + this.getEndpoint(), this.getApiVersion(), showStats, body, accept, context)); } /** @@ -185,4 +218,76 @@ public Mono> analyzeTextWithResponseAsync( final String accept = "application/json"; return service.analyzeText(this.getEndpoint(), this.getApiVersion(), showStats, body, accept, context); } + + /** + * Request text analysis over a collection of documents. + * + *

Submit a collection of text documents for analysis. Specify a single unique task to be executed immediately. + * + * @param body Collection of documents to analyze and a single task to execute. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono analyzeTextAsync(AnalyzeTextTask body, Boolean showStats) { + return analyzeTextWithResponseAsync(body, showStats).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request text analysis over a collection of documents. + * + *

Submit a collection of text documents for analysis. Specify a single unique task to be executed immediately. + * + * @param body Collection of documents to analyze and a single task to execute. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono analyzeTextAsync(AnalyzeTextTask body, Boolean showStats, Context context) { + return analyzeTextWithResponseAsync(body, showStats, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request text analysis over a collection of documents. + * + *

Submit a collection of text documents for analysis. Specify a single unique task to be executed immediately. + * + * @param body Collection of documents to analyze and a single task to execute. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response analyzeTextWithResponse( + AnalyzeTextTask body, Boolean showStats, Context context) { + final String accept = "application/json"; + return service.analyzeTextSync(this.getEndpoint(), this.getApiVersion(), showStats, body, accept, context); + } + + /** + * Request text analysis over a collection of documents. + * + *

Submit a collection of text documents for analysis. Specify a single unique task to be executed immediately. + * + * @param body Collection of documents to analyze and a single task to execute. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeTextTaskResult analyzeText(AnalyzeTextTask body, Boolean showStats) { + return analyzeTextWithResponse(body, showStats, Context.NONE).getValue(); + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImplBuilder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImplBuilder.java index b3c36d4e69ca6..697556a5d4cb5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImplBuilder.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/MicrosoftCognitiveLanguageServiceTextAnalysisImplBuilder.java @@ -42,6 +42,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; /** A builder for creating a new instance of the MicrosoftCognitiveLanguageServiceTextAnalysis type. */ @@ -59,7 +60,7 @@ public final class MicrosoftCognitiveLanguageServiceTextAnalysisImplBuilder @Generated private static final String[] DEFAULT_SCOPES = new String[] {"https://cognitiveservices.azure.com/.default"}; - @Generated private final Map properties = new HashMap<>(); + @Generated private static final Map PROPERTIES = new HashMap<>(); @Generated private final List pipelinePolicies; @@ -138,6 +139,7 @@ public MicrosoftCognitiveLanguageServiceTextAnalysisImplBuilder retryOptions(Ret @Generated @Override public MicrosoftCognitiveLanguageServiceTextAnalysisImplBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); pipelinePolicies.add(customPolicy); return this; } @@ -267,21 +269,17 @@ public MicrosoftCognitiveLanguageServiceTextAnalysisImpl buildClient() { private HttpPipeline createHttpPipeline() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - if (httpLogOptions == null) { - httpLogOptions = new HttpLogOptions(); - } - if (clientOptions == null) { - clientOptions = new ClientOptions(); - } + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; List policies = new ArrayList<>(); - String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersFromContextPolicy()); HttpHeaders headers = new HttpHeaders(); - clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + localClientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); if (headers.getSize() > 0) { policies.add(new AddHeadersPolicy(headers)); } @@ -309,7 +307,7 @@ private HttpPipeline createHttpPipeline() { new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) - .clientOptions(clientOptions) + .clientOptions(localClientOptions) .build(); return httpPipeline; } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java index 2594723da8ddc..87f9498cc8ea3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java @@ -174,6 +174,16 @@ Mono> analyze( @HeaderParam("Accept") String accept, Context context); + @Post("/analyze") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + ResponseBase analyzeSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @BodyParam("application/json") AnalyzeBatchInput body, + @HeaderParam("Accept") String accept, + Context context); + @Get("/analyze/jobs/{jobId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -187,6 +197,19 @@ Mono> analyzeStatus( @HeaderParam("Accept") String accept, Context context); + @Get("/analyze/jobs/{jobId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response analyzeStatusSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("jobId") String jobId, + @QueryParam("showStats") Boolean showStats, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @HeaderParam("Accept") String accept, + Context context); + @Get("/entities/health/jobs/{jobId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -200,6 +223,19 @@ Mono> healthStatus( @HeaderParam("Accept") String accept, Context context); + @Get("/entities/health/jobs/{jobId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response healthStatusSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("jobId") UUID jobId, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("showStats") Boolean showStats, + @HeaderParam("Accept") String accept, + Context context); + @Delete("/entities/health/jobs/{jobId}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -210,6 +246,16 @@ Mono> cancelHealthJob( @HeaderParam("Accept") String accept, Context context); + @Delete("/entities/health/jobs/{jobId}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + ResponseBase cancelHealthJobSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("jobId") UUID jobId, + @HeaderParam("Accept") String accept, + Context context); + @Post("/entities/health/jobs") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -223,6 +269,19 @@ Mono> health( @HeaderParam("Accept") String accept, Context context); + @Post("/entities/health/jobs") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + ResponseBase healthSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @QueryParam("model-version") String modelVersion, + @QueryParam("stringIndexType") StringIndexType stringIndexType, + @QueryParam("loggingOptOut") Boolean loggingOptOut, + @BodyParam("application/json") MultiLanguageBatchInput input, + @HeaderParam("Accept") String accept, + Context context); + @Post("/entities/recognition/general") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -237,6 +296,20 @@ Mono> entitiesRecognitionGeneral( @HeaderParam("Accept") String accept, Context context); + @Post("/entities/recognition/general") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response entitiesRecognitionGeneralSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @QueryParam("model-version") String modelVersion, + @QueryParam("showStats") Boolean showStats, + @QueryParam("loggingOptOut") Boolean loggingOptOut, + @QueryParam("stringIndexType") StringIndexType stringIndexType, + @BodyParam("application/json") MultiLanguageBatchInput input, + @HeaderParam("Accept") String accept, + Context context); + @Post("/entities/recognition/pii") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -253,6 +326,22 @@ Mono> entitiesRecognitionPii( @HeaderParam("Accept") String accept, Context context); + @Post("/entities/recognition/pii") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response entitiesRecognitionPiiSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @QueryParam("model-version") String modelVersion, + @QueryParam("showStats") Boolean showStats, + @QueryParam("loggingOptOut") Boolean loggingOptOut, + @QueryParam("domain") String domain, + @QueryParam("stringIndexType") StringIndexType stringIndexType, + @QueryParam("piiCategories") String piiCategories, + @BodyParam("application/json") MultiLanguageBatchInput input, + @HeaderParam("Accept") String accept, + Context context); + @Post("/entities/linking") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -267,6 +356,20 @@ Mono> entitiesLinking( @HeaderParam("Accept") String accept, Context context); + @Post("/entities/linking") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response entitiesLinkingSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @QueryParam("model-version") String modelVersion, + @QueryParam("showStats") Boolean showStats, + @QueryParam("loggingOptOut") Boolean loggingOptOut, + @QueryParam("stringIndexType") StringIndexType stringIndexType, + @BodyParam("application/json") MultiLanguageBatchInput input, + @HeaderParam("Accept") String accept, + Context context); + @Post("/keyPhrases") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -280,6 +383,19 @@ Mono> keyPhrases( @HeaderParam("Accept") String accept, Context context); + @Post("/keyPhrases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response keyPhrasesSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @QueryParam("model-version") String modelVersion, + @QueryParam("showStats") Boolean showStats, + @QueryParam("loggingOptOut") Boolean loggingOptOut, + @BodyParam("application/json") MultiLanguageBatchInput input, + @HeaderParam("Accept") String accept, + Context context); + @Post("/languages") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -293,6 +409,19 @@ Mono> languages( @HeaderParam("Accept") String accept, Context context); + @Post("/languages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response languagesSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @QueryParam("model-version") String modelVersion, + @QueryParam("showStats") Boolean showStats, + @QueryParam("loggingOptOut") Boolean loggingOptOut, + @BodyParam("application/json") LanguageBatchInput input, + @HeaderParam("Accept") String accept, + Context context); + @Post("/sentiment") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorResponseException.class) @@ -307,6 +436,21 @@ Mono> sentiment( @BodyParam("application/json") MultiLanguageBatchInput input, @HeaderParam("Accept") String accept, Context context); + + @Post("/sentiment") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorResponseException.class) + Response sentimentSync( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @QueryParam("model-version") String modelVersion, + @QueryParam("showStats") Boolean showStats, + @QueryParam("loggingOptOut") Boolean loggingOptOut, + @QueryParam("opinionMining") Boolean opinionMining, + @QueryParam("stringIndexType") StringIndexType stringIndexType, + @BodyParam("application/json") MultiLanguageBatchInput input, + @HeaderParam("Accept") String accept, + Context context); } /** @@ -325,6 +469,22 @@ public Mono> analyzeWithResponseAsync(Analyze return service.analyze(this.getEndpoint(), this.getApiVersion(), body, accept, context); } + /** + * Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed. + * + * @param body Collection of documents to analyze and tasks to execute. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase analyzeWithResponseSync(AnalyzeBatchInput body, Context context) { + final String accept = "application/json, text/json"; + return service.analyzeSync(this.getEndpoint(), this.getApiVersion(), body, accept, context); + } + /** * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are completed, the job * will transition to the completed state and results will be available for each task. @@ -349,6 +509,30 @@ public Mono> analyzeStatusWithResponseAsync( this.getEndpoint(), this.getApiVersion(), jobId, showStats, top, skip, accept, context); } + /** + * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are completed, the job + * will transition to the completed state and results will be available for each task. + * + * @param jobId Job ID for Analyze. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param top (Optional) Set the maximum number of results per task. When both $top and $skip are specified, $skip + * is applied first. + * @param skip (Optional) Set the number of elements to offset in the response. When both $top and $skip are + * specified, $skip is applied first. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an analysis job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response analyzeStatusWithResponseSync( + String jobId, Boolean showStats, Integer top, Integer skip, Context context) { + final String accept = "application/json, text/json"; + return service.analyzeStatusSync( + this.getEndpoint(), this.getApiVersion(), jobId, showStats, top, skip, accept, context); + } + /** * Get details of the healthcare prediction job specified by the jobId. * @@ -372,6 +556,29 @@ public Mono> healthStatusWithResponseAsync( this.getEndpoint(), this.getApiVersion(), jobId, top, skip, showStats, accept, context); } + /** + * Get details of the healthcare prediction job specified by the jobId. + * + * @param jobId Job ID. + * @param top (Optional) Set the maximum number of results per task. When both $top and $skip are specified, $skip + * is applied first. + * @param skip (Optional) Set the number of elements to offset in the response. When both $top and $skip are + * specified, $skip is applied first. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the healthcare prediction job specified by the jobId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response healthStatusWithResponseSync( + UUID jobId, Integer top, Integer skip, Boolean showStats, Context context) { + final String accept = "application/json, text/json"; + return service.healthStatusSync( + this.getEndpoint(), this.getApiVersion(), jobId, top, skip, showStats, accept, context); + } + /** * Cancel healthcare prediction job. * @@ -390,6 +597,22 @@ public Mono> cancelHealthJobWithRespo return service.cancelHealthJob(this.getEndpoint(), this.getApiVersion(), jobId, accept, context); } + /** + * Cancel healthcare prediction job. + * + * @param jobId Job ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase cancelHealthJobWithResponseSync(UUID jobId, Context context) { + final String accept = "application/json, text/json"; + return service.cancelHealthJobSync(this.getEndpoint(), this.getApiVersion(), jobId, accept, context); + } + /** * Start a healthcare analysis job to recognize healthcare related entities (drugs, conditions, symptoms, etc) and * their relations. @@ -431,6 +654,47 @@ public Mono> healthWithResponseAsync( context); } + /** + * Start a healthcare analysis job to recognize healthcare related entities (drugs, conditions, symptoms, etc) and + * their relations. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is + * not specified, the API should default to the latest, non-preview version. + * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text + * Elements (Graphemes) according to Unicode v8.0.0. For additional information see + * https://aka.ms/text-analytics-offsets. + * @param loggingOptOut (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. + * By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in + * providing you with the Text Analytics natural language processing functions. Setting this parameter to true, + * disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive + * Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft + * Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase healthWithResponseSync( + MultiLanguageBatchInput input, + String modelVersion, + StringIndexType stringIndexType, + Boolean loggingOptOut, + Context context) { + final String accept = "application/json, text/json"; + return service.healthSync( + this.getEndpoint(), + this.getApiVersion(), + modelVersion, + stringIndexType, + loggingOptOut, + input, + accept, + context); + } + /** * The API returns a list of general named entities in a given document. For the list of supported entity types, * check <a href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</a>. See the <a @@ -477,6 +741,52 @@ public Mono> entitiesRecognitionGeneralWithResponseAsyn context); } + /** + * The API returns a list of general named entities in a given document. For the list of supported entity types, + * check <a href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</a>. See the <a + * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled + * languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is + * not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param loggingOptOut (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. + * By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in + * providing you with the Text Analytics natural language processing functions. Setting this parameter to true, + * disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive + * Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft + * Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai. + * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text + * Elements (Graphemes) according to Unicode v8.0.0. For additional information see + * https://aka.ms/text-analytics-offsets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response entitiesRecognitionGeneralWithResponseSync( + MultiLanguageBatchInput input, + String modelVersion, + Boolean showStats, + Boolean loggingOptOut, + StringIndexType stringIndexType, + Context context) { + final String accept = "application/json, text/json"; + return service.entitiesRecognitionGeneralSync( + this.getEndpoint(), + this.getApiVersion(), + modelVersion, + showStats, + loggingOptOut, + stringIndexType, + input, + accept, + context); + } + /** * The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in the document. For * the list of supported entity types, check <a href="https://aka.ms/azsdk/language/pii">Supported Entity @@ -532,6 +842,61 @@ public Mono> entitiesRecognitionPiiWithResponseAsync( context); } + /** + * The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in the document. For + * the list of supported entity types, check <a href="https://aka.ms/azsdk/language/pii">Supported Entity + * Types in Text Analytics API</a>. See the <a href="https://aka.ms/talangs">Supported languages in Text + * Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is + * not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param loggingOptOut (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. + * By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in + * providing you with the Text Analytics natural language processing functions. Setting this parameter to true, + * disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive + * Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft + * Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai. + * @param domain (Optional) if specified, will set the PII domain to include only a subset of the entity categories. + * Possible values include: 'PHI', 'none'. + * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text + * Elements (Graphemes) according to Unicode v8.0.0. For additional information see + * https://aka.ms/text-analytics-offsets. + * @param piiCategories (Optional) describes the PII categories to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response entitiesRecognitionPiiWithResponseSync( + MultiLanguageBatchInput input, + String modelVersion, + Boolean showStats, + Boolean loggingOptOut, + String domain, + StringIndexType stringIndexType, + List piiCategories, + Context context) { + final String accept = "application/json, text/json"; + String piiCategoriesConverted = + JacksonAdapter.createDefaultSerializerAdapter().serializeList(piiCategories, CollectionFormat.CSV); + return service.entitiesRecognitionPiiSync( + this.getEndpoint(), + this.getApiVersion(), + modelVersion, + showStats, + loggingOptOut, + domain, + stringIndexType, + piiCategoriesConverted, + input, + accept, + context); + } + /** * The API returns a list of recognized entities with links to a well known knowledge base. See the <a * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled @@ -577,6 +942,51 @@ public Mono> entitiesLinkingWithResponseAsync( context); } + /** + * The API returns a list of recognized entities with links to a well known knowledge base. See the <a + * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled + * languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is + * not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param loggingOptOut (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. + * By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in + * providing you with the Text Analytics natural language processing functions. Setting this parameter to true, + * disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive + * Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft + * Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai. + * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text + * Elements (Graphemes) according to Unicode v8.0.0. For additional information see + * https://aka.ms/text-analytics-offsets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response entitiesLinkingWithResponseSync( + MultiLanguageBatchInput input, + String modelVersion, + Boolean showStats, + Boolean loggingOptOut, + StringIndexType stringIndexType, + Context context) { + final String accept = "application/json, text/json"; + return service.entitiesLinkingSync( + this.getEndpoint(), + this.getApiVersion(), + modelVersion, + showStats, + loggingOptOut, + stringIndexType, + input, + accept, + context); + } + /** * The API returns a list of strings denoting the key phrases in the input text. See the <a * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled @@ -617,6 +1027,46 @@ public Mono> keyPhrasesWithResponseAsync( context); } + /** + * The API returns a list of strings denoting the key phrases in the input text. See the <a + * href="https://aka.ms/talangs">Supported languages in Text Analytics API</a> for the list of enabled + * languages. + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is + * not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param loggingOptOut (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. + * By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in + * providing you with the Text Analytics natural language processing functions. Setting this parameter to true, + * disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive + * Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft + * Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response keyPhrasesWithResponseSync( + MultiLanguageBatchInput input, + String modelVersion, + Boolean showStats, + Boolean loggingOptOut, + Context context) { + final String accept = "application/json, text/json"; + return service.keyPhrasesSync( + this.getEndpoint(), + this.getApiVersion(), + modelVersion, + showStats, + loggingOptOut, + input, + accept, + context); + } + /** * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% * certainty that the identified language is true. See the <a href="https://aka.ms/talangs">Supported @@ -653,6 +1103,42 @@ public Mono> languagesWithResponseAsync( context); } + /** + * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% + * certainty that the identified language is true. See the <a href="https://aka.ms/talangs">Supported + * languages in Text Analytics API</a> for the list of enabled languages. + * + * @param input Collection of documents to analyze for language endpoint. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is + * not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param loggingOptOut (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. + * By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in + * providing you with the Text Analytics natural language processing functions. Setting this parameter to true, + * disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive + * Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft + * Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response languagesWithResponseSync( + LanguageBatchInput input, String modelVersion, Boolean showStats, Boolean loggingOptOut, Context context) { + final String accept = "application/json, text/json"; + return service.languagesSync( + this.getEndpoint(), + this.getApiVersion(), + modelVersion, + showStats, + loggingOptOut, + input, + accept, + context); + } + /** * The API returns a detailed sentiment analysis for the input text. The analysis is done in multiple levels of * granularity, start from the a document level, down to sentence and key terms (targets and assessments). @@ -700,4 +1186,52 @@ public Mono> sentimentWithResponseAsync( accept, context); } + + /** + * The API returns a detailed sentiment analysis for the input text. The analysis is done in multiple levels of + * granularity, start from the a document level, down to sentence and key terms (targets and assessments). + * + * @param input Collection of documents to analyze. + * @param modelVersion (Optional) This value indicates which model will be used for scoring. If a model-version is + * not specified, the API should default to the latest, non-preview version. + * @param showStats (Optional) if set to true, response will contain request and document level statistics. + * @param loggingOptOut (Optional) If set to true, you opt-out of having your text input logged for troubleshooting. + * By default, Text Analytics logs your input text for 48 hours, solely to allow for troubleshooting issues in + * providing you with the Text Analytics natural language processing functions. Setting this parameter to true, + * disables input logging and may limit our ability to remediate issues that occur. Please see Cognitive + * Services Compliance and Privacy notes at https://aka.ms/cs-compliance for additional details, and Microsoft + * Responsible AI principles at https://www.microsoft.com/en-us/ai/responsible-ai. + * @param opinionMining (Optional) if set to true, response will contain not only sentiment prediction but also + * opinion mining (aspect-based sentiment analysis) results. + * @param stringIndexType (Optional) Specifies the method used to interpret string offsets. Defaults to Text + * Elements (Graphemes) according to Unicode v8.0.0. For additional information see + * https://aka.ms/text-analytics-offsets. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sentimentWithResponseSync( + MultiLanguageBatchInput input, + String modelVersion, + Boolean showStats, + Boolean loggingOptOut, + Boolean opinionMining, + StringIndexType stringIndexType, + Context context) { + final String accept = "application/json, text/json"; + return service.sentimentSync( + this.getEndpoint(), + this.getApiVersion(), + modelVersion, + showStats, + loggingOptOut, + opinionMining, + stringIndexType, + input, + accept, + context); + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java index 59655c7b2e2df..55d0f9359cf2c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java @@ -188,6 +188,7 @@ public final class Utility { // default time interval for polling public static final Duration DEFAULT_POLL_INTERVAL = Duration.ofSeconds(30); + public static final String HTTP_REST_PROXY_SYNC_PROXY_ENABLE = "com.azure.core.http.restproxy.syncproxy.enable"; private static final ClientLogger LOGGER = new ClientLogger(Utility.class); @@ -430,7 +431,7 @@ public static Response toDynamicClassif } // Detect Language - public static Response toDetectLanguageResultCollectionResponse( + public static Response toDetectLanguageResultCollectionLegacyApi( Response response) { final LanguageResult languageResult = response.getValue(); final List detectLanguageResults = new ArrayList<>(); @@ -464,7 +465,7 @@ public static Response toDetectLanguageResultCol languageResult.getStatistics() == null ? null : toBatchStatistics(languageResult.getStatistics()))); } - public static Response toDetectLanguageResultCollectionResponse2( + public static Response toDetectLanguageResultCollectionLanguageApi( Response response) { final LanguageDetectionResult languageResult = ((LanguageDetectionTaskResult) response.getValue()).getResults(); @@ -515,7 +516,7 @@ public static DetectedLanguage toDetectedLanguage( } // Key Phrase Extraction - public static Response toExtractKeyPhrasesResultCollectionResponse( + public static Response toResultCollectionResponseLegacyApi( final Response response) { final KeyPhraseResult keyPhraseResult = response.getValue(); // List of documents results @@ -543,7 +544,7 @@ public static Response toExtractKeyPhrasesRes : toBatchStatistics(keyPhraseResult.getStatistics()))); } - public static Response toExtractKeyPhrasesResultCollectionResponse2( + public static Response toResultCollectionResponseLanguageApi( final Response response) { final KeyPhraseResult keyPhraseResult = ((KeyPhraseTaskResult) response.getValue()).getResults(); // List of documents results @@ -629,7 +630,7 @@ public static RecognizeEntitiesResultCollection toRecognizeEntitiesResultCollect entitiesResult.getStatistics() == null ? null : toBatchStatistics(entitiesResult.getStatistics())); } - public static Response toRecognizeEntitiesResultCollectionResponse( + public static Response toRecognizeEntitiesResultCollectionResponseLegacyApi( final Response response) { EntitiesResult entitiesResult = response.getValue(); return new SimpleResponse<>(response, @@ -1260,6 +1261,18 @@ private static Integer getHealthcareEntityIndex(String entityReference) { new RuntimeException("Failed to parse healthcare entity index from: " + entityReference)); } + /** + * Enable the sync stack rest proxy. + * + * @param context It offers a means of passing arbitrary data (key-value pairs) to pipeline policies. + * Most applications do not need to pass arbitrary data to the pipeline and can pass Context.NONE or null. + * + * @return The Context. + */ + public static Context enableSyncRestProxy(Context context) { + return context.addData(HTTP_REST_PROXY_SYNC_PROXY_ENABLE, true); + } + /** * Get the non-null {@link Context}. The default value is {@link Context#NONE}. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROResult.java index ba01f21d9798c..d337ba1e56087 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROResult.java @@ -21,6 +21,9 @@ public final class AbstractiveSummarizationLROResult extends AnalyzeTextLROResul @JsonProperty(value = "results", required = true) private AbstractiveSummarizationResult results; + /** Creates an instance of AbstractiveSummarizationLROResult class. */ + public AbstractiveSummarizationLROResult() {} + /** * Get the results property: An object representing the pre-build summarization results of each document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROTask.java index 930d066208d2c..dd4b927bc52d5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationLROTask.java @@ -20,6 +20,9 @@ public final class AbstractiveSummarizationLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters", required = true) private AbstractiveSummarizationTaskParameters parameters; + /** Creates an instance of AbstractiveSummarizationLROTask class. */ + public AbstractiveSummarizationLROTask() {} + /** * Get the parameters property: Supported parameters for the pre-build Abstractive Summarization task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResult.java index ae97e8e19ac0c..2ad80b4c9c299 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResult.java @@ -29,6 +29,9 @@ public final class AbstractiveSummarizationResult extends AbstractiveSummarizati @JsonProperty(value = "modelVersion", required = true) private String modelVersion; + /** Creates an instance of AbstractiveSummarizationResult class. */ + public AbstractiveSummarizationResult() {} + /** * Get the errors property: Errors by document id. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResultBase.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResultBase.java index c79c25b96b93b..034011bc1ff5b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResultBase.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationResultBase.java @@ -17,6 +17,9 @@ public class AbstractiveSummarizationResultBase { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of AbstractiveSummarizationResultBase class. */ + public AbstractiveSummarizationResultBase() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParameters.java index 3d1ab564d1d11..b2d4e8a7ab97b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParameters.java @@ -22,6 +22,9 @@ public final class AbstractiveSummarizationTaskParameters extends AbstractiveSum @JsonProperty(value = "loggingOptOut") private Boolean loggingOptOut; + /** Creates an instance of AbstractiveSummarizationTaskParameters class. */ + public AbstractiveSummarizationTaskParameters() {} + /** * Get the modelVersion property: The modelVersion property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParametersBase.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParametersBase.java index 418fd7a143575..31b9be54983f6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParametersBase.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummarizationTaskParametersBase.java @@ -23,6 +23,9 @@ public class AbstractiveSummarizationTaskParametersBase { @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of AbstractiveSummarizationTaskParametersBase class. */ + public AbstractiveSummarizationTaskParametersBase() {} + /** * Get the sentenceCount property: It controls the approximate number of sentences in the output summaries. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummary.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummary.java index 5c5f754ec6419..375397d702179 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummary.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummary.java @@ -23,6 +23,9 @@ public final class AbstractiveSummary { @JsonProperty(value = "contexts") private List contexts; + /** Creates an instance of AbstractiveSummary class. */ + public AbstractiveSummary() {} + /** * Get the text property: The text of the summary. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResult.java index 8d66ec710077a..a5d7518be0d34 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResult.java @@ -17,6 +17,9 @@ public class AbstractiveSummaryDocumentResult extends DocumentResult { @JsonProperty(value = "summaries", required = true) private List summaries; + /** Creates an instance of AbstractiveSummaryDocumentResult class. */ + public AbstractiveSummaryDocumentResult() {} + /** * Get the summaries property: A list of abstractive summaries. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResultWithDetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResultWithDetectedLanguage.java index fa0175ba2f324..c6af418ff1297 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResultWithDetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AbstractiveSummaryDocumentResultWithDetectedLanguage.java @@ -18,6 +18,9 @@ public final class AbstractiveSummaryDocumentResultWithDetectedLanguage extends @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of AbstractiveSummaryDocumentResultWithDetectedLanguage class. */ + public AbstractiveSummaryDocumentResultWithDetectedLanguage() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeResolution.java index 0ce03151126c8..1f67e2dd4b7df 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeResolution.java @@ -26,6 +26,9 @@ public final class AgeResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of AgeResolution class. */ + public AgeResolution() {} + /** * Get the unit property: The Age Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeUnit.java index 9fa19896e019a..ea7cf331902cf 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AgeUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for AgeUnit. */ +/** The Age Unit of measurement. */ public final class AgeUnit extends ExpandableStringEnum { /** Static value Unspecified for AgeUnit. */ public static final AgeUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextDynamicClassificationInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextDynamicClassificationInput.java index b6a50a6d56c35..5344518e5a843 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextDynamicClassificationInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextDynamicClassificationInput.java @@ -26,6 +26,9 @@ public final class AnalyzeTextDynamicClassificationInput extends AnalyzeTextTask @JsonProperty(value = "parameters") private DynamicClassificationTaskParameters parameters; + /** Creates an instance of AnalyzeTextDynamicClassificationInput class. */ + public AnalyzeTextDynamicClassificationInput() {} + /** * Get the analysisInput property: The analysisInput property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityLinkingInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityLinkingInput.java index 44e2803eb656d..9e73a58d4ede8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityLinkingInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityLinkingInput.java @@ -26,6 +26,9 @@ public final class AnalyzeTextEntityLinkingInput extends AnalyzeTextTask { @JsonProperty(value = "parameters") private EntityLinkingTaskParameters parameters; + /** Creates an instance of AnalyzeTextEntityLinkingInput class. */ + public AnalyzeTextEntityLinkingInput() {} + /** * Get the analysisInput property: The analysisInput property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityRecognitionInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityRecognitionInput.java index 3496df98c4ca7..bcfa610b3ccf3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityRecognitionInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextEntityRecognitionInput.java @@ -26,6 +26,9 @@ public final class AnalyzeTextEntityRecognitionInput extends AnalyzeTextTask { @JsonProperty(value = "parameters") private EntitiesTaskParameters parameters; + /** Creates an instance of AnalyzeTextEntityRecognitionInput class. */ + public AnalyzeTextEntityRecognitionInput() {} + /** * Get the analysisInput property: The analysisInput property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobState.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobState.java index 0cbc2e6dc1900..d39cfd1a21319 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobState.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobState.java @@ -24,6 +24,9 @@ public final class AnalyzeTextJobState extends JobState { @JsonProperty(value = "statistics") private RequestStatistics statistics; + /** Creates an instance of AnalyzeTextJobState class. */ + public AnalyzeTextJobState() {} + /** * Get the tasks property: The tasks property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobStatistics.java index 71ac00323b66c..16aaa2f0da665 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobStatistics.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobStatistics.java @@ -16,6 +16,9 @@ public class AnalyzeTextJobStatistics { @JsonProperty(value = "statistics") private RequestStatistics statistics; + /** Creates an instance of AnalyzeTextJobStatistics class. */ + public AnalyzeTextJobStatistics() {} + /** * Get the statistics property: if showStats=true was specified in the request this field will contain information * about the request payload. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobsInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobsInput.java index fa4f780f1cffe..7994bb7d7756b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobsInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextJobsInput.java @@ -35,6 +35,9 @@ public final class AnalyzeTextJobsInput { @JsonProperty(value = "tasks", required = true) private List tasks; + /** Creates an instance of AnalyzeTextJobsInput class. */ + public AnalyzeTextJobsInput() {} + /** * Get the displayName property: Optional display name for the analysis job. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextKeyPhraseExtractionInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextKeyPhraseExtractionInput.java index 1cbcfce68c83b..58317c626fa82 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextKeyPhraseExtractionInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextKeyPhraseExtractionInput.java @@ -26,6 +26,9 @@ public final class AnalyzeTextKeyPhraseExtractionInput extends AnalyzeTextTask { @JsonProperty(value = "parameters") private KeyPhraseTaskParameters parameters; + /** Creates an instance of AnalyzeTextKeyPhraseExtractionInput class. */ + public AnalyzeTextKeyPhraseExtractionInput() {} + /** * Get the analysisInput property: The analysisInput property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResult.java index b589a0eeaa5d5..381c0538e3116 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResult.java @@ -43,6 +43,9 @@ public class AnalyzeTextLROResult extends TaskState { @JsonProperty(value = "taskName") private String taskName; + /** Creates an instance of AnalyzeTextLROResult class. */ + public AnalyzeTextLROResult() {} + /** * Get the taskName property: The taskName property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResultsKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResultsKind.java index c779fb46684d4..1b245326a5d54 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResultsKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROResultsKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for AnalyzeTextLROResultsKind. */ +/** Enumeration of supported Text Analysis long-running operation task results. */ public final class AnalyzeTextLROResultsKind extends ExpandableStringEnum { /** Static value SentimentAnalysisLROResults for AnalyzeTextLROResultsKind. */ public static final AnalyzeTextLROResultsKind SENTIMENT_ANALYSIS_LRORESULTS = diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTask.java index 92fdb0207a11c..c2cebc9f1c8ee 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTask.java @@ -31,6 +31,9 @@ }) @Fluent public class AnalyzeTextLROTask extends TaskIdentifier { + /** Creates an instance of AnalyzeTextLROTask class. */ + public AnalyzeTextLROTask() {} + /** {@inheritDoc} */ @Override public AnalyzeTextLROTask setTaskName(String taskName) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTaskKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTaskKind.java index 2fd0c03c0dec7..35a1261654a3b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTaskKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLROTaskKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for AnalyzeTextLROTaskKind. */ +/** Enumeration of supported long-running Text Analysis tasks. */ public final class AnalyzeTextLROTaskKind extends ExpandableStringEnum { /** Static value SentimentAnalysis for AnalyzeTextLROTaskKind. */ public static final AnalyzeTextLROTaskKind SENTIMENT_ANALYSIS = fromString("SentimentAnalysis"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLanguageDetectionInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLanguageDetectionInput.java index e5be868087cdb..4850872e2c077 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLanguageDetectionInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextLanguageDetectionInput.java @@ -26,6 +26,9 @@ public final class AnalyzeTextLanguageDetectionInput extends AnalyzeTextTask { @JsonProperty(value = "parameters") private LanguageDetectionTaskParameters parameters; + /** Creates an instance of AnalyzeTextLanguageDetectionInput class. */ + public AnalyzeTextLanguageDetectionInput() {} + /** * Get the analysisInput property: The analysisInput property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextPiiEntitiesRecognitionInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextPiiEntitiesRecognitionInput.java index b852509a94b97..ea53015c35e25 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextPiiEntitiesRecognitionInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextPiiEntitiesRecognitionInput.java @@ -26,6 +26,9 @@ public final class AnalyzeTextPiiEntitiesRecognitionInput extends AnalyzeTextTas @JsonProperty(value = "parameters") private PiiTaskParameters parameters; + /** Creates an instance of AnalyzeTextPiiEntitiesRecognitionInput class. */ + public AnalyzeTextPiiEntitiesRecognitionInput() {} + /** * Get the analysisInput property: The analysisInput property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextSentimentAnalysisInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextSentimentAnalysisInput.java index 2e8b16fb79516..589b2fda9a600 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextSentimentAnalysisInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextSentimentAnalysisInput.java @@ -26,6 +26,9 @@ public final class AnalyzeTextSentimentAnalysisInput extends AnalyzeTextTask { @JsonProperty(value = "parameters") private SentimentAnalysisTaskParameters parameters; + /** Creates an instance of AnalyzeTextSentimentAnalysisInput class. */ + public AnalyzeTextSentimentAnalysisInput() {} + /** * Get the analysisInput property: The analysisInput property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTask.java index 066966a22979f..cc700bb685b7e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTask.java @@ -26,4 +26,7 @@ @JsonSubTypes.Type(name = "DynamicClassification", value = AnalyzeTextDynamicClassificationInput.class) }) @Immutable -public class AnalyzeTextTask {} +public class AnalyzeTextTask { + /** Creates an instance of AnalyzeTextTask class. */ + public AnalyzeTextTask() {} +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskKind.java index 696989adad9ae..538da1cbf288d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for AnalyzeTextTaskKind. */ +/** Enumeration of supported Text Analysis tasks. */ public final class AnalyzeTextTaskKind extends ExpandableStringEnum { /** Static value SentimentAnalysis for AnalyzeTextTaskKind. */ public static final AnalyzeTextTaskKind SENTIMENT_ANALYSIS = fromString("SentimentAnalysis"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResult.java index eccadb5472493..17740b7b4829c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResult.java @@ -26,4 +26,7 @@ @JsonSubTypes.Type(name = "DynamicClassificationResults", value = DynamicClassificationTaskResult.class) }) @Immutable -public class AnalyzeTextTaskResult {} +public class AnalyzeTextTaskResult { + /** Creates an instance of AnalyzeTextTaskResult class. */ + public AnalyzeTextTaskResult() {} +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResultsKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResultsKind.java index 73f8083228b2f..b25d7cf8c92c5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResultsKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextTaskResultsKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for AnalyzeTextTaskResultsKind. */ +/** Enumeration of supported Text Analysis task results. */ public final class AnalyzeTextTaskResultsKind extends ExpandableStringEnum { /** Static value SentimentAnalysisResults for AnalyzeTextTaskResultsKind. */ public static final AnalyzeTextTaskResultsKind SENTIMENT_ANALYSIS_RESULTS = fromString("SentimentAnalysisResults"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsCancelJobHeaders.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsCancelJobHeaders.java index 55c069b76e41e..98636711f8d25 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsCancelJobHeaders.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsCancelJobHeaders.java @@ -5,6 +5,8 @@ package com.azure.ai.textanalytics.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; import com.fasterxml.jackson.annotation.JsonProperty; /** The AnalyzeTextsCancelJobHeaders model. */ @@ -16,6 +18,18 @@ public final class AnalyzeTextsCancelJobHeaders { @JsonProperty(value = "Operation-Location") private String operationLocation; + private static final HttpHeaderName OPERATION_LOCATION = HttpHeaderName.fromString("Operation-Location"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of AnalyzeTextsCancelJobHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public AnalyzeTextsCancelJobHeaders(HttpHeaders rawHeaders) { + this.operationLocation = rawHeaders.getValue(OPERATION_LOCATION); + } + /** * Get the operationLocation property: The Operation-Location property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsSubmitJobHeaders.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsSubmitJobHeaders.java index f443bbcadd174..dc85e871b75d1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsSubmitJobHeaders.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AnalyzeTextsSubmitJobHeaders.java @@ -5,6 +5,8 @@ package com.azure.ai.textanalytics.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; import com.fasterxml.jackson.annotation.JsonProperty; /** The AnalyzeTextsSubmitJobHeaders model. */ @@ -16,6 +18,18 @@ public final class AnalyzeTextsSubmitJobHeaders { @JsonProperty(value = "Operation-Location") private String operationLocation; + private static final HttpHeaderName OPERATION_LOCATION = HttpHeaderName.fromString("Operation-Location"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of AnalyzeTextsSubmitJobHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public AnalyzeTextsSubmitJobHeaders(HttpHeaders rawHeaders) { + this.operationLocation = rawHeaders.getValue(OPERATION_LOCATION); + } + /** * Get the operationLocation property: The Operation-Location property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaResolution.java index 5d7c189b3a7b3..a3e95547b0a9b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaResolution.java @@ -26,6 +26,9 @@ public final class AreaResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of AreaResolution class. */ + public AreaResolution() {} + /** * Get the unit property: The area Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaUnit.java index 5ae5b2d48edbb..a765ed27b0db3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/AreaUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for AreaUnit. */ +/** The area Unit of measurement. */ public final class AreaUnit extends ExpandableStringEnum { /** Static value Unspecified for AreaUnit. */ public static final AreaUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Association.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Association.java index 1bb1e94ca4d3f..91e4f40f65651 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Association.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Association.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for Association. */ +/** Describes if the entity is the subject of the text or if it describes someone else. */ public enum Association { /** Enum value subject. */ SUBJECT("subject"), @@ -42,6 +42,7 @@ public static Association fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BaseResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BaseResolution.java index 6ceb511271075..c85f56de81a7e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BaseResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BaseResolution.java @@ -34,4 +34,7 @@ @JsonSubTypes.Type(name = "NumericRangeResolution", value = NumericRangeResolution.class) }) @Immutable -public class BaseResolution {} +public class BaseResolution { + /** Creates an instance of BaseResolution class. */ + public BaseResolution() {} +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BooleanResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BooleanResolution.java index 8987c61574aab..ac0a3b5b2de77 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BooleanResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/BooleanResolution.java @@ -20,6 +20,9 @@ public final class BooleanResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private boolean value; + /** Creates an instance of BooleanResolution class. */ + public BooleanResolution() {} + /** * Get the value property: The value property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Certainty.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Certainty.java index 6d5aa8fcc5d2a..4c26a5e453474 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Certainty.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Certainty.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for Certainty. */ +/** Describes the entities certainty and polarity. */ public enum Certainty { /** Enum value positive. */ POSITIVE("positive"), @@ -51,6 +51,7 @@ public static Certainty fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationDocumentResult.java index 3ef59c1cc220b..72be7fac97af1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationDocumentResult.java @@ -17,6 +17,9 @@ public class ClassificationDocumentResult extends DocumentResult { @JsonProperty(value = "class", required = true) private List classProperty; + /** Creates an instance of ClassificationDocumentResult class. */ + public ClassificationDocumentResult() {} + /** * Get the classProperty property: The class property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationResult.java index d9f5b2837ea2d..6b6aeb8ea6652 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationResult.java @@ -22,6 +22,9 @@ public final class ClassificationResult { @JsonProperty(value = "confidenceScore", required = true) private double confidenceScore; + /** Creates an instance of ClassificationResult class. */ + public ClassificationResult() {} + /** * Get the category property: Classification type. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationType.java index 5c160f1ee7068..d3d102b59d0c9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationType.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ClassificationType.java @@ -8,7 +8,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ClassificationType. */ +/** + * Specifies either one or multiple categories per document. Defaults to multi classification which may return more than + * one class for each document. + */ public final class ClassificationType extends ExpandableStringEnum { /** Static value Single for ClassificationType. */ public static final ClassificationType SINGLE = fromString("Single"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Conditionality.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Conditionality.java index 76ebbbe5562b1..f4d700d651340 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Conditionality.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Conditionality.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for Conditionality. */ +/** Describes any conditionality on the entity. */ public enum Conditionality { /** Enum value hypothetical. */ HYPOTHETICAL("hypothetical"), @@ -42,6 +42,7 @@ public static Conditionality fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CurrencyResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CurrencyResolution.java index 0c62ac8bb73ee..14a00816e929d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CurrencyResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CurrencyResolution.java @@ -34,6 +34,9 @@ public final class CurrencyResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of CurrencyResolution class. */ + public CurrencyResolution() {} + /** * Get the iso4217 property: The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for * country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesLROTask.java index 6af3a5adb9551..5a4d6a09b9cd4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesLROTask.java @@ -23,6 +23,9 @@ public final class CustomEntitiesLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private CustomEntitiesTaskParameters parameters; + /** Creates an instance of CustomEntitiesLROTask class. */ + public CustomEntitiesLROTask() {} + /** * Get the parameters property: Supported parameters for a Custom Entities task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResult.java index 1b3937526f172..59ef9165dbd25 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResult.java @@ -17,6 +17,9 @@ public final class CustomEntitiesResult extends CustomResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of CustomEntitiesResult class. */ + public CustomEntitiesResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResultDocumentsItem.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResultDocumentsItem.java index 6c64bcd9d9492..f0fdd645a7645 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResultDocumentsItem.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesResultDocumentsItem.java @@ -18,6 +18,9 @@ public final class CustomEntitiesResultDocumentsItem extends EntitiesDocumentRes @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of CustomEntitiesResultDocumentsItem class. */ + public CustomEntitiesResultDocumentsItem() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesTaskParameters.java index 1751e2ace90e2..b8dd6aa12ba20 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntitiesTaskParameters.java @@ -17,6 +17,9 @@ public final class CustomEntitiesTaskParameters extends CustomTaskParameters { @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of CustomEntitiesTaskParameters class. */ + public CustomEntitiesTaskParameters() {} + /** * Get the stringIndexType property: Specifies the method used to interpret string offsets. Defaults to Text * Elements (Graphemes) according to Unicode v8.0.0. For additional information see diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntityRecognitionLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntityRecognitionLROResult.java index 8711ee0103de1..24551ccced8bd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntityRecognitionLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomEntityRecognitionLROResult.java @@ -21,6 +21,9 @@ public final class CustomEntityRecognitionLROResult extends AnalyzeTextLROResult @JsonProperty(value = "results", required = true) private CustomEntitiesResult results; + /** Creates an instance of CustomEntityRecognitionLROResult class. */ + public CustomEntityRecognitionLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResult.java index 3cd6575b3547c..46530503672e3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResult.java @@ -17,6 +17,9 @@ public final class CustomLabelClassificationResult extends CustomResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of CustomLabelClassificationResult class. */ + public CustomLabelClassificationResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResultDocumentsItem.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResultDocumentsItem.java index 888540b50c2e3..2996b801c7117 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResultDocumentsItem.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomLabelClassificationResultDocumentsItem.java @@ -18,6 +18,9 @@ public final class CustomLabelClassificationResultDocumentsItem extends Classifi @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of CustomLabelClassificationResultDocumentsItem class. */ + public CustomLabelClassificationResultDocumentsItem() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROResult.java index bca27b31bb662..0426a5e1a98e8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROResult.java @@ -21,6 +21,9 @@ public final class CustomMultiLabelClassificationLROResult extends AnalyzeTextLR @JsonProperty(value = "results", required = true) private CustomLabelClassificationResult results; + /** Creates an instance of CustomMultiLabelClassificationLROResult class. */ + public CustomMultiLabelClassificationLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROTask.java index 742e596abed5b..616b2497c5959 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationLROTask.java @@ -20,6 +20,9 @@ public final class CustomMultiLabelClassificationLROTask extends AnalyzeTextLROT @JsonProperty(value = "parameters") private CustomMultiLabelClassificationTaskParameters parameters; + /** Creates an instance of CustomMultiLabelClassificationLROTask class. */ + public CustomMultiLabelClassificationLROTask() {} + /** * Get the parameters property: Supported parameters for a Custom Multi Classification task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationTaskParameters.java index 41478321cabb7..9f48117099da0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomMultiLabelClassificationTaskParameters.java @@ -9,6 +9,9 @@ /** Supported parameters for a Custom Multi Classification task. */ @Fluent public final class CustomMultiLabelClassificationTaskParameters extends CustomTaskParameters { + /** Creates an instance of CustomMultiLabelClassificationTaskParameters class. */ + public CustomMultiLabelClassificationTaskParameters() {} + /** {@inheritDoc} */ @Override public CustomMultiLabelClassificationTaskParameters setProjectName(String projectName) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomResult.java index 851cdffdd6704..73143bf1efbc4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomResult.java @@ -35,6 +35,9 @@ public class CustomResult { @JsonProperty(value = "deploymentName", required = true) private String deploymentName; + /** Creates an instance of CustomResult class. */ + public CustomResult() {} + /** * Get the errors property: Errors by document id. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROResult.java index ffd5cad78be54..86737aa8773e4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROResult.java @@ -21,6 +21,9 @@ public final class CustomSingleLabelClassificationLROResult extends AnalyzeTextL @JsonProperty(value = "results", required = true) private CustomLabelClassificationResult results; + /** Creates an instance of CustomSingleLabelClassificationLROResult class. */ + public CustomSingleLabelClassificationLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROTask.java index 5c2d57c87768d..fdc2900ce18d7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationLROTask.java @@ -20,6 +20,9 @@ public final class CustomSingleLabelClassificationLROTask extends AnalyzeTextLRO @JsonProperty(value = "parameters") private CustomSingleLabelClassificationTaskParameters parameters; + /** Creates an instance of CustomSingleLabelClassificationLROTask class. */ + public CustomSingleLabelClassificationLROTask() {} + /** * Get the parameters property: Supported parameters for a Custom Single Classification task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationTaskParameters.java index 14aefdfb15859..afabfb6f08b36 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomSingleLabelClassificationTaskParameters.java @@ -9,6 +9,9 @@ /** Supported parameters for a Custom Single Classification task. */ @Fluent public final class CustomSingleLabelClassificationTaskParameters extends CustomTaskParameters { + /** Creates an instance of CustomSingleLabelClassificationTaskParameters class. */ + public CustomSingleLabelClassificationTaskParameters() {} + /** {@inheritDoc} */ @Override public CustomSingleLabelClassificationTaskParameters setProjectName(String projectName) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomTaskParameters.java index e58631b716f9f..adc97ed2405ef 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/CustomTaskParameters.java @@ -22,6 +22,9 @@ public class CustomTaskParameters extends TaskParameters { @JsonProperty(value = "deploymentName", required = true) private String deploymentName; + /** Creates an instance of CustomTaskParameters class. */ + public CustomTaskParameters() {} + /** * Get the projectName property: This field indicates the project name for the model. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeResolution.java index a17117446c58a..b2fbf9a327648 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeResolution.java @@ -39,6 +39,9 @@ public final class DateTimeResolution extends BaseResolution { @JsonProperty(value = "modifier") private TemporalModifier modifier; + /** Creates an instance of DateTimeResolution class. */ + public DateTimeResolution() {} + /** * Get the timex property: An extended ISO 8601 date/time representation as described in * (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeSubKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeSubKind.java index f0128689e54f5..9a1fe21da4c02 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeSubKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DateTimeSubKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for DateTimeSubKind. */ +/** The DateTime SubKind. */ public final class DateTimeSubKind extends ExpandableStringEnum { /** Static value Time for DateTimeSubKind. */ public static final DateTimeSubKind TIME = fromString("Time"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java index 123209fd609ca..d5327a47e3789 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java @@ -35,6 +35,9 @@ public final class DetectedLanguage { @JsonProperty(value = "script") private ScriptKind script; + /** Creates an instance of DetectedLanguage class. */ + public DetectedLanguage() {} + /** * Get the name property: Long name of a detected language (e.g. English, French). * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguage.java index e0fdcd1f20c8a..c6b2ad5426baf 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguage.java @@ -17,6 +17,9 @@ public class DocumentDetectedLanguage { @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of DocumentDetectedLanguage class. */ + public DocumentDetectedLanguage() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguageString.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguageString.java index 8cbfa7219b095..3c7a6a9e7affd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguageString.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentDetectedLanguageString.java @@ -17,6 +17,9 @@ public class DocumentDetectedLanguageString { @JsonProperty(value = "detectedLanguage") private String detectedLanguage; + /** Creates an instance of DocumentDetectedLanguageString class. */ + public DocumentDetectedLanguageString() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java index a76be29114c77..24c02d7c7c248 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentError.java @@ -22,6 +22,9 @@ public final class DocumentError { @JsonProperty(value = "error", required = true) private Error error; + /** Creates an instance of DocumentError class. */ + public DocumentError() {} + /** * Get the id property: Document Id. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentRequestStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentRequestStatistics.java index d6524145b9c72..344eea01ef7b5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentRequestStatistics.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentRequestStatistics.java @@ -12,6 +12,9 @@ */ @Fluent public final class DocumentRequestStatistics extends RequestStatistics { + /** Creates an instance of DocumentRequestStatistics class. */ + public DocumentRequestStatistics() {} + /** {@inheritDoc} */ @Override public DocumentRequestStatistics setDocumentsCount(int documentsCount) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentResult.java index 0f9e0571a8711..8eb0da7b464db 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentResult.java @@ -29,6 +29,9 @@ public class DocumentResult { @JsonProperty(value = "statistics") private DocumentStatistics statistics; + /** Creates an instance of DocumentResult class. */ + public DocumentResult() {} + /** * Get the id property: Unique, non-empty document identifier. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java index c6103b516af79..2af33502cbbbd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentSentimentValue.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for DocumentSentimentValue. */ +/** Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). */ public enum DocumentSentimentValue { /** Enum value positive. */ POSITIVE("positive"), @@ -48,6 +48,7 @@ public static DocumentSentimentValue fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java index af0e95e74743e..c99ef2546c1f6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentStatistics.java @@ -22,6 +22,9 @@ public final class DocumentStatistics { @JsonProperty(value = "transactionsCount", required = true) private int transactionsCount; + /** Creates an instance of DocumentStatistics class. */ + public DocumentStatistics() {} + /** * Get the charactersCount property: Number of text elements recognized in the document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentWarning.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentWarning.java index 874b97b330ff3..7bb78ec11fed0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentWarning.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DocumentWarning.java @@ -28,6 +28,9 @@ public final class DocumentWarning { @JsonProperty(value = "targetRef") private String targetRef; + /** Creates an instance of DocumentWarning class. */ + public DocumentWarning() {} + /** * Get the code property: Error code. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationDocumentResult.java index 7f8623fa0aee5..c7e6065d96113 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationDocumentResult.java @@ -17,6 +17,9 @@ public class DynamicClassificationDocumentResult extends DocumentResult { @JsonProperty(value = "classifications", required = true) private List classifications; + /** Creates an instance of DynamicClassificationDocumentResult class. */ + public DynamicClassificationDocumentResult() {} + /** * Get the classifications property: The classifications property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResult.java index df49e2d1f698d..42915aa27a91f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResult.java @@ -17,6 +17,9 @@ public final class DynamicClassificationResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of DynamicClassificationResult class. */ + public DynamicClassificationResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResultDocumentsItem.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResultDocumentsItem.java index d6fee2a3923a4..0a6093c21846c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResultDocumentsItem.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationResultDocumentsItem.java @@ -10,6 +10,9 @@ /** The DynamicClassificationResultDocumentsItem model. */ @Fluent public final class DynamicClassificationResultDocumentsItem extends DynamicClassificationDocumentResult { + /** Creates an instance of DynamicClassificationResultDocumentsItem class. */ + public DynamicClassificationResultDocumentsItem() {} + /** {@inheritDoc} */ @Override public DynamicClassificationResultDocumentsItem setClassifications(List classifications) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskParameters.java index fd580453a90b1..e7a0819321aa8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskParameters.java @@ -24,6 +24,9 @@ public final class DynamicClassificationTaskParameters extends PreBuiltTaskParam @JsonProperty(value = "categories", required = true) private List categories; + /** Creates an instance of DynamicClassificationTaskParameters class. */ + public DynamicClassificationTaskParameters() {} + /** * Get the classificationType property: Specifies either one or multiple categories per document. Defaults to multi * classification which may return more than one class for each document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskResult.java index f4ebd030c353c..27957a3205c12 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DynamicClassificationTaskResult.java @@ -20,6 +20,9 @@ public final class DynamicClassificationTaskResult extends AnalyzeTextTaskResult @JsonProperty(value = "results", required = true) private DynamicClassificationResult results; + /** Creates an instance of DynamicClassificationTaskResult class. */ + public DynamicClassificationTaskResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesDocumentResult.java index dc4d4064c2b05..7e912895fd1fe 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesDocumentResult.java @@ -17,6 +17,9 @@ public class EntitiesDocumentResult extends DocumentResult { @JsonProperty(value = "entities", required = true) private List entities; + /** Creates an instance of EntitiesDocumentResult class. */ + public EntitiesDocumentResult() {} + /** * Get the entities property: Recognized entities in the document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesLROTask.java index ef0a079b66498..cff7a50c9b53d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesLROTask.java @@ -20,6 +20,9 @@ public final class EntitiesLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private EntitiesTaskParameters parameters; + /** Creates an instance of EntitiesLROTask class. */ + public EntitiesLROTask() {} + /** * Get the parameters property: Supported parameters for an Entity Recognition task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java index 3c93fdd54128c..b8a8777c49327 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResult.java @@ -17,6 +17,9 @@ public final class EntitiesResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of EntitiesResult class. */ + public EntitiesResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResultWithDetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResultWithDetectedLanguage.java index 70e516edc00e5..0c62b31b443be 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResultWithDetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesResultWithDetectedLanguage.java @@ -18,6 +18,9 @@ public final class EntitiesResultWithDetectedLanguage extends EntitiesDocumentRe @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of EntitiesResultWithDetectedLanguage class. */ + public EntitiesResultWithDetectedLanguage() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskParameters.java index 0c0a1941e03bf..7ac72c67e6fa5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskParameters.java @@ -17,6 +17,9 @@ public final class EntitiesTaskParameters extends PreBuiltTaskParameters { @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of EntitiesTaskParameters class. */ + public EntitiesTaskParameters() {} + /** * Get the stringIndexType property: Specifies the method used to interpret string offsets. Defaults to Text * Elements (Graphemes) according to Unicode v8.0.0. For additional information see diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskResult.java index 83e622606f3d4..321360b79bb2b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskResult.java @@ -20,6 +20,9 @@ public final class EntitiesTaskResult extends AnalyzeTextTaskResult { @JsonProperty(value = "results", required = true) private EntitiesResult results; + /** Creates an instance of EntitiesTaskResult class. */ + public EntitiesTaskResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java index 660fccb455df5..5a946b238fe1c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Entity.java @@ -46,6 +46,9 @@ public class Entity { @JsonProperty(value = "confidenceScore", required = true) private double confidenceScore; + /** Creates an instance of Entity class. */ + public Entity() {} + /** * Get the text property: Entity text as appears in the request. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROResult.java index 47723f6b60d3c..4df0594125e35 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROResult.java @@ -21,6 +21,9 @@ public final class EntityLinkingLROResult extends AnalyzeTextLROResult { @JsonProperty(value = "results", required = true) private EntityLinkingResult results; + /** Creates an instance of EntityLinkingLROResult class. */ + public EntityLinkingLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROTask.java index deee105e78e59..9ae6282dced2a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingLROTask.java @@ -20,6 +20,9 @@ public final class EntityLinkingLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private EntityLinkingTaskParameters parameters; + /** Creates an instance of EntityLinkingLROTask class. */ + public EntityLinkingLROTask() {} + /** * Get the parameters property: Supported parameters for an Entity Linking task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java index 74d0d12215320..7983b5244a25b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResult.java @@ -17,6 +17,9 @@ public final class EntityLinkingResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of EntityLinkingResult class. */ + public EntityLinkingResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResultWithDetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResultWithDetectedLanguage.java index 72ca5034870c6..a79799b5f6c0a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResultWithDetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingResultWithDetectedLanguage.java @@ -18,6 +18,9 @@ public final class EntityLinkingResultWithDetectedLanguage extends LinkedEntitie @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of EntityLinkingResultWithDetectedLanguage class. */ + public EntityLinkingResultWithDetectedLanguage() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskParameters.java index 08a5609977751..dbb24bd4283b2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskParameters.java @@ -17,6 +17,9 @@ public final class EntityLinkingTaskParameters extends PreBuiltTaskParameters { @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of EntityLinkingTaskParameters class. */ + public EntityLinkingTaskParameters() {} + /** * Get the stringIndexType property: Specifies the method used to interpret string offsets. Defaults to Text * Elements (Graphemes) according to Unicode v8.0.0. For additional information see diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskResult.java index 0372275536e25..1d802be582689 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskResult.java @@ -20,6 +20,9 @@ public final class EntityLinkingTaskResult extends AnalyzeTextTaskResult { @JsonProperty(value = "results", required = true) private EntityLinkingResult results; + /** Creates an instance of EntityLinkingTaskResult class. */ + public EntityLinkingTaskResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityRecognitionLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityRecognitionLROResult.java index 5ef7171e7a357..6ffe3ab1e8e0d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityRecognitionLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityRecognitionLROResult.java @@ -21,6 +21,9 @@ public final class EntityRecognitionLROResult extends AnalyzeTextLROResult { @JsonProperty(value = "results", required = true) private EntitiesResult results; + /** Creates an instance of EntityRecognitionLROResult class. */ + public EntityRecognitionLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityWithResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityWithResolution.java index 5fa4f2743591f..e6abd3d8fb8a3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityWithResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityWithResolution.java @@ -17,6 +17,9 @@ public final class EntityWithResolution extends Entity { @JsonProperty(value = "resolutions") private List resolutions; + /** Creates an instance of EntityWithResolution class. */ + public EntityWithResolution() {} + /** * Get the resolutions property: The collection of entity resolution objects. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Error.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Error.java index 307ec9e931412..090f720576f26 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Error.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Error.java @@ -51,6 +51,9 @@ public final class Error { */ @JsonIgnore private Map additionalProperties; + /** Creates an instance of Error class. */ + public Error() {} + /** * Get the code property: One of a server-defined set of error codes. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCode.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCode.java index a76f0b66414de..47d15b53f5860 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCode.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorCode.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ErrorCode. */ +/** Human-readable error code. */ public final class ErrorCode extends ExpandableStringEnum { /** Static value InvalidRequest for ErrorCode. */ public static final ErrorCode INVALID_REQUEST = fromString("InvalidRequest"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponse.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponse.java index 80351a4490204..9e815d1ebac6a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponse.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponse.java @@ -16,6 +16,9 @@ public final class ErrorResponse { @JsonProperty(value = "error", required = true) private Error error; + /** Creates an instance of ErrorResponse class. */ + public ErrorResponse() {} + /** * Get the error property: The error object. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponseException.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponseException.java index 4d335f2abf876..63d8c99e31b27 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponseException.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ErrorResponseException.java @@ -30,6 +30,7 @@ public ErrorResponseException(String message, HttpResponse response, ErrorRespon super(message, response, value); } + /** {@inheritDoc} */ @Override public ErrorResponse getValue() { return (ErrorResponse) super.getValue(); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResult.java index b1c6630263c06..0c7b81e1fe152 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResult.java @@ -17,6 +17,9 @@ public class ExtractedSummaryDocumentResult extends DocumentResult { @JsonProperty(value = "sentences", required = true) private List sentences; + /** Creates an instance of ExtractedSummaryDocumentResult class. */ + public ExtractedSummaryDocumentResult() {} + /** * Get the sentences property: A ranked list of sentences representing the extracted summary. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResultWithDetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResultWithDetectedLanguage.java index a12403e51f6c1..bc8dec964909e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResultWithDetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummaryDocumentResultWithDetectedLanguage.java @@ -18,6 +18,9 @@ public final class ExtractedSummaryDocumentResultWithDetectedLanguage extends Ex @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of ExtractedSummaryDocumentResultWithDetectedLanguage class. */ + public ExtractedSummaryDocumentResultWithDetectedLanguage() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummarySentence.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummarySentence.java index c94a2b890a438..62be6af328fd6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummarySentence.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractedSummarySentence.java @@ -35,6 +35,9 @@ public final class ExtractedSummarySentence { @JsonProperty(value = "length", required = true) private int length; + /** Creates an instance of ExtractedSummarySentence class. */ + public ExtractedSummarySentence() {} + /** * Get the text property: The extracted sentence text. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROResult.java index 4916bb317867d..df48a778ec07b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROResult.java @@ -21,6 +21,9 @@ public final class ExtractiveSummarizationLROResult extends AnalyzeTextLROResult @JsonProperty(value = "results", required = true) private ExtractiveSummarizationResult results; + /** Creates an instance of ExtractiveSummarizationLROResult class. */ + public ExtractiveSummarizationLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROTask.java index 3391feb4567cb..ebf15a4d31f6b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationLROTask.java @@ -20,6 +20,9 @@ public final class ExtractiveSummarizationLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private ExtractiveSummarizationTaskParameters parameters; + /** Creates an instance of ExtractiveSummarizationLROTask class. */ + public ExtractiveSummarizationLROTask() {} + /** * Get the parameters property: Supported parameters for an Extractive Summarization task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationResult.java index d5f42038833ba..4a9c8f0123c07 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationResult.java @@ -17,6 +17,9 @@ public final class ExtractiveSummarizationResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of ExtractiveSummarizationResult class. */ + public ExtractiveSummarizationResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationSortingCriteria.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationSortingCriteria.java index 321c3dd421033..ff7c1fc32ff89 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationSortingCriteria.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationSortingCriteria.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ExtractiveSummarizationSortingCriteria. */ +/** The sorting criteria to use for the results of Extractive Summarization. */ public final class ExtractiveSummarizationSortingCriteria extends ExpandableStringEnum { /** Static value Offset for ExtractiveSummarizationSortingCriteria. */ diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationTaskParameters.java index ebe40c9bb45a9..f12e57d826098 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ExtractiveSummarizationTaskParameters.java @@ -29,6 +29,9 @@ public final class ExtractiveSummarizationTaskParameters extends PreBuiltTaskPar @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of ExtractiveSummarizationTaskParameters class. */ + public ExtractiveSummarizationTaskParameters() {} + /** * Get the sentenceCount property: The sentenceCount property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/FhirVersion.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/FhirVersion.java index 02574b584fbcb..1c99cb2297c83 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/FhirVersion.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/FhirVersion.java @@ -8,7 +8,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for FhirVersion. */ +/** + * The FHIR Spec version that the result will use to format the fhirBundle. For additional information see + * https://www.hl7.org/fhir/overview.html. + */ public final class FhirVersion extends ExpandableStringEnum { /** Static value 4.0.1 for FhirVersion. */ public static final FhirVersion FOUR01 = fromString("4.0.1"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareAssertion.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareAssertion.java index ed9da2a325300..ed06785de05a9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareAssertion.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareAssertion.java @@ -28,6 +28,9 @@ public final class HealthcareAssertion { @JsonProperty(value = "association") private Association association; + /** Creates an instance of HealthcareAssertion class. */ + public HealthcareAssertion() {} + /** * Get the conditionality property: Describes any conditionality on the entity. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareDocumentType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareDocumentType.java index a8d32ed3a8b3f..9f795b04b8b1d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareDocumentType.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareDocumentType.java @@ -8,7 +8,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for HealthcareDocumentType. */ +/** + * Document type that can be provided as input for Fhir Documents. Expect to have fhirVersion provided when used. + * Behavior of using None enum is the same as not using the documentType parameter. + */ public final class HealthcareDocumentType extends ExpandableStringEnum { /** Static value None for HealthcareDocumentType. */ public static final HealthcareDocumentType NONE = fromString("None"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResult.java index 17be3d7ffbdba..5210b5388841f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResult.java @@ -31,6 +31,9 @@ public class HealthcareEntitiesDocumentResult extends DocumentResult { @JsonProperty(value = "fhirBundle") private Map fhirBundle; + /** Creates an instance of HealthcareEntitiesDocumentResult class. */ + public HealthcareEntitiesDocumentResult() {} + /** * Get the entities property: Healthcare entities. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.java index bf98ceab588e2..4cf01edbccda5 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.java @@ -20,6 +20,9 @@ public final class HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage @JsonProperty(value = "detectedLanguage") private String detectedLanguage; + /** Creates an instance of HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage class. */ + public HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntity.java index e29733203a1d2..c38377dc94061 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntity.java @@ -65,6 +65,9 @@ public final class HealthcareEntity { @JsonProperty(value = "links") private List links; + /** Creates an instance of HealthcareEntity class. */ + public HealthcareEntity() {} + /** * Get the text property: Entity text as appears in the request. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityCategory.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityCategory.java index f19136ec50aa6..30aac4fa67e52 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityCategory.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityCategory.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for HealthcareEntityCategory. */ +/** Healthcare Entity Category. */ public final class HealthcareEntityCategory extends ExpandableStringEnum { /** Static value BodyStructure for HealthcareEntityCategory. */ public static final HealthcareEntityCategory BODY_STRUCTURE = fromString("BodyStructure"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityLink.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityLink.java index a2e8e08ce61f0..ff65a823182ac 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityLink.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareEntityLink.java @@ -22,6 +22,9 @@ public final class HealthcareEntityLink { @JsonProperty(value = "id", required = true) private String id; + /** Creates an instance of HealthcareEntityLink class. */ + public HealthcareEntityLink() {} + /** * Get the dataSource property: Entity Catalog. Examples include: UMLS, CHV, MSH, etc. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROResult.java index e0fe9b676d326..8b577d8f08a90 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROResult.java @@ -21,6 +21,9 @@ public final class HealthcareLROResult extends AnalyzeTextLROResult { @JsonProperty(value = "results", required = true) private HealthcareResult results; + /** Creates an instance of HealthcareLROResult class. */ + public HealthcareLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROTask.java index 6e525d0a217a7..e46e8dfc52ca4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareLROTask.java @@ -20,6 +20,9 @@ public final class HealthcareLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private HealthcareTaskParameters parameters; + /** Creates an instance of HealthcareLROTask class. */ + public HealthcareLROTask() {} + /** * Get the parameters property: Supported parameters for a Healthcare task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelation.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelation.java index 472941f97a350..d1c1b02fe7b6f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelation.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelation.java @@ -32,6 +32,9 @@ public final class HealthcareRelation { @JsonProperty(value = "entities", required = true) private List entities; + /** Creates an instance of HealthcareRelation class. */ + public HealthcareRelation() {} + /** * Get the relationType property: Type of relation. Examples include: `DosageOfMedication` or * 'FrequencyOfMedication', etc. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelationEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelationEntity.java index 7e06a6f631078..e0056002446ef 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelationEntity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareRelationEntity.java @@ -25,6 +25,9 @@ public final class HealthcareRelationEntity { @JsonProperty(value = "role", required = true) private String role; + /** Creates an instance of HealthcareRelationEntity class. */ + public HealthcareRelationEntity() {} + /** * Get the ref property: Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier * Representation), pointing to the entity . diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareResult.java index 7550bf3a184d0..f0b8a92cff42f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareResult.java @@ -17,6 +17,9 @@ public final class HealthcareResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of HealthcareResult class. */ + public HealthcareResult() {} + /** * Get the documents property: The documents property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareTaskParameters.java index 6428f20b72a32..4b6c6967969a9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/HealthcareTaskParameters.java @@ -31,6 +31,9 @@ public final class HealthcareTaskParameters extends PreBuiltTaskParameters { @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of HealthcareTaskParameters class. */ + public HealthcareTaskParameters() {} + /** * Get the fhirVersion property: The FHIR Spec version that the result will use to format the fhirBundle. For * additional information see https://www.hl7.org/fhir/overview.html. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationResolution.java index 82bf3d96637f2..d75a22b8c5074 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationResolution.java @@ -26,6 +26,9 @@ public final class InformationResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of InformationResolution class. */ + public InformationResolution() {} + /** * Get the unit property: The information (data) Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationUnit.java index c33fbefbe48ac..80e88568c440b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InformationUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for InformationUnit. */ +/** The information (data) Unit of measurement. */ public final class InformationUnit extends ExpandableStringEnum { /** Static value Unspecified for InformationUnit. */ public static final InformationUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCode.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCode.java index 5530636e54533..d33c14a31db45 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCode.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorCode.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for InnerErrorCode. */ +/** Human-readable error code. */ public final class InnerErrorCode extends ExpandableStringEnum { /** Static value InvalidRequest for InnerErrorCode. */ public static final InnerErrorCode INVALID_REQUEST = fromString("InvalidRequest"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorModel.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorModel.java index 7b7c259723f82..43501c7b429cc 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorModel.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InnerErrorModel.java @@ -44,6 +44,9 @@ public final class InnerErrorModel { @JsonProperty(value = "innererror") private InnerErrorModel innererror; + /** Creates an instance of InnerErrorModel class. */ + public InnerErrorModel() {} + /** * Get the code property: One of a server-defined set of error codes. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InputError.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InputError.java index 0bf9d6c0f469e..d748fa5281fa4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InputError.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/InputError.java @@ -22,6 +22,9 @@ public final class InputError { @JsonProperty(value = "error", required = true) private Error error; + /** Creates an instance of InputError class. */ + public InputError() {} + /** * Get the id property: The ID of the input. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/JobState.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/JobState.java index 928b227d13c3e..c9c861a366210 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/JobState.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/JobState.java @@ -60,6 +60,9 @@ public class JobState { @JsonProperty(value = "nextLink") private String nextLink; + /** Creates an instance of JobState class. */ + public JobState() {} + /** * Get the displayName property: The displayName property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseExtractionLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseExtractionLROResult.java index 57d51c0a99eff..a7f1eafc485c9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseExtractionLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseExtractionLROResult.java @@ -21,6 +21,9 @@ public final class KeyPhraseExtractionLROResult extends AnalyzeTextLROResult { @JsonProperty(value = "results", required = true) private KeyPhraseResult results; + /** Creates an instance of KeyPhraseExtractionLROResult class. */ + public KeyPhraseExtractionLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseLROTask.java index 80b32dfc21a58..1abd29da4a59e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseLROTask.java @@ -20,6 +20,9 @@ public final class KeyPhraseLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private KeyPhraseTaskParameters parameters; + /** Creates an instance of KeyPhraseLROTask class. */ + public KeyPhraseLROTask() {} + /** * Get the parameters property: Supported parameters for a Key Phrase Extraction task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java index 7c39fe17c2f9c..72d49cffe5a3c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResult.java @@ -17,6 +17,9 @@ public final class KeyPhraseResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of KeyPhraseResult class. */ + public KeyPhraseResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResultDocumentsItem.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResultDocumentsItem.java index 9fef976dbd50b..d25d7301b6844 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResultDocumentsItem.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseResultDocumentsItem.java @@ -18,6 +18,9 @@ public final class KeyPhraseResultDocumentsItem extends KeyPhrasesDocumentResult @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of KeyPhraseResultDocumentsItem class. */ + public KeyPhraseResultDocumentsItem() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskParameters.java index ad407b6610435..6a0f747ccb86d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskParameters.java @@ -9,6 +9,9 @@ /** Supported parameters for a Key Phrase Extraction task. */ @Fluent public final class KeyPhraseTaskParameters extends PreBuiltTaskParameters { + /** Creates an instance of KeyPhraseTaskParameters class. */ + public KeyPhraseTaskParameters() {} + /** {@inheritDoc} */ @Override public KeyPhraseTaskParameters setModelVersion(String modelVersion) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskResult.java index e3f6113c264a2..e0936a890cf86 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhraseTaskResult.java @@ -20,6 +20,9 @@ public final class KeyPhraseTaskResult extends AnalyzeTextTaskResult { @JsonProperty(value = "results", required = true) private KeyPhraseResult results; + /** Creates an instance of KeyPhraseTaskResult class. */ + public KeyPhraseTaskResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhrasesDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhrasesDocumentResult.java index e95fda00c09e2..180eea58af2e1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhrasesDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/KeyPhrasesDocumentResult.java @@ -18,6 +18,9 @@ public class KeyPhrasesDocumentResult extends DocumentResult { @JsonProperty(value = "keyPhrases", required = true) private List keyPhrases; + /** Creates an instance of KeyPhrasesDocumentResult class. */ + public KeyPhrasesDocumentResult() {} + /** * Get the keyPhrases property: A list of representative words or phrases. The number of key phrases returned is * proportional to the number of words in the input document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionAnalysisInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionAnalysisInput.java index 35976619abfe8..7824a907c7753 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionAnalysisInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionAnalysisInput.java @@ -17,6 +17,9 @@ public final class LanguageDetectionAnalysisInput { @JsonProperty(value = "documents") private List documents; + /** Creates an instance of LanguageDetectionAnalysisInput class. */ + public LanguageDetectionAnalysisInput() {} + /** * Get the documents property: The documents property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionDocumentResult.java index 9fd29c1c2a243..21626c828d44e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionDocumentResult.java @@ -17,6 +17,9 @@ public final class LanguageDetectionDocumentResult extends DocumentResult { @JsonProperty(value = "detectedLanguage", required = true) private DetectedLanguage detectedLanguage; + /** Creates an instance of LanguageDetectionDocumentResult class. */ + public LanguageDetectionDocumentResult() {} + /** * Get the detectedLanguage property: Detected Language. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionResult.java index a39ccef101020..a8996185421f6 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionResult.java @@ -17,6 +17,9 @@ public final class LanguageDetectionResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of LanguageDetectionResult class. */ + public LanguageDetectionResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskParameters.java index 2fc542cf9dc39..eaa9544d9676f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskParameters.java @@ -9,6 +9,9 @@ /** Supported parameters for a Language Detection task. */ @Fluent public final class LanguageDetectionTaskParameters extends PreBuiltTaskParameters { + /** Creates an instance of LanguageDetectionTaskParameters class. */ + public LanguageDetectionTaskParameters() {} + /** {@inheritDoc} */ @Override public LanguageDetectionTaskParameters setModelVersion(String modelVersion) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskResult.java index 9de2a721762fb..a20a43808d7c2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageDetectionTaskResult.java @@ -20,6 +20,9 @@ public final class LanguageDetectionTaskResult extends AnalyzeTextTaskResult { @JsonProperty(value = "results", required = true) private LanguageDetectionResult results; + /** Creates an instance of LanguageDetectionTaskResult class. */ + public LanguageDetectionTaskResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java index d81ea140b1a0c..015be3c385f9f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LanguageInput.java @@ -28,6 +28,9 @@ public final class LanguageInput { @JsonProperty(value = "countryHint") private String countryHint; + /** Creates an instance of LanguageInput class. */ + public LanguageInput() {} + /** * Get the id property: Unique, non-empty document identifier. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthResolution.java index ea83c94c305dc..2b761a403077e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthResolution.java @@ -26,6 +26,9 @@ public final class LengthResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of LengthResolution class. */ + public LengthResolution() {} + /** * Get the unit property: The length Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthUnit.java index d80af15355025..0c0d4a74e716c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LengthUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for LengthUnit. */ +/** The length Unit of measurement. */ public final class LengthUnit extends ExpandableStringEnum { /** Static value Unspecified for LengthUnit. */ public static final LengthUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntitiesDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntitiesDocumentResult.java index 0b88f2d9cd597..2ca5750ffb505 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntitiesDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntitiesDocumentResult.java @@ -17,6 +17,9 @@ public class LinkedEntitiesDocumentResult extends DocumentResult { @JsonProperty(value = "entities", required = true) private List entities; + /** Creates an instance of LinkedEntitiesDocumentResult class. */ + public LinkedEntitiesDocumentResult() {} + /** * Get the entities property: Recognized well known entities in the document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java index 2747e845e0340..685f1579b6769 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/LinkedEntity.java @@ -53,6 +53,9 @@ public final class LinkedEntity { @JsonProperty(value = "bingId") private String bingId; + /** Creates an instance of LinkedEntity class. */ + public LinkedEntity() {} + /** * Get the name property: Entity Linking formal name. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java index c4c00ce04c061..64d740a05cfb2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Match.java @@ -35,6 +35,9 @@ public final class Match { @JsonProperty(value = "length", required = true) private int length; + /** Creates an instance of Match class. */ + public Match() {} + /** * Get the confidenceScore property: If a well known item is recognized, a decimal number denoting the confidence * level between 0 and 1 will be returned. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageAnalysisInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageAnalysisInput.java index c576fa5469fa2..688d186e91c23 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageAnalysisInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageAnalysisInput.java @@ -17,6 +17,9 @@ public final class MultiLanguageAnalysisInput { @JsonProperty(value = "documents") private List documents; + /** Creates an instance of MultiLanguageAnalysisInput class. */ + public MultiLanguageAnalysisInput() {} + /** * Get the documents property: The documents property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java index 562ce6a13ee42..1df7dd68b90dd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/MultiLanguageInput.java @@ -29,6 +29,9 @@ public final class MultiLanguageInput { @JsonProperty(value = "language") private String language; + /** Creates an instance of MultiLanguageInput class. */ + public MultiLanguageInput() {} + /** * Get the id property: A unique, non-empty document identifier. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberKind.java index 51eeb6c330c41..707a655b659fe 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for NumberKind. */ +/** The type of the extracted number entity. */ public final class NumberKind extends ExpandableStringEnum { /** Static value Integer for NumberKind. */ public static final NumberKind INTEGER = fromString("Integer"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberResolution.java index fc1bd08c484ef..930e8d74e8362 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumberResolution.java @@ -26,6 +26,9 @@ public final class NumberResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of NumberResolution class. */ + public NumberResolution() {} + /** * Get the numberKind property: The type of the extracted number entity. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumericRangeResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumericRangeResolution.java index ed24bd52360b9..315092719365b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumericRangeResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/NumericRangeResolution.java @@ -32,6 +32,9 @@ public final class NumericRangeResolution extends BaseResolution { @JsonProperty(value = "maximum", required = true) private double maximum; + /** Creates an instance of NumericRangeResolution class. */ + public NumericRangeResolution() {} + /** * Get the rangeKind property: The kind of range that the resolution object represents. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/OrdinalResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/OrdinalResolution.java index c58e365d0a07c..8b938faf33fbe 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/OrdinalResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/OrdinalResolution.java @@ -32,6 +32,9 @@ public final class OrdinalResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private String value; + /** Creates an instance of OrdinalResolution class. */ + public OrdinalResolution() {} + /** * Get the offset property: The offset With respect to the reference (e.g., offset = -1 in "show me the second to * last". diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PIIResultWithDetectedLanguage.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PIIResultWithDetectedLanguage.java index 1f30e0f423764..f1e1c5bd3fcc1 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PIIResultWithDetectedLanguage.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PIIResultWithDetectedLanguage.java @@ -18,6 +18,9 @@ public final class PIIResultWithDetectedLanguage extends PiiEntitiesDocumentResu @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of PIIResultWithDetectedLanguage class. */ + public PIIResultWithDetectedLanguage() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Pagination.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Pagination.java index 5bd1cc0547223..1d111b442a020 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Pagination.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/Pagination.java @@ -16,6 +16,9 @@ public final class Pagination { @JsonProperty(value = "nextLink") private String nextLink; + /** Creates an instance of Pagination class. */ + public Pagination() {} + /** * Get the nextLink property: The nextLink property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiDomain.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiDomain.java index eebf9960357aa..50646a2e1759c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiDomain.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiDomain.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for PiiDomain. */ +/** The PII domain used for PII Entity Recognition. */ public final class PiiDomain extends ExpandableStringEnum { /** Static value phi for PiiDomain. */ public static final PiiDomain PHI = fromString("phi"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntitiesDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntitiesDocumentResult.java index 17a929ba76590..d024dfed4bed4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntitiesDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntitiesDocumentResult.java @@ -23,6 +23,9 @@ public class PiiEntitiesDocumentResult extends DocumentResult { @JsonProperty(value = "entities", required = true) private List entities; + /** Creates an instance of PiiEntitiesDocumentResult class. */ + public PiiEntitiesDocumentResult() {} + /** * Get the redactedText property: Returns redacted text. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntityRecognitionLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntityRecognitionLROResult.java index 24c72cad8a082..a35f3f3665446 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntityRecognitionLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiEntityRecognitionLROResult.java @@ -21,6 +21,9 @@ public final class PiiEntityRecognitionLROResult extends AnalyzeTextLROResult { @JsonProperty(value = "results", required = true) private PiiResult results; + /** Creates an instance of PiiEntityRecognitionLROResult class. */ + public PiiEntityRecognitionLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiLROTask.java index f6968e04a10ec..393012757c710 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiLROTask.java @@ -20,6 +20,9 @@ public final class PiiLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private PiiTaskParameters parameters; + /** Creates an instance of PiiLROTask class. */ + public PiiLROTask() {} + /** * Get the parameters property: Supported parameters for a PII Entities Recognition task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiResult.java index e282b501dd9c0..603bbed73598f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiResult.java @@ -17,6 +17,9 @@ public final class PiiResult extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of PiiResult class. */ + public PiiResult() {} + /** * Get the documents property: Response by document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskParameters.java index ad3996cddaad6..cb06dfe7acb8d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskParameters.java @@ -30,6 +30,9 @@ public final class PiiTaskParameters extends PreBuiltTaskParameters { @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of PiiTaskParameters class. */ + public PiiTaskParameters() {} + /** * Get the domain property: The PII domain used for PII Entity Recognition. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskResult.java index a5ad1843a3ded..b5197a102b37c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskResult.java @@ -20,6 +20,9 @@ public final class PiiTaskResult extends AnalyzeTextTaskResult { @JsonProperty(value = "results", required = true) private PiiResult results; + /** Creates an instance of PiiTaskResult class. */ + public PiiTaskResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltResult.java index f1dd754708288..cdebd46384fbb 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltResult.java @@ -29,6 +29,9 @@ public class PreBuiltResult { @JsonProperty(value = "modelVersion", required = true) private String modelVersion; + /** Creates an instance of PreBuiltResult class. */ + public PreBuiltResult() {} + /** * Get the errors property: Errors by document id. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltTaskParameters.java index 6b662dff12ecb..a5d84f6c6b6cd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PreBuiltTaskParameters.java @@ -16,6 +16,9 @@ public class PreBuiltTaskParameters extends TaskParameters { @JsonProperty(value = "modelVersion") private String modelVersion; + /** Creates an instance of PreBuiltTaskParameters class. */ + public PreBuiltTaskParameters() {} + /** * Get the modelVersion property: The modelVersion property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/QuantityResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/QuantityResolution.java index 0471f0c973bbd..a2571d782096f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/QuantityResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/QuantityResolution.java @@ -16,6 +16,9 @@ public class QuantityResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of QuantityResolution class. */ + public QuantityResolution() {} + /** * Get the value property: The numeric value that the extracted text denotes. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RangeKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RangeKind.java index 92263bb206c35..9a47cc09339d9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RangeKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RangeKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for RangeKind. */ +/** The kind of range that the resolution object represents. */ public final class RangeKind extends ExpandableStringEnum { /** Static value Number for RangeKind. */ public static final RangeKind NUMBER = fromString("Number"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelationType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelationType.java index b829b6b046557..973659b52db31 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelationType.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelationType.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for RelationType. */ +/** Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. */ public final class RelationType extends ExpandableStringEnum { /** Static value Abbreviation for RelationType. */ public static final RelationType ABBREVIATION = fromString("Abbreviation"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelativeTo.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelativeTo.java index 12e95dc715298..a2dfb5b2ce28e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelativeTo.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RelativeTo.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for RelativeTo. */ +/** The reference point that the ordinal number denotes. */ public final class RelativeTo extends ExpandableStringEnum { /** Static value Current for RelativeTo. */ public static final RelativeTo CURRENT = fromString("Current"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java index e53625c60175a..db3668487bae0 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/RequestStatistics.java @@ -44,6 +44,9 @@ public class RequestStatistics { */ @JsonIgnore private Map additionalProperties; + /** Creates an instance of RequestStatistics class. */ + public RequestStatistics() {} + /** * Get the documentsCount property: Number of documents submitted in the request. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ResolutionKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ResolutionKind.java index 47c6d024cba0b..f631bb999809f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ResolutionKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ResolutionKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ResolutionKind. */ +/** The entity resolution object kind. */ public final class ResolutionKind extends ExpandableStringEnum { /** Static value BooleanResolution for ResolutionKind. */ public static final ResolutionKind BOOLEAN_RESOLUTION = fromString("BooleanResolution"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ScriptKind.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ScriptKind.java index e0faa2dfa20ea..001167bed554f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ScriptKind.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/ScriptKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ScriptKind. */ +/** Identifies the script of the input document. */ public final class ScriptKind extends ExpandableStringEnum { /** Static value Latin for ScriptKind. */ public static final ScriptKind LATIN = fromString("Latin"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAssessment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAssessment.java index a47ee14288163..70ab230fee57d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAssessment.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceAssessment.java @@ -46,6 +46,9 @@ public final class SentenceAssessment { @JsonProperty(value = "isNegated", required = true) private boolean isNegated; + /** Creates an instance of SentenceAssessment class. */ + public SentenceAssessment() {} + /** * Get the sentiment property: Assessment sentiment in the sentence. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java index d489d44c77fc2..460c5608a0937 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentiment.java @@ -53,6 +53,9 @@ public final class SentenceSentiment { @JsonProperty(value = "assessments") private List assessments; + /** Creates an instance of SentenceSentiment class. */ + public SentenceSentiment() {} + /** * Get the text property: The sentence text. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java index 0a28f6375868c..bcd7206254545 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceSentimentValue.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for SentenceSentimentValue. */ +/** The predicted Sentiment for the sentence. */ public enum SentenceSentimentValue { /** Enum value positive. */ POSITIVE("positive"), @@ -45,6 +45,7 @@ public static SentenceSentimentValue fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceTarget.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceTarget.java index d9157125d2bac..851ce42fd9fa4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceTarget.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentenceTarget.java @@ -47,6 +47,9 @@ public final class SentenceTarget { @JsonProperty(value = "relations", required = true) private List relations; + /** Creates an instance of SentenceTarget class. */ + public SentenceTarget() {} + /** * Get the sentiment property: Targeted sentiment in the sentence. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisLROTask.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisLROTask.java index f405b0903de9c..7d2e6e55892dd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisLROTask.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisLROTask.java @@ -20,6 +20,9 @@ public final class SentimentAnalysisLROTask extends AnalyzeTextLROTask { @JsonProperty(value = "parameters") private SentimentAnalysisTaskParameters parameters; + /** Creates an instance of SentimentAnalysisLROTask class. */ + public SentimentAnalysisLROTask() {} + /** * Get the parameters property: Supported parameters for a Sentiment Analysis task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisTaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisTaskParameters.java index 4c175955a895a..a31a3adc826a2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisTaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentAnalysisTaskParameters.java @@ -23,6 +23,9 @@ public final class SentimentAnalysisTaskParameters extends PreBuiltTaskParameter @JsonProperty(value = "stringIndexType") private StringIndexType stringIndexType; + /** Creates an instance of SentimentAnalysisTaskParameters class. */ + public SentimentAnalysisTaskParameters() {} + /** * Get the opinionMining property: The opinionMining property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java index 8f190bec5d68d..04d9a5873f01c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentConfidenceScorePerLabel.java @@ -28,6 +28,9 @@ public final class SentimentConfidenceScorePerLabel { @JsonProperty(value = "negative", required = true) private double negative; + /** Creates an instance of SentimentConfidenceScorePerLabel class. */ + public SentimentConfidenceScorePerLabel() {} + /** * Get the positive property: Confidence score for positive sentiment. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentDocumentResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentDocumentResult.java index 81f751313c7de..8b94e000da816 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentDocumentResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentDocumentResult.java @@ -29,6 +29,9 @@ public class SentimentDocumentResult extends DocumentResult { @JsonProperty(value = "sentences", required = true) private List sentences; + /** Creates an instance of SentimentDocumentResult class. */ + public SentimentDocumentResult() {} + /** * Get the sentiment property: Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentLROResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentLROResult.java index 4e9a1ea0864e6..2c6de1db4a1d4 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentLROResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentLROResult.java @@ -21,6 +21,9 @@ public final class SentimentLROResult extends AnalyzeTextLROResult { @JsonProperty(value = "results", required = true) private SentimentResponse results; + /** Creates an instance of SentimentLROResult class. */ + public SentimentLROResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java index 921e61c299019..5e39baa20d30b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponse.java @@ -17,6 +17,9 @@ public final class SentimentResponse extends PreBuiltResult { @JsonProperty(value = "documents", required = true) private List documents; + /** Creates an instance of SentimentResponse class. */ + public SentimentResponse() {} + /** * Get the documents property: Sentiment analysis per document. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponseDocumentsItem.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponseDocumentsItem.java index 5a615183d129f..ce3e9f98f84ec 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponseDocumentsItem.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentResponseDocumentsItem.java @@ -18,6 +18,9 @@ public final class SentimentResponseDocumentsItem extends SentimentDocumentResul @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; + /** Creates an instance of SentimentResponseDocumentsItem class. */ + public SentimentResponseDocumentsItem() {} + /** * Get the detectedLanguage property: If 'language' is set to 'auto' for the document in the request this field will * contain a 2 letter ISO 639-1 representation of the language detected for this document. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentTaskResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentTaskResult.java index 2972371e3cc32..4093e57ebfe1f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentTaskResult.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SentimentTaskResult.java @@ -20,6 +20,9 @@ public final class SentimentTaskResult extends AnalyzeTextTaskResult { @JsonProperty(value = "results", required = true) private SentimentResponse results; + /** Creates an instance of SentimentTaskResult class. */ + public SentimentTaskResult() {} + /** * Get the results property: The results property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedResolution.java index 15216439d93b5..1eb091831d87c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedResolution.java @@ -26,6 +26,9 @@ public final class SpeedResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of SpeedResolution class. */ + public SpeedResolution() {} + /** * Get the unit property: The speed Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedUnit.java index 75b3ea472d13e..64d4353744e9b 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SpeedUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for SpeedUnit. */ +/** The speed Unit of measurement. */ public final class SpeedUnit extends ExpandableStringEnum { /** Static value Unspecified for SpeedUnit. */ public static final SpeedUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/State.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/State.java index 24aa5605baacc..93e7ab2f5c978 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/State.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/State.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for State. */ +/** The status of the task at the mentioned last update time. */ public final class State extends ExpandableStringEnum { /** Static value notStarted for State. */ public static final State NOT_STARTED = fromString("notStarted"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/StringIndexType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/StringIndexType.java index f6f1b649192d1..3c4aa177afc7e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/StringIndexType.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/StringIndexType.java @@ -8,7 +8,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for StringIndexType. */ +/** + * Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode + * v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. + */ public final class StringIndexType extends ExpandableStringEnum { /** Static value TextElements_v8 for StringIndexType. */ public static final StringIndexType TEXT_ELEMENTS_V8 = fromString("TextElements_v8"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SummaryContext.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SummaryContext.java index 3342a7fa86966..732f321bfa446 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SummaryContext.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/SummaryContext.java @@ -22,6 +22,9 @@ public final class SummaryContext { @JsonProperty(value = "length", required = true) private int length; + /** Creates an instance of SummaryContext class. */ + public SummaryContext() {} + /** * Get the offset property: Start position for the context. Use of different 'stringIndexType' values can affect the * offset returned. diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetConfidenceScoreLabel.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetConfidenceScoreLabel.java index 4c21039bf32f8..17cf3b4c2817c 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetConfidenceScoreLabel.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetConfidenceScoreLabel.java @@ -22,6 +22,9 @@ public final class TargetConfidenceScoreLabel { @JsonProperty(value = "negative", required = true) private double negative; + /** Creates an instance of TargetConfidenceScoreLabel class. */ + public TargetConfidenceScoreLabel() {} + /** * Get the positive property: Confidence score for positive sentiment. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelation.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelation.java index a10437b3af07f..c1c4b3adbfb0a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelation.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelation.java @@ -22,6 +22,9 @@ public final class TargetRelation { @JsonProperty(value = "ref", required = true) private String ref; + /** Creates an instance of TargetRelation class. */ + public TargetRelation() {} + /** * Get the relationType property: The type related to the target. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelationType.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelationType.java index 4eba5a31969ac..1e95a98928a3d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelationType.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TargetRelationType.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for TargetRelationType. */ +/** The type related to the target. */ public enum TargetRelationType { /** Enum value assessment. */ ASSESSMENT("assessment"), @@ -42,6 +42,7 @@ public static TargetRelationType fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskIdentifier.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskIdentifier.java index 4c16879659479..b2e6a80334ed2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskIdentifier.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskIdentifier.java @@ -16,6 +16,9 @@ public class TaskIdentifier { @JsonProperty(value = "taskName") private String taskName; + /** Creates an instance of TaskIdentifier class. */ + public TaskIdentifier() {} + /** * Get the taskName property: The taskName property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskParameters.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskParameters.java index ca364efaf57f9..02b74b0c04af3 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskParameters.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskParameters.java @@ -16,6 +16,9 @@ public class TaskParameters { @JsonProperty(value = "loggingOptOut") private Boolean loggingOptOut; + /** Creates an instance of TaskParameters class. */ + public TaskParameters() {} + /** * Get the loggingOptOut property: The loggingOptOut property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskState.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskState.java index 2fda914cdd8dc..5008557c348fc 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskState.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TaskState.java @@ -23,6 +23,9 @@ public class TaskState { @JsonProperty(value = "status", required = true) private State status; + /** Creates an instance of TaskState class. */ + public TaskState() {} + /** * Get the lastUpdateDateTime property: The last updated time in UTC for the task. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksState.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksState.java index c47d36e816beb..e2bbe2c5b7ba7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksState.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksState.java @@ -16,6 +16,9 @@ public class TasksState { @JsonProperty(value = "tasks", required = true) private TasksStateTasks tasks; + /** Creates an instance of TasksState class. */ + public TasksState() {} + /** * Get the tasks property: The tasks property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksStateTasks.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksStateTasks.java index 63bf97b0e2d58..6656a2d2b50ad 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksStateTasks.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TasksStateTasks.java @@ -41,6 +41,9 @@ public final class TasksStateTasks { @JsonProperty(value = "items") private List items; + /** Creates an instance of TasksStateTasks class. */ + public TasksStateTasks() {} + /** * Get the completed property: The completed property. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureResolution.java index 0c86f21044fd6..c31e5ade48a6f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureResolution.java @@ -26,6 +26,9 @@ public final class TemperatureResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of TemperatureResolution class. */ + public TemperatureResolution() {} + /** * Get the unit property: The temperature Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureUnit.java index 72a8da38b6248..722cf7bf39701 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemperatureUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for TemperatureUnit. */ +/** The temperature Unit of measurement. */ public final class TemperatureUnit extends ExpandableStringEnum { /** Static value Unspecified for TemperatureUnit. */ public static final TemperatureUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalModifier.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalModifier.java index 08afd6e1e8310..747de536db244 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalModifier.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalModifier.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for TemporalModifier. */ +/** An optional modifier of a date/time instance. */ public final class TemporalModifier extends ExpandableStringEnum { /** Static value AfterApprox for TemporalModifier. */ public static final TemporalModifier AFTER_APPROX = fromString("AfterApprox"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalSpanResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalSpanResolution.java index c6c5c3bb0242a..c3752487ccbde 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalSpanResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TemporalSpanResolution.java @@ -47,6 +47,9 @@ public final class TemporalSpanResolution extends BaseResolution { @JsonProperty(value = "timex") private String timex; + /** Creates an instance of TemporalSpanResolution class. */ + public TemporalSpanResolution() {} + /** * Get the begin property: An extended ISO 8601 date/time representation as described in * (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TokenSentimentValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TokenSentimentValue.java index 9d7cd81e433dc..372c3e98a3807 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TokenSentimentValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/TokenSentimentValue.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for TokenSentimentValue. */ +/** Targeted sentiment in the sentence. */ public enum TokenSentimentValue { /** Enum value positive. */ POSITIVE("positive"), @@ -45,6 +45,7 @@ public static TokenSentimentValue fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeResolution.java index b39103de08ac6..10da97e0df67a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeResolution.java @@ -26,6 +26,9 @@ public final class VolumeResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of VolumeResolution class. */ + public VolumeResolution() {} + /** * Get the unit property: The Volume Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeUnit.java index a8e6376957078..9758989141394 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/VolumeUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for VolumeUnit. */ +/** The Volume Unit of measurement. */ public final class VolumeUnit extends ExpandableStringEnum { /** Static value Unspecified for VolumeUnit. */ public static final VolumeUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java index 813fd472ca1c6..e9230ce2e176d 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WarningCodeValue.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for WarningCodeValue. */ +/** Error code. */ public final class WarningCodeValue extends ExpandableStringEnum { /** Static value LongWordsInDocument for WarningCodeValue. */ public static final WarningCodeValue LONG_WORDS_IN_DOCUMENT = fromString("LongWordsInDocument"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightResolution.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightResolution.java index 0e47ba37c307f..607b2fb83a039 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightResolution.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightResolution.java @@ -26,6 +26,9 @@ public final class WeightResolution extends BaseResolution { @JsonProperty(value = "value", required = true) private double value; + /** Creates an instance of WeightResolution class. */ + public WeightResolution() {} + /** * Get the unit property: The weight Unit of measurement. * diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightUnit.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightUnit.java index 9c4aac6cc3409..7c1a7505cb8a2 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightUnit.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/WeightUnit.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for WeightUnit. */ +/** The weight Unit of measurement. */ public final class WeightUnit extends ExpandableStringEnum { /** Static value Unspecified for WeightUnit. */ public static final WeightUnit UNSPECIFIED = fromString("Unspecified"); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeActionsResultPagedIterable.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeActionsResultPagedIterable.java index 49c3eb2724a85..25bc9c30ebfe7 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeActionsResultPagedIterable.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeActionsResultPagedIterable.java @@ -6,8 +6,11 @@ import com.azure.ai.textanalytics.models.AnalyzeActionsResult; import com.azure.core.annotation.Immutable; import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.CoreUtils; import com.azure.core.util.paging.ContinuablePagedIterable; +import com.azure.core.util.paging.PageRetrieverSync; +import java.util.function.Supplier; import java.util.stream.Stream; /** @@ -26,4 +29,18 @@ public final class AnalyzeActionsResultPagedIterable public AnalyzeActionsResultPagedIterable(AnalyzeActionsResultPagedFlux textAnalyticsPagedFlux) { super(textAnalyticsPagedFlux); } + + /** + * Creates an instance of {@link AnalyzeActionsResultPagedIterable}. The constructor takes a {@code Supplier} and + * {@code Function}. The {@code Supplier} returns the first page of {@link AnalyzeActionsResult}, + * the {@code Function} retrieves subsequent pages of {@link AnalyzeActionsResult}. + * + * @param provider Supplier that retrieves the first page + */ + public AnalyzeActionsResultPagedIterable( + Supplier>> provider) { + super(provider, (Integer) null, (token) -> { + return !CoreUtils.isNullOrEmpty(token); + }); + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeHealthcareEntitiesPagedIterable.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeHealthcareEntitiesPagedIterable.java index c4bf2515e2160..4b284feaa7a8e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeHealthcareEntitiesPagedIterable.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AnalyzeHealthcareEntitiesPagedIterable.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.CoreUtils; import com.azure.core.util.paging.ContinuablePagedIterable; +import com.azure.core.util.paging.PageRetrieverSync; +import java.util.function.Supplier; import java.util.stream.Stream; /** @@ -25,4 +28,19 @@ public final class AnalyzeHealthcareEntitiesPagedIterable extends ContinuablePag public AnalyzeHealthcareEntitiesPagedIterable(AnalyzeHealthcareEntitiesPagedFlux pagedFlux) { super(pagedFlux); } + + /** + * Creates an instance of {@link AnalyzeHealthcareEntitiesPagedIterable}. The constructor takes a {@code Supplier} + * and {@code Function}. The {@code Supplier} returns the first page of + * {@link AnalyzeHealthcareEntitiesResultCollection}, the {@code Function} retrieves subsequent pages of + * {@link AnalyzeHealthcareEntitiesResultCollection}. + * + * @param provider Supplier that retrieves the first page + */ + public AnalyzeHealthcareEntitiesPagedIterable( + Supplier>> provider) { + super(provider, (Integer) null, (token) -> { + return !CoreUtils.isNullOrEmpty(token); + }); + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ClassifyDocumentPagedIterable.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ClassifyDocumentPagedIterable.java index b50112339ce51..9fdfc38379f6f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ClassifyDocumentPagedIterable.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ClassifyDocumentPagedIterable.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.CoreUtils; import com.azure.core.util.paging.ContinuablePagedIterable; +import com.azure.core.util.paging.PageRetrieverSync; +import java.util.function.Supplier; import java.util.stream.Stream; /** @@ -25,4 +28,18 @@ public final class ClassifyDocumentPagedIterable extends ContinuablePagedIterabl public ClassifyDocumentPagedIterable(ClassifyDocumentPagedFlux pagedFlux) { super(pagedFlux); } + + /** + * Creates an instance of {@link ClassifyDocumentPagedIterable}. The constructor takes a {@code Supplier} and + * {@code Function}. The {@code Supplier} returns the first page of {@link ClassifyDocumentResultCollection}, + * the {@code Function} retrieves subsequent pages of {@link ClassifyDocumentResultCollection}. + * + * @param provider Supplier that retrieves the first page + */ + public ClassifyDocumentPagedIterable( + Supplier>> provider) { + super(provider, (Integer) null, (token) -> { + return !CoreUtils.isNullOrEmpty(token); + }); + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/RecognizeCustomEntitiesPagedIterable.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/RecognizeCustomEntitiesPagedIterable.java index 546aa5d185fa5..47c4fec65541a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/RecognizeCustomEntitiesPagedIterable.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/RecognizeCustomEntitiesPagedIterable.java @@ -5,8 +5,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.CoreUtils; import com.azure.core.util.paging.ContinuablePagedIterable; +import com.azure.core.util.paging.PageRetrieverSync; +import java.util.function.Supplier; import java.util.stream.Stream; /** @@ -25,4 +28,18 @@ public final class RecognizeCustomEntitiesPagedIterable extends ContinuablePaged public RecognizeCustomEntitiesPagedIterable(RecognizeCustomEntitiesPagedFlux pagedFlux) { super(pagedFlux); } + + /** + * Creates an instance of {@link RecognizeCustomEntitiesPagedIterable}. The constructor takes a {@code Supplier} and + * {@code Function}. The {@code Supplier} returns the first page of {@link RecognizeCustomEntitiesResultCollection}, + * the {@code Function} retrieves subsequent pages of {@link RecognizeCustomEntitiesResultCollection}. + * + * @param provider Supplier that retrieves the first page + */ + public RecognizeCustomEntitiesPagedIterable( + Supplier>> provider) { + super(provider, (Integer) null, (token) -> { + return !CoreUtils.isNullOrEmpty(token); + }); + } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java index 216e7ccc2ff14..6bc3c3a759805 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java @@ -40,6 +40,7 @@ import com.azure.ai.textanalytics.util.RecognizeCustomEntitiesPagedFlux; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; +import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.util.IterableStream; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; @@ -132,9 +133,20 @@ static void afterAll() { StepVerifier.resetDefaultTimeout(); } + private HttpClient buildAsyncAssertingClient(HttpClient httpClient) { + return new AssertingHttpClientBuilder(httpClient) + .skipRequest((ignored1, ignored2) -> false) + .assertAsync() + .build(); + } + private TextAnalyticsAsyncClient getTextAnalyticsAsyncClient(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion, boolean isStaticResource) { - return getTextAnalyticsAsyncClientBuilder(httpClient, serviceVersion, isStaticResource).buildAsyncClient(); + return getTextAnalyticsClientBuilder( + buildAsyncAssertingClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient), + serviceVersion, + isStaticResource) + .buildAsyncClient(); } // Detected Languages diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java index 734c00de9ef7d..ef52c28770a36 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java @@ -48,6 +48,7 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; +import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.util.Context; import com.azure.core.util.IterableStream; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -128,9 +129,20 @@ public class TextAnalyticsClientTest extends TextAnalyticsClientTestBase { private TextAnalyticsClient client; + private HttpClient buildSyncAssertingClient(HttpClient httpClient) { + return new AssertingHttpClientBuilder(httpClient) + .skipRequest((ignored1, ignored2) -> false) + .assertSync() + .build(); + } + private TextAnalyticsClient getTextAnalyticsClient(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion, boolean isStaticResource) { - return getTextAnalyticsAsyncClientBuilder(httpClient, serviceVersion, isStaticResource).buildClient(); + return getTextAnalyticsClientBuilder( + buildSyncAssertingClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient), + serviceVersion, + isStaticResource) + .buildClient(); } // Detect language diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java index 8d40e358be754..9162931d3ff1f 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java @@ -1515,11 +1515,11 @@ String getApiKey(boolean isStaticSource) { : isStaticSource ? AZURE_TEXT_ANALYTICS_CUSTOM_TEXT_API_KEY : AZURE_TEXT_ANALYTICS_API_KEY; } - TextAnalyticsClientBuilder getTextAnalyticsAsyncClientBuilder(HttpClient httpClient, + TextAnalyticsClientBuilder getTextAnalyticsClientBuilder(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion, boolean isStaticResource) { TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder() .endpoint(getEndpoint(isStaticResource)) - .httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient) + .httpClient(httpClient) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .serviceVersion(serviceVersion); if (getTestMode() == TestMode.RECORD) { diff --git a/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md b/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md index b3f6ac274a630..18cb83b5dcd28 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md +++ b/sdk/textanalytics/azure-ai-textanalytics/swagger/README.md @@ -5,6 +5,9 @@ ### Setup ```ps Fork and clone https://github.com/Azure/autorest.java +Add a system envirement variable, `AUTOREST_HOME=C:\work\autorestHome`, which contains all autorest related pacakges. +such as `@autorest_core`, `@autorest_java`, `@autorest_modelerfour`. + git checkout main git submodule update --init --recursive mvn package -Dlocal @@ -18,6 +21,14 @@ cd autorest ``` +Alternately, for using the specific autorest java version, use `--use:@autorest/java@{specific-version}`. The version +will be downloaded and compiled locally in `AUTOREST_HOME`. + +```ps +cd +autorest --java --use:@autorest/java@4.1.9 README.md +``` + ### Code generation settings ``` yaml use: '@autorest/java@4.1.2' @@ -27,7 +38,7 @@ output-folder: ..\ generate-client-as-impl: true namespace: com.azure.ai.textanalytics generate-client-interfaces: false -sync-methods: none +enable-sync-stack: true license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models