Code review comment: Currently, we don't have `analyzeBatchSentiment(inputs, requestOptions)` API. So we will add one if needed

Code before review:
public static void main(String[] args) {
TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder()
.subscriptionKey("<replace-with-your-text-analytics-key-here>")
.endpoint("<replace-with-your-text-analytics-endpoint-here>")
.buildAsyncClient();
List<TextDocumentInput> inputs = Arrays.asList(
new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.", "en"),
new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.", "en")
);
final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true);
client.analyzeBatchSentimentWithResponse(inputs, requestOptions).subscribe(
result -> {
DocumentResultCollection<AnalyzeSentimentResult> analyzedBatchResult = result.getValue();
System.out.printf("Model version: %s%n", analyzedBatchResult.getModelVersion());
final TextDocumentBatchStatistics batchStatistics = analyzedBatchResult.getStatistics();
System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n",
batchStatistics.getDocumentCount(),
batchStatistics.getErroneousDocumentCount(),
batchStatistics.getTransactionCount(),
batchStatistics.getValidDocumentCount());
for (AnalyzeSentimentResult analyzeSentimentResult : analyzedBatchResult) {
System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId());
final TextSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
if (documentSentiment == null) {
System.out.printf("Cannot analyze sentiment. Error: %s%n", analyzeSentimentResult.getError().getMessage());
continue;
}
System.out.printf("Analyzed document sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n",
documentSentiment.getTextSentimentClass(),
documentSentiment.getPositiveScore(),
documentSentiment.getNeutralScore(),
documentSentiment.getNegativeScore(),
documentSentiment.getLength(),
documentSentiment.getOffset());
for (TextSentiment sentenceSentiment : analyzeSentimentResult.getSentenceSentiments()) {
System.out.printf("Analyzed sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n",
sentenceSentiment.getTextSentimentClass(),
sentenceSentiment.getPositiveScore(),
sentenceSentiment.getNeutralScore(),
sentenceSentiment.getNegativeScore(),
sentenceSentiment.getLength(),
sentenceSentiment.getOffset());
}
}
},
error -> System.err.println("There was an error analyzing sentiment of the text inputs." + error),
() -> System.out.println("Batch of sentiment analyzed."));
try {
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException ignored) {
}
}

Line under review: client.analyzeBatchSentimentWithResponse(inputs, requestOptions).subscribe(

Code after addressing the review:
public static void main(String[] args) {
TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder()
.subscriptionKey("{subscription_key}")
.endpoint("https:
.buildAsyncClient();
List<TextDocumentInput> inputs = Arrays.asList(
new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.", "en"),
new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.", "en")
);
final TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setShowStatistics(true);
client.analyzeBatchSentimentWithResponse(inputs, requestOptions).subscribe(
result -> {
DocumentResultCollection<AnalyzeSentimentResult> analyzedBatchResult = result.getValue();
System.out.printf("Model version: %s%n", analyzedBatchResult.getModelVersion());
final TextDocumentBatchStatistics batchStatistics = analyzedBatchResult.getStatistics();
System.out.printf("A batch of document statistics, document count: %s, erroneous document count: %s, transaction count: %s, valid document count: %s.%n",
batchStatistics.getDocumentCount(),
batchStatistics.getErroneousDocumentCount(),
batchStatistics.getTransactionCount(),
batchStatistics.getValidDocumentCount());
for (AnalyzeSentimentResult analyzeSentimentResult : analyzedBatchResult) {
System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId());
if (analyzeSentimentResult.isError()) {
System.out.printf("Cannot analyze sentiment. Error: %s%n", analyzeSentimentResult.getError().getMessage());
continue;
}
final TextSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
System.out.printf("Analyzed document sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n",
documentSentiment.getTextSentimentClass(),
documentSentiment.getPositiveScore(),
documentSentiment.getNeutralScore(),
documentSentiment.getNegativeScore(),
documentSentiment.getLength(),
documentSentiment.getOffset());
for (TextSentiment sentenceSentiment : analyzeSentimentResult.getSentenceSentiments()) {
System.out.printf("Analyzed sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s, length of sentence: %s, offset of sentence: %s.%n",
sentenceSentiment.getTextSentimentClass(),
sentenceSentiment.getPositiveScore(),
sentenceSentiment.getNeutralScore(),
sentenceSentiment.getNegativeScore(),
sentenceSentiment.getLength(),
sentenceSentiment.getOffset());
}
}
},
error -> System.err.println("There was an error analyzing sentiment of the text inputs." + error),
() -> System.out.println("Batch of sentiment analyzed."));
try {
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException ignored) {
}
}