Skip to content

Commit

Permalink
[TA] Update based code based on the latest swagger changes (Azure#19567)
Browse files Browse the repository at this point in the history
* updated the base code
  • Loading branch information
mssfang authored Mar 3, 2021
1 parent 74a9b2d commit c1bf419
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 23 deletions.
3 changes: 2 additions & 1 deletion sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History
## 5.1.0-beta.5 (Unreleased)
### Breaking changes
- Renamed `AspectSentiment` to `TargetSentiment`, `OpinionSentiment` to `AssesssmentSentiment`.
- Renamed classes,
`AspectSentiment` to `TargetSentiment`, `OpinionSentiment` to `AssesssmentSentiment`, `MinedOpinion` to `SentenceOpinion`.
- Renamed
`SentenceSentiment`'s method, `getMinedOpinions()` to `getOpinions()`.
`MinedOpinion`'s methods, `getAspect()` to `getTarget()`, `getOpinions()` to `getAssessments()`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.azure.ai.textanalytics.implementation.models.PiiTaskParameters;
import com.azure.ai.textanalytics.implementation.models.PiiTaskParametersDomain;
import com.azure.ai.textanalytics.implementation.models.RequestStatistics;
import com.azure.ai.textanalytics.implementation.models.StringIndexTypeResponse;
import com.azure.ai.textanalytics.implementation.models.TasksStateTasks;
import com.azure.ai.textanalytics.implementation.models.TasksStateTasksEntityRecognitionPiiTasksItem;
import com.azure.ai.textanalytics.implementation.models.TasksStateTasksEntityRecognitionTasksItem;
Expand All @@ -39,7 +38,6 @@
import com.azure.ai.textanalytics.models.RecognizeEntitiesActionResult;
import com.azure.ai.textanalytics.models.RecognizePiiEntitiesActionResult;
import com.azure.ai.textanalytics.models.TextAnalyticsActionResult;
import com.azure.ai.textanalytics.models.StringIndexType;
import com.azure.ai.textanalytics.models.TextAnalyticsActions;
import com.azure.ai.textanalytics.models.TextAnalyticsErrorCode;
import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics;
Expand Down Expand Up @@ -71,6 +69,7 @@

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.getNonNullStringIndexType;
import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation;
import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink;
import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId;
Expand Down Expand Up @@ -186,7 +185,7 @@ private JobManifestTasks getJobManifestTasks(TextAnalyticsActions actions) {
// https://github.com/Azure/azure-sdk-for-java/issues/17625
new EntitiesTaskParameters()
.setModelVersion(getNotNullModelVersion(action.getModelVersion()))
.setStringIndexType(getNonNullStringIndexTypeResponse(action.getStringIndexType())));
.setStringIndexType(getNonNullStringIndexType(action.getStringIndexType())));
return entitiesTask;
}).collect(Collectors.toList()))
.setEntityRecognitionPiiTasks(actions.getRecognizePiiEntitiesOptions() == null ? null
Expand All @@ -205,7 +204,7 @@ private JobManifestTasks getJobManifestTasks(TextAnalyticsActions actions) {
.setDomain(PiiTaskParametersDomain.fromString(
action.getDomainFilter() == null ? null
: action.getDomainFilter().toString()))
.setStringIndexType(getNonNullStringIndexTypeResponse(action.getStringIndexType()))
.setStringIndexType(getNonNullStringIndexType(action.getStringIndexType()))
);
return piiTask;
}).collect(Collectors.toList()))
Expand Down Expand Up @@ -494,10 +493,4 @@ private String[] parseActionErrorTarget(String targetReference) {
}
return taskNameIdPair;
}

private StringIndexTypeResponse getNonNullStringIndexTypeResponse(StringIndexType stringIndexType) {
return StringIndexTypeResponse.fromString(
stringIndexType == null ? StringIndexType.UTF16CODE_UNIT.toString()
: stringIndexType.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
import com.azure.core.util.serializer.CollectionFormat;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.core.util.serializer.SerializerAdapter;
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.UUID;
import reactor.core.publisher.Mono;

/** Initializes a new instance of the TextAnalyticsClient type. */
public final class TextAnalyticsClientImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class EntitiesTaskParameters {
* The stringIndexType property.
*/
@JsonProperty(value = "stringIndexType")
private StringIndexTypeResponse stringIndexType;
private StringIndexType stringIndexType;

/**
* Get the modelVersion property: The model-version property.
Expand All @@ -47,7 +47,7 @@ public EntitiesTaskParameters setModelVersion(String modelVersion) {
*
* @return the stringIndexType value.
*/
public StringIndexTypeResponse getStringIndexType() {
public StringIndexType getStringIndexType() {
return this.stringIndexType;
}

Expand All @@ -57,7 +57,7 @@ public StringIndexTypeResponse getStringIndexType() {
* @param stringIndexType the stringIndexType value to set.
* @return the EntitiesTaskParameters object itself.
*/
public EntitiesTaskParameters setStringIndexType(StringIndexTypeResponse stringIndexType) {
public EntitiesTaskParameters setStringIndexType(StringIndexType stringIndexType) {
this.stringIndexType = stringIndexType;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class EntityLinkingTaskParameters {
* The stringIndexType property.
*/
@JsonProperty(value = "stringIndexType")
private StringIndexTypeResponse stringIndexType;
private StringIndexType stringIndexType;

/**
* Get the modelVersion property: The model-version property.
Expand All @@ -47,7 +47,7 @@ public EntityLinkingTaskParameters setModelVersion(String modelVersion) {
*
* @return the stringIndexType value.
*/
public StringIndexTypeResponse getStringIndexType() {
public StringIndexType getStringIndexType() {
return this.stringIndexType;
}

Expand All @@ -57,7 +57,7 @@ public StringIndexTypeResponse getStringIndexType() {
* @param stringIndexType the stringIndexType value to set.
* @return the EntityLinkingTaskParameters object itself.
*/
public EntityLinkingTaskParameters setStringIndexType(StringIndexTypeResponse stringIndexType) {
public EntityLinkingTaskParameters setStringIndexType(StringIndexType stringIndexType) {
this.stringIndexType = stringIndexType;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public final class PiiTaskParameters {
/*
* (Optional) describes the PII categories to return
*/
@JsonProperty(value = "piiCategories")
@JsonProperty(value = "pii-categories")
private List<PiiCategory> piiCategories;

/*
* The stringIndexType property.
*/
@JsonProperty(value = "stringIndexType")
private StringIndexTypeResponse stringIndexType;
private StringIndexType stringIndexType;

/**
* Get the domain property: The domain property.
Expand Down Expand Up @@ -100,7 +100,7 @@ public PiiTaskParameters setPiiCategories(List<PiiCategory> piiCategories) {
*
* @return the stringIndexType value.
*/
public StringIndexTypeResponse getStringIndexType() {
public StringIndexType getStringIndexType() {
return this.stringIndexType;
}

Expand All @@ -110,7 +110,7 @@ public StringIndexTypeResponse getStringIndexType() {
* @param stringIndexType the stringIndexType value to set.
* @return the PiiTaskParameters object itself.
*/
public PiiTaskParameters setStringIndexType(StringIndexTypeResponse stringIndexType) {
public PiiTaskParameters setStringIndexType(StringIndexType stringIndexType) {
this.stringIndexType = stringIndexType;
return this;
}
Expand Down

0 comments on commit c1bf419

Please sign in to comment.