Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync client updates #5

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.azure.cs.textanalytics.implementation.TextAnalyticsAPIImpl;
import com.azure.cs.textanalytics.implementation.models.LanguageBatchInput;
import com.azure.cs.textanalytics.implementation.models.MultiLanguageBatchInput;
import com.azure.cs.textanalytics.models.DetectedLanguageResult;
import com.azure.cs.textanalytics.models.DetectLanguageResult;
import com.azure.cs.textanalytics.models.DocumentResultCollection;
import com.azure.cs.textanalytics.models.KeyPhraseResult;
import com.azure.cs.textanalytics.models.LinkedEntityResult;
Expand Down Expand Up @@ -54,18 +54,18 @@ public TextAnalyticsServiceVersion getServiceVersion() {
// (1) language
// new user
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DetectedLanguageResult> detectLanguage(String text) { return detectLanguage(text, null);}
public Mono<DetectLanguageResult> detectLanguage(String text) { return detectLanguage(text, null);}

@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DetectedLanguageResult> detectLanguage(String text, String countryHint) {
public Mono<DetectLanguageResult> detectLanguage(String text, String countryHint) {
return detectLanguageWithResponse(text, countryHint)
.flatMap(response -> Mono.justOrEmpty(response.getValue()));
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<DetectedLanguageResult>> detectLanguageWithResponse(String text, String countryHint) {
public Mono<Response<DetectLanguageResult>> detectLanguageWithResponse(String text, String countryHint) {
List<DetectLanguageInput> languageInputs = new ArrayList<>();
languageInputs.add(new DetectLanguageInput(Integer.toString(0), text).setCountryHint(countryHint));
languageInputs.add(new DetectLanguageInput(Integer.toString(0), text, countryHint));
// TODO: correct it
// return detectLanguagesWithResponse(languageInputs, null).flatMap(
// response -> {
Expand All @@ -80,28 +80,28 @@ public Mono<Response<DetectedLanguageResult>> detectLanguageWithResponse(String

// Hackathon user
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DocumentResultCollection<DetectedLanguageResult>> detectLanguages(List<String> inputs) {
public Mono<DocumentResultCollection<DetectLanguageResult>> detectLanguages(List<String> inputs) {
return null;
}

public Mono<DocumentResultCollection<DetectedLanguageResult>> detectLanguages(List<String> inputs,
String countryHint) {
public Mono<DocumentResultCollection<DetectLanguageResult>> detectLanguages(List<String> inputs,
String countryHint) {
List<DetectLanguageInput> languageInputs = new ArrayList<>();
for (int i = 0; i < inputs.size(); i++) {
languageInputs.add(new DetectLanguageInput(Integer.toString(i), inputs.get(i)).setCountryHint(countryHint));
languageInputs.add(new DetectLanguageInput(Integer.toString(i), inputs.get(i), countryHint));
}

return detectBatchLanguages(languageInputs, null);
}

// Advanced user
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DocumentResultCollection<DetectedLanguageResult>> detectBatchLanguages(List<DetectLanguageInput> inputs) {
public Mono<DocumentResultCollection<DetectLanguageResult>> detectBatchLanguages(List<DetectLanguageInput> inputs) {
return detectBatchLanguages(inputs, null);
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DocumentResultCollection<DetectedLanguageResult>> detectBatchLanguages(
public Mono<DocumentResultCollection<DetectLanguageResult>> detectBatchLanguages(
List<DetectLanguageInput> inputs, TextAnalyticsRequestOptions options) {
try {
return withContext(context -> detectBatchLanguagesWithResponse(inputs, options, context)
Expand All @@ -112,7 +112,7 @@ public Mono<DocumentResultCollection<DetectedLanguageResult>> detectBatchLanguag
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<DocumentResultCollection<DetectedLanguageResult>>> detectBatchLanguagesWithResponse(
public Mono<Response<DocumentResultCollection<DetectLanguageResult>>> detectBatchLanguagesWithResponse(
List<DetectLanguageInput> inputs, TextAnalyticsRequestOptions options) {
try {
return withContext(
Expand All @@ -122,7 +122,7 @@ public Mono<Response<DocumentResultCollection<DetectedLanguageResult>>> detectBa
}
}

Mono<Response<DocumentResultCollection<DetectedLanguageResult>>> detectBatchLanguagesWithResponse(
Mono<Response<DocumentResultCollection<DetectLanguageResult>>> detectBatchLanguagesWithResponse(
List<DetectLanguageInput> inputs, TextAnalyticsRequestOptions options, Context context) {
// TODO: validate inputs
final LanguageBatchInput languageBatchInput = new LanguageBatchInput().setDocuments(inputs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.cs.textanalytics.models.DetectLanguageInput;
import com.azure.cs.textanalytics.models.DetectedLanguageResult;
import com.azure.cs.textanalytics.models.DetectLanguageResult;
import com.azure.cs.textanalytics.models.DocumentResultCollection;
import com.azure.cs.textanalytics.models.KeyPhraseResult;
import com.azure.cs.textanalytics.models.LinkedEntityResult;
Expand All @@ -31,39 +31,44 @@ public final class TextAnalyticsClient {
// (1) language
// new user
@ServiceMethod(returns = ReturnType.SINGLE)
public DetectedLanguageResult detectLanguage(String text) { return null; }
public DetectLanguageResult detectLanguage(String text) { return null; }

@ServiceMethod(returns = ReturnType.SINGLE)
public DetectedLanguageResult detectLanguage(String text, String countryHint) {
public DetectLanguageResult detectLanguage(String text, String countryHint) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DetectedLanguageResult> detectLanguageWithResponse(
public Response<DetectLanguageResult> detectLanguageWithResponse(
String text, String countryHint, Context context) {
return null;
}

// hackathon user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<DetectedLanguageResult> detectLanguages(List<String> inputs, String countryHint) {
public DocumentResultCollection<DetectLanguageResult> detectLanguages(List<String> inputs) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<DetectLanguageResult> detectLanguages(List<String> inputs, String countryHint) {
return null;
}

// advantage user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<DetectedLanguageResult> detectLanguages(List<DetectLanguageInput> inputs) {
public DocumentResultCollection<DetectLanguageResult> detectBatchLanguages(List<DetectLanguageInput> inputs) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<DetectedLanguageResult> detectLanguages(
public DocumentResultCollection<DetectLanguageResult> detectBatchLanguages(
List<DetectLanguageInput> inputs, TextAnalyticsRequestOptions options) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DocumentResultCollection<DetectedLanguageResult>> detectLanguagesWithResponse(
public Response<DocumentResultCollection<DetectLanguageResult>> detectBatchLanguagesWithResponse(
List<DetectLanguageInput> inputs, TextAnalyticsRequestOptions options, Context context) {
return client.detectBatchLanguagesWithResponse(inputs, options, context).block();
}
Expand All @@ -81,30 +86,34 @@ public NamedEntityResult recognizeEntities(String text, String language) {
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<NamedEntityResult> recognizeEntitiesWithResponse(String text, String language, Context context) {
public Response<NamedEntityResult> recognizeBatchEntitiesWithResponse(String text, String language, Context context) {
return null;
}

// hackathon user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizeEntities(List<String> inputs) {
return null;
}
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizeEntities(List<String> inputs, String language) {
return null;
}

// advantage user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizeEntities(List<TextDocumentInput> inputs) {
public DocumentResultCollection<NamedEntityResult> recognizeBatchEntities(List<TextDocumentInput> inputs) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizeEntities(
public DocumentResultCollection<NamedEntityResult> recognizeBatchEntities(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DocumentResultCollection<NamedEntityResult>> recognizeEntitiesWithResponse(
public Response<DocumentResultCollection<NamedEntityResult>> recognizeBatchEntitiesWithResponse(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options, Context context) {
return client.recognizeBatchEntitiesWithResponse(inputs, options, context).block();
}
Expand All @@ -122,30 +131,34 @@ public NamedEntityResult recognizePiiEntities(String text, String language) {
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<NamedEntityResult> recognizePiiEntitiesWithResponse(String text, String language) {
public Response<NamedEntityResult> recognizeBatchPiiEntitiesWithResponse(String text, String language) {
return null;
}

// hackathon user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizePiiEntities(List<String> inputs) {
return null;
}
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizePiiEntities(List<String> inputs, String language) {
return null;
}

// advantage user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizePiiEntities(List<TextDocumentInput> inputs) {
public DocumentResultCollection<NamedEntityResult> recognizeBatchPiiEntities(List<TextDocumentInput> inputs) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<NamedEntityResult> recognizePiiEntities(
public DocumentResultCollection<NamedEntityResult> recognizeBatchPiiEntities(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DocumentResultCollection<NamedEntityResult>> recognizePiiEntitiesWithResponse(
public Response<DocumentResultCollection<NamedEntityResult>> recognizeBatchPiiEntitiesWithResponse(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options, Context context) {
return client.recognizeBatchPiiEntitiesWithResponse(inputs, options, context).block();
}
Expand All @@ -163,30 +176,34 @@ public LinkedEntityResult recognizeLinkedEntities(String text, String language)
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<LinkedEntityResult> recognizeLinkedEntitiesWithResponse(String text, String language) {
public Response<LinkedEntityResult> recognizeBatchLinkedEntitiesWithResponse(String text, String language) {
return null;
}

// hackathon user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<LinkedEntityResult> recognizeLinkedEntities(List<String> inputs) {
return null;
}
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<LinkedEntityResult> recognizeLinkedEntities(List<String> inputs, String language) {
return null;
}

// advantage user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<LinkedEntityResult> recognizeLinkedEntities(List<TextDocumentInput> inputs) {
public DocumentResultCollection<LinkedEntityResult> recognizeBatchLinkedEntities(List<TextDocumentInput> inputs) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<LinkedEntityResult> recognizeLinkedEntities(
public DocumentResultCollection<LinkedEntityResult> recognizeBatchLinkedEntities(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DocumentResultCollection<LinkedEntityResult>> recognizeLinkedEntitiesWithResponse(
public Response<DocumentResultCollection<LinkedEntityResult>> recognizeBatchLinkedEntitiesWithResponse(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options, Context context) {
return client.recognizeBatchLinkedEntitiesWithResponse(inputs, options, context).block();
}
Expand All @@ -204,30 +221,34 @@ public KeyPhraseResult extractKeyPhrases(String text, String language) {
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<KeyPhraseResult> extractKeyPhrasesWithResponse(String text, String language) {
public Response<KeyPhraseResult> extractBatchKeyPhrasesWithResponse(String text, String language) {
return null;
}

// hackathon user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<KeyPhraseResult> extractKeyPhrases(List<String> inputs) {
return null;
}
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<KeyPhraseResult> extractKeyPhrases(List<String> inputs, String language) {
return null;
}

// advantage user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<KeyPhraseResult> extractKeyPhrases(List<TextDocumentInput> inputs) {
public DocumentResultCollection<KeyPhraseResult> extractBatchKeyPhrases(List<TextDocumentInput> inputs) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<KeyPhraseResult> extractKeyPhrases(
public DocumentResultCollection<KeyPhraseResult> extractBatchKeyPhrases(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DocumentResultCollection<KeyPhraseResult>> extractKeyPhrasesWithResponse(
public Response<DocumentResultCollection<KeyPhraseResult>> extractBatchKeyPhrasesWithResponse(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options, Context context) {
return client.extractBatchKeyPhrasesWithResponse(inputs, options, context).block();
}
Expand All @@ -245,31 +266,35 @@ public TextSentimentResult analyzeSentiment(String input, String language) {
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<TextSentimentResult> analyzeSentimentWithResponse(
public Response<TextSentimentResult> analyzeBatchSentimentWithResponse(
String input, String language, Context context) {
return null;
}

// hackathon user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<TextSentimentResult> analyzeSentiment(List<String> inputs) {
return null;
}
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<TextSentimentResult> analyzeSentiment(List<String> inputs, String language) {
return null;
}

// advantage user
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<TextSentimentResult> analyzeSentiment(List<TextDocumentInput> inputs) {
public DocumentResultCollection<TextSentimentResult> analyzeBatchSentiment(List<TextDocumentInput> inputs) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentResultCollection<TextSentimentResult> analyzeSentiment(
public DocumentResultCollection<TextSentimentResult> analyzeBatchSentiment(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options) {
return null;
}

@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DocumentResultCollection<TextSentimentResult>> analyzeSentimentWithResponse(
public Response<DocumentResultCollection<TextSentimentResult>> analyzeBatchSentimentWithResponse(
List<TextDocumentInput> inputs, TextAnalyticsRequestOptions options, Context context) {
return client.analyzeBatchSentimentWithResponse(inputs, options, context).block();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public DetectLanguageInput(String id, String text) {
this.text = text;
}

public DetectLanguageInput(String id, String text, String countryHint) {
this.id = id;
this.text = text;
this.countryHint = countryHint;
}
/*
* Unique, non-empty document identifier.
*/
Expand Down Expand Up @@ -73,15 +78,4 @@ public String getText() {
public String getCountryHint() {
return this.countryHint;
}

/**
* Set the countryHint property: The countryHint property.
*
* @param countryHint the countryHint value to set.
* @return the UnknownLanguageInput object itself.
*/
public DetectLanguageInput setCountryHint(String countryHint) {
this.countryHint = countryHint;
return this;
}
}
Loading