diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java index a9bf0ab50466..dba9dbcfda98 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java @@ -162,7 +162,7 @@ public Mono> getLanguagesWithResponse(RequestOptions reques * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. * Note: the dynamic dictionary feature is case-sensitive. * textTypeStringNoDefines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "plain", "html". + * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". * categoryStringNoA string specifying the category (domain) of the translation. This parameter is used to get translations * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator * project details to this parameter to use your deployed customized system. Default value is: general. @@ -252,7 +252,7 @@ public Mono> getLanguagesWithResponse(RequestOptions reques * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -263,8 +263,8 @@ public Mono> getLanguagesWithResponse(RequestOptions reques @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> translateWithResponse( - List to, BinaryData content, RequestOptions requestOptions) { - return this.serviceClient.translateWithResponseAsync(to, content, requestOptions); + List to, BinaryData requestBody, RequestOptions requestOptions) { + return this.serviceClient.translateWithResponseAsync(to, requestBody, requestOptions); } /** @@ -307,7 +307,7 @@ public Mono> translateWithResponse( * transliteration scope, to find input scripts available for the selected language. * @param toScript Specifies the output script. Look up supported languages using the transliteration scope, to find * output scripts available for the selected combination of input language and input script. - * @param content Array of the text to be transliterated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -318,9 +318,13 @@ public Mono> translateWithResponse( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> transliterateWithResponse( - String language, String fromScript, String toScript, BinaryData content, RequestOptions requestOptions) { + String language, + String fromScript, + String toScript, + BinaryData requestBody, + RequestOptions requestOptions) { return this.serviceClient.transliterateWithResponseAsync( - language, fromScript, toScript, content, requestOptions); + language, fromScript, toScript, requestBody, requestOptions); } /** @@ -375,7 +379,7 @@ public Mono> transliterateWithResponse( * ] * } * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -386,8 +390,8 @@ public Mono> transliterateWithResponse( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> findSentenceBoundariesWithResponse( - BinaryData content, RequestOptions requestOptions) { - return this.serviceClient.findSentenceBoundariesWithResponseAsync(content, requestOptions); + BinaryData requestBody, RequestOptions requestOptions) { + return this.serviceClient.findSentenceBoundariesWithResponseAsync(requestBody, requestOptions); } /** @@ -445,7 +449,7 @@ public Mono> findSentenceBoundariesWithResponse( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -456,8 +460,8 @@ public Mono> findSentenceBoundariesWithResponse( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryEntriesWithResponse( - String from, String to, BinaryData content, RequestOptions requestOptions) { - return this.serviceClient.lookupDictionaryEntriesWithResponseAsync(from, to, content, requestOptions); + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { + return this.serviceClient.lookupDictionaryEntriesWithResponseAsync(from, to, requestBody, requestOptions); } /** @@ -509,7 +513,7 @@ public Mono> lookupDictionaryEntriesWithResponse( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -520,8 +524,8 @@ public Mono> lookupDictionaryEntriesWithResponse( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryExamplesWithResponse( - String from, String to, BinaryData content, RequestOptions requestOptions) { - return this.serviceClient.lookupDictionaryExamplesWithResponseAsync(from, to, content, requestOptions); + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { + return this.serviceClient.lookupDictionaryExamplesWithResponseAsync(from, to, requestBody, requestOptions); } /** @@ -601,7 +605,7 @@ public Mono getLanguages() { * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @param from Specifies the language of the input text. Find which languages are available to translate from by * looking up supported languages using the translation scope. If the from parameter isn't specified, automatic @@ -647,7 +651,7 @@ public Mono getLanguages() { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> translate( List to, - List content, + List requestBody, String clientTraceId, String from, TextType textType, @@ -698,7 +702,7 @@ public Mono> translate( if (allowFallback != null) { requestOptions.addQueryParam("allowFallback", String.valueOf(allowFallback), false); } - return translateWithResponse(to, BinaryData.fromObject(content), requestOptions) + return translateWithResponse(to, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_TRANSLATED_TEXT_ITEM)); } @@ -710,7 +714,7 @@ public Mono> translate( * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -721,10 +725,10 @@ public Mono> translate( */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> translate(List to, List content) { + public Mono> translate(List to, List requestBody) { // Generated convenience method for translateWithResponse RequestOptions requestOptions = new RequestOptions(); - return translateWithResponse(to, BinaryData.fromObject(content), requestOptions) + return translateWithResponse(to, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_TRANSLATED_TEXT_ITEM)); } @@ -738,7 +742,7 @@ public Mono> translate(List to, List> translate(List to, List> transliterate( - String language, String fromScript, String toScript, List content, String clientTraceId) { + String language, + String fromScript, + String toScript, + List requestBody, + String clientTraceId) { // Generated convenience method for transliterateWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { requestOptions.setHeader("X-ClientTraceId", clientTraceId); } - return transliterateWithResponse(language, fromScript, toScript, BinaryData.fromObject(content), requestOptions) + return transliterateWithResponse( + language, fromScript, toScript, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_TRANSLITERATED_TEXT)); } @@ -771,7 +780,7 @@ public Mono> transliterate( * transliteration scope, to find input scripts available for the selected language. * @param toScript Specifies the output script. Look up supported languages using the transliteration scope, to find * output scripts available for the selected combination of input language and input script. - * @param content Array of the text to be transliterated. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -783,10 +792,11 @@ public Mono> transliterate( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> transliterate( - String language, String fromScript, String toScript, List content) { + String language, String fromScript, String toScript, List requestBody) { // Generated convenience method for transliterateWithResponse RequestOptions requestOptions = new RequestOptions(); - return transliterateWithResponse(language, fromScript, toScript, BinaryData.fromObject(content), requestOptions) + return transliterateWithResponse( + language, fromScript, toScript, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_TRANSLITERATED_TEXT)); } @@ -794,7 +804,7 @@ public Mono> transliterate( /** * Find Sentence Boundaries. * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @param language Language tag identifying the language of the input text. If a code isn't specified, automatic * language detection will be applied. @@ -811,7 +821,7 @@ public Mono> transliterate( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> findSentenceBoundaries( - List content, String clientTraceId, String language, String script) { + List requestBody, String clientTraceId, String language, String script) { // Generated convenience method for findSentenceBoundariesWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { @@ -823,7 +833,7 @@ public Mono> findSentenceBoundaries( if (script != null) { requestOptions.addQueryParam("script", script, false); } - return findSentenceBoundariesWithResponse(BinaryData.fromObject(content), requestOptions) + return findSentenceBoundariesWithResponse(BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BREAK_SENTENCE_ITEM)); } @@ -831,7 +841,7 @@ public Mono> findSentenceBoundaries( /** * Find Sentence Boundaries. * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -842,10 +852,10 @@ public Mono> findSentenceBoundaries( */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> findSentenceBoundaries(List content) { + public Mono> findSentenceBoundaries(List requestBody) { // Generated convenience method for findSentenceBoundariesWithResponse RequestOptions requestOptions = new RequestOptions(); - return findSentenceBoundariesWithResponse(BinaryData.fromObject(content), requestOptions) + return findSentenceBoundariesWithResponse(BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BREAK_SENTENCE_ITEM)); } @@ -857,7 +867,7 @@ public Mono> findSentenceBoundaries(List * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -870,13 +880,13 @@ public Mono> findSentenceBoundaries(List @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryEntries( - String from, String to, List content, String clientTraceId) { + String from, String to, List requestBody, String clientTraceId) { // Generated convenience method for lookupDictionaryEntriesWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { requestOptions.setHeader("X-ClientTraceId", clientTraceId); } - return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DICTIONARY_LOOKUP_ITEM)); } @@ -888,7 +898,7 @@ public Mono> lookupDictionaryEntries( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -900,10 +910,10 @@ public Mono> lookupDictionaryEntries( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryEntries( - String from, String to, List content) { + String from, String to, List requestBody) { // Generated convenience method for lookupDictionaryEntriesWithResponse RequestOptions requestOptions = new RequestOptions(); - return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DICTIONARY_LOOKUP_ITEM)); } @@ -915,7 +925,7 @@ public Mono> lookupDictionaryEntries( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -928,13 +938,13 @@ public Mono> lookupDictionaryEntries( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryExamples( - String from, String to, List content, String clientTraceId) { + String from, String to, List requestBody, String clientTraceId) { // Generated convenience method for lookupDictionaryExamplesWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { requestOptions.setHeader("X-ClientTraceId", clientTraceId); } - return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DICTIONARY_EXAMPLE_ITEM)); } @@ -946,7 +956,7 @@ public Mono> lookupDictionaryExamples( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -958,26 +968,31 @@ public Mono> lookupDictionaryExamples( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryExamples( - String from, String to, List content) { + String from, String to, List requestBody) { // Generated convenience method for lookupDictionaryExamplesWithResponse RequestOptions requestOptions = new RequestOptions(); - return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DICTIONARY_EXAMPLE_ITEM)); } + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_TRANSLITERATED_TEXT = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_BREAK_SENTENCE_ITEM = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_DICTIONARY_LOOKUP_ITEM = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_DICTIONARY_EXAMPLE_ITEM = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_TRANSLATED_TEXT_ITEM = new TypeReference>() {}; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClient.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClient.java index f6f784b81f14..903052c18a79 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClient.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClient.java @@ -159,7 +159,7 @@ public Response getLanguagesWithResponse(RequestOptions requestOptio * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. * Note: the dynamic dictionary feature is case-sensitive. * textTypeStringNoDefines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "plain", "html". + * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". * categoryStringNoA string specifying the category (domain) of the translation. This parameter is used to get translations * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator * project details to this parameter to use your deployed customized system. Default value is: general. @@ -249,7 +249,7 @@ public Response getLanguagesWithResponse(RequestOptions requestOptio * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -260,8 +260,8 @@ public Response getLanguagesWithResponse(RequestOptions requestOptio @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response translateWithResponse( - List to, BinaryData content, RequestOptions requestOptions) { - return this.client.translateWithResponse(to, content, requestOptions).block(); + List to, BinaryData requestBody, RequestOptions requestOptions) { + return this.client.translateWithResponse(to, requestBody, requestOptions).block(); } /** @@ -304,7 +304,7 @@ public Response translateWithResponse( * transliteration scope, to find input scripts available for the selected language. * @param toScript Specifies the output script. Look up supported languages using the transliteration scope, to find * output scripts available for the selected combination of input language and input script. - * @param content Array of the text to be transliterated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -315,8 +315,14 @@ public Response translateWithResponse( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response transliterateWithResponse( - String language, String fromScript, String toScript, BinaryData content, RequestOptions requestOptions) { - return this.client.transliterateWithResponse(language, fromScript, toScript, content, requestOptions).block(); + String language, + String fromScript, + String toScript, + BinaryData requestBody, + RequestOptions requestOptions) { + return this.client + .transliterateWithResponse(language, fromScript, toScript, requestBody, requestOptions) + .block(); } /** @@ -371,7 +377,7 @@ public Response transliterateWithResponse( * ] * } * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -381,8 +387,9 @@ public Response transliterateWithResponse( */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response findSentenceBoundariesWithResponse(BinaryData content, RequestOptions requestOptions) { - return this.client.findSentenceBoundariesWithResponse(content, requestOptions).block(); + public Response findSentenceBoundariesWithResponse( + BinaryData requestBody, RequestOptions requestOptions) { + return this.client.findSentenceBoundariesWithResponse(requestBody, requestOptions).block(); } /** @@ -440,7 +447,7 @@ public Response findSentenceBoundariesWithResponse(BinaryData conten * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -451,8 +458,8 @@ public Response findSentenceBoundariesWithResponse(BinaryData conten @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response lookupDictionaryEntriesWithResponse( - String from, String to, BinaryData content, RequestOptions requestOptions) { - return this.client.lookupDictionaryEntriesWithResponse(from, to, content, requestOptions).block(); + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { + return this.client.lookupDictionaryEntriesWithResponse(from, to, requestBody, requestOptions).block(); } /** @@ -504,7 +511,7 @@ public Response lookupDictionaryEntriesWithResponse( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -515,8 +522,8 @@ public Response lookupDictionaryEntriesWithResponse( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Response lookupDictionaryExamplesWithResponse( - String from, String to, BinaryData content, RequestOptions requestOptions) { - return this.client.lookupDictionaryExamplesWithResponse(from, to, content, requestOptions).block(); + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { + return this.client.lookupDictionaryExamplesWithResponse(from, to, requestBody, requestOptions).block(); } /** @@ -590,7 +597,7 @@ public GetLanguagesResult getLanguages() { * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @param from Specifies the language of the input text. Find which languages are available to translate from by * looking up supported languages using the translation scope. If the from parameter isn't specified, automatic @@ -636,7 +643,7 @@ public GetLanguagesResult getLanguages() { @ServiceMethod(returns = ReturnType.SINGLE) public List translate( List to, - List content, + List requestBody, String clientTraceId, String from, TextType textType, @@ -687,7 +694,7 @@ public List translate( if (allowFallback != null) { requestOptions.addQueryParam("allowFallback", String.valueOf(allowFallback), false); } - return translateWithResponse(to, BinaryData.fromObject(content), requestOptions) + return translateWithResponse(to, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_TRANSLATED_TEXT_ITEM); } @@ -699,7 +706,7 @@ public List translate( * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -710,10 +717,10 @@ public List translate( */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public List translate(List to, List content) { + public List translate(List to, List requestBody) { // Generated convenience method for translateWithResponse RequestOptions requestOptions = new RequestOptions(); - return translateWithResponse(to, BinaryData.fromObject(content), requestOptions) + return translateWithResponse(to, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_TRANSLATED_TEXT_ITEM); } @@ -727,7 +734,7 @@ public List translate(List to, List c * transliteration scope, to find input scripts available for the selected language. * @param toScript Specifies the output script. Look up supported languages using the transliteration scope, to find * output scripts available for the selected combination of input language and input script. - * @param content Array of the text to be transliterated. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -740,13 +747,18 @@ public List translate(List to, List c @Generated @ServiceMethod(returns = ReturnType.SINGLE) public List transliterate( - String language, String fromScript, String toScript, List content, String clientTraceId) { + String language, + String fromScript, + String toScript, + List requestBody, + String clientTraceId) { // Generated convenience method for transliterateWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { requestOptions.setHeader("X-ClientTraceId", clientTraceId); } - return transliterateWithResponse(language, fromScript, toScript, BinaryData.fromObject(content), requestOptions) + return transliterateWithResponse( + language, fromScript, toScript, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_TRANSLITERATED_TEXT); } @@ -760,7 +772,7 @@ public List transliterate( * transliteration scope, to find input scripts available for the selected language. * @param toScript Specifies the output script. Look up supported languages using the transliteration scope, to find * output scripts available for the selected combination of input language and input script. - * @param content Array of the text to be transliterated. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -772,10 +784,11 @@ public List transliterate( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public List transliterate( - String language, String fromScript, String toScript, List content) { + String language, String fromScript, String toScript, List requestBody) { // Generated convenience method for transliterateWithResponse RequestOptions requestOptions = new RequestOptions(); - return transliterateWithResponse(language, fromScript, toScript, BinaryData.fromObject(content), requestOptions) + return transliterateWithResponse( + language, fromScript, toScript, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_TRANSLITERATED_TEXT); } @@ -783,7 +796,7 @@ public List transliterate( /** * Find Sentence Boundaries. * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @param language Language tag identifying the language of the input text. If a code isn't specified, automatic * language detection will be applied. @@ -800,7 +813,7 @@ public List transliterate( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public List findSentenceBoundaries( - List content, String clientTraceId, String language, String script) { + List requestBody, String clientTraceId, String language, String script) { // Generated convenience method for findSentenceBoundariesWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { @@ -812,7 +825,7 @@ public List findSentenceBoundaries( if (script != null) { requestOptions.addQueryParam("script", script, false); } - return findSentenceBoundariesWithResponse(BinaryData.fromObject(content), requestOptions) + return findSentenceBoundariesWithResponse(BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_BREAK_SENTENCE_ITEM); } @@ -820,7 +833,7 @@ public List findSentenceBoundaries( /** * Find Sentence Boundaries. * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -831,10 +844,10 @@ public List findSentenceBoundaries( */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public List findSentenceBoundaries(List content) { + public List findSentenceBoundaries(List requestBody) { // Generated convenience method for findSentenceBoundariesWithResponse RequestOptions requestOptions = new RequestOptions(); - return findSentenceBoundariesWithResponse(BinaryData.fromObject(content), requestOptions) + return findSentenceBoundariesWithResponse(BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_BREAK_SENTENCE_ITEM); } @@ -846,7 +859,7 @@ public List findSentenceBoundaries(List conten * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -859,13 +872,13 @@ public List findSentenceBoundaries(List conten @Generated @ServiceMethod(returns = ReturnType.SINGLE) public List lookupDictionaryEntries( - String from, String to, List content, String clientTraceId) { + String from, String to, List requestBody, String clientTraceId) { // Generated convenience method for lookupDictionaryEntriesWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { requestOptions.setHeader("X-ClientTraceId", clientTraceId); } - return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_DICTIONARY_LOOKUP_ITEM); } @@ -877,7 +890,7 @@ public List lookupDictionaryEntries( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -888,10 +901,10 @@ public List lookupDictionaryEntries( */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public List lookupDictionaryEntries(String from, String to, List content) { + public List lookupDictionaryEntries(String from, String to, List requestBody) { // Generated convenience method for lookupDictionaryEntriesWithResponse RequestOptions requestOptions = new RequestOptions(); - return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryEntriesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_DICTIONARY_LOOKUP_ITEM); } @@ -903,7 +916,7 @@ public List lookupDictionaryEntries(String from, String to * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param clientTraceId A client-generated GUID to uniquely identify the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -916,13 +929,13 @@ public List lookupDictionaryEntries(String from, String to @Generated @ServiceMethod(returns = ReturnType.SINGLE) public List lookupDictionaryExamples( - String from, String to, List content, String clientTraceId) { + String from, String to, List requestBody, String clientTraceId) { // Generated convenience method for lookupDictionaryExamplesWithResponse RequestOptions requestOptions = new RequestOptions(); if (clientTraceId != null) { requestOptions.setHeader("X-ClientTraceId", clientTraceId); } - return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_DICTIONARY_EXAMPLE_ITEM); } @@ -934,7 +947,7 @@ public List lookupDictionaryExamples( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -946,26 +959,31 @@ public List lookupDictionaryExamples( @Generated @ServiceMethod(returns = ReturnType.SINGLE) public List lookupDictionaryExamples( - String from, String to, List content) { + String from, String to, List requestBody) { // Generated convenience method for lookupDictionaryExamplesWithResponse RequestOptions requestOptions = new RequestOptions(); - return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(content), requestOptions) + return lookupDictionaryExamplesWithResponse(from, to, BinaryData.fromObject(requestBody), requestOptions) .getValue() .toObject(TYPE_REFERENCE_LIST_DICTIONARY_EXAMPLE_ITEM); } + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_TRANSLITERATED_TEXT = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_BREAK_SENTENCE_ITEM = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_DICTIONARY_LOOKUP_ITEM = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_DICTIONARY_EXAMPLE_ITEM = new TypeReference>() {}; + @Generated private static final TypeReference> TYPE_REFERENCE_LIST_TRANSLATED_TEXT_ITEM = new TypeReference>() {}; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClientBuilder.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClientBuilder.java index a3bdd34c17b1..58ea9c223a1c 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClientBuilder.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationClientBuilder.java @@ -7,13 +7,9 @@ import com.azure.ai.translation.text.implementation.TextTranslationClientImpl; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.AzureKeyCredentialTrait; import com.azure.core.client.traits.ConfigurationTrait; import com.azure.core.client.traits.EndpointTrait; import com.azure.core.client.traits.HttpTrait; -import com.azure.core.client.traits.TokenCredentialTrait; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; @@ -22,8 +18,6 @@ import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.http.policy.AddHeadersPolicy; -import com.azure.core.http.policy.AzureKeyCredentialPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; @@ -37,9 +31,8 @@ import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.serializer.JacksonAdapter; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -50,20 +43,11 @@ public final class TextTranslationClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait, - AzureKeyCredentialTrait, - TokenCredentialTrait { + EndpointTrait { @Generated private static final String SDK_NAME = "name"; @Generated private static final String SDK_VERSION = "version"; - private static final String DEFAULT_SCOPE = "https://cognitiveservices.azure.com/.default"; - private static final String OCP_APIM_SUBSCRIPTION_KEY = "Ocp-Apim-Subscription-Key"; - - private String region; - private AzureKeyCredential credential; - private TokenCredential tokenCredential; - @Generated private static final Map PROPERTIES = CoreUtils.getProperties("azure-ai-translation-text.properties"); @@ -85,6 +69,9 @@ public TextTranslationClientBuilder() { @Generated @Override public TextTranslationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured."); + } this.pipeline = pipeline; return this; } @@ -168,14 +155,11 @@ public TextTranslationClientBuilder configuration(Configuration configuration) { */ @Generated private String endpoint; - private Boolean isCustomEndpoint = false; - /** {@inheritDoc}. */ @Generated @Override public TextTranslationClientBuilder endpoint(String endpoint) { this.endpoint = endpoint; - this.isCustomEndpoint = CustomEndpointUtils.isPlatformHost(endpoint); return this; } @@ -213,47 +197,6 @@ public TextTranslationClientBuilder retryPolicy(RetryPolicy retryPolicy) { return this; } - /** - * Sets the {@link AzureKeyCredential} used to authorize requests sent to the service. - * - * @param credential {@link AzureKeyCredential} used to authorize requests sent to the service. - * @return The updated {@link TextTranslationClientBuilder} object. - * @throws NullPointerException If {@code credential} is null. - */ - public TextTranslationClientBuilder credential(AzureKeyCredential credential) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - this.credential = credential; - return this; - } - - /** - * Sets the region used to authorize requests sent to the service. - * - * @param region where the Translator resource is created. - * @return The updated {@link TextTranslationClientBuilder} object. - * @throws NullPointerException If {@code tokenCredential} is null. - */ - public TextTranslationClientBuilder region(String region) { - Objects.requireNonNull(region, "'region' cannot be null."); - this.region = region; - return this; - } - - /** - * Sets the {@link TokenCredential} used to authorize requests sent to the service. Refer to the Azure SDK for Java - * identity and authentication - * documentation for more details on proper usage of the {@link TokenCredential} type. - * - * @param tokenCredential {@link TokenCredential} used to authorize requests sent to the service. - * @return The updated {@link TextTranslationClientBuilder} object. - * @throws NullPointerException If {@code tokenCredential} is null. - */ - public TextTranslationClientBuilder credential(TokenCredential tokenCredential) { - Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); - this.tokenCredential = tokenCredential; - return this; - } - /** * Builds an instance of TextTranslationClientImpl with the provided parameters. * @@ -264,25 +207,9 @@ private TextTranslationClientImpl buildInnerClient() { HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); TextTranslationServiceVersion localServiceVersion = (serviceVersion != null) ? serviceVersion : TextTranslationServiceVersion.getLatest(); - - String serviceEndpoint; - if (this.endpoint == null) { - serviceEndpoint = "https://api.cognitive.microsofttranslator.com"; - } else if (this.isCustomEndpoint) { - try { - URL hostUri = new URL(endpoint); - URL fullUri = new URL(hostUri, "/translator/text/v" + localServiceVersion.getVersion()); - serviceEndpoint = fullUri.toString(); - } catch (MalformedURLException ex) { - serviceEndpoint = endpoint; - } - } else { - serviceEndpoint = endpoint; - } - TextTranslationClientImpl client = new TextTranslationClientImpl( - localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), serviceEndpoint, localServiceVersion); + localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, localServiceVersion); return client; } @@ -311,19 +238,6 @@ private HttpPipeline createHttpPipeline() { policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); policies.add(new AddDatePolicy()); policies.add(new CookiePolicy()); - - if (tokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE)); - } - - if (this.credential != null) { - policies.add(new AzureKeyCredentialPolicy(OCP_APIM_SUBSCRIPTION_KEY, credential)); - - if (this.region != null) { - policies.add(new TranslatorRegionAuthenticationPolicy(this.region)); - } - } - this.pipelinePolicies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .forEach(p -> policies.add(p)); @@ -357,4 +271,6 @@ public TextTranslationAsyncClient buildAsyncClient() { public TextTranslationClient buildClient() { return new TextTranslationClient(new TextTranslationAsyncClient(buildInnerClient())); } + + private static final ClientLogger LOGGER = new ClientLogger(TextTranslationClientBuilder.class); } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/implementation/TextTranslationClientImpl.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/implementation/TextTranslationClientImpl.java index a9c05dbff243..015fa897c8b1 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/implementation/TextTranslationClientImpl.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/implementation/TextTranslationClientImpl.java @@ -191,7 +191,7 @@ Mono> translate( @QueryParam(value = "to", multipleQueryParams = true) List to, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData content, + @BodyParam("application/json") BinaryData requestBody, RequestOptions requestOptions, Context context); @@ -214,7 +214,7 @@ Mono> transliterate( @QueryParam("toScript") String toScript, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData content, + @BodyParam("application/json") BinaryData requestBody, RequestOptions requestOptions, Context context); @@ -234,7 +234,7 @@ Mono> findSentenceBoundaries( @HostParam("Endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData content, + @BodyParam("application/json") BinaryData requestBody, RequestOptions requestOptions, Context context); @@ -256,7 +256,7 @@ Mono> lookupDictionaryEntries( @QueryParam("to") String to, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData content, + @BodyParam("application/json") BinaryData requestBody, RequestOptions requestOptions, Context context); @@ -278,7 +278,7 @@ Mono> lookupDictionaryExamples( @QueryParam("to") String to, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData content, + @BodyParam("application/json") BinaryData requestBody, RequestOptions requestOptions, Context context); } @@ -504,7 +504,7 @@ public Response getLanguagesWithResponse(RequestOptions requestOptio * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. * Note: the dynamic dictionary feature is case-sensitive. * textTypeStringNoDefines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "plain", "html". + * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". * categoryStringNoA string specifying the category (domain) of the translation. This parameter is used to get translations * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator * project details to this parameter to use your deployed customized system. Default value is: general. @@ -594,7 +594,7 @@ public Response getLanguagesWithResponse(RequestOptions requestOptio * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -604,7 +604,7 @@ public Response getLanguagesWithResponse(RequestOptions requestOptio */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> translateWithResponseAsync( - List to, BinaryData content, RequestOptions requestOptions) { + List to, BinaryData requestBody, RequestOptions requestOptions) { final String accept = "application/json"; List toConverted = to.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); return FluxUtil.withContext( @@ -614,7 +614,7 @@ public Mono> translateWithResponseAsync( toConverted, this.getServiceVersion().getVersion(), accept, - content, + requestBody, requestOptions, context)); } @@ -634,7 +634,7 @@ public Mono> translateWithResponseAsync( * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. * Note: the dynamic dictionary feature is case-sensitive. * textTypeStringNoDefines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "plain", "html". + * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". * categoryStringNoA string specifying the category (domain) of the translation. This parameter is used to get translations * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator * project details to this parameter to use your deployed customized system. Default value is: general. @@ -724,7 +724,7 @@ public Mono> translateWithResponseAsync( * included in the translation scope. For example, use to=de to translate to German. It's possible to translate * to multiple languages simultaneously by repeating the parameter in the query string. For example, use * to=de&to=it to translate to German and Italian. - * @param content Array of the text to be translated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -734,8 +734,8 @@ public Mono> translateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Response translateWithResponse( - List to, BinaryData content, RequestOptions requestOptions) { - return translateWithResponseAsync(to, content, requestOptions).block(); + List to, BinaryData requestBody, RequestOptions requestOptions) { + return translateWithResponseAsync(to, requestBody, requestOptions).block(); } /** @@ -778,7 +778,7 @@ public Response translateWithResponse( * transliteration scope, to find input scripts available for the selected language. * @param toScript Specifies the output script. Look up supported languages using the transliteration scope, to find * output scripts available for the selected combination of input language and input script. - * @param content Array of the text to be transliterated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -788,7 +788,11 @@ public Response translateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> transliterateWithResponseAsync( - String language, String fromScript, String toScript, BinaryData content, RequestOptions requestOptions) { + String language, + String fromScript, + String toScript, + BinaryData requestBody, + RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> @@ -799,7 +803,7 @@ public Mono> transliterateWithResponseAsync( toScript, this.getServiceVersion().getVersion(), accept, - content, + requestBody, requestOptions, context)); } @@ -844,7 +848,7 @@ public Mono> transliterateWithResponseAsync( * transliteration scope, to find input scripts available for the selected language. * @param toScript Specifies the output script. Look up supported languages using the transliteration scope, to find * output scripts available for the selected combination of input language and input script. - * @param content Array of the text to be transliterated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -854,8 +858,12 @@ public Mono> transliterateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Response transliterateWithResponse( - String language, String fromScript, String toScript, BinaryData content, RequestOptions requestOptions) { - return transliterateWithResponseAsync(language, fromScript, toScript, content, requestOptions).block(); + String language, + String fromScript, + String toScript, + BinaryData requestBody, + RequestOptions requestOptions) { + return transliterateWithResponseAsync(language, fromScript, toScript, requestBody, requestOptions).block(); } /** @@ -910,7 +918,7 @@ public Response transliterateWithResponse( * ] * } * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -920,7 +928,7 @@ public Response transliterateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> findSentenceBoundariesWithResponseAsync( - BinaryData content, RequestOptions requestOptions) { + BinaryData requestBody, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> @@ -928,7 +936,7 @@ public Mono> findSentenceBoundariesWithResponseAsync( this.getEndpoint(), this.getServiceVersion().getVersion(), accept, - content, + requestBody, requestOptions, context)); } @@ -985,7 +993,7 @@ public Mono> findSentenceBoundariesWithResponseAsync( * ] * } * - * @param content Array of the text for which values the sentence boundaries will be calculated. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -994,8 +1002,9 @@ public Mono> findSentenceBoundariesWithResponseAsync( * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response findSentenceBoundariesWithResponse(BinaryData content, RequestOptions requestOptions) { - return findSentenceBoundariesWithResponseAsync(content, requestOptions).block(); + public Response findSentenceBoundariesWithResponse( + BinaryData requestBody, RequestOptions requestOptions) { + return findSentenceBoundariesWithResponseAsync(requestBody, requestOptions).block(); } /** @@ -1053,7 +1062,7 @@ public Response findSentenceBoundariesWithResponse(BinaryData conten * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -1063,7 +1072,7 @@ public Response findSentenceBoundariesWithResponse(BinaryData conten */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryEntriesWithResponseAsync( - String from, String to, BinaryData content, RequestOptions requestOptions) { + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> @@ -1073,7 +1082,7 @@ public Mono> lookupDictionaryEntriesWithResponseAsync( to, this.getServiceVersion().getVersion(), accept, - content, + requestBody, requestOptions, context)); } @@ -1133,7 +1142,7 @@ public Mono> lookupDictionaryEntriesWithResponseAsync( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -1143,8 +1152,8 @@ public Mono> lookupDictionaryEntriesWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Response lookupDictionaryEntriesWithResponse( - String from, String to, BinaryData content, RequestOptions requestOptions) { - return lookupDictionaryEntriesWithResponseAsync(from, to, content, requestOptions).block(); + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { + return lookupDictionaryEntriesWithResponseAsync(from, to, requestBody, requestOptions).block(); } /** @@ -1196,7 +1205,7 @@ public Response lookupDictionaryEntriesWithResponse( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -1206,7 +1215,7 @@ public Response lookupDictionaryEntriesWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> lookupDictionaryExamplesWithResponseAsync( - String from, String to, BinaryData content, RequestOptions requestOptions) { + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> @@ -1216,7 +1225,7 @@ public Mono> lookupDictionaryExamplesWithResponseAsync( to, this.getServiceVersion().getVersion(), accept, - content, + requestBody, requestOptions, context)); } @@ -1270,7 +1279,7 @@ public Mono> lookupDictionaryExamplesWithResponseAsync( * included in the dictionary scope. * @param to Specifies the language of the output text. The target language must be one of the supported languages * included in the dictionary scope. - * @param content Array of the text to be sent to dictionary. + * @param requestBody Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -1280,7 +1289,7 @@ public Mono> lookupDictionaryExamplesWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Response lookupDictionaryExamplesWithResponse( - String from, String to, BinaryData content, RequestOptions requestOptions) { - return lookupDictionaryExamplesWithResponseAsync(from, to, content, requestOptions).block(); + String from, String to, BinaryData requestBody, RequestOptions requestOptions) { + return lookupDictionaryExamplesWithResponseAsync(from, to, requestBody, requestOptions).block(); } } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BackTranslation.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BackTranslation.java index 6cc0c8465cac..0dc0a5487cea 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BackTranslation.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BackTranslation.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -15,14 +16,16 @@ public final class BackTranslation { * A string giving the normalized form of the source term that is a back-translation of the target. * This value should be used as input to lookup examples. */ - @JsonProperty(value = "normalizedText", required = true) + @Generated + @JsonProperty(value = "normalizedText") private String normalizedText; /* * A string giving the source term that is a back-translation of the target in a form best * suited for end-user display. */ - @JsonProperty(value = "displayText", required = true) + @Generated + @JsonProperty(value = "displayText") private String displayText; /* @@ -34,7 +37,8 @@ public final class BackTranslation { * by a call to lookup examples may be less than numExamples, because additional filtering may be * applied on the fly to remove "bad" examples. */ - @JsonProperty(value = "numExamples", required = true) + @Generated + @JsonProperty(value = "numExamples") private int numExamples; /* @@ -42,7 +46,8 @@ public final class BackTranslation { * field is to provide a user interface with a means to sort back-translations so the most frequent terms are * first. */ - @JsonProperty(value = "frequencyCount", required = true) + @Generated + @JsonProperty(value = "frequencyCount") private int frequencyCount; /** @@ -53,12 +58,13 @@ public final class BackTranslation { * @param numExamples the numExamples value to set. * @param frequencyCount the frequencyCount value to set. */ + @Generated @JsonCreator private BackTranslation( - @JsonProperty(value = "normalizedText", required = true) String normalizedText, - @JsonProperty(value = "displayText", required = true) String displayText, - @JsonProperty(value = "numExamples", required = true) int numExamples, - @JsonProperty(value = "frequencyCount", required = true) int frequencyCount) { + @JsonProperty(value = "normalizedText") String normalizedText, + @JsonProperty(value = "displayText") String displayText, + @JsonProperty(value = "numExamples") int numExamples, + @JsonProperty(value = "frequencyCount") int frequencyCount) { this.normalizedText = normalizedText; this.displayText = displayText; this.numExamples = numExamples; @@ -71,6 +77,7 @@ private BackTranslation( * * @return the normalizedText value. */ + @Generated public String getNormalizedText() { return this.normalizedText; } @@ -81,6 +88,7 @@ public String getNormalizedText() { * * @return the displayText value. */ + @Generated public String getDisplayText() { return this.displayText; } @@ -95,6 +103,7 @@ public String getDisplayText() { * * @return the numExamples value. */ + @Generated public int getNumExamples() { return this.numExamples; } @@ -106,6 +115,7 @@ public int getNumExamples() { * * @return the frequencyCount value. */ + @Generated public int getFrequencyCount() { return this.frequencyCount; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BreakSentenceItem.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BreakSentenceItem.java index 202bcc0791fb..93326bf4d4c8 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BreakSentenceItem.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/BreakSentenceItem.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -15,6 +16,7 @@ public final class BreakSentenceItem { /* * The detectedLanguage property is only present in the result object when language auto-detection is requested. */ + @Generated @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; @@ -22,7 +24,8 @@ public final class BreakSentenceItem { * An integer array representing the lengths of the sentences in the input text. * The length of the array is the number of sentences, and the values are the length of each sentence. */ - @JsonProperty(value = "sentLen", required = true) + @Generated + @JsonProperty(value = "sentLen") private List sentLen; /** @@ -30,8 +33,9 @@ public final class BreakSentenceItem { * * @param sentLen the sentLen value to set. */ + @Generated @JsonCreator - private BreakSentenceItem(@JsonProperty(value = "sentLen", required = true) List sentLen) { + private BreakSentenceItem(@JsonProperty(value = "sentLen") List sentLen) { this.sentLen = sentLen; } @@ -41,6 +45,7 @@ private BreakSentenceItem(@JsonProperty(value = "sentLen", required = true) List * * @return the detectedLanguage value. */ + @Generated public DetectedLanguage getDetectedLanguage() { return this.detectedLanguage; } @@ -51,6 +56,7 @@ public DetectedLanguage getDetectedLanguage() { * * @return the sentLen value. */ + @Generated public List getSentLen() { return this.sentLen; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/CommonScriptModel.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/CommonScriptModel.java index 862b7d3dad7f..79f28718009f 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/CommonScriptModel.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/CommonScriptModel.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,25 +15,29 @@ public class CommonScriptModel { /* * Code identifying the script. */ - @JsonProperty(value = "code", required = true) + @Generated + @JsonProperty(value = "code") private String code; /* * Display name of the script in the locale requested via Accept-Language header. */ - @JsonProperty(value = "name", required = true) + @Generated + @JsonProperty(value = "name") private String name; /* * Display name of the language in the locale native for the language. */ - @JsonProperty(value = "nativeName", required = true) + @Generated + @JsonProperty(value = "nativeName") private String nativeName; /* * Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ - @JsonProperty(value = "dir", required = true) + @Generated + @JsonProperty(value = "dir") private String dir; /** @@ -43,12 +48,13 @@ public class CommonScriptModel { * @param nativeName the nativeName value to set. * @param dir the dir value to set. */ + @Generated @JsonCreator protected CommonScriptModel( - @JsonProperty(value = "code", required = true) String code, - @JsonProperty(value = "name", required = true) String name, - @JsonProperty(value = "nativeName", required = true) String nativeName, - @JsonProperty(value = "dir", required = true) String dir) { + @JsonProperty(value = "code") String code, + @JsonProperty(value = "name") String name, + @JsonProperty(value = "nativeName") String nativeName, + @JsonProperty(value = "dir") String dir) { this.code = code; this.name = name; this.nativeName = nativeName; @@ -60,6 +66,7 @@ protected CommonScriptModel( * * @return the code value. */ + @Generated public String getCode() { return this.code; } @@ -69,6 +76,7 @@ public String getCode() { * * @return the name value. */ + @Generated public String getName() { return this.name; } @@ -78,6 +86,7 @@ public String getName() { * * @return the nativeName value. */ + @Generated public String getNativeName() { return this.nativeName; } @@ -88,6 +97,7 @@ public String getNativeName() { * * @return the dir value. */ + @Generated public String getDir() { return this.dir; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DetectedLanguage.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DetectedLanguage.java index eba1c2177297..3e6c2c7a0379 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DetectedLanguage.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DetectedLanguage.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,14 +15,16 @@ public final class DetectedLanguage { /* * A string representing the code of the detected language. */ - @JsonProperty(value = "language", required = true) + @Generated + @JsonProperty(value = "language") private String language; /* * A float value indicating the confidence in the result. * The score is between zero and one and a low score indicates a low confidence. */ - @JsonProperty(value = "score", required = true) + @Generated + @JsonProperty(value = "score") private double score; /** @@ -30,10 +33,10 @@ public final class DetectedLanguage { * @param language the language value to set. * @param score the score value to set. */ + @Generated @JsonCreator private DetectedLanguage( - @JsonProperty(value = "language", required = true) String language, - @JsonProperty(value = "score", required = true) double score) { + @JsonProperty(value = "language") String language, @JsonProperty(value = "score") double score) { this.language = language; this.score = score; } @@ -43,6 +46,7 @@ private DetectedLanguage( * * @return the language value. */ + @Generated public String getLanguage() { return this.language; } @@ -53,6 +57,7 @@ public String getLanguage() { * * @return the score value. */ + @Generated public double getScore() { return this.score; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExample.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExample.java index d42515294340..397cf91e0160 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExample.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExample.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,7 +17,8 @@ public final class DictionaryExample { * Do not add a space character, since it is already there when it should be. * This value may be an empty string. */ - @JsonProperty(value = "sourcePrefix", required = true) + @Generated + @JsonProperty(value = "sourcePrefix") private String sourcePrefix; /* @@ -24,7 +26,8 @@ public final class DictionaryExample { * and sourceSuffix to form the complete example. Its value is separated so it can be * marked in a user interface, e.g., by bolding it. */ - @JsonProperty(value = "sourceTerm", required = true) + @Generated + @JsonProperty(value = "sourceTerm") private String sourceTerm; /* @@ -32,25 +35,29 @@ public final class DictionaryExample { * Do not add a space character, since it is already there when it should be. * This value may be an empty string. */ - @JsonProperty(value = "sourceSuffix", required = true) + @Generated + @JsonProperty(value = "sourceSuffix") private String sourceSuffix; /* * A string similar to sourcePrefix but for the target. */ - @JsonProperty(value = "targetPrefix", required = true) + @Generated + @JsonProperty(value = "targetPrefix") private String targetPrefix; /* * A string similar to sourceTerm but for the target. */ - @JsonProperty(value = "targetTerm", required = true) + @Generated + @JsonProperty(value = "targetTerm") private String targetTerm; /* * A string similar to sourceSuffix but for the target. */ - @JsonProperty(value = "targetSuffix", required = true) + @Generated + @JsonProperty(value = "targetSuffix") private String targetSuffix; /** @@ -63,14 +70,15 @@ public final class DictionaryExample { * @param targetTerm the targetTerm value to set. * @param targetSuffix the targetSuffix value to set. */ + @Generated @JsonCreator private DictionaryExample( - @JsonProperty(value = "sourcePrefix", required = true) String sourcePrefix, - @JsonProperty(value = "sourceTerm", required = true) String sourceTerm, - @JsonProperty(value = "sourceSuffix", required = true) String sourceSuffix, - @JsonProperty(value = "targetPrefix", required = true) String targetPrefix, - @JsonProperty(value = "targetTerm", required = true) String targetTerm, - @JsonProperty(value = "targetSuffix", required = true) String targetSuffix) { + @JsonProperty(value = "sourcePrefix") String sourcePrefix, + @JsonProperty(value = "sourceTerm") String sourceTerm, + @JsonProperty(value = "sourceSuffix") String sourceSuffix, + @JsonProperty(value = "targetPrefix") String targetPrefix, + @JsonProperty(value = "targetTerm") String targetTerm, + @JsonProperty(value = "targetSuffix") String targetSuffix) { this.sourcePrefix = sourcePrefix; this.sourceTerm = sourceTerm; this.sourceSuffix = sourceSuffix; @@ -86,6 +94,7 @@ private DictionaryExample( * * @return the sourcePrefix value. */ + @Generated public String getSourcePrefix() { return this.sourcePrefix; } @@ -97,6 +106,7 @@ public String getSourcePrefix() { * * @return the sourceTerm value. */ + @Generated public String getSourceTerm() { return this.sourceTerm; } @@ -108,6 +118,7 @@ public String getSourceTerm() { * * @return the sourceSuffix value. */ + @Generated public String getSourceSuffix() { return this.sourceSuffix; } @@ -117,6 +128,7 @@ public String getSourceSuffix() { * * @return the targetPrefix value. */ + @Generated public String getTargetPrefix() { return this.targetPrefix; } @@ -126,6 +138,7 @@ public String getTargetPrefix() { * * @return the targetTerm value. */ + @Generated public String getTargetTerm() { return this.targetTerm; } @@ -135,6 +148,7 @@ public String getTargetTerm() { * * @return the targetSuffix value. */ + @Generated public String getTargetSuffix() { return this.targetSuffix; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleItem.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleItem.java index 1cbadc4b387f..f267a8a85309 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleItem.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleItem.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,20 +17,23 @@ public final class DictionaryExampleItem { * A string giving the normalized form of the source term. Generally, this should be identical * to the value of the Text field at the matching list index in the body of the request. */ - @JsonProperty(value = "normalizedSource", required = true) + @Generated + @JsonProperty(value = "normalizedSource") private String normalizedSource; /* * A string giving the normalized form of the target term. Generally, this should be identical * to the value of the Translation field at the matching list index in the body of the request. */ - @JsonProperty(value = "normalizedTarget", required = true) + @Generated + @JsonProperty(value = "normalizedTarget") private String normalizedTarget; /* * A list of examples for the (source term, target term) pair. */ - @JsonProperty(value = "examples", required = true) + @Generated + @JsonProperty(value = "examples") private List examples; /** @@ -39,11 +43,12 @@ public final class DictionaryExampleItem { * @param normalizedTarget the normalizedTarget value to set. * @param examples the examples value to set. */ + @Generated @JsonCreator private DictionaryExampleItem( - @JsonProperty(value = "normalizedSource", required = true) String normalizedSource, - @JsonProperty(value = "normalizedTarget", required = true) String normalizedTarget, - @JsonProperty(value = "examples", required = true) List examples) { + @JsonProperty(value = "normalizedSource") String normalizedSource, + @JsonProperty(value = "normalizedTarget") String normalizedTarget, + @JsonProperty(value = "examples") List examples) { this.normalizedSource = normalizedSource; this.normalizedTarget = normalizedTarget; this.examples = examples; @@ -55,6 +60,7 @@ private DictionaryExampleItem( * * @return the normalizedSource value. */ + @Generated public String getNormalizedSource() { return this.normalizedSource; } @@ -65,6 +71,7 @@ public String getNormalizedSource() { * * @return the normalizedTarget value. */ + @Generated public String getNormalizedTarget() { return this.normalizedTarget; } @@ -74,6 +81,7 @@ public String getNormalizedTarget() { * * @return the examples value. */ + @Generated public List getExamples() { return this.examples; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleTextItem.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleTextItem.java index e9805789f8ea..56d02aa1bbb2 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleTextItem.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryExampleTextItem.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,7 +17,8 @@ public final class DictionaryExampleTextItem extends InputTextItem { * This should be the value from the normalizedTarget field in the translations list of the Dictionary * lookup response. The service will return examples for the specific source-target word-pair. */ - @JsonProperty(value = "translation", required = true) + @Generated + @JsonProperty(value = "translation") private String translation; /** @@ -25,10 +27,10 @@ public final class DictionaryExampleTextItem extends InputTextItem { * @param text the text value to set. * @param translation the translation value to set. */ + @Generated @JsonCreator public DictionaryExampleTextItem( - @JsonProperty(value = "text", required = true) String text, - @JsonProperty(value = "translation", required = true) String translation) { + @JsonProperty(value = "text") String text, @JsonProperty(value = "translation") String translation) { super(text); this.translation = translation; } @@ -40,6 +42,7 @@ public DictionaryExampleTextItem( * * @return the translation value. */ + @Generated public String getTranslation() { return this.translation; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryLookupItem.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryLookupItem.java index 5df50a947e52..cd91afb08473 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryLookupItem.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryLookupItem.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,7 +18,8 @@ public final class DictionaryLookupItem { * For example, if the request is "JOHN", the normalized form will be "john". * The content of this field becomes the input to lookup examples. */ - @JsonProperty(value = "normalizedSource", required = true) + @Generated + @JsonProperty(value = "normalizedSource") private String normalizedSource; /* @@ -25,13 +27,15 @@ public final class DictionaryLookupItem { * For example, if the input is "JOHN", the display form will reflect the usual * spelling of the name: "John". */ - @JsonProperty(value = "displaySource", required = true) + @Generated + @JsonProperty(value = "displaySource") private String displaySource; /* * A list of translations for the source term. */ - @JsonProperty(value = "translations", required = true) + @Generated + @JsonProperty(value = "translations") private List translations; /** @@ -41,11 +45,12 @@ public final class DictionaryLookupItem { * @param displaySource the displaySource value to set. * @param translations the translations value to set. */ + @Generated @JsonCreator private DictionaryLookupItem( - @JsonProperty(value = "normalizedSource", required = true) String normalizedSource, - @JsonProperty(value = "displaySource", required = true) String displaySource, - @JsonProperty(value = "translations", required = true) List translations) { + @JsonProperty(value = "normalizedSource") String normalizedSource, + @JsonProperty(value = "displaySource") String displaySource, + @JsonProperty(value = "translations") List translations) { this.normalizedSource = normalizedSource; this.displaySource = displaySource; this.translations = translations; @@ -58,6 +63,7 @@ private DictionaryLookupItem( * * @return the normalizedSource value. */ + @Generated public String getNormalizedSource() { return this.normalizedSource; } @@ -68,6 +74,7 @@ public String getNormalizedSource() { * * @return the displaySource value. */ + @Generated public String getDisplaySource() { return this.displaySource; } @@ -77,6 +84,7 @@ public String getDisplaySource() { * * @return the translations value. */ + @Generated public List getTranslations() { return this.translations; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryTranslation.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryTranslation.java index a24fda817e29..88c5d6c49e24 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryTranslation.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/DictionaryTranslation.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,7 +17,8 @@ public final class DictionaryTranslation { * A string giving the normalized form of this term in the target language. * This value should be used as input to lookup examples. */ - @JsonProperty(value = "normalizedTarget", required = true) + @Generated + @JsonProperty(value = "normalizedTarget") private String normalizedTarget; /* @@ -25,13 +27,15 @@ public final class DictionaryTranslation { * in terms of capitalization. For example, a proper noun like "Juan" will have * normalizedTarget = "juan" and displayTarget = "Juan". */ - @JsonProperty(value = "displayTarget", required = true) + @Generated + @JsonProperty(value = "displayTarget") private String displayTarget; /* * A string associating this term with a part-of-speech tag. */ - @JsonProperty(value = "posTag", required = true) + @Generated + @JsonProperty(value = "posTag") private String posTag; /* @@ -39,7 +43,8 @@ public final class DictionaryTranslation { * (or perhaps more accurately, "probability in the training data") of that translation pair. * The sum of confidence scores for one source word may or may not sum to 1.0. */ - @JsonProperty(value = "confidence", required = true) + @Generated + @JsonProperty(value = "confidence") private double confidence; /* @@ -49,7 +54,8 @@ public final class DictionaryTranslation { * This is only dependent on the translation, and not on the source. * If there is no prefix, it will be the empty string. */ - @JsonProperty(value = "prefixWord", required = true) + @Generated + @JsonProperty(value = "prefixWord") private String prefixWord; /* @@ -58,7 +64,8 @@ public final class DictionaryTranslation { * looked up is "fly", then it is guaranteed that "fly" will be in the backTranslations list). * However, it is not guaranteed to be in the first position, and often will not be. */ - @JsonProperty(value = "backTranslations", required = true) + @Generated + @JsonProperty(value = "backTranslations") private List backTranslations; /** @@ -71,14 +78,15 @@ public final class DictionaryTranslation { * @param prefixWord the prefixWord value to set. * @param backTranslations the backTranslations value to set. */ + @Generated @JsonCreator private DictionaryTranslation( - @JsonProperty(value = "normalizedTarget", required = true) String normalizedTarget, - @JsonProperty(value = "displayTarget", required = true) String displayTarget, - @JsonProperty(value = "posTag", required = true) String posTag, - @JsonProperty(value = "confidence", required = true) double confidence, - @JsonProperty(value = "prefixWord", required = true) String prefixWord, - @JsonProperty(value = "backTranslations", required = true) List backTranslations) { + @JsonProperty(value = "normalizedTarget") String normalizedTarget, + @JsonProperty(value = "displayTarget") String displayTarget, + @JsonProperty(value = "posTag") String posTag, + @JsonProperty(value = "confidence") double confidence, + @JsonProperty(value = "prefixWord") String prefixWord, + @JsonProperty(value = "backTranslations") List backTranslations) { this.normalizedTarget = normalizedTarget; this.displayTarget = displayTarget; this.posTag = posTag; @@ -93,6 +101,7 @@ private DictionaryTranslation( * * @return the normalizedTarget value. */ + @Generated public String getNormalizedTarget() { return this.normalizedTarget; } @@ -104,6 +113,7 @@ public String getNormalizedTarget() { * * @return the displayTarget value. */ + @Generated public String getDisplayTarget() { return this.displayTarget; } @@ -113,6 +123,7 @@ public String getDisplayTarget() { * * @return the posTag value. */ + @Generated public String getPosTag() { return this.posTag; } @@ -124,6 +135,7 @@ public String getPosTag() { * * @return the confidence value. */ + @Generated public double getConfidence() { return this.confidence; } @@ -136,6 +148,7 @@ public double getConfidence() { * * @return the prefixWord value. */ + @Generated public String getPrefixWord() { return this.prefixWord; } @@ -148,6 +161,7 @@ public String getPrefixWord() { * * @return the backTranslations value. */ + @Generated public List getBackTranslations() { return this.backTranslations; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/GetLanguagesResult.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/GetLanguagesResult.java index 0541d62a2e81..32ca27bf56ec 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/GetLanguagesResult.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/GetLanguagesResult.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -14,22 +15,26 @@ public final class GetLanguagesResult { /* * Languages that support translate API. */ + @Generated @JsonProperty(value = "translation") private Map translation; /* * Languages that support transliteration API. */ + @Generated @JsonProperty(value = "transliteration") private Map transliteration; /* * Languages that support dictionary API. */ + @Generated @JsonProperty(value = "dictionary") private Map dictionary; /** Creates an instance of GetLanguagesResult class. */ + @Generated private GetLanguagesResult() {} /** @@ -37,6 +42,7 @@ private GetLanguagesResult() {} * * @return the translation value. */ + @Generated public Map getTranslation() { return this.translation; } @@ -46,6 +52,7 @@ public Map getTranslation() { * * @return the transliteration value. */ + @Generated public Map getTransliteration() { return this.transliteration; } @@ -55,6 +62,7 @@ public Map getTransliteration() { * * @return the dictionary value. */ + @Generated public Map getDictionary() { return this.dictionary; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/InputTextItem.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/InputTextItem.java index 66d3964a7e2f..56b933a29277 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/InputTextItem.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/InputTextItem.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,7 +15,8 @@ public class InputTextItem { /* * Text to translate. */ - @JsonProperty(value = "text", required = true) + @Generated + @JsonProperty(value = "text") private String text; /** @@ -22,8 +24,9 @@ public class InputTextItem { * * @param text the text value to set. */ + @Generated @JsonCreator - public InputTextItem(@JsonProperty(value = "text", required = true) String text) { + public InputTextItem(@JsonProperty(value = "text") String text) { this.text = text; } @@ -32,6 +35,7 @@ public InputTextItem(@JsonProperty(value = "text", required = true) String text) * * @return the text value. */ + @Generated public String getText() { return this.text; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityAction.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityAction.java index 2b55aaa027fc..c9112e051165 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityAction.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityAction.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; @@ -11,19 +12,20 @@ /** Defines values for ProfanityAction. */ public final class ProfanityAction extends ExpandableStringEnum { /** Static value NoAction for ProfanityAction. */ - public static final ProfanityAction NO_ACTION = fromString("NoAction"); + @Generated public static final ProfanityAction NO_ACTION = fromString("NoAction"); /** Static value Marked for ProfanityAction. */ - public static final ProfanityAction MARKED = fromString("Marked"); + @Generated public static final ProfanityAction MARKED = fromString("Marked"); /** Static value Deleted for ProfanityAction. */ - public static final ProfanityAction DELETED = fromString("Deleted"); + @Generated public static final ProfanityAction DELETED = fromString("Deleted"); /** * Creates a new instance of ProfanityAction value. * * @deprecated Use the {@link #fromString(String)} factory method. */ + @Generated @Deprecated public ProfanityAction() {} @@ -33,6 +35,7 @@ public ProfanityAction() {} * @param name a name to look for. * @return the corresponding ProfanityAction. */ + @Generated @JsonCreator public static ProfanityAction fromString(String name) { return fromString(name, ProfanityAction.class); @@ -43,6 +46,7 @@ public static ProfanityAction fromString(String name) { * * @return known ProfanityAction values. */ + @Generated public static Collection values() { return values(ProfanityAction.class); } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityMarker.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityMarker.java index a2a0d0ae5765..219d980e7412 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityMarker.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/ProfanityMarker.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; @@ -11,16 +12,17 @@ /** Defines values for ProfanityMarker. */ public final class ProfanityMarker extends ExpandableStringEnum { /** Static value Asterisk for ProfanityMarker. */ - public static final ProfanityMarker ASTERISK = fromString("Asterisk"); + @Generated public static final ProfanityMarker ASTERISK = fromString("Asterisk"); /** Static value Tag for ProfanityMarker. */ - public static final ProfanityMarker TAG = fromString("Tag"); + @Generated public static final ProfanityMarker TAG = fromString("Tag"); /** * Creates a new instance of ProfanityMarker value. * * @deprecated Use the {@link #fromString(String)} factory method. */ + @Generated @Deprecated public ProfanityMarker() {} @@ -30,6 +32,7 @@ public ProfanityMarker() {} * @param name a name to look for. * @return the corresponding ProfanityMarker. */ + @Generated @JsonCreator public static ProfanityMarker fromString(String name) { return fromString(name, ProfanityMarker.class); @@ -40,6 +43,7 @@ public static ProfanityMarker fromString(String name) { * * @return known ProfanityMarker values. */ + @Generated public static Collection values() { return values(ProfanityMarker.class); } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SentenceLength.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SentenceLength.java index 55f3998b926c..28c3cd35fa62 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SentenceLength.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SentenceLength.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,14 +17,16 @@ public final class SentenceLength { * An integer array representing the lengths of the sentences in the input text. * The length of the array is the number of sentences, and the values are the length of each sentence. */ - @JsonProperty(value = "srcSentLen", required = true) + @Generated + @JsonProperty(value = "srcSentLen") private List srcSentLen; /* * An integer array representing the lengths of the sentences in the translated text. * The length of the array is the number of sentences, and the values are the length of each sentence. */ - @JsonProperty(value = "transSentLen", required = true) + @Generated + @JsonProperty(value = "transSentLen") private List transSentLen; /** @@ -32,10 +35,11 @@ public final class SentenceLength { * @param srcSentLen the srcSentLen value to set. * @param transSentLen the transSentLen value to set. */ + @Generated @JsonCreator private SentenceLength( - @JsonProperty(value = "srcSentLen", required = true) List srcSentLen, - @JsonProperty(value = "transSentLen", required = true) List transSentLen) { + @JsonProperty(value = "srcSentLen") List srcSentLen, + @JsonProperty(value = "transSentLen") List transSentLen) { this.srcSentLen = srcSentLen; this.transSentLen = transSentLen; } @@ -46,6 +50,7 @@ private SentenceLength( * * @return the srcSentLen value. */ + @Generated public List getSrcSentLen() { return this.srcSentLen; } @@ -56,6 +61,7 @@ public List getSrcSentLen() { * * @return the transSentLen value. */ + @Generated public List getTransSentLen() { return this.transSentLen; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceDictionaryLanguage.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceDictionaryLanguage.java index f75b3f9c2417..923cb67a6b48 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceDictionaryLanguage.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceDictionaryLanguage.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -15,25 +16,29 @@ public final class SourceDictionaryLanguage { /* * Display name of the language in the locale requested via Accept-Language header. */ - @JsonProperty(value = "name", required = true) + @Generated + @JsonProperty(value = "name") private String name; /* * Display name of the language in the locale native for this language. */ - @JsonProperty(value = "nativeName", required = true) + @Generated + @JsonProperty(value = "nativeName") private String nativeName; /* * Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ - @JsonProperty(value = "dir", required = true) + @Generated + @JsonProperty(value = "dir") private String dir; /* * List of languages with alterative translations and examples for the query expressed in the source language. */ - @JsonProperty(value = "translations", required = true) + @Generated + @JsonProperty(value = "translations") private List translations; /** @@ -44,12 +49,13 @@ public final class SourceDictionaryLanguage { * @param dir the dir value to set. * @param translations the translations value to set. */ + @Generated @JsonCreator private SourceDictionaryLanguage( - @JsonProperty(value = "name", required = true) String name, - @JsonProperty(value = "nativeName", required = true) String nativeName, - @JsonProperty(value = "dir", required = true) String dir, - @JsonProperty(value = "translations", required = true) List translations) { + @JsonProperty(value = "name") String name, + @JsonProperty(value = "nativeName") String nativeName, + @JsonProperty(value = "dir") String dir, + @JsonProperty(value = "translations") List translations) { this.name = name; this.nativeName = nativeName; this.dir = dir; @@ -61,6 +67,7 @@ private SourceDictionaryLanguage( * * @return the name value. */ + @Generated public String getName() { return this.name; } @@ -70,6 +77,7 @@ public String getName() { * * @return the nativeName value. */ + @Generated public String getNativeName() { return this.nativeName; } @@ -80,6 +88,7 @@ public String getNativeName() { * * @return the dir value. */ + @Generated public String getDir() { return this.dir; } @@ -90,6 +99,7 @@ public String getDir() { * * @return the translations value. */ + @Generated public List getTranslations() { return this.translations; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceText.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceText.java index 80c22e87974d..74d9018b6026 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceText.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/SourceText.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,7 +15,8 @@ public final class SourceText { /* * Input text in the default script of the source language. */ - @JsonProperty(value = "text", required = true) + @Generated + @JsonProperty(value = "text") private String text; /** @@ -22,8 +24,9 @@ public final class SourceText { * * @param text the text value to set. */ + @Generated @JsonCreator - private SourceText(@JsonProperty(value = "text", required = true) String text) { + private SourceText(@JsonProperty(value = "text") String text) { this.text = text; } @@ -32,6 +35,7 @@ private SourceText(@JsonProperty(value = "text", required = true) String text) { * * @return the text value. */ + @Generated public String getText() { return this.text; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TargetDictionaryLanguage.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TargetDictionaryLanguage.java index 5fe26e177480..cdd628ab0466 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TargetDictionaryLanguage.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TargetDictionaryLanguage.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,25 +15,29 @@ public final class TargetDictionaryLanguage { /* * Display name of the language in the locale requested via Accept-Language header. */ - @JsonProperty(value = "name", required = true) + @Generated + @JsonProperty(value = "name") private String name; /* * Display name of the language in the locale native for this language. */ - @JsonProperty(value = "nativeName", required = true) + @Generated + @JsonProperty(value = "nativeName") private String nativeName; /* * Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ - @JsonProperty(value = "dir", required = true) + @Generated + @JsonProperty(value = "dir") private String dir; /* * Language code identifying the target language. */ - @JsonProperty(value = "code", required = true) + @Generated + @JsonProperty(value = "code") private String code; /** @@ -43,12 +48,13 @@ public final class TargetDictionaryLanguage { * @param dir the dir value to set. * @param code the code value to set. */ + @Generated @JsonCreator private TargetDictionaryLanguage( - @JsonProperty(value = "name", required = true) String name, - @JsonProperty(value = "nativeName", required = true) String nativeName, - @JsonProperty(value = "dir", required = true) String dir, - @JsonProperty(value = "code", required = true) String code) { + @JsonProperty(value = "name") String name, + @JsonProperty(value = "nativeName") String nativeName, + @JsonProperty(value = "dir") String dir, + @JsonProperty(value = "code") String code) { this.name = name; this.nativeName = nativeName; this.dir = dir; @@ -60,6 +66,7 @@ private TargetDictionaryLanguage( * * @return the name value. */ + @Generated public String getName() { return this.name; } @@ -69,6 +76,7 @@ public String getName() { * * @return the nativeName value. */ + @Generated public String getNativeName() { return this.nativeName; } @@ -79,6 +87,7 @@ public String getNativeName() { * * @return the dir value. */ + @Generated public String getDir() { return this.dir; } @@ -88,6 +97,7 @@ public String getDir() { * * @return the code value. */ + @Generated public String getCode() { return this.code; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TextType.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TextType.java index baffc9b5d1eb..6b678e4d6e19 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TextType.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TextType.java @@ -4,23 +4,25 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** Defines values for TextType. */ public final class TextType extends ExpandableStringEnum { - /** Static value plain for TextType. */ - public static final TextType PLAIN = fromString("plain"); + /** Static value Plain for TextType. */ + @Generated public static final TextType PLAIN = fromString("Plain"); - /** Static value html for TextType. */ - public static final TextType HTML = fromString("html"); + /** Static value Html for TextType. */ + @Generated public static final TextType HTML = fromString("Html"); /** * Creates a new instance of TextType value. * * @deprecated Use the {@link #fromString(String)} factory method. */ + @Generated @Deprecated public TextType() {} @@ -30,6 +32,7 @@ public TextType() {} * @param name a name to look for. * @return the corresponding TextType. */ + @Generated @JsonCreator public static TextType fromString(String name) { return fromString(name, TextType.class); @@ -40,6 +43,7 @@ public static TextType fromString(String name) { * * @return known TextType values. */ + @Generated public static Collection values() { return values(TextType.class); } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextAlignment.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextAlignment.java index e50540e3bf69..295eaf5c33c4 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextAlignment.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextAlignment.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,7 +20,8 @@ public final class TranslatedTextAlignment { * One word may align with zero, one, or multiple words in the other language, and the aligned words may * be non-contiguous. When no alignment information is available, the alignment element will be empty. */ - @JsonProperty(value = "proj", required = true) + @Generated + @JsonProperty(value = "proj") private String proj; /** @@ -27,8 +29,9 @@ public final class TranslatedTextAlignment { * * @param proj the proj value to set. */ + @Generated @JsonCreator - private TranslatedTextAlignment(@JsonProperty(value = "proj", required = true) String proj) { + private TranslatedTextAlignment(@JsonProperty(value = "proj") String proj) { this.proj = proj; } @@ -42,6 +45,7 @@ private TranslatedTextAlignment(@JsonProperty(value = "proj", required = true) S * * @return the proj value. */ + @Generated public String getProj() { return this.proj; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextItem.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextItem.java index 65c336d1d619..60269d948cef 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextItem.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslatedTextItem.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -15,6 +16,7 @@ public final class TranslatedTextItem { /* * The detectedLanguage property is only present in the result object when language auto-detection is requested. */ + @Generated @JsonProperty(value = "detectedLanguage") private DetectedLanguage detectedLanguage; @@ -22,7 +24,8 @@ public final class TranslatedTextItem { * An array of translation results. The size of the array matches the number of target * languages specified through the to query parameter. */ - @JsonProperty(value = "translations", required = true) + @Generated + @JsonProperty(value = "translations") private List translations; /* @@ -31,6 +34,7 @@ public final class TranslatedTextItem { * if the input were Arabic written in Latin script, then sourceText.text would be the same Arabic text * converted into Arab script. */ + @Generated @JsonProperty(value = "sourceText") private SourceText sourceText; @@ -39,8 +43,9 @@ public final class TranslatedTextItem { * * @param translations the translations value to set. */ + @Generated @JsonCreator - private TranslatedTextItem(@JsonProperty(value = "translations", required = true) List translations) { + private TranslatedTextItem(@JsonProperty(value = "translations") List translations) { this.translations = translations; } @@ -50,6 +55,7 @@ private TranslatedTextItem(@JsonProperty(value = "translations", required = true * * @return the detectedLanguage value. */ + @Generated public DetectedLanguage getDetectedLanguage() { return this.detectedLanguage; } @@ -60,6 +66,7 @@ public DetectedLanguage getDetectedLanguage() { * * @return the translations value. */ + @Generated public List getTranslations() { return this.translations; } @@ -72,6 +79,7 @@ public List getTranslations() { * * @return the sourceText value. */ + @Generated public SourceText getSourceText() { return this.sourceText; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/Translation.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/Translation.java index 0f61c37845c0..0cda531a25e3 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/Translation.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/Translation.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,30 +15,35 @@ public final class Translation { /* * A string representing the language code of the target language. */ - @JsonProperty(value = "to", required = true) + @Generated + @JsonProperty(value = "to") private String to; /* * A string giving the translated text. */ - @JsonProperty(value = "text", required = true) + @Generated + @JsonProperty(value = "text") private String text; /* * An object giving the translated text in the script specified by the toScript parameter. */ + @Generated @JsonProperty(value = "transliteration") private TransliteratedText transliteration; /* * Alignment information. */ + @Generated @JsonProperty(value = "alignment") private TranslatedTextAlignment alignment; /* * Sentence boundaries in the input and output texts. */ + @Generated @JsonProperty(value = "sentLen") private SentenceLength sentLen; @@ -47,10 +53,9 @@ public final class Translation { * @param to the to value to set. * @param text the text value to set. */ + @Generated @JsonCreator - private Translation( - @JsonProperty(value = "to", required = true) String to, - @JsonProperty(value = "text", required = true) String text) { + private Translation(@JsonProperty(value = "to") String to, @JsonProperty(value = "text") String text) { this.to = to; this.text = text; } @@ -60,6 +65,7 @@ private Translation( * * @return the to value. */ + @Generated public String getTo() { return this.to; } @@ -69,6 +75,7 @@ public String getTo() { * * @return the text value. */ + @Generated public String getText() { return this.text; } @@ -79,6 +86,7 @@ public String getText() { * * @return the transliteration value. */ + @Generated public TransliteratedText getTransliteration() { return this.transliteration; } @@ -88,6 +96,7 @@ public TransliteratedText getTransliteration() { * * @return the alignment value. */ + @Generated public TranslatedTextAlignment getAlignment() { return this.alignment; } @@ -97,6 +106,7 @@ public TranslatedTextAlignment getAlignment() { * * @return the sentLen value. */ + @Generated public SentenceLength getSentLen() { return this.sentLen; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslationLanguage.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslationLanguage.java index 6c792ce672b1..30b9ec817480 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslationLanguage.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TranslationLanguage.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,19 +18,22 @@ public final class TranslationLanguage { /* * Display name of the language in the locale requested via Accept-Language header. */ - @JsonProperty(value = "name", required = true) + @Generated + @JsonProperty(value = "name") private String name; /* * Display name of the language in the locale native for this language. */ - @JsonProperty(value = "nativeName", required = true) + @Generated + @JsonProperty(value = "nativeName") private String nativeName; /* * Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */ - @JsonProperty(value = "dir", required = true) + @Generated + @JsonProperty(value = "dir") private String dir; /** @@ -39,11 +43,12 @@ public final class TranslationLanguage { * @param nativeName the nativeName value to set. * @param dir the dir value to set. */ + @Generated @JsonCreator private TranslationLanguage( - @JsonProperty(value = "name", required = true) String name, - @JsonProperty(value = "nativeName", required = true) String nativeName, - @JsonProperty(value = "dir", required = true) String dir) { + @JsonProperty(value = "name") String name, + @JsonProperty(value = "nativeName") String nativeName, + @JsonProperty(value = "dir") String dir) { this.name = name; this.nativeName = nativeName; this.dir = dir; @@ -54,6 +59,7 @@ private TranslationLanguage( * * @return the name value. */ + @Generated public String getName() { return this.name; } @@ -63,6 +69,7 @@ public String getName() { * * @return the nativeName value. */ + @Generated public String getNativeName() { return this.nativeName; } @@ -73,6 +80,7 @@ public String getNativeName() { * * @return the dir value. */ + @Generated public String getDir() { return this.dir; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterableScript.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterableScript.java index 3facb37b4f28..6787f675f9c5 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterableScript.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterableScript.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -15,7 +16,8 @@ public final class TransliterableScript extends CommonScriptModel { /* * List of scripts available to convert text to. */ - @JsonProperty(value = "toScripts", required = true) + @Generated + @JsonProperty(value = "toScripts") private List toScripts; /** @@ -27,13 +29,14 @@ public final class TransliterableScript extends CommonScriptModel { * @param dir the dir value to set. * @param toScripts the toScripts value to set. */ + @Generated @JsonCreator private TransliterableScript( - @JsonProperty(value = "code", required = true) String code, - @JsonProperty(value = "name", required = true) String name, - @JsonProperty(value = "nativeName", required = true) String nativeName, - @JsonProperty(value = "dir", required = true) String dir, - @JsonProperty(value = "toScripts", required = true) List toScripts) { + @JsonProperty(value = "code") String code, + @JsonProperty(value = "name") String name, + @JsonProperty(value = "nativeName") String nativeName, + @JsonProperty(value = "dir") String dir, + @JsonProperty(value = "toScripts") List toScripts) { super(code, name, nativeName, dir); this.toScripts = toScripts; } @@ -43,6 +46,7 @@ private TransliterableScript( * * @return the toScripts value. */ + @Generated public List getToScripts() { return this.toScripts; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliteratedText.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliteratedText.java index 92fa7622643c..ef55845bf3ef 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliteratedText.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliteratedText.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,13 +15,15 @@ public final class TransliteratedText { /* * A string which is the result of converting the input string to the output script. */ - @JsonProperty(value = "text", required = true) + @Generated + @JsonProperty(value = "text") private String text; /* * A string specifying the script used in the output. */ - @JsonProperty(value = "script", required = true) + @Generated + @JsonProperty(value = "script") private String script; /** @@ -29,10 +32,10 @@ public final class TransliteratedText { * @param text the text value to set. * @param script the script value to set. */ + @Generated @JsonCreator private TransliteratedText( - @JsonProperty(value = "text", required = true) String text, - @JsonProperty(value = "script", required = true) String script) { + @JsonProperty(value = "text") String text, @JsonProperty(value = "script") String script) { this.text = text; this.script = script; } @@ -42,6 +45,7 @@ private TransliteratedText( * * @return the text value. */ + @Generated public String getText() { return this.text; } @@ -51,6 +55,7 @@ public String getText() { * * @return the script value. */ + @Generated public String getScript() { return this.script; } diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterationLanguage.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterationLanguage.java index e4927e38dc28..f9fe274660c7 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterationLanguage.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/models/TransliterationLanguage.java @@ -4,6 +4,7 @@ package com.azure.ai.translation.text.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,19 +19,22 @@ public final class TransliterationLanguage { /* * Display name of the language in the locale requested via Accept-Language header. */ - @JsonProperty(value = "name", required = true) + @Generated + @JsonProperty(value = "name") private String name; /* * Display name of the language in the locale native for this language. */ - @JsonProperty(value = "nativeName", required = true) + @Generated + @JsonProperty(value = "nativeName") private String nativeName; /* * List of scripts to convert from. */ - @JsonProperty(value = "scripts", required = true) + @Generated + @JsonProperty(value = "scripts") private List scripts; /** @@ -40,11 +44,12 @@ public final class TransliterationLanguage { * @param nativeName the nativeName value to set. * @param scripts the scripts value to set. */ + @Generated @JsonCreator private TransliterationLanguage( - @JsonProperty(value = "name", required = true) String name, - @JsonProperty(value = "nativeName", required = true) String nativeName, - @JsonProperty(value = "scripts", required = true) List scripts) { + @JsonProperty(value = "name") String name, + @JsonProperty(value = "nativeName") String nativeName, + @JsonProperty(value = "scripts") List scripts) { this.name = name; this.nativeName = nativeName; this.scripts = scripts; @@ -55,6 +60,7 @@ private TransliterationLanguage( * * @return the name value. */ + @Generated public String getName() { return this.name; } @@ -64,6 +70,7 @@ public String getName() { * * @return the nativeName value. */ + @Generated public String getNativeName() { return this.nativeName; } @@ -73,6 +80,7 @@ public String getNativeName() { * * @return the scripts value. */ + @Generated public List getScripts() { return this.scripts; } diff --git a/sdk/translation/azure-ai-translation-text/src/test/java/com/azure/ai/translation/text/generated/TextTranslationClientTestBase.java b/sdk/translation/azure-ai-translation-text/src/test/java/com/azure/ai/translation/text/generated/TextTranslationClientTestBase.java new file mode 100644 index 000000000000..9062680f0906 --- /dev/null +++ b/sdk/translation/azure-ai-translation-text/src/test/java/com/azure/ai/translation/text/generated/TextTranslationClientTestBase.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.translation.text.generated; + +import com.azure.ai.translation.text.TextTranslationClient; +import com.azure.ai.translation.text.TextTranslationClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.util.Configuration; + +class TextTranslationClientTestBase extends TestBase { + protected TextTranslationClient textTranslationClient; + + @Override + protected void beforeTest() { + TextTranslationClientBuilder textTranslationClientbuilder = + new TextTranslationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + textTranslationClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + textTranslationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + textTranslationClient = textTranslationClientbuilder.buildClient(); + } +}