Skip to content

Commit c1bf419

Browse files
authored
[TA] Update based code based on the latest swagger changes (Azure#19567)
* updated the base code
1 parent 74a9b2d commit c1bf419

File tree

6 files changed

+16
-23
lines changed

6 files changed

+16
-23
lines changed

sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Release History
22
## 5.1.0-beta.5 (Unreleased)
33
### Breaking changes
4-
- Renamed `AspectSentiment` to `TargetSentiment`, `OpinionSentiment` to `AssesssmentSentiment`.
4+
- Renamed classes,
5+
`AspectSentiment` to `TargetSentiment`, `OpinionSentiment` to `AssesssmentSentiment`, `MinedOpinion` to `SentenceOpinion`.
56
- Renamed
67
`SentenceSentiment`'s method, `getMinedOpinions()` to `getOpinions()`.
78
`MinedOpinion`'s methods, `getAspect()` to `getTarget()`, `getOpinions()` to `getAssessments()`,

sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeBatchActionsAsyncClient.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.azure.ai.textanalytics.implementation.models.PiiTaskParameters;
2727
import com.azure.ai.textanalytics.implementation.models.PiiTaskParametersDomain;
2828
import com.azure.ai.textanalytics.implementation.models.RequestStatistics;
29-
import com.azure.ai.textanalytics.implementation.models.StringIndexTypeResponse;
3029
import com.azure.ai.textanalytics.implementation.models.TasksStateTasks;
3130
import com.azure.ai.textanalytics.implementation.models.TasksStateTasksEntityRecognitionPiiTasksItem;
3231
import com.azure.ai.textanalytics.implementation.models.TasksStateTasksEntityRecognitionTasksItem;
@@ -39,7 +38,6 @@
3938
import com.azure.ai.textanalytics.models.RecognizeEntitiesActionResult;
4039
import com.azure.ai.textanalytics.models.RecognizePiiEntitiesActionResult;
4140
import com.azure.ai.textanalytics.models.TextAnalyticsActionResult;
42-
import com.azure.ai.textanalytics.models.StringIndexType;
4341
import com.azure.ai.textanalytics.models.TextAnalyticsActions;
4442
import com.azure.ai.textanalytics.models.TextAnalyticsErrorCode;
4543
import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics;
@@ -71,6 +69,7 @@
7169

7270
import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE;
7371
import static com.azure.ai.textanalytics.implementation.Utility.DEFAULT_POLL_INTERVAL;
72+
import static com.azure.ai.textanalytics.implementation.Utility.getNonNullStringIndexType;
7473
import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation;
7574
import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink;
7675
import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId;
@@ -186,7 +185,7 @@ private JobManifestTasks getJobManifestTasks(TextAnalyticsActions actions) {
186185
// https://github.com/Azure/azure-sdk-for-java/issues/17625
187186
new EntitiesTaskParameters()
188187
.setModelVersion(getNotNullModelVersion(action.getModelVersion()))
189-
.setStringIndexType(getNonNullStringIndexTypeResponse(action.getStringIndexType())));
188+
.setStringIndexType(getNonNullStringIndexType(action.getStringIndexType())));
190189
return entitiesTask;
191190
}).collect(Collectors.toList()))
192191
.setEntityRecognitionPiiTasks(actions.getRecognizePiiEntitiesOptions() == null ? null
@@ -205,7 +204,7 @@ private JobManifestTasks getJobManifestTasks(TextAnalyticsActions actions) {
205204
.setDomain(PiiTaskParametersDomain.fromString(
206205
action.getDomainFilter() == null ? null
207206
: action.getDomainFilter().toString()))
208-
.setStringIndexType(getNonNullStringIndexTypeResponse(action.getStringIndexType()))
207+
.setStringIndexType(getNonNullStringIndexType(action.getStringIndexType()))
209208
);
210209
return piiTask;
211210
}).collect(Collectors.toList()))
@@ -494,10 +493,4 @@ private String[] parseActionErrorTarget(String targetReference) {
494493
}
495494
return taskNameIdPair;
496495
}
497-
498-
private StringIndexTypeResponse getNonNullStringIndexTypeResponse(StringIndexType stringIndexType) {
499-
return StringIndexTypeResponse.fromString(
500-
stringIndexType == null ? StringIndexType.UTF16CODE_UNIT.toString()
501-
: stringIndexType.toString());
502-
}
503496
}

sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/TextAnalyticsClientImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646
import com.azure.core.util.serializer.CollectionFormat;
4747
import com.azure.core.util.serializer.JacksonAdapter;
4848
import com.azure.core.util.serializer.SerializerAdapter;
49-
import reactor.core.publisher.Mono;
50-
5149
import java.util.List;
5250
import java.util.UUID;
51+
import reactor.core.publisher.Mono;
5352

5453
/** Initializes a new instance of the TextAnalyticsClient type. */
5554
public final class TextAnalyticsClientImpl {

sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntitiesTaskParameters.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public final class EntitiesTaskParameters {
2020
* The stringIndexType property.
2121
*/
2222
@JsonProperty(value = "stringIndexType")
23-
private StringIndexTypeResponse stringIndexType;
23+
private StringIndexType stringIndexType;
2424

2525
/**
2626
* Get the modelVersion property: The model-version property.
@@ -47,7 +47,7 @@ public EntitiesTaskParameters setModelVersion(String modelVersion) {
4747
*
4848
* @return the stringIndexType value.
4949
*/
50-
public StringIndexTypeResponse getStringIndexType() {
50+
public StringIndexType getStringIndexType() {
5151
return this.stringIndexType;
5252
}
5353

@@ -57,7 +57,7 @@ public StringIndexTypeResponse getStringIndexType() {
5757
* @param stringIndexType the stringIndexType value to set.
5858
* @return the EntitiesTaskParameters object itself.
5959
*/
60-
public EntitiesTaskParameters setStringIndexType(StringIndexTypeResponse stringIndexType) {
60+
public EntitiesTaskParameters setStringIndexType(StringIndexType stringIndexType) {
6161
this.stringIndexType = stringIndexType;
6262
return this;
6363
}

sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/EntityLinkingTaskParameters.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public final class EntityLinkingTaskParameters {
2020
* The stringIndexType property.
2121
*/
2222
@JsonProperty(value = "stringIndexType")
23-
private StringIndexTypeResponse stringIndexType;
23+
private StringIndexType stringIndexType;
2424

2525
/**
2626
* Get the modelVersion property: The model-version property.
@@ -47,7 +47,7 @@ public EntityLinkingTaskParameters setModelVersion(String modelVersion) {
4747
*
4848
* @return the stringIndexType value.
4949
*/
50-
public StringIndexTypeResponse getStringIndexType() {
50+
public StringIndexType getStringIndexType() {
5151
return this.stringIndexType;
5252
}
5353

@@ -57,7 +57,7 @@ public StringIndexTypeResponse getStringIndexType() {
5757
* @param stringIndexType the stringIndexType value to set.
5858
* @return the EntityLinkingTaskParameters object itself.
5959
*/
60-
public EntityLinkingTaskParameters setStringIndexType(StringIndexTypeResponse stringIndexType) {
60+
public EntityLinkingTaskParameters setStringIndexType(StringIndexType stringIndexType) {
6161
this.stringIndexType = stringIndexType;
6262
return this;
6363
}

sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/PiiTaskParameters.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public final class PiiTaskParameters {
2626
/*
2727
* (Optional) describes the PII categories to return
2828
*/
29-
@JsonProperty(value = "piiCategories")
29+
@JsonProperty(value = "pii-categories")
3030
private List<PiiCategory> piiCategories;
3131

3232
/*
3333
* The stringIndexType property.
3434
*/
3535
@JsonProperty(value = "stringIndexType")
36-
private StringIndexTypeResponse stringIndexType;
36+
private StringIndexType stringIndexType;
3737

3838
/**
3939
* Get the domain property: The domain property.
@@ -100,7 +100,7 @@ public PiiTaskParameters setPiiCategories(List<PiiCategory> piiCategories) {
100100
*
101101
* @return the stringIndexType value.
102102
*/
103-
public StringIndexTypeResponse getStringIndexType() {
103+
public StringIndexType getStringIndexType() {
104104
return this.stringIndexType;
105105
}
106106

@@ -110,7 +110,7 @@ public StringIndexTypeResponse getStringIndexType() {
110110
* @param stringIndexType the stringIndexType value to set.
111111
* @return the PiiTaskParameters object itself.
112112
*/
113-
public PiiTaskParameters setStringIndexType(StringIndexTypeResponse stringIndexType) {
113+
public PiiTaskParameters setStringIndexType(StringIndexType stringIndexType) {
114114
this.stringIndexType = stringIndexType;
115115
return this;
116116
}

0 commit comments

Comments
 (0)