diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationAsyncClient.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationAsyncClient.java index 8c955a345b43c..277609db2da1b 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationAsyncClient.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationAsyncClient.java @@ -4,11 +4,13 @@ package com.azure.ai.translation.document; import com.azure.ai.translation.document.implementation.DocumentTranslationClientImpl; +import com.azure.ai.translation.document.implementation.models.FileFormatType; +import com.azure.ai.translation.document.implementation.models.SupportedFileFormats; import com.azure.ai.translation.document.models.DocumentStatus; import com.azure.ai.translation.document.models.FileFormatType; -import com.azure.ai.translation.document.models.StartTranslationDetails; import com.azure.ai.translation.document.models.SupportedFileFormats; -import com.azure.ai.translation.document.models.TranslationStatus; +import com.azure.ai.translation.document.models.TranslationBatch; +import com.azure.ai.translation.document.models.TranslationStatusResult; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; @@ -51,6 +53,357 @@ public final class DocumentTranslationAsyncClient { this.serviceClient = serviceClient; } + /** + * Returns the status for a specific document + * + * Returns the translation status for a specific document based on the request Id + * and document Id. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     path: String (Optional)
+     *     sourcePath: String (Required)
+     *     createdDateTimeUtc: OffsetDateTime (Required)
+     *     lastActionDateTimeUtc: OffsetDateTime (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
+     *     to: String (Required)
+     *     error (Optional): {
+     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         innerError (Optional): {
+     *             code: String (Required)
+     *             message: String (Required)
+     *             target: String (Optional)
+     *             innerError (Optional): (recursive schema, see innerError above)
+     *         }
+     *     }
+     *     progress: double (Required)
+     *     id: String (Required)
+     *     characterCharged: Integer (Optional)
+     * }
+     * }
+     * 
+ * + * @param translationId Format - uuid. The batch id. + * @param documentId Format - uuid. The document id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return document Status Response along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDocumentStatusWithResponse(String translationId, String documentId, + RequestOptions requestOptions) { + return this.serviceClient.getDocumentStatusWithResponseAsync(translationId, documentId, requestOptions); + } + + /** + * Returns the status for a document translation request + * + * Returns the status for a document translation request. + * The status includes the + * overall request status, as well as the status for documents that are being + * translated as part of that request. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     createdDateTimeUtc: OffsetDateTime (Required)
+     *     lastActionDateTimeUtc: OffsetDateTime (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
+     *     error (Optional): {
+     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         innerError (Optional): {
+     *             code: String (Required)
+     *             message: String (Required)
+     *             target: String (Optional)
+     *             innerError (Optional): (recursive schema, see innerError above)
+     *         }
+     *     }
+     *     summary (Required): {
+     *         total: int (Required)
+     *         failed: int (Required)
+     *         success: int (Required)
+     *         inProgress: int (Required)
+     *         notYetStarted: int (Required)
+     *         cancelled: int (Required)
+     *         totalCharacterCharged: long (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param translationId Format - uuid. The operation id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return translation job status response along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTranslationStatusWithResponse(String translationId, + RequestOptions requestOptions) { + return this.serviceClient.getTranslationStatusWithResponseAsync(translationId, requestOptions); + } + + /** + * Cancel a currently processing or queued translation + * + * Cancel a currently processing or queued translation. + * A translation will not be + * cancelled if it is already completed or failed or cancelling. A bad request + * will be returned. + * All documents that have completed translation will not be + * cancelled and will be charged. + * All pending documents will be cancelled if + * possible. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     createdDateTimeUtc: OffsetDateTime (Required)
+     *     lastActionDateTimeUtc: OffsetDateTime (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
+     *     error (Optional): {
+     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         innerError (Optional): {
+     *             code: String (Required)
+     *             message: String (Required)
+     *             target: String (Optional)
+     *             innerError (Optional): (recursive schema, see innerError above)
+     *         }
+     *     }
+     *     summary (Required): {
+     *         total: int (Required)
+     *         failed: int (Required)
+     *         success: int (Required)
+     *         inProgress: int (Required)
+     *         notYetStarted: int (Required)
+     *         cancelled: int (Required)
+     *         totalCharacterCharged: long (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param translationId Format - uuid. The operation-id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return translation job status response along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelTranslationWithResponse(String translationId, + RequestOptions requestOptions) { + return this.serviceClient.cancelTranslationWithResponseAsync(translationId, requestOptions); + } + + /** + * Returns a list of supported document formats + * + * The list of supported formats supported by the Document Translation + * service. + * The list includes the common file extension, as well as the + * content-type if using the upload API. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNothe type of format like document or glossary . Allowed values: + * "document", "glossary".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             format: String (Required)
+     *             fileExtensions (Required): [
+     *                 String (Required)
+     *             ]
+     *             contentTypes (Required): [
+     *                 String (Required)
+     *             ]
+     *             defaultVersion: String (Optional)
+     *             versions (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             type: String(document/glossary) (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return list of supported file formats along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getSupportedFormatsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getSupportedFormatsWithResponseAsync(requestOptions); + } + + /** + * Returns the status for a specific document + * + * Returns the translation status for a specific document based on the request Id + * and document Id. + * + * @param translationId Format - uuid. The batch id. + * @param documentId Format - uuid. The document id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return document Status Response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDocumentStatus(String translationId, String documentId) { + // Generated convenience method for getDocumentStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDocumentStatusWithResponse(translationId, documentId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DocumentStatus.class)); + } + + /** + * Returns the status for a document translation request + * + * Returns the status for a document translation request. + * The status includes the + * overall request status, as well as the status for documents that are being + * translated as part of that request. + * + * @param translationId Format - uuid. The operation id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return translation job status response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTranslationStatus(String translationId) { + // Generated convenience method for getTranslationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTranslationStatusWithResponse(translationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatusResult.class)); + } + + /** + * Cancel a currently processing or queued translation + * + * Cancel a currently processing or queued translation. + * A translation will not be + * cancelled if it is already completed or failed or cancelling. A bad request + * will be returned. + * All documents that have completed translation will not be + * cancelled and will be charged. + * All pending documents will be cancelled if + * possible. + * + * @param translationId Format - uuid. The operation-id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return translation job status response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelTranslation(String translationId) { + // Generated convenience method for cancelTranslationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return cancelTranslationWithResponse(translationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatusResult.class)); + } + + /** + * Returns a list of supported document formats + * + * The list of supported formats supported by the Document Translation + * service. + * The list includes the common file extension, as well as the + * content-type if using the upload API. + * + * @param type the type of format like document or glossary. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of supported file formats on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getSupportedFormats(FileFormatType type) { + // Generated convenience method for getSupportedFormatsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + return getSupportedFormatsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SupportedFileFormats.class)); + } + + /** + * Returns a list of supported document formats + * + * The list of supported formats supported by the Document Translation + * service. + * The list includes the common file extension, as well as the + * content-type if using the upload API. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of supported file formats on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getSupportedFormats() { + // Generated convenience method for getSupportedFormatsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getSupportedFormatsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SupportedFileFormats.class)); + } + /** * Submit a document translation request to the Document Translation service * @@ -112,7 +465,7 @@ public final class DocumentTranslationAsyncClient { * } * * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -122,9 +475,8 @@ public final class DocumentTranslationAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginStartTranslation(BinaryData startTranslationDetails, - RequestOptions requestOptions) { - return this.serviceClient.beginStartTranslationAsync(startTranslationDetails, requestOptions); + public PollerFlux beginBeginTranslation(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.beginBeginTranslationAsync(body, requestOptions); } /** @@ -180,218 +532,57 @@ public PollerFlux beginStartTranslation(BinaryData start * instead of just ignoring the query options. * This reduces the risk of the client * making assumptions about the data returned. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNotop indicates the total number of records the user wants to be - * returned across - * all pages. - * - * Clients MAY use top and skip query parameters to - * specify a number of results to return and an offset into the collection. - * When - * both top and skip are given by a client, the server SHOULD first apply skip - * and then top on the collection. - * - * Note: If the server can't honor - * top and/or skip, the server MUST return an error to the client informing - * about it instead of just ignoring the query options.
skipIntegerNoskip indicates the number of records to skip from the list of - * records held by - * the server based on the sorting method specified. By default, we sort by - * descending start time. - * - * Clients MAY use top and skip query - * parameters to specify a number of results to return and an offset into the - * collection. - * When both top and skip are given by a client, the server SHOULD - * first apply skip and then top on the collection. - * - * Note: If the - * server can't honor top and/or skip, the server MUST return an error to the - * client informing about it instead of just ignoring the query options.
maxpagesizeIntegerNomaxpagesize is the maximum items returned in a page. If - * more items are - * requested via top (or top is not specified and there are more items to be - * returned), @nextLink will contain the link to the next page. - * - * Clients MAY request server-driven paging with a specific page size by - * specifying a maxpagesize preference. The server SHOULD honor this preference - * if the specified page size is smaller than the server's default page size.
idsList<String>NoIds to use in filtering. In the form of "," separated - * string.
statusesList<String>NoStatuses to use in filtering. In the form of "," - * separated string.
createdDateTimeUtcStartOffsetDateTimeNothe start datetime to get items - * after
createdDateTimeUtcEndOffsetDateTimeNothe end datetime to get items - * before
orderbyList<String>Nothe sorting query for the collection (ex: - * 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc'). In the form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     createdDateTimeUtc: OffsetDateTime (Required)
-     *     lastActionDateTimeUtc: OffsetDateTime (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
-     *     error (Optional): {
-     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         innerError (Optional): {
-     *             code: String (Required)
-     *             message: String (Required)
-     *             target: String (Optional)
-     *             innerError (Optional): (recursive schema, see innerError above)
-     *         }
-     *     }
-     *     summary (Required): {
-     *         total: int (Required)
-     *         failed: int (Required)
-     *         success: int (Required)
-     *         inProgress: int (Required)
-     *         notYetStarted: int (Required)
-     *         cancelled: int (Required)
-     *         totalCharacterCharged: long (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return translation job Status Response as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getTranslationsStatus(RequestOptions requestOptions) { - return this.serviceClient.getTranslationsStatusAsync(requestOptions); - } - - /** - * Returns the status for a specific document - * - * Returns the translation status for a specific document based on the request Id - * and document Id. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     path: String (Optional)
-     *     sourcePath: String (Required)
-     *     createdDateTimeUtc: OffsetDateTime (Required)
-     *     lastActionDateTimeUtc: OffsetDateTime (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
-     *     to: String (Required)
-     *     error (Optional): {
-     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         innerError (Optional): {
-     *             code: String (Required)
-     *             message: String (Required)
-     *             target: String (Optional)
-     *             innerError (Optional): (recursive schema, see innerError above)
-     *         }
-     *     }
-     *     progress: double (Required)
-     *     id: String (Required)
-     *     characterCharged: Integer (Optional)
-     * }
-     * }
-     * 
- * - * @param id Format - uuid. The batch id. - * @param documentId Format - uuid. The document id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return document Status Response along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDocumentStatusWithResponse(String id, String documentId, - RequestOptions requestOptions) { - return this.serviceClient.getDocumentStatusWithResponseAsync(id, documentId, requestOptions); - } - - /** - * Returns the status for a document translation request - * - * Returns the status for a document translation request. - * The status includes the - * overall request status, as well as the status for documents that are being - * translated as part of that request. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     createdDateTimeUtc: OffsetDateTime (Required)
-     *     lastActionDateTimeUtc: OffsetDateTime (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
-     *     error (Optional): {
-     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         innerError (Optional): {
-     *             code: String (Required)
-     *             message: String (Required)
-     *             target: String (Optional)
-     *             innerError (Optional): (recursive schema, see innerError above)
-     *         }
-     *     }
-     *     summary (Required): {
-     *         total: int (Required)
-     *         failed: int (Required)
-     *         success: int (Required)
-     *         inProgress: int (Required)
-     *         notYetStarted: int (Required)
-     *         cancelled: int (Required)
-     *         totalCharacterCharged: long (Required)
-     *     }
-     * }
-     * }
-     * 
+ *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNotop indicates the total number of records the user wants to be + * returned across + * all pages. * - * @param id Format - uuid. The operation id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return translation job status response along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTranslationStatusWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.getTranslationStatusWithResponseAsync(id, requestOptions); - } - - /** - * Cancel a currently processing or queued translation + * Clients MAY use top and skip query parameters to + * specify a number of results to return and an offset into the collection. + * When + * both top and skip are given by a client, the server SHOULD first apply skip + * and then top on the collection. * - * Cancel a currently processing or queued translation. - * A translation will not be - * cancelled if it is already completed or failed or cancelling. A bad request - * will be returned. - * All documents that have completed translation will not be - * cancelled and will be charged. - * All pending documents will be cancelled if - * possible. + * Note: If the server can't honor + * top and/or skip, the server MUST return an error to the client informing + * about it instead of just ignoring the query options.
skipIntegerNoskip indicates the number of records to skip from the list of + * records held by + * the server based on the sorting method specified. By default, we sort by + * descending start time. + * + * Clients MAY use top and skip query + * parameters to specify a number of results to return and an offset into the + * collection. + * When both top and skip are given by a client, the server SHOULD + * first apply skip and then top on the collection. + * + * Note: If the + * server can't honor top and/or skip, the server MUST return an error to the + * client informing about it instead of just ignoring the query options.
maxpagesizeIntegerNomaxpagesize is the maximum items returned in a page. If + * more items are + * requested via top (or top is not specified and there are more items to be + * returned), @nextLink will contain the link to the next page. + * + * Clients MAY request server-driven paging with a specific page size by + * specifying a maxpagesize preference. The server SHOULD honor this preference + * if the specified page size is smaller than the server's default page size.
idsList<String>NoIds to use in filtering. In the form of "," separated + * string.
statusesList<String>NoStatuses to use in filtering. In the form of "," + * separated string.
createdDateTimeUtcStartOffsetDateTimeNothe start datetime to get items + * after
createdDateTimeUtcEndOffsetDateTimeNothe end datetime to get items + * before
orderbyList<String>Nothe sorting query for the collection (ex: + * 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc'). In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} *

Response Body Schema

* *
@@ -425,18 +616,17 @@ public Mono> getTranslationStatusWithResponse(String id, Re
      * }
      * 
* - * @param id Format - uuid. The operation-id. * @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. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return translation job status response along with {@link Response} on successful completion of {@link Mono}. + * @return translation job Status Response as paginated response with {@link PagedFlux}. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> cancelTranslationWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.cancelTranslationWithResponseAsync(id, requestOptions); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTranslationStatuses(RequestOptions requestOptions) { + return this.serviceClient.listTranslationStatusesAsync(requestOptions); } /** @@ -566,7 +756,7 @@ public Mono> cancelTranslationWithResponse(String id, Reque * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -576,61 +766,8 @@ public Mono> cancelTranslationWithResponse(String id, Reque */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getDocumentsStatus(String id, RequestOptions requestOptions) { - return this.serviceClient.getDocumentsStatusAsync(id, requestOptions); - } - - /** - * Returns a list of supported document formats - * - * The list of supported formats supported by the Document Translation - * service. - * The list includes the common file extension, as well as the - * content-type if using the upload API. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
typeStringNothe type of format like document or glossary . Allowed values: - * "document", "glossary".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             format: String (Required)
-     *             fileExtensions (Required): [
-     *                 String (Required)
-     *             ]
-     *             contentTypes (Required): [
-     *                 String (Required)
-     *             ]
-     *             defaultVersion: String (Optional)
-     *             versions (Optional): [
-     *                 String (Optional)
-     *             ]
-     *             type: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return list of supported file formats along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getSupportedFormatsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getSupportedFormatsWithResponseAsync(requestOptions); + public PagedFlux listDocumentStatuses(String translationId, RequestOptions requestOptions) { + return this.serviceClient.listDocumentStatusesAsync(translationId, requestOptions); } /** @@ -656,7 +793,7 @@ public Mono> getSupportedFormatsWithResponse(RequestOptions * destination, it will be overwritten. The targetUrl for each target language * must be unique. * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -667,12 +804,10 @@ public Mono> getSupportedFormatsWithResponse(RequestOptions */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux - beginStartTranslation(StartTranslationDetails startTranslationDetails) { - // Generated convenience method for beginStartTranslationWithModel + public PollerFlux beginBeginTranslation(TranslationBatch body) { + // Generated convenience method for beginBeginTranslationWithModel RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginStartTranslationWithModelAsync(BinaryData.fromObject(startTranslationDetails), - requestOptions); + return serviceClient.beginBeginTranslationWithModelAsync(BinaryData.fromObject(body), requestOptions); } /** @@ -754,7 +889,7 @@ public Mono> getSupportedFormatsWithResponse(RequestOptions * Note: If the * server can't honor top and/or skip, the server MUST return an error to the * client informing about it instead of just ignoring the query options. - * @param ids Ids to use in filtering. + * @param translationIds Ids to use in filtering. * @param statuses Statuses to use in filtering. * @param createdDateTimeUtcStart the start datetime to get items after. * @param createdDateTimeUtcEnd the end datetime to get items before. @@ -769,10 +904,10 @@ public Mono> getSupportedFormatsWithResponse(RequestOptions */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getTranslationsStatus(Integer top, Integer skip, List ids, - List statuses, OffsetDateTime createdDateTimeUtcStart, OffsetDateTime createdDateTimeUtcEnd, - List orderBy) { - // Generated convenience method for getTranslationsStatus + public PagedFlux listTranslationStatuses(Integer top, Integer skip, + List translationIds, List statuses, OffsetDateTime createdDateTimeUtcStart, + OffsetDateTime createdDateTimeUtcEnd, List orderBy) { + // Generated convenience method for listTranslationStatuses RequestOptions requestOptions = new RequestOptions(); if (top != null) { requestOptions.addQueryParam("top", String.valueOf(top), false); @@ -780,9 +915,9 @@ public PagedFlux getTranslationsStatus(Integer top, Integer s if (skip != null) { requestOptions.addQueryParam("skip", String.valueOf(skip), false); } - if (ids != null) { + if (translationIds != null) { requestOptions.addQueryParam("ids", - ids.stream() + translationIds.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")), false); @@ -807,18 +942,19 @@ public PagedFlux getTranslationsStatus(Integer top, Integer s .collect(Collectors.joining(",")), false); } - PagedFlux pagedFluxResponse = getTranslationsStatus(requestOptions); + PagedFlux pagedFluxResponse = listTranslationStatuses(requestOptions); return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { Flux> flux = (continuationTokenParam == null) ? pagedFluxResponse.byPage().take(1) : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatus.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); + return flux + .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatusResult.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); }); } @@ -885,105 +1021,25 @@ public PagedFlux getTranslationsStatus(Integer top, Integer s */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getTranslationsStatus() { - // Generated convenience method for getTranslationsStatus + public PagedFlux listTranslationStatuses() { + // Generated convenience method for listTranslationStatuses RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = getTranslationsStatus(requestOptions); + PagedFlux pagedFluxResponse = listTranslationStatuses(requestOptions); return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { Flux> flux = (continuationTokenParam == null) ? pagedFluxResponse.byPage().take(1) : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatus.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); + return flux + .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatusResult.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); }); } - /** - * Returns the status for a specific document - * - * Returns the translation status for a specific document based on the request Id - * and document Id. - * - * @param id Format - uuid. The batch id. - * @param documentId Format - uuid. The document id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return document Status Response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDocumentStatus(String id, String documentId) { - // Generated convenience method for getDocumentStatusWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDocumentStatusWithResponse(id, documentId, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DocumentStatus.class)); - } - - /** - * Returns the status for a document translation request - * - * Returns the status for a document translation request. - * The status includes the - * overall request status, as well as the status for documents that are being - * translated as part of that request. - * - * @param id Format - uuid. The operation id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return translation job status response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTranslationStatus(String id) { - // Generated convenience method for getTranslationStatusWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTranslationStatusWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatus.class)); - } - - /** - * Cancel a currently processing or queued translation - * - * Cancel a currently processing or queued translation. - * A translation will not be - * cancelled if it is already completed or failed or cancelling. A bad request - * will be returned. - * All documents that have completed translation will not be - * cancelled and will be charged. - * All pending documents will be cancelled if - * possible. - * - * @param id Format - uuid. The operation-id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return translation job status response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono cancelTranslation(String id) { - // Generated convenience method for cancelTranslationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return cancelTranslationWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TranslationStatus.class)); - } - /** * Returns the status for all documents in a batch document translation request * @@ -1032,7 +1088,7 @@ public Mono cancelTranslation(String id) { * This reduces the risk of the client making assumptions about * the data returned. * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @param top top indicates the total number of records the user wants to be returned across * all pages. * @@ -1058,7 +1114,7 @@ public Mono cancelTranslation(String id) { * Note: If the * server can't honor top and/or skip, the server MUST return an error to the * client informing about it instead of just ignoring the query options. - * @param ids Ids to use in filtering. + * @param documentIds Ids to use in filtering. * @param statuses Statuses to use in filtering. * @param createdDateTimeUtcStart the start datetime to get items after. * @param createdDateTimeUtcEnd the end datetime to get items before. @@ -1073,10 +1129,10 @@ public Mono cancelTranslation(String id) { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getDocumentsStatus(String id, Integer top, Integer skip, List ids, - List statuses, OffsetDateTime createdDateTimeUtcStart, OffsetDateTime createdDateTimeUtcEnd, - List orderBy) { - // Generated convenience method for getDocumentsStatus + public PagedFlux listDocumentStatuses(String translationId, Integer top, Integer skip, + List documentIds, List statuses, OffsetDateTime createdDateTimeUtcStart, + OffsetDateTime createdDateTimeUtcEnd, List orderBy) { + // Generated convenience method for listDocumentStatuses RequestOptions requestOptions = new RequestOptions(); if (top != null) { requestOptions.addQueryParam("top", String.valueOf(top), false); @@ -1084,9 +1140,9 @@ public PagedFlux getDocumentsStatus(String id, Integer top, Inte if (skip != null) { requestOptions.addQueryParam("skip", String.valueOf(skip), false); } - if (ids != null) { + if (documentIds != null) { requestOptions.addQueryParam("ids", - ids.stream() + documentIds.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")), false); @@ -1111,7 +1167,7 @@ public PagedFlux getDocumentsStatus(String id, Integer top, Inte .collect(Collectors.joining(",")), false); } - PagedFlux pagedFluxResponse = getDocumentsStatus(id, requestOptions); + PagedFlux pagedFluxResponse = listDocumentStatuses(translationId, requestOptions); return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { Flux> flux = (continuationTokenParam == null) ? pagedFluxResponse.byPage().take(1) @@ -1174,7 +1230,7 @@ public PagedFlux getDocumentsStatus(String id, Integer top, Inte * This reduces the risk of the client making assumptions about * the data returned. * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -1185,10 +1241,10 @@ public PagedFlux getDocumentsStatus(String id, Integer top, Inte */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getDocumentsStatus(String id) { - // Generated convenience method for getDocumentsStatus + public PagedFlux listDocumentStatuses(String translationId) { + // Generated convenience method for listDocumentStatuses RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = getDocumentsStatus(id, requestOptions); + PagedFlux pagedFluxResponse = listDocumentStatuses(translationId, requestOptions); return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { Flux> flux = (continuationTokenParam == null) ? pagedFluxResponse.byPage().take(1) @@ -1202,57 +1258,4 @@ public PagedFlux getDocumentsStatus(String id) { pagedResponse.getContinuationToken(), null)); }); } - - /** - * Returns a list of supported document formats - * - * The list of supported formats supported by the Document Translation - * service. - * The list includes the common file extension, as well as the - * content-type if using the upload API. - * - * @param type the type of format like document or glossary. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of supported file formats on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getSupportedFormats(FileFormatType type) { - // Generated convenience method for getSupportedFormatsWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (type != null) { - requestOptions.addQueryParam("type", type.toString(), false); - } - return getSupportedFormatsWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SupportedFileFormats.class)); - } - - /** - * Returns a list of supported document formats - * - * The list of supported formats supported by the Document Translation - * service. - * The list includes the common file extension, as well as the - * content-type if using the upload API. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of supported file formats on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getSupportedFormats() { - // Generated convenience method for getSupportedFormatsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getSupportedFormatsWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SupportedFileFormats.class)); - } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationClient.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationClient.java index ebbcc4836438a..06f4efa06b6bc 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationClient.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/DocumentTranslationClient.java @@ -4,11 +4,13 @@ package com.azure.ai.translation.document; import com.azure.ai.translation.document.implementation.DocumentTranslationClientImpl; +import com.azure.ai.translation.document.implementation.models.FileFormatType; +import com.azure.ai.translation.document.implementation.models.SupportedFileFormats; import com.azure.ai.translation.document.models.DocumentStatus; import com.azure.ai.translation.document.models.FileFormatType; -import com.azure.ai.translation.document.models.StartTranslationDetails; import com.azure.ai.translation.document.models.SupportedFileFormats; -import com.azure.ai.translation.document.models.TranslationStatus; +import com.azure.ai.translation.document.models.TranslationBatch; +import com.azure.ai.translation.document.models.TranslationStatusResult; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; @@ -47,185 +49,62 @@ public final class DocumentTranslationClient { } /** - * Submit a document translation request to the Document Translation service - * - * Use this API to submit a bulk (batch) translation request to the Document - * Translation service. - * Each request can contain multiple documents and must - * contain a source and destination container for each document. - * - * The - * prefix and suffix filter (if supplied) are used to filter folders. The prefix - * is applied to the subpath after the container name. - * - * Glossaries / - * Translation memory can be included in the request and are applied by the - * service when the document is translated. + * Returns the status for a specific document * - * If the glossary is - * invalid or unreachable during translation, an error is indicated in the - * document status. - * If a file with the same name already exists at the - * destination, it will be overwritten. The targetUrl for each target language - * must be unique. - *

Request Body Schema

+ * Returns the translation status for a specific document based on the request Id + * and document Id. + *

Response Body Schema

* *
      * {@code
      * {
-     *     inputs (Required): [
-     *          (Required){
-     *             source (Required): {
-     *                 sourceUrl: String (Required)
-     *                 filter (Optional): {
-     *                     prefix: String (Optional)
-     *                     suffix: String (Optional)
-     *                 }
-     *                 language: String (Optional)
-     *                 storageSource: String(AzureBlob) (Optional)
-     *             }
-     *             targets (Required): [
-     *                  (Required){
-     *                     targetUrl: String (Required)
-     *                     category: String (Optional)
-     *                     language: String (Required)
-     *                     glossaries (Optional): [
-     *                          (Optional){
-     *                             glossaryUrl: String (Required)
-     *                             format: String (Required)
-     *                             version: String (Optional)
-     *                             storageSource: String(AzureBlob) (Optional)
-     *                         }
-     *                     ]
-     *                     storageSource: String(AzureBlob) (Optional)
-     *                 }
-     *             ]
-     *             storageType: String(Folder/File) (Optional)
+     *     path: String (Optional)
+     *     sourcePath: String (Required)
+     *     createdDateTimeUtc: OffsetDateTime (Required)
+     *     lastActionDateTimeUtc: OffsetDateTime (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
+     *     to: String (Required)
+     *     error (Optional): {
+     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         innerError (Optional): {
+     *             code: String (Required)
+     *             message: String (Required)
+     *             target: String (Optional)
+     *             innerError (Optional): (recursive schema, see innerError above)
      *         }
-     *     ]
+     *     }
+     *     progress: double (Required)
+     *     id: String (Required)
+     *     characterCharged: Integer (Optional)
      * }
      * }
      * 
* - * @param startTranslationDetails Translation job submission batch request. + * @param translationId Format - uuid. The batch id. + * @param documentId Format - uuid. The document id. * @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. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return document Status Response along with {@link Response}. */ @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginStartTranslation(BinaryData startTranslationDetails, + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDocumentStatusWithResponse(String translationId, String documentId, RequestOptions requestOptions) { - return this.serviceClient.beginStartTranslation(startTranslationDetails, requestOptions); + return this.serviceClient.getDocumentStatusWithResponse(translationId, documentId, requestOptions); } /** - * Returns a list of batch requests submitted and the status for each request - * - * Returns a list of batch requests submitted and the status for each - * request. - * This list only contains batch requests submitted by the user (based on - * the resource). - * - * If the number of requests exceeds our paging limit, - * server-side paging is used. Paginated responses indicate a partial result and - * include a continuation token in the response. - * The absence of a continuation - * token means that no additional pages are available. - * - * top, skip - * and maxpagesize query parameters can be used to specify a number of results to - * return and an offset for the collection. - * - * top indicates the total - * number of records the user wants to be returned across all pages. - * skip - * indicates the number of records to skip from the list of batches based on the - * sorting method specified. By default, we sort by descending start - * time. - * maxpagesize is the maximum items returned in a page. If more items are - * requested via top (or top is not specified and there are more items to be - * returned), @nextLink will contain the link to the next page. - * - * orderby query parameter can be used to sort the returned list (ex - * "orderby=createdDateTimeUtc asc" or "orderby=createdDateTimeUtc - * desc"). - * The default sorting is descending by createdDateTimeUtc. - * Some query - * parameters can be used to filter the returned list (ex: - * "status=Succeeded,Cancelled") will only return succeeded and cancelled - * operations. - * createdDateTimeUtcStart and createdDateTimeUtcEnd can be used - * combined or separately to specify a range of datetime to filter the returned - * list by. - * The supported filtering query parameters are (status, ids, - * createdDateTimeUtcStart, createdDateTimeUtcEnd). - * - * The server honors - * the values specified by the client. However, clients must be prepared to handle - * responses that contain a different page size or contain a continuation token. - * - * When both top and skip are included, the server should first apply - * skip and then top on the collection. - * Note: If the server can't honor top - * and/or skip, the server must return an error to the client informing about it - * instead of just ignoring the query options. - * This reduces the risk of the client - * making assumptions about the data returned. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNotop indicates the total number of records the user wants to be - * returned across - * all pages. - * - * Clients MAY use top and skip query parameters to - * specify a number of results to return and an offset into the collection. - * When - * both top and skip are given by a client, the server SHOULD first apply skip - * and then top on the collection. - * - * Note: If the server can't honor - * top and/or skip, the server MUST return an error to the client informing - * about it instead of just ignoring the query options.
skipIntegerNoskip indicates the number of records to skip from the list of - * records held by - * the server based on the sorting method specified. By default, we sort by - * descending start time. - * - * Clients MAY use top and skip query - * parameters to specify a number of results to return and an offset into the - * collection. - * When both top and skip are given by a client, the server SHOULD - * first apply skip and then top on the collection. - * - * Note: If the - * server can't honor top and/or skip, the server MUST return an error to the - * client informing about it instead of just ignoring the query options.
maxpagesizeIntegerNomaxpagesize is the maximum items returned in a page. If - * more items are - * requested via top (or top is not specified and there are more items to be - * returned), @nextLink will contain the link to the next page. + * Returns the status for a document translation request * - * Clients MAY request server-driven paging with a specific page size by - * specifying a maxpagesize preference. The server SHOULD honor this preference - * if the specified page size is smaller than the server's default page size.
idsList<String>NoIds to use in filtering. In the form of "," separated - * string.
statusesList<String>NoStatuses to use in filtering. In the form of "," - * separated string.
createdDateTimeUtcStartOffsetDateTimeNothe start datetime to get items - * after
createdDateTimeUtcEndOffsetDateTimeNothe end datetime to get items - * before
orderbyList<String>Nothe sorting query for the collection (ex: - * 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc'). In the form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} + * Returns the status for a document translation request. + * The status includes the + * overall request status, as well as the status for documents that are being + * translated as part of that request. *

Response Body Schema

* *
@@ -259,35 +138,40 @@ public SyncPoller beginStartTranslation(BinaryData start
      * }
      * 
* + * @param translationId Format - uuid. The operation id. * @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. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return translation job Status Response as paginated response with {@link PagedIterable}. + * @return translation job status response along with {@link Response}. */ @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getTranslationsStatus(RequestOptions requestOptions) { - return this.serviceClient.getTranslationsStatus(requestOptions); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTranslationStatusWithResponse(String translationId, RequestOptions requestOptions) { + return this.serviceClient.getTranslationStatusWithResponse(translationId, requestOptions); } /** - * Returns the status for a specific document + * Cancel a currently processing or queued translation * - * Returns the translation status for a specific document based on the request Id - * and document Id. + * Cancel a currently processing or queued translation. + * A translation will not be + * cancelled if it is already completed or failed or cancelling. A bad request + * will be returned. + * All documents that have completed translation will not be + * cancelled and will be charged. + * All pending documents will be cancelled if + * possible. *

Response Body Schema

* *
      * {@code
      * {
-     *     path: String (Optional)
-     *     sourcePath: String (Required)
+     *     id: String (Required)
      *     createdDateTimeUtc: OffsetDateTime (Required)
      *     lastActionDateTimeUtc: OffsetDateTime (Required)
      *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
-     *     to: String (Required)
      *     error (Optional): {
      *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
      *         message: String (Required)
@@ -299,27 +183,109 @@ public PagedIterable getTranslationsStatus(RequestOptions requestOpt
      *             innerError (Optional): (recursive schema, see innerError above)
      *         }
      *     }
-     *     progress: double (Required)
-     *     id: String (Required)
-     *     characterCharged: Integer (Optional)
+     *     summary (Required): {
+     *         total: int (Required)
+     *         failed: int (Required)
+     *         success: int (Required)
+     *         inProgress: int (Required)
+     *         notYetStarted: int (Required)
+     *         cancelled: int (Required)
+     *         totalCharacterCharged: long (Required)
+     *     }
      * }
      * }
      * 
* - * @param id Format - uuid. The batch id. - * @param documentId Format - uuid. The document id. + * @param translationId Format - uuid. The operation-id. * @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. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return document Status Response along with {@link Response}. + * @return translation job status response along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDocumentStatusWithResponse(String id, String documentId, - RequestOptions requestOptions) { - return this.serviceClient.getDocumentStatusWithResponse(id, documentId, requestOptions); + public Response cancelTranslationWithResponse(String translationId, RequestOptions requestOptions) { + return this.serviceClient.cancelTranslationWithResponse(translationId, requestOptions); + } + + /** + * Returns a list of supported document formats + * + * The list of supported formats supported by the Document Translation + * service. + * The list includes the common file extension, as well as the + * content-type if using the upload API. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNothe type of format like document or glossary . Allowed values: + * "document", "glossary".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             format: String (Required)
+     *             fileExtensions (Required): [
+     *                 String (Required)
+     *             ]
+     *             contentTypes (Required): [
+     *                 String (Required)
+     *             ]
+     *             defaultVersion: String (Optional)
+     *             versions (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             type: String(document/glossary) (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return list of supported file formats along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSupportedFormatsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getSupportedFormatsWithResponse(requestOptions); + } + + /** + * Returns the status for a specific document + * + * Returns the translation status for a specific document based on the request Id + * and document Id. + * + * @param translationId Format - uuid. The batch id. + * @param documentId Format - uuid. The document id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return document Status Response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DocumentStatus getDocumentStatus(String translationId, String documentId) { + // Generated convenience method for getDocumentStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDocumentStatusWithResponse(translationId, documentId, requestOptions).getValue() + .toObject(DocumentStatus.class); } /** @@ -329,64 +295,285 @@ public Response getDocumentStatusWithResponse(String id, String docu * The status includes the * overall request status, as well as the status for documents that are being * translated as part of that request. - *

Response Body Schema

+ * + * @param translationId Format - uuid. The operation id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return translation job status response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TranslationStatusResult getTranslationStatus(String translationId) { + // Generated convenience method for getTranslationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTranslationStatusWithResponse(translationId, requestOptions).getValue() + .toObject(TranslationStatusResult.class); + } + + /** + * Cancel a currently processing or queued translation + * + * Cancel a currently processing or queued translation. + * A translation will not be + * cancelled if it is already completed or failed or cancelling. A bad request + * will be returned. + * All documents that have completed translation will not be + * cancelled and will be charged. + * All pending documents will be cancelled if + * possible. + * + * @param translationId Format - uuid. The operation-id. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return translation job status response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TranslationStatusResult cancelTranslation(String translationId) { + // Generated convenience method for cancelTranslationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return cancelTranslationWithResponse(translationId, requestOptions).getValue() + .toObject(TranslationStatusResult.class); + } + + /** + * Returns a list of supported document formats + * + * The list of supported formats supported by the Document Translation + * service. + * The list includes the common file extension, as well as the + * content-type if using the upload API. + * + * @param type the type of format like document or glossary. + * @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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of supported file formats. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + SupportedFileFormats getSupportedFormats(FileFormatType type) { + // Generated convenience method for getSupportedFormatsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type.toString(), false); + } + return getSupportedFormatsWithResponse(requestOptions).getValue().toObject(SupportedFileFormats.class); + } + + /** + * Returns a list of supported document formats + * + * The list of supported formats supported by the Document Translation + * service. + * The list includes the common file extension, as well as the + * content-type if using the upload API. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of supported file formats. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + SupportedFileFormats getSupportedFormats() { + // Generated convenience method for getSupportedFormatsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getSupportedFormatsWithResponse(requestOptions).getValue().toObject(SupportedFileFormats.class); + } + + /** + * Submit a document translation request to the Document Translation service + * + * Use this API to submit a bulk (batch) translation request to the Document + * Translation service. + * Each request can contain multiple documents and must + * contain a source and destination container for each document. + * + * The + * prefix and suffix filter (if supplied) are used to filter folders. The prefix + * is applied to the subpath after the container name. + * + * Glossaries / + * Translation memory can be included in the request and are applied by the + * service when the document is translated. + * + * If the glossary is + * invalid or unreachable during translation, an error is indicated in the + * document status. + * If a file with the same name already exists at the + * destination, it will be overwritten. The targetUrl for each target language + * must be unique. + *

Request Body Schema

* *
      * {@code
      * {
-     *     id: String (Required)
-     *     createdDateTimeUtc: OffsetDateTime (Required)
-     *     lastActionDateTimeUtc: OffsetDateTime (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) (Required)
-     *     error (Optional): {
-     *         code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         innerError (Optional): {
-     *             code: String (Required)
-     *             message: String (Required)
-     *             target: String (Optional)
-     *             innerError (Optional): (recursive schema, see innerError above)
+     *     inputs (Required): [
+     *          (Required){
+     *             source (Required): {
+     *                 sourceUrl: String (Required)
+     *                 filter (Optional): {
+     *                     prefix: String (Optional)
+     *                     suffix: String (Optional)
+     *                 }
+     *                 language: String (Optional)
+     *                 storageSource: String(AzureBlob) (Optional)
+     *             }
+     *             targets (Required): [
+     *                  (Required){
+     *                     targetUrl: String (Required)
+     *                     category: String (Optional)
+     *                     language: String (Required)
+     *                     glossaries (Optional): [
+     *                          (Optional){
+     *                             glossaryUrl: String (Required)
+     *                             format: String (Required)
+     *                             version: String (Optional)
+     *                             storageSource: String(AzureBlob) (Optional)
+     *                         }
+     *                     ]
+     *                     storageSource: String(AzureBlob) (Optional)
+     *                 }
+     *             ]
+     *             storageType: String(Folder/File) (Optional)
      *         }
-     *     }
-     *     summary (Required): {
-     *         total: int (Required)
-     *         failed: int (Required)
-     *         success: int (Required)
-     *         inProgress: int (Required)
-     *         notYetStarted: int (Required)
-     *         cancelled: int (Required)
-     *         totalCharacterCharged: long (Required)
-     *     }
+     *     ]
      * }
      * }
      * 
* - * @param id Format - uuid. The operation id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return translation job status response along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTranslationStatusWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.getTranslationStatusWithResponse(id, requestOptions); - } - - /** - * Cancel a currently processing or queued translation + * @param body Translation job submission batch 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. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginBeginTranslation(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.beginBeginTranslation(body, requestOptions); + } + + /** + * Returns a list of batch requests submitted and the status for each request + * + * Returns a list of batch requests submitted and the status for each + * request. + * This list only contains batch requests submitted by the user (based on + * the resource). + * + * If the number of requests exceeds our paging limit, + * server-side paging is used. Paginated responses indicate a partial result and + * include a continuation token in the response. + * The absence of a continuation + * token means that no additional pages are available. + * + * top, skip + * and maxpagesize query parameters can be used to specify a number of results to + * return and an offset for the collection. + * + * top indicates the total + * number of records the user wants to be returned across all pages. + * skip + * indicates the number of records to skip from the list of batches based on the + * sorting method specified. By default, we sort by descending start + * time. + * maxpagesize is the maximum items returned in a page. If more items are + * requested via top (or top is not specified and there are more items to be + * returned), @nextLink will contain the link to the next page. + * + * orderby query parameter can be used to sort the returned list (ex + * "orderby=createdDateTimeUtc asc" or "orderby=createdDateTimeUtc + * desc"). + * The default sorting is descending by createdDateTimeUtc. + * Some query + * parameters can be used to filter the returned list (ex: + * "status=Succeeded,Cancelled") will only return succeeded and cancelled + * operations. + * createdDateTimeUtcStart and createdDateTimeUtcEnd can be used + * combined or separately to specify a range of datetime to filter the returned + * list by. + * The supported filtering query parameters are (status, ids, + * createdDateTimeUtcStart, createdDateTimeUtcEnd). + * + * The server honors + * the values specified by the client. However, clients must be prepared to handle + * responses that contain a different page size or contain a continuation token. * - * Cancel a currently processing or queued translation. - * A translation will not be - * cancelled if it is already completed or failed or cancelling. A bad request - * will be returned. - * All documents that have completed translation will not be - * cancelled and will be charged. - * All pending documents will be cancelled if - * possible. + * When both top and skip are included, the server should first apply + * skip and then top on the collection. + * Note: If the server can't honor top + * and/or skip, the server must return an error to the client informing about it + * instead of just ignoring the query options. + * This reduces the risk of the client + * making assumptions about the data returned. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNotop indicates the total number of records the user wants to be + * returned across + * all pages. + * + * Clients MAY use top and skip query parameters to + * specify a number of results to return and an offset into the collection. + * When + * both top and skip are given by a client, the server SHOULD first apply skip + * and then top on the collection. + * + * Note: If the server can't honor + * top and/or skip, the server MUST return an error to the client informing + * about it instead of just ignoring the query options.
skipIntegerNoskip indicates the number of records to skip from the list of + * records held by + * the server based on the sorting method specified. By default, we sort by + * descending start time. + * + * Clients MAY use top and skip query + * parameters to specify a number of results to return and an offset into the + * collection. + * When both top and skip are given by a client, the server SHOULD + * first apply skip and then top on the collection. + * + * Note: If the + * server can't honor top and/or skip, the server MUST return an error to the + * client informing about it instead of just ignoring the query options.
maxpagesizeIntegerNomaxpagesize is the maximum items returned in a page. If + * more items are + * requested via top (or top is not specified and there are more items to be + * returned), @nextLink will contain the link to the next page. + * + * Clients MAY request server-driven paging with a specific page size by + * specifying a maxpagesize preference. The server SHOULD honor this preference + * if the specified page size is smaller than the server's default page size.
idsList<String>NoIds to use in filtering. In the form of "," separated + * string.
statusesList<String>NoStatuses to use in filtering. In the form of "," + * separated string.
createdDateTimeUtcStartOffsetDateTimeNothe start datetime to get items + * after
createdDateTimeUtcEndOffsetDateTimeNothe end datetime to get items + * before
orderbyList<String>Nothe sorting query for the collection (ex: + * 'CreatedDateTimeUtc asc','CreatedDateTimeUtc desc'). In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} *

Response Body Schema

* *
@@ -420,18 +607,17 @@ public Response getTranslationStatusWithResponse(String id, RequestO
      * }
      * 
* - * @param id Format - uuid. The operation-id. * @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. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return translation job status response along with {@link Response}. + * @return translation job Status Response as paginated response with {@link PagedIterable}. */ @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response cancelTranslationWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.cancelTranslationWithResponse(id, requestOptions); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTranslationStatuses(RequestOptions requestOptions) { + return this.serviceClient.listTranslationStatuses(requestOptions); } /** @@ -561,7 +747,7 @@ public Response cancelTranslationWithResponse(String id, RequestOpti * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -571,61 +757,8 @@ public Response cancelTranslationWithResponse(String id, RequestOpti */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getDocumentsStatus(String id, RequestOptions requestOptions) { - return this.serviceClient.getDocumentsStatus(id, requestOptions); - } - - /** - * Returns a list of supported document formats - * - * The list of supported formats supported by the Document Translation - * service. - * The list includes the common file extension, as well as the - * content-type if using the upload API. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
typeStringNothe type of format like document or glossary . Allowed values: - * "document", "glossary".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *          (Required){
-     *             format: String (Required)
-     *             fileExtensions (Required): [
-     *                 String (Required)
-     *             ]
-     *             contentTypes (Required): [
-     *                 String (Required)
-     *             ]
-     *             defaultVersion: String (Optional)
-     *             versions (Optional): [
-     *                 String (Optional)
-     *             ]
-     *             type: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return list of supported file formats along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getSupportedFormatsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getSupportedFormatsWithResponse(requestOptions); + public PagedIterable listDocumentStatuses(String translationId, RequestOptions requestOptions) { + return this.serviceClient.listDocumentStatuses(translationId, requestOptions); } /** @@ -651,7 +784,7 @@ public Response getSupportedFormatsWithResponse(RequestOptions reque * destination, it will be overwritten. The targetUrl for each target language * must be unique. * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -662,12 +795,10 @@ public Response getSupportedFormatsWithResponse(RequestOptions reque */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller - beginStartTranslation(StartTranslationDetails startTranslationDetails) { - // Generated convenience method for beginStartTranslationWithModel + public SyncPoller beginBeginTranslation(TranslationBatch body) { + // Generated convenience method for beginBeginTranslationWithModel RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginStartTranslationWithModel(BinaryData.fromObject(startTranslationDetails), - requestOptions); + return serviceClient.beginBeginTranslationWithModel(BinaryData.fromObject(body), requestOptions); } /** @@ -749,7 +880,7 @@ public Response getSupportedFormatsWithResponse(RequestOptions reque * Note: If the * server can't honor top and/or skip, the server MUST return an error to the * client informing about it instead of just ignoring the query options. - * @param ids Ids to use in filtering. + * @param translationIds Ids to use in filtering. * @param statuses Statuses to use in filtering. * @param createdDateTimeUtcStart the start datetime to get items after. * @param createdDateTimeUtcEnd the end datetime to get items before. @@ -764,10 +895,10 @@ public Response getSupportedFormatsWithResponse(RequestOptions reque */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getTranslationsStatus(Integer top, Integer skip, List ids, - List statuses, OffsetDateTime createdDateTimeUtcStart, OffsetDateTime createdDateTimeUtcEnd, - List orderBy) { - // Generated convenience method for getTranslationsStatus + public PagedIterable listTranslationStatuses(Integer top, Integer skip, + List translationIds, List statuses, OffsetDateTime createdDateTimeUtcStart, + OffsetDateTime createdDateTimeUtcEnd, List orderBy) { + // Generated convenience method for listTranslationStatuses RequestOptions requestOptions = new RequestOptions(); if (top != null) { requestOptions.addQueryParam("top", String.valueOf(top), false); @@ -775,9 +906,9 @@ public PagedIterable getTranslationsStatus(Integer top, Integ if (skip != null) { requestOptions.addQueryParam("skip", String.valueOf(skip), false); } - if (ids != null) { + if (translationIds != null) { requestOptions.addQueryParam("ids", - ids.stream() + translationIds.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")), false); @@ -802,8 +933,8 @@ public PagedIterable getTranslationsStatus(Integer top, Integ .collect(Collectors.joining(",")), false); } - return serviceClient.getTranslationsStatus(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(TranslationStatus.class)); + return serviceClient.listTranslationStatuses(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(TranslationStatusResult.class)); } /** @@ -869,89 +1000,11 @@ public PagedIterable getTranslationsStatus(Integer top, Integ */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getTranslationsStatus() { - // Generated convenience method for getTranslationsStatus - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.getTranslationsStatus(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(TranslationStatus.class)); - } - - /** - * Returns the status for a specific document - * - * Returns the translation status for a specific document based on the request Id - * and document Id. - * - * @param id Format - uuid. The batch id. - * @param documentId Format - uuid. The document id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return document Status Response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DocumentStatus getDocumentStatus(String id, String documentId) { - // Generated convenience method for getDocumentStatusWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDocumentStatusWithResponse(id, documentId, requestOptions).getValue().toObject(DocumentStatus.class); - } - - /** - * Returns the status for a document translation request - * - * Returns the status for a document translation request. - * The status includes the - * overall request status, as well as the status for documents that are being - * translated as part of that request. - * - * @param id Format - uuid. The operation id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return translation job status response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public TranslationStatus getTranslationStatus(String id) { - // Generated convenience method for getTranslationStatusWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTranslationStatusWithResponse(id, requestOptions).getValue().toObject(TranslationStatus.class); - } - - /** - * Cancel a currently processing or queued translation - * - * Cancel a currently processing or queued translation. - * A translation will not be - * cancelled if it is already completed or failed or cancelling. A bad request - * will be returned. - * All documents that have completed translation will not be - * cancelled and will be charged. - * All pending documents will be cancelled if - * possible. - * - * @param id Format - uuid. The operation-id. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return translation job status response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public TranslationStatus cancelTranslation(String id) { - // Generated convenience method for cancelTranslationWithResponse + public PagedIterable listTranslationStatuses() { + // Generated convenience method for listTranslationStatuses RequestOptions requestOptions = new RequestOptions(); - return cancelTranslationWithResponse(id, requestOptions).getValue().toObject(TranslationStatus.class); + return serviceClient.listTranslationStatuses(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(TranslationStatusResult.class)); } /** @@ -1002,7 +1055,7 @@ public TranslationStatus cancelTranslation(String id) { * This reduces the risk of the client making assumptions about * the data returned. * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @param top top indicates the total number of records the user wants to be returned across * all pages. * @@ -1028,7 +1081,7 @@ public TranslationStatus cancelTranslation(String id) { * Note: If the * server can't honor top and/or skip, the server MUST return an error to the * client informing about it instead of just ignoring the query options. - * @param ids Ids to use in filtering. + * @param documentIds Ids to use in filtering. * @param statuses Statuses to use in filtering. * @param createdDateTimeUtcStart the start datetime to get items after. * @param createdDateTimeUtcEnd the end datetime to get items before. @@ -1043,10 +1096,10 @@ public TranslationStatus cancelTranslation(String id) { */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getDocumentsStatus(String id, Integer top, Integer skip, List ids, - List statuses, OffsetDateTime createdDateTimeUtcStart, OffsetDateTime createdDateTimeUtcEnd, - List orderBy) { - // Generated convenience method for getDocumentsStatus + public PagedIterable listDocumentStatuses(String translationId, Integer top, Integer skip, + List documentIds, List statuses, OffsetDateTime createdDateTimeUtcStart, + OffsetDateTime createdDateTimeUtcEnd, List orderBy) { + // Generated convenience method for listDocumentStatuses RequestOptions requestOptions = new RequestOptions(); if (top != null) { requestOptions.addQueryParam("top", String.valueOf(top), false); @@ -1054,9 +1107,9 @@ public PagedIterable getDocumentsStatus(String id, Integer top, if (skip != null) { requestOptions.addQueryParam("skip", String.valueOf(skip), false); } - if (ids != null) { + if (documentIds != null) { requestOptions.addQueryParam("ids", - ids.stream() + documentIds.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")), false); @@ -1081,7 +1134,7 @@ public PagedIterable getDocumentsStatus(String id, Integer top, .collect(Collectors.joining(",")), false); } - return serviceClient.getDocumentsStatus(id, requestOptions) + return serviceClient.listDocumentStatuses(translationId, requestOptions) .mapPage(bodyItemValue -> bodyItemValue.toObject(DocumentStatus.class)); } @@ -1133,7 +1186,7 @@ public PagedIterable getDocumentsStatus(String id, Integer top, * This reduces the risk of the client making assumptions about * the data returned. * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -1144,61 +1197,10 @@ public PagedIterable getDocumentsStatus(String id, Integer top, */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getDocumentsStatus(String id) { - // Generated convenience method for getDocumentsStatus + public PagedIterable listDocumentStatuses(String translationId) { + // Generated convenience method for listDocumentStatuses RequestOptions requestOptions = new RequestOptions(); - return serviceClient.getDocumentsStatus(id, requestOptions) + return serviceClient.listDocumentStatuses(translationId, requestOptions) .mapPage(bodyItemValue -> bodyItemValue.toObject(DocumentStatus.class)); } - - /** - * Returns a list of supported document formats - * - * The list of supported formats supported by the Document Translation - * service. - * The list includes the common file extension, as well as the - * content-type if using the upload API. - * - * @param type the type of format like document or glossary. - * @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. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of supported file formats. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SupportedFileFormats getSupportedFormats(FileFormatType type) { - // Generated convenience method for getSupportedFormatsWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (type != null) { - requestOptions.addQueryParam("type", type.toString(), false); - } - return getSupportedFormatsWithResponse(requestOptions).getValue().toObject(SupportedFileFormats.class); - } - - /** - * Returns a list of supported document formats - * - * The list of supported formats supported by the Document Translation - * service. - * The list includes the common file extension, as well as the - * content-type if using the upload API. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of supported file formats. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SupportedFileFormats getSupportedFormats() { - // Generated convenience method for getSupportedFormatsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getSupportedFormatsWithResponse(requestOptions).getValue().toObject(SupportedFileFormats.class); - } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationAsyncClient.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationAsyncClient.java index 4b06e2f6b63fb..84c02e035021b 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationAsyncClient.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationAsyncClient.java @@ -82,12 +82,11 @@ public final class SingleDocumentTranslationAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - Mono> documentTranslateWithResponse(String targetLanguage, BinaryData documentTranslateContent, + Mono> translateWithResponse(String targetLanguage, BinaryData documentTranslateContent, RequestOptions requestOptions) { - // Protocol API requires serialization of parts with content-disposition and data, as operation - // 'documentTranslate' is 'multipart/form-data' - return this.serviceClient.documentTranslateWithResponseAsync(targetLanguage, documentTranslateContent, - requestOptions); + // Protocol API requires serialization of parts with content-disposition and data, as operation 'translate' is + // 'multipart/form-data' + return this.serviceClient.translateWithResponseAsync(targetLanguage, documentTranslateContent, requestOptions); } /** @@ -119,9 +118,9 @@ Mono> documentTranslateWithResponse(String targetLanguage, */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono documentTranslate(String targetLanguage, DocumentTranslateContent documentTranslateContent, + public Mono translate(String targetLanguage, DocumentTranslateContent documentTranslateContent, String sourceLanguage, String category, Boolean allowFallback) { - // Generated convenience method for documentTranslateWithResponse + // Generated convenience method for translateWithResponse RequestOptions requestOptions = new RequestOptions(); if (sourceLanguage != null) { requestOptions.addQueryParam("sourceLanguage", sourceLanguage, false); @@ -132,7 +131,7 @@ public Mono documentTranslate(String targetLanguage, DocumentTransla if (allowFallback != null) { requestOptions.addQueryParam("allowFallback", String.valueOf(allowFallback), false); } - return documentTranslateWithResponse(targetLanguage, + return translateWithResponse(targetLanguage, new MultipartFormDataHelper(requestOptions) .serializeFileField("document", documentTranslateContent.getDocument().getContent(), documentTranslateContent.getDocument().getContentType(), @@ -180,11 +179,10 @@ public Mono documentTranslate(String targetLanguage, DocumentTransla */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono documentTranslate(String targetLanguage, - DocumentTranslateContent documentTranslateContent) { - // Generated convenience method for documentTranslateWithResponse + public Mono translate(String targetLanguage, DocumentTranslateContent documentTranslateContent) { + // Generated convenience method for translateWithResponse RequestOptions requestOptions = new RequestOptions(); - return documentTranslateWithResponse(targetLanguage, + return translateWithResponse(targetLanguage, new MultipartFormDataHelper(requestOptions) .serializeFileField("document", documentTranslateContent.getDocument().getContent(), documentTranslateContent.getDocument().getContentType(), diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationClient.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationClient.java index ddf9235951e00..8f1b193bca8f3 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationClient.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/SingleDocumentTranslationClient.java @@ -80,12 +80,11 @@ public final class SingleDocumentTranslationClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - Response documentTranslateWithResponse(String targetLanguage, BinaryData documentTranslateContent, + Response translateWithResponse(String targetLanguage, BinaryData documentTranslateContent, RequestOptions requestOptions) { - // Protocol API requires serialization of parts with content-disposition and data, as operation - // 'documentTranslate' is 'multipart/form-data' - return this.serviceClient.documentTranslateWithResponse(targetLanguage, documentTranslateContent, - requestOptions); + // Protocol API requires serialization of parts with content-disposition and data, as operation 'translate' is + // 'multipart/form-data' + return this.serviceClient.translateWithResponse(targetLanguage, documentTranslateContent, requestOptions); } /** @@ -117,9 +116,9 @@ Response documentTranslateWithResponse(String targetLanguage, Binary */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData documentTranslate(String targetLanguage, DocumentTranslateContent documentTranslateContent, + public BinaryData translate(String targetLanguage, DocumentTranslateContent documentTranslateContent, String sourceLanguage, String category, Boolean allowFallback) { - // Generated convenience method for documentTranslateWithResponse + // Generated convenience method for translateWithResponse RequestOptions requestOptions = new RequestOptions(); if (sourceLanguage != null) { requestOptions.addQueryParam("sourceLanguage", sourceLanguage, false); @@ -130,7 +129,7 @@ public BinaryData documentTranslate(String targetLanguage, DocumentTranslateCont if (allowFallback != null) { requestOptions.addQueryParam("allowFallback", String.valueOf(allowFallback), false); } - return documentTranslateWithResponse(targetLanguage, + return translateWithResponse(targetLanguage, new MultipartFormDataHelper(requestOptions) .serializeFileField("document", documentTranslateContent.getDocument().getContent(), documentTranslateContent.getDocument().getContentType(), @@ -178,10 +177,10 @@ public BinaryData documentTranslate(String targetLanguage, DocumentTranslateCont */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData documentTranslate(String targetLanguage, DocumentTranslateContent documentTranslateContent) { - // Generated convenience method for documentTranslateWithResponse + public BinaryData translate(String targetLanguage, DocumentTranslateContent documentTranslateContent) { + // Generated convenience method for translateWithResponse RequestOptions requestOptions = new RequestOptions(); - return documentTranslateWithResponse(targetLanguage, + return translateWithResponse(targetLanguage, new MultipartFormDataHelper(requestOptions) .serializeFileField("document", documentTranslateContent.getDocument().getContent(), documentTranslateContent.getDocument().getContentType(), diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/DocumentTranslationClientImpl.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/DocumentTranslationClientImpl.java index cf440221edca8..1381ae4f3d8f4 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/DocumentTranslationClientImpl.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/DocumentTranslationClientImpl.java @@ -5,7 +5,7 @@ package com.azure.ai.translation.document.implementation; import com.azure.ai.translation.document.DocumentTranslationServiceVersion; -import com.azure.ai.translation.document.models.TranslationStatus; +import com.azure.ai.translation.document.models.TranslationStatusResult; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; @@ -177,9 +177,9 @@ public interface DocumentTranslationClientService { @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> startTranslation(@HostParam("endpoint") String endpoint, + Mono> beginTranslation(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData startTranslationDetails, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); @Post("/document/batches") @@ -188,9 +188,9 @@ Mono> startTranslation(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response startTranslationSync(@HostParam("endpoint") String endpoint, + Response beginTranslationSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData startTranslationDetails, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); @Get("/document/batches") @@ -199,7 +199,7 @@ Response startTranslationSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTranslationsStatus(@HostParam("endpoint") String endpoint, + Mono> listTranslationStatuses(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -209,7 +209,7 @@ Mono> getTranslationsStatus(@HostParam("endpoint") String e @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTranslationsStatusSync(@HostParam("endpoint") String endpoint, + Response listTranslationStatusesSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -220,7 +220,7 @@ Response getTranslationsStatusSync(@HostParam("endpoint") String end @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> getDocumentStatus(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @PathParam("documentId") String documentId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -231,7 +231,7 @@ Mono> getDocumentStatus(@HostParam("endpoint") String endpo @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response getDocumentStatusSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @PathParam("documentId") String documentId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -242,7 +242,7 @@ Response getDocumentStatusSync(@HostParam("endpoint") String endpoin @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> getTranslationStatus(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/document/batches/{id}") @@ -252,7 +252,7 @@ Mono> getTranslationStatus(@HostParam("endpoint") String en @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response getTranslationStatusSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/document/batches/{id}") @@ -262,7 +262,7 @@ Response getTranslationStatusSync(@HostParam("endpoint") String endp @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> cancelTranslation(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/document/batches/{id}") @@ -272,7 +272,7 @@ Mono> cancelTranslation(@HostParam("endpoint") String endpo @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response cancelTranslationSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/document/batches/{id}/documents") @@ -281,8 +281,8 @@ Response cancelTranslationSync(@HostParam("endpoint") String endpoin @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDocumentsStatus(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + Mono> listDocumentStatuses(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/document/batches/{id}/documents") @@ -291,8 +291,8 @@ Mono> getDocumentsStatus(@HostParam("endpoint") String endp @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDocumentsStatusSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + Response listDocumentStatusesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") String translationId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/document/formats") @@ -321,7 +321,7 @@ Response getSupportedFormatsSync(@HostParam("endpoint") String endpo @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTranslationsStatusNext( + Mono> listTranslationStatusesNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -331,7 +331,7 @@ Mono> getTranslationsStatusNext( @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTranslationsStatusNextSync( + Response listTranslationStatusesNextSync( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -341,7 +341,7 @@ Response getTranslationsStatusNextSync( @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDocumentsStatusNext( + Mono> listDocumentStatusesNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -351,9 +351,9 @@ Mono> getDocumentsStatusNext( @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDocumentsStatusNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); + Response listDocumentStatusesNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); } /** @@ -417,7 +417,7 @@ Response getDocumentsStatusNextSync(@PathParam(value = "nextLink", e * } * * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -426,13 +426,11 @@ Response getDocumentsStatusNextSync(@PathParam(value = "nextLink", e * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> startTranslationWithResponseAsync(BinaryData startTranslationDetails, - RequestOptions requestOptions) { + private Mono> beginTranslationWithResponseAsync(BinaryData body, RequestOptions requestOptions) { final String contentType = "application/json"; final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.startTranslation(this.getEndpoint(), this.getServiceVersion().getVersion(), - contentType, accept, startTranslationDetails, requestOptions, context)); + return FluxUtil.withContext(context -> service.beginTranslation(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); } /** @@ -496,7 +494,7 @@ private Mono> startTranslationWithResponseAsync(BinaryData startT * } * * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -505,12 +503,11 @@ private Mono> startTranslationWithResponseAsync(BinaryData startT * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Response startTranslationWithResponse(BinaryData startTranslationDetails, - RequestOptions requestOptions) { + private Response beginTranslationWithResponse(BinaryData body, RequestOptions requestOptions) { final String contentType = "application/json"; final String accept = "application/json"; - return service.startTranslationSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - accept, startTranslationDetails, requestOptions, Context.NONE); + return service.beginTranslationSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + accept, body, requestOptions, Context.NONE); } /** @@ -574,7 +571,7 @@ private Response startTranslationWithResponse(BinaryData startTranslationD * } * * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -583,10 +580,10 @@ private Response startTranslationWithResponse(BinaryData startTranslationD * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginStartTranslationAsync(BinaryData startTranslationDetails, + public PollerFlux beginBeginTranslationAsync(BinaryData body, RequestOptions requestOptions) { return PollerFlux.create(Duration.ofSeconds(1), - () -> this.startTranslationWithResponseAsync(startTranslationDetails, requestOptions), + () -> this.beginTranslationWithResponseAsync(body, requestOptions), new DefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/translator".replace("{endpoint}", this.getEndpoint())) .setContext(requestOptions != null && requestOptions.getContext() != null @@ -657,7 +654,7 @@ public PollerFlux beginStartTranslationAsync(BinaryData * } * * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -666,10 +663,9 @@ public PollerFlux beginStartTranslationAsync(BinaryData * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginStartTranslation(BinaryData startTranslationDetails, - RequestOptions requestOptions) { + public SyncPoller beginBeginTranslation(BinaryData body, RequestOptions requestOptions) { return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.startTranslationWithResponse(startTranslationDetails, requestOptions), + () -> this.beginTranslationWithResponse(body, requestOptions), new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/translator".replace("{endpoint}", this.getEndpoint())) .setContext(requestOptions != null && requestOptions.getContext() != null @@ -740,7 +736,7 @@ public SyncPoller beginStartTranslation(BinaryData start * } * * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -749,18 +745,18 @@ public SyncPoller beginStartTranslation(BinaryData start * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux - beginStartTranslationWithModelAsync(BinaryData startTranslationDetails, RequestOptions requestOptions) { + public PollerFlux + beginBeginTranslationWithModelAsync(BinaryData body, RequestOptions requestOptions) { return PollerFlux.create(Duration.ofSeconds(1), - () -> this.startTranslationWithResponseAsync(startTranslationDetails, requestOptions), + () -> this.beginTranslationWithResponseAsync(body, requestOptions), new DefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/translator".replace("{endpoint}", this.getEndpoint())) .setContext(requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(TranslationStatus.class), - TypeReference.createInstance(TranslationStatus.class)); + TypeReference.createInstance(TranslationStatusResult.class), + TypeReference.createInstance(TranslationStatusResult.class)); } /** @@ -824,7 +820,7 @@ public SyncPoller beginStartTranslation(BinaryData start * } * * - * @param startTranslationDetails Translation job submission batch request. + * @param body Translation job submission batch 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. @@ -833,18 +829,18 @@ public SyncPoller beginStartTranslation(BinaryData start * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller - beginStartTranslationWithModel(BinaryData startTranslationDetails, RequestOptions requestOptions) { + public SyncPoller beginBeginTranslationWithModel(BinaryData body, + RequestOptions requestOptions) { return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.startTranslationWithResponse(startTranslationDetails, requestOptions), + () -> this.beginTranslationWithResponse(body, requestOptions), new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/translator".replace("{endpoint}", this.getEndpoint())) .setContext(requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(TranslationStatus.class), - TypeReference.createInstance(TranslationStatus.class)); + TypeReference.createInstance(TranslationStatusResult.class), + TypeReference.createInstance(TranslationStatusResult.class)); } /** @@ -996,10 +992,10 @@ public SyncPoller beginStartTranslation(BinaryData start * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getTranslationsStatusSinglePageAsync(RequestOptions requestOptions) { + private Mono> listTranslationStatusesSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getTranslationsStatus(this.getEndpoint(), + .withContext(context -> service.listTranslationStatuses(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); @@ -1153,7 +1149,7 @@ private Mono> getTranslationsStatusSinglePageAsync(Req * @return translation job Status Response as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getTranslationsStatusAsync(RequestOptions requestOptions) { + public PagedFlux listTranslationStatusesAsync(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); @@ -1166,7 +1162,7 @@ public PagedFlux getTranslationsStatusAsync(RequestOptions requestOp requestLocal.setUrl(urlBuilder.toString()); }); } - return getTranslationsStatusSinglePageAsync(requestOptionsLocal); + return listTranslationStatusesSinglePageAsync(requestOptionsLocal); }, (nextLink, pageSize) -> { RequestOptions requestOptionsLocal = new RequestOptions(); requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); @@ -1177,7 +1173,7 @@ public PagedFlux getTranslationsStatusAsync(RequestOptions requestOp requestLocal.setUrl(urlBuilder.toString()); }); } - return getTranslationsStatusNextSinglePageAsync(nextLink, requestOptionsLocal); + return listTranslationStatusesNextSinglePageAsync(nextLink, requestOptionsLocal); }); } @@ -1329,9 +1325,9 @@ public PagedFlux getTranslationsStatusAsync(RequestOptions requestOp * @return translation job Status Response along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse getTranslationsStatusSinglePage(RequestOptions requestOptions) { + private PagedResponse listTranslationStatusesSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.getTranslationsStatusSync(this.getEndpoint(), + Response res = service.listTranslationStatusesSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); @@ -1485,7 +1481,7 @@ private PagedResponse getTranslationsStatusSinglePage(RequestOptions * @return translation job Status Response as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getTranslationsStatus(RequestOptions requestOptions) { + public PagedIterable listTranslationStatuses(RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); @@ -1498,7 +1494,7 @@ public PagedIterable getTranslationsStatus(RequestOptions requestOpt requestLocal.setUrl(urlBuilder.toString()); }); } - return getTranslationsStatusSinglePage(requestOptionsLocal); + return listTranslationStatusesSinglePage(requestOptionsLocal); }, (nextLink, pageSize) -> { RequestOptions requestOptionsLocal = new RequestOptions(); requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); @@ -1509,7 +1505,7 @@ public PagedIterable getTranslationsStatus(RequestOptions requestOpt requestLocal.setUrl(urlBuilder.toString()); }); } - return getTranslationsStatusNextSinglePage(nextLink, requestOptionsLocal); + return listTranslationStatusesNextSinglePage(nextLink, requestOptionsLocal); }); } @@ -1547,7 +1543,7 @@ public PagedIterable getTranslationsStatus(RequestOptions requestOpt * } * * - * @param id Format - uuid. The batch id. + * @param translationId Format - uuid. The batch id. * @param documentId Format - uuid. The document id. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1557,11 +1553,11 @@ public PagedIterable getTranslationsStatus(RequestOptions requestOpt * @return document Status Response along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDocumentStatusWithResponseAsync(String id, String documentId, + public Mono> getDocumentStatusWithResponseAsync(String translationId, String documentId, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext(context -> service.getDocumentStatus(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, documentId, accept, requestOptions, context)); + this.getServiceVersion().getVersion(), translationId, documentId, accept, requestOptions, context)); } /** @@ -1598,7 +1594,7 @@ public Mono> getDocumentStatusWithResponseAsync(String id, * } * * - * @param id Format - uuid. The batch id. + * @param translationId Format - uuid. The batch id. * @param documentId Format - uuid. The document id. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1608,11 +1604,11 @@ public Mono> getDocumentStatusWithResponseAsync(String id, * @return document Status Response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDocumentStatusWithResponse(String id, String documentId, + public Response getDocumentStatusWithResponse(String translationId, String documentId, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getDocumentStatusSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, documentId, - accept, requestOptions, Context.NONE); + return service.getDocumentStatusSync(this.getEndpoint(), this.getServiceVersion().getVersion(), translationId, + documentId, accept, requestOptions, Context.NONE); } /** @@ -1655,7 +1651,7 @@ public Response getDocumentStatusWithResponse(String id, String docu * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -1664,10 +1660,11 @@ public Response getDocumentStatusWithResponse(String id, String docu * @return translation job status response along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTranslationStatusWithResponseAsync(String id, RequestOptions requestOptions) { + public Mono> getTranslationStatusWithResponseAsync(String translationId, + RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext(context -> service.getTranslationStatus(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, accept, requestOptions, context)); + this.getServiceVersion().getVersion(), translationId, accept, requestOptions, context)); } /** @@ -1710,7 +1707,7 @@ public Mono> getTranslationStatusWithResponseAsync(String i * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -1719,10 +1716,10 @@ public Mono> getTranslationStatusWithResponseAsync(String i * @return translation job status response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTranslationStatusWithResponse(String id, RequestOptions requestOptions) { + public Response getTranslationStatusWithResponse(String translationId, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getTranslationStatusSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, accept, - requestOptions, Context.NONE); + return service.getTranslationStatusSync(this.getEndpoint(), this.getServiceVersion().getVersion(), + translationId, accept, requestOptions, Context.NONE); } /** @@ -1769,7 +1766,7 @@ public Response getTranslationStatusWithResponse(String id, RequestO * } * * - * @param id Format - uuid. The operation-id. + * @param translationId Format - uuid. The operation-id. * @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. @@ -1778,10 +1775,11 @@ public Response getTranslationStatusWithResponse(String id, RequestO * @return translation job status response along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> cancelTranslationWithResponseAsync(String id, RequestOptions requestOptions) { + public Mono> cancelTranslationWithResponseAsync(String translationId, + RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext(context -> service.cancelTranslation(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, accept, requestOptions, context)); + this.getServiceVersion().getVersion(), translationId, accept, requestOptions, context)); } /** @@ -1828,7 +1826,7 @@ public Mono> cancelTranslationWithResponseAsync(String id, * } * * - * @param id Format - uuid. The operation-id. + * @param translationId Format - uuid. The operation-id. * @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. @@ -1837,10 +1835,10 @@ public Mono> cancelTranslationWithResponseAsync(String id, * @return translation job status response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response cancelTranslationWithResponse(String id, RequestOptions requestOptions) { + public Response cancelTranslationWithResponse(String translationId, RequestOptions requestOptions) { final String accept = "application/json"; - return service.cancelTranslationSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, accept, - requestOptions, Context.NONE); + return service.cancelTranslationSync(this.getEndpoint(), this.getServiceVersion().getVersion(), translationId, + accept, requestOptions, Context.NONE); } /** @@ -1973,7 +1971,7 @@ public Response cancelTranslationWithResponse(String id, RequestOpti * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -1982,12 +1980,12 @@ public Response cancelTranslationWithResponse(String id, RequestOpti * @return documents Status Response along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getDocumentsStatusSinglePageAsync(String id, + private Mono> listDocumentStatusesSinglePageAsync(String translationId, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getDocumentsStatus(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, accept, requestOptions, context)) + .withContext(context -> service.listDocumentStatuses(this.getEndpoint(), + this.getServiceVersion().getVersion(), translationId, accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } @@ -2122,7 +2120,7 @@ private Mono> getDocumentsStatusSinglePageAsync(String * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -2131,7 +2129,7 @@ private Mono> getDocumentsStatusSinglePageAsync(String * @return documents Status Response as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getDocumentsStatusAsync(String id, RequestOptions requestOptions) { + public PagedFlux listDocumentStatusesAsync(String translationId, RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); @@ -2144,7 +2142,7 @@ public PagedFlux getDocumentsStatusAsync(String id, RequestOptions r requestLocal.setUrl(urlBuilder.toString()); }); } - return getDocumentsStatusSinglePageAsync(id, requestOptionsLocal); + return listDocumentStatusesSinglePageAsync(translationId, requestOptionsLocal); }, (nextLink, pageSize) -> { RequestOptions requestOptionsLocal = new RequestOptions(); requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); @@ -2155,7 +2153,7 @@ public PagedFlux getDocumentsStatusAsync(String id, RequestOptions r requestLocal.setUrl(urlBuilder.toString()); }); } - return getDocumentsStatusNextSinglePageAsync(nextLink, requestOptionsLocal); + return listDocumentStatusesNextSinglePageAsync(nextLink, requestOptionsLocal); }); } @@ -2289,7 +2287,7 @@ public PagedFlux getDocumentsStatusAsync(String id, RequestOptions r * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -2298,10 +2296,11 @@ public PagedFlux getDocumentsStatusAsync(String id, RequestOptions r * @return documents Status Response along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse getDocumentsStatusSinglePage(String id, RequestOptions requestOptions) { + private PagedResponse listDocumentStatusesSinglePage(String translationId, + RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.getDocumentsStatusSync(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, accept, requestOptions, Context.NONE); + Response res = service.listDocumentStatusesSync(this.getEndpoint(), + this.getServiceVersion().getVersion(), translationId, accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } @@ -2436,7 +2435,7 @@ private PagedResponse getDocumentsStatusSinglePage(String id, Reques * } * * - * @param id Format - uuid. The operation id. + * @param translationId Format - uuid. The operation id. * @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. @@ -2445,7 +2444,7 @@ private PagedResponse getDocumentsStatusSinglePage(String id, Reques * @return documents Status Response as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getDocumentsStatus(String id, RequestOptions requestOptions) { + public PagedIterable listDocumentStatuses(String translationId, RequestOptions requestOptions) { RequestOptions requestOptionsForNextPage = new RequestOptions(); requestOptionsForNextPage.setContext( requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); @@ -2458,7 +2457,7 @@ public PagedIterable getDocumentsStatus(String id, RequestOptions re requestLocal.setUrl(urlBuilder.toString()); }); } - return getDocumentsStatusSinglePage(id, requestOptionsLocal); + return listDocumentStatusesSinglePage(translationId, requestOptionsLocal); }, (nextLink, pageSize) -> { RequestOptions requestOptionsLocal = new RequestOptions(); requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); @@ -2469,7 +2468,7 @@ public PagedIterable getDocumentsStatus(String id, RequestOptions re requestLocal.setUrl(urlBuilder.toString()); }); } - return getDocumentsStatusNextSinglePage(nextLink, requestOptionsLocal); + return listDocumentStatusesNextSinglePage(nextLink, requestOptionsLocal); }); } @@ -2506,7 +2505,7 @@ public PagedIterable getDocumentsStatus(String id, RequestOptions re * versions (Optional): [ * String (Optional) * ] - * type: String (Optional) + * type: String(document/glossary) (Optional) * } * ] * } @@ -2560,7 +2559,7 @@ public Mono> getSupportedFormatsWithResponseAsync(RequestOp * versions (Optional): [ * String (Optional) * ] - * type: String (Optional) + * type: String(document/glossary) (Optional) * } * ] * } @@ -2628,11 +2627,12 @@ public Response getSupportedFormatsWithResponse(RequestOptions reque * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getTranslationsStatusNextSinglePageAsync(String nextLink, + private Mono> listTranslationStatusesNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getTranslationsStatusNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) + return FluxUtil + .withContext(context -> service.listTranslationStatusesNext(nextLink, this.getEndpoint(), accept, + requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } @@ -2683,11 +2683,11 @@ private Mono> getTranslationsStatusNextSinglePageAsync * @return translation job Status Response along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse getTranslationsStatusNextSinglePage(String nextLink, + private PagedResponse listTranslationStatusesNextSinglePage(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; - Response res - = service.getTranslationsStatusNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + Response res = service.listTranslationStatusesNextSync(nextLink, this.getEndpoint(), accept, + requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } @@ -2734,11 +2734,11 @@ private PagedResponse getTranslationsStatusNextSinglePage(String nex * @return documents Status Response along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getDocumentsStatusNextSinglePageAsync(String nextLink, + private Mono> listDocumentStatusesNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( - context -> service.getDocumentsStatusNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) + context -> service.listDocumentStatusesNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } @@ -2785,10 +2785,11 @@ private Mono> getDocumentsStatusNextSinglePageAsync(St * @return documents Status Response along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse getDocumentsStatusNextSinglePage(String nextLink, RequestOptions requestOptions) { + private PagedResponse listDocumentStatusesNextSinglePage(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; Response res - = service.getDocumentsStatusNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + = service.listDocumentStatusesNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/SingleDocumentTranslationClientImpl.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/SingleDocumentTranslationClientImpl.java index 4b92c5620f31d..c2ca570a27a71 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/SingleDocumentTranslationClientImpl.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/SingleDocumentTranslationClientImpl.java @@ -159,7 +159,7 @@ public interface SingleDocumentTranslationClientService { @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> documentTranslate(@HostParam("endpoint") String endpoint, + Mono> translate(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @QueryParam("targetLanguage") String targetLanguage, @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData documentTranslateContent, RequestOptions requestOptions, @@ -172,7 +172,7 @@ Mono> documentTranslate(@HostParam("endpoint") String endpo @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response documentTranslateSync(@HostParam("endpoint") String endpoint, + Response translateSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @QueryParam("targetLanguage") String targetLanguage, @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData documentTranslateContent, RequestOptions requestOptions, @@ -219,12 +219,12 @@ Response documentTranslateSync(@HostParam("endpoint") String endpoin * @return the response body along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> documentTranslateWithResponseAsync(String targetLanguage, + public Mono> translateWithResponseAsync(String targetLanguage, BinaryData documentTranslateContent, RequestOptions requestOptions) { final String contentType = "multipart/form-data"; final String accept = "application/octet-stream"; return FluxUtil - .withContext(context -> service.documentTranslate(this.getEndpoint(), this.getServiceVersion().getVersion(), + .withContext(context -> service.translate(this.getEndpoint(), this.getServiceVersion().getVersion(), targetLanguage, contentType, accept, documentTranslateContent, requestOptions, context)); } @@ -268,11 +268,11 @@ public Mono> documentTranslateWithResponseAsync(String targ * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response documentTranslateWithResponse(String targetLanguage, - BinaryData documentTranslateContent, RequestOptions requestOptions) { + public Response translateWithResponse(String targetLanguage, BinaryData documentTranslateContent, + RequestOptions requestOptions) { final String contentType = "multipart/form-data"; final String accept = "application/octet-stream"; - return service.documentTranslateSync(this.getEndpoint(), this.getServiceVersion().getVersion(), targetLanguage, + return service.translateSync(this.getEndpoint(), this.getServiceVersion().getVersion(), targetLanguage, contentType, accept, documentTranslateContent, requestOptions, Context.NONE); } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/FileFormat.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/FileFormat.java new file mode 100644 index 0000000000000..5c249cf35f2bf --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/FileFormat.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * File Format. + */ +@Immutable +public final class FileFormat implements JsonSerializable { + /* + * Name of the format + */ + @Generated + private final String format; + + /* + * Supported file extension for this format + */ + @Generated + private final List fileExtensions; + + /* + * Supported Content-Types for this format + */ + @Generated + private final List contentTypes; + + /* + * Default version if none is specified + */ + @Generated + private String defaultVersion; + + /* + * Supported Version + */ + @Generated + private List versions; + + /* + * Supported Type for this format + */ + @Generated + private FileFormatType type; + + /** + * Creates an instance of FileFormat class. + * + * @param format the format value to set. + * @param fileExtensions the fileExtensions value to set. + * @param contentTypes the contentTypes value to set. + */ + @Generated + private FileFormat(String format, List fileExtensions, List contentTypes) { + this.format = format; + this.fileExtensions = fileExtensions; + this.contentTypes = contentTypes; + } + + /** + * Get the format property: Name of the format. + * + * @return the format value. + */ + @Generated + public String getFormat() { + return this.format; + } + + /** + * Get the fileExtensions property: Supported file extension for this format. + * + * @return the fileExtensions value. + */ + @Generated + public List getFileExtensions() { + return this.fileExtensions; + } + + /** + * Get the contentTypes property: Supported Content-Types for this format. + * + * @return the contentTypes value. + */ + @Generated + public List getContentTypes() { + return this.contentTypes; + } + + /** + * Get the defaultVersion property: Default version if none is specified. + * + * @return the defaultVersion value. + */ + @Generated + public String getDefaultVersion() { + return this.defaultVersion; + } + + /** + * Get the versions property: Supported Version. + * + * @return the versions value. + */ + @Generated + public List getVersions() { + return this.versions; + } + + /** + * Get the type property: Supported Type for this format. + * + * @return the type value. + */ + @Generated + public FileFormatType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("format", this.format); + jsonWriter.writeArrayField("fileExtensions", this.fileExtensions, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("contentTypes", this.contentTypes, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("defaultVersion", this.defaultVersion); + jsonWriter.writeArrayField("versions", this.versions, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileFormat from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileFormat if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileFormat. + */ + @Generated + public static FileFormat fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String format = null; + List fileExtensions = null; + List contentTypes = null; + String defaultVersion = null; + List versions = null; + FileFormatType type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("format".equals(fieldName)) { + format = reader.getString(); + } else if ("fileExtensions".equals(fieldName)) { + fileExtensions = reader.readArray(reader1 -> reader1.getString()); + } else if ("contentTypes".equals(fieldName)) { + contentTypes = reader.readArray(reader1 -> reader1.getString()); + } else if ("defaultVersion".equals(fieldName)) { + defaultVersion = reader.getString(); + } else if ("versions".equals(fieldName)) { + versions = reader.readArray(reader1 -> reader1.getString()); + } else if ("type".equals(fieldName)) { + type = FileFormatType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + FileFormat deserializedFileFormat = new FileFormat(format, fileExtensions, contentTypes); + deserializedFileFormat.defaultVersion = defaultVersion; + deserializedFileFormat.versions = versions; + deserializedFileFormat.type = type; + + return deserializedFileFormat; + }); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/FileFormatType.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/FileFormatType.java new file mode 100644 index 0000000000000..9f8b64280b495 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/FileFormatType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Format types. + */ +public final class FileFormatType extends ExpandableStringEnum { + /** + * Document type file format. + */ + @Generated + public static final FileFormatType DOCUMENT = fromString("document"); + + /** + * Glossary type file format. + */ + @Generated + public static final FileFormatType GLOSSARY = fromString("glossary"); + + /** + * Creates a new instance of FileFormatType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public FileFormatType() { + } + + /** + * Creates or finds a FileFormatType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileFormatType. + */ + @Generated + public static FileFormatType fromString(String name) { + return fromString(name, FileFormatType.class); + } + + /** + * Gets known FileFormatType values. + * + * @return known FileFormatType values. + */ + @Generated + public static Collection values() { + return values(FileFormatType.class); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/SupportedFileFormats.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/SupportedFileFormats.java new file mode 100644 index 0000000000000..62ed214223854 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/SupportedFileFormats.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * List of supported file formats. + */ +@Immutable +public final class SupportedFileFormats implements JsonSerializable { + /* + * list of objects + */ + @Generated + private final List value; + + /** + * Creates an instance of SupportedFileFormats class. + * + * @param value the value value to set. + */ + @Generated + private SupportedFileFormats(List value) { + this.value = value; + } + + /** + * Get the value property: list of objects. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SupportedFileFormats from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SupportedFileFormats if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SupportedFileFormats. + */ + @Generated + public static SupportedFileFormats fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> FileFormat.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new SupportedFileFormats(value); + }); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/package-info.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/package-info.java new file mode 100644 index 0000000000000..3a0ed81bc4d31 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for DocumentTranslation. + * Document translation service. + * + */ +package com.azure.ai.translation.document.implementation.models; diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/DocumentStatus.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/DocumentStatus.java index a53ba0468a49b..bf79488c1a998 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/DocumentStatus.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/DocumentStatus.java @@ -48,7 +48,7 @@ public final class DocumentStatus implements JsonSerializable { * List of possible statuses for job or document */ @Generated - private final Status status; + private final TranslationStatus status; /* * To language @@ -81,29 +81,6 @@ public final class DocumentStatus implements JsonSerializable { @Generated private Integer characterCharged; - /** - * Creates an instance of DocumentStatus class. - * - * @param sourcePath the sourcePath value to set. - * @param createdDateTimeUtc the createdDateTimeUtc value to set. - * @param lastActionDateTimeUtc the lastActionDateTimeUtc value to set. - * @param status the status value to set. - * @param to the to value to set. - * @param progress the progress value to set. - * @param id the id value to set. - */ - @Generated - private DocumentStatus(String sourcePath, OffsetDateTime createdDateTimeUtc, OffsetDateTime lastActionDateTimeUtc, - Status status, String to, double progress, String id) { - this.sourcePath = sourcePath; - this.createdDateTimeUtc = createdDateTimeUtc; - this.lastActionDateTimeUtc = lastActionDateTimeUtc; - this.status = status; - this.to = to; - this.progress = progress; - this.id = id; - } - /** * Get the path property: Location of the document or folder. * @@ -150,7 +127,7 @@ public OffsetDateTime getLastActionDateTimeUtc() { * @return the status value. */ @Generated - public Status getStatus() { + public TranslationStatus getStatus() { return this.status; } @@ -246,7 +223,7 @@ public static DocumentStatus fromJson(JsonReader jsonReader) throws IOException String sourcePath = null; OffsetDateTime createdDateTimeUtc = null; OffsetDateTime lastActionDateTimeUtc = null; - Status status = null; + TranslationStatus status = null; String to = null; double progress = 0.0; String id = null; @@ -265,7 +242,7 @@ public static DocumentStatus fromJson(JsonReader jsonReader) throws IOException lastActionDateTimeUtc = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("status".equals(fieldName)) { - status = Status.fromString(reader.getString()); + status = TranslationStatus.fromString(reader.getString()); } else if ("to".equals(fieldName)) { to = reader.getString(); } else if ("progress".equals(fieldName)) { @@ -290,4 +267,27 @@ public static DocumentStatus fromJson(JsonReader jsonReader) throws IOException return deserializedDocumentStatus; }); } + + /** + * Creates an instance of DocumentStatus class. + * + * @param sourcePath the sourcePath value to set. + * @param createdDateTimeUtc the createdDateTimeUtc value to set. + * @param lastActionDateTimeUtc the lastActionDateTimeUtc value to set. + * @param status the status value to set. + * @param to the to value to set. + * @param progress the progress value to set. + * @param id the id value to set. + */ + @Generated + private DocumentStatus(String sourcePath, OffsetDateTime createdDateTimeUtc, OffsetDateTime lastActionDateTimeUtc, + TranslationStatus status, String to, double progress, String id) { + this.sourcePath = sourcePath; + this.createdDateTimeUtc = createdDateTimeUtc; + this.lastActionDateTimeUtc = lastActionDateTimeUtc; + this.status = status; + this.to = to; + this.progress = progress; + this.id = id; + } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/DocumentTranslationInput.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/DocumentTranslationInput.java new file mode 100644 index 0000000000000..6e199c167c547 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/DocumentTranslationInput.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Definition for the input batch translation request. + */ +@Fluent +public final class DocumentTranslationInput implements JsonSerializable { + /* + * Source of the input documents + */ + @Generated + private final SourceInput source; + + /* + * Location of the destination for the output + */ + @Generated + private final List targets; + + /* + * Storage type of the input documents source string + */ + @Generated + private StorageInputType storageType; + + /** + * Creates an instance of DocumentTranslationInput class. + * + * @param source the source value to set. + * @param targets the targets value to set. + */ + @Generated + public DocumentTranslationInput(SourceInput source, List targets) { + this.source = source; + this.targets = targets; + } + + /** + * Get the source property: Source of the input documents. + * + * @return the source value. + */ + @Generated + public SourceInput getSource() { + return this.source; + } + + /** + * Get the targets property: Location of the destination for the output. + * + * @return the targets value. + */ + @Generated + public List getTargets() { + return this.targets; + } + + /** + * Get the storageType property: Storage type of the input documents source string. + * + * @return the storageType value. + */ + @Generated + public StorageInputType getStorageType() { + return this.storageType; + } + + /** + * Set the storageType property: Storage type of the input documents source string. + * + * @param storageType the storageType value to set. + * @return the DocumentTranslationInput object itself. + */ + @Generated + public DocumentTranslationInput setStorageType(StorageInputType storageType) { + this.storageType = storageType; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("source", this.source); + jsonWriter.writeArrayField("targets", this.targets, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("storageType", this.storageType == null ? null : this.storageType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DocumentTranslationInput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DocumentTranslationInput if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DocumentTranslationInput. + */ + @Generated + public static DocumentTranslationInput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceInput source = null; + List targets = null; + StorageInputType storageType = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("source".equals(fieldName)) { + source = SourceInput.fromJson(reader); + } else if ("targets".equals(fieldName)) { + targets = reader.readArray(reader1 -> TargetInput.fromJson(reader1)); + } else if ("storageType".equals(fieldName)) { + storageType = StorageInputType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + DocumentTranslationInput deserializedDocumentTranslationInput + = new DocumentTranslationInput(source, targets); + deserializedDocumentTranslationInput.storageType = storageType; + + return deserializedDocumentTranslationInput; + }); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/Glossary.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/Glossary.java index c7eeee453b447..e742af07bd013 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/Glossary.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/Glossary.java @@ -44,7 +44,7 @@ public final class Glossary implements JsonSerializable { * Storage Source */ @Generated - private StorageSource storageSource; + private TranslationStorageSource storageSource; /** * Creates an instance of Glossary class. @@ -111,22 +111,10 @@ public Glossary setVersion(String version) { * @return the storageSource value. */ @Generated - public StorageSource getStorageSource() { + public TranslationStorageSource getStorageSource() { return this.storageSource; } - /** - * Set the storageSource property: Storage Source. - * - * @param storageSource the storageSource value to set. - * @return the Glossary object itself. - */ - @Generated - public Glossary setStorageSource(StorageSource storageSource) { - this.storageSource = storageSource; - return this; - } - /** * {@inheritDoc} */ @@ -156,7 +144,7 @@ public static Glossary fromJson(JsonReader jsonReader) throws IOException { String glossaryUrl = null; String format = null; String version = null; - StorageSource storageSource = null; + TranslationStorageSource storageSource = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -167,7 +155,7 @@ public static Glossary fromJson(JsonReader jsonReader) throws IOException { } else if ("version".equals(fieldName)) { version = reader.getString(); } else if ("storageSource".equals(fieldName)) { - storageSource = StorageSource.fromString(reader.getString()); + storageSource = TranslationStorageSource.fromString(reader.getString()); } else { reader.skipChildren(); } @@ -178,4 +166,16 @@ public static Glossary fromJson(JsonReader jsonReader) throws IOException { return deserializedGlossary; }); } + + /** + * Set the storageSource property: Storage Source. + * + * @param storageSource the storageSource value to set. + * @return the Glossary object itself. + */ + @Generated + public Glossary setStorageSource(TranslationStorageSource storageSource) { + this.storageSource = storageSource; + return this; + } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/SourceInput.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/SourceInput.java index d9dc722b5fc86..3482dfdcc7e4a 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/SourceInput.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/SourceInput.java @@ -40,7 +40,7 @@ public final class SourceInput implements JsonSerializable { * Storage Source */ @Generated - private StorageSource storageSource; + private TranslationStorageSource storageSource; /** * Creates an instance of SourceInput class. @@ -114,22 +114,10 @@ public SourceInput setLanguage(String language) { * @return the storageSource value. */ @Generated - public StorageSource getStorageSource() { + public TranslationStorageSource getStorageSource() { return this.storageSource; } - /** - * Set the storageSource property: Storage Source. - * - * @param storageSource the storageSource value to set. - * @return the SourceInput object itself. - */ - @Generated - public SourceInput setStorageSource(StorageSource storageSource) { - this.storageSource = storageSource; - return this; - } - /** * {@inheritDoc} */ @@ -159,7 +147,7 @@ public static SourceInput fromJson(JsonReader jsonReader) throws IOException { String sourceUrl = null; DocumentFilter filter = null; String language = null; - StorageSource storageSource = null; + TranslationStorageSource storageSource = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -170,7 +158,7 @@ public static SourceInput fromJson(JsonReader jsonReader) throws IOException { } else if ("language".equals(fieldName)) { language = reader.getString(); } else if ("storageSource".equals(fieldName)) { - storageSource = StorageSource.fromString(reader.getString()); + storageSource = TranslationStorageSource.fromString(reader.getString()); } else { reader.skipChildren(); } @@ -182,4 +170,16 @@ public static SourceInput fromJson(JsonReader jsonReader) throws IOException { return deserializedSourceInput; }); } + + /** + * Set the storageSource property: Storage Source. + * + * @param storageSource the storageSource value to set. + * @return the SourceInput object itself. + */ + @Generated + public SourceInput setStorageSource(TranslationStorageSource storageSource) { + this.storageSource = storageSource; + return this; + } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TargetInput.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TargetInput.java index 14a8e5e16f96f..ffcda71894e99 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TargetInput.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TargetInput.java @@ -46,7 +46,7 @@ public final class TargetInput implements JsonSerializable { * Storage Source */ @Generated - private StorageSource storageSource; + private TranslationStorageSource storageSource; /** * Creates an instance of TargetInput class. @@ -130,22 +130,10 @@ public TargetInput setGlossaries(List glossaries) { * @return the storageSource value. */ @Generated - public StorageSource getStorageSource() { + public TranslationStorageSource getStorageSource() { return this.storageSource; } - /** - * Set the storageSource property: Storage Source. - * - * @param storageSource the storageSource value to set. - * @return the TargetInput object itself. - */ - @Generated - public TargetInput setStorageSource(StorageSource storageSource) { - this.storageSource = storageSource; - return this; - } - /** * {@inheritDoc} */ @@ -177,7 +165,7 @@ public static TargetInput fromJson(JsonReader jsonReader) throws IOException { String language = null; String category = null; List glossaries = null; - StorageSource storageSource = null; + TranslationStorageSource storageSource = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); @@ -190,7 +178,7 @@ public static TargetInput fromJson(JsonReader jsonReader) throws IOException { } else if ("glossaries".equals(fieldName)) { glossaries = reader.readArray(reader1 -> Glossary.fromJson(reader1)); } else if ("storageSource".equals(fieldName)) { - storageSource = StorageSource.fromString(reader.getString()); + storageSource = TranslationStorageSource.fromString(reader.getString()); } else { reader.skipChildren(); } @@ -202,4 +190,16 @@ public static TargetInput fromJson(JsonReader jsonReader) throws IOException { return deserializedTargetInput; }); } + + /** + * Set the storageSource property: Storage Source. + * + * @param storageSource the storageSource value to set. + * @return the TargetInput object itself. + */ + @Generated + public TargetInput setStorageSource(TranslationStorageSource storageSource) { + this.storageSource = storageSource; + return this; + } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationBatch.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationBatch.java new file mode 100644 index 0000000000000..a471443df91aa --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationBatch.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Translation job submission batch request. + */ +@Immutable +public final class TranslationBatch implements JsonSerializable { + /* + * The input list of documents or folders containing documents + */ + @Generated + private final List inputs; + + /** + * Creates an instance of TranslationBatch class. + * + * @param inputs the inputs value to set. + */ + @Generated + public TranslationBatch(List inputs) { + this.inputs = inputs; + } + + /** + * Get the inputs property: The input list of documents or folders containing documents. + * + * @return the inputs value. + */ + @Generated + public List getInputs() { + return this.inputs; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("inputs", this.inputs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TranslationBatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TranslationBatch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TranslationBatch. + */ + @Generated + public static TranslationBatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List inputs = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputs".equals(fieldName)) { + inputs = reader.readArray(reader1 -> DocumentTranslationInput.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new TranslationBatch(inputs); + }); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatus.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatus.java index 7e4657ca7a3bf..c764902abfc27 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatus.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatus.java @@ -4,204 +4,84 @@ package com.azure.ai.translation.document.models; import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; /** - * Translation job status response. + * List of possible statuses for job or document. */ -@Immutable -public final class TranslationStatus implements JsonSerializable { +public final class TranslationStatus extends ExpandableStringEnum { - /* - * Id of the operation. - */ - @Generated - private final String id; - - /* - * Operation created date time - */ - @Generated - private final OffsetDateTime createdDateTimeUtc; - - /* - * Date time in which the operation's status has been updated - */ - @Generated - private final OffsetDateTime lastActionDateTimeUtc; - - /* - * List of possible statuses for job or document - */ - @Generated - private final Status status; - - /* - * This contains an outer error with error code, message, details, target and an - * inner error with more descriptive details. - */ - @Generated - private TranslationError error; - - /* - * Status Summary + /** + * NotStarted. */ @Generated - private final StatusSummary summary; + public static final TranslationStatus NOT_STARTED = fromString("NotStarted"); /** - * Creates an instance of TranslationStatus class. - * - * @param id the id value to set. - * @param createdDateTimeUtc the createdDateTimeUtc value to set. - * @param lastActionDateTimeUtc the lastActionDateTimeUtc value to set. - * @param status the status value to set. - * @param summary the summary value to set. + * Running. */ @Generated - private TranslationStatus(String id, OffsetDateTime createdDateTimeUtc, OffsetDateTime lastActionDateTimeUtc, - Status status, StatusSummary summary) { - this.id = id; - this.createdDateTimeUtc = createdDateTimeUtc; - this.lastActionDateTimeUtc = lastActionDateTimeUtc; - this.status = status; - this.summary = summary; - } + public static final TranslationStatus RUNNING = fromString("Running"); /** - * Get the id property: Id of the operation. - * - * @return the id value. + * Succeeded. */ @Generated - public String getId() { - return this.id; - } + public static final TranslationStatus SUCCEEDED = fromString("Succeeded"); /** - * Get the createdDateTimeUtc property: Operation created date time. - * - * @return the createdDateTimeUtc value. + * Failed. */ @Generated - public OffsetDateTime getCreatedDateTimeUtc() { - return this.createdDateTimeUtc; - } + public static final TranslationStatus FAILED = fromString("Failed"); /** - * Get the lastActionDateTimeUtc property: Date time in which the operation's status has been updated. - * - * @return the lastActionDateTimeUtc value. + * Cancelled. */ @Generated - public OffsetDateTime getLastActionDateTimeUtc() { - return this.lastActionDateTimeUtc; - } + public static final TranslationStatus CANCELLED = fromString("Cancelled"); /** - * Get the status property: List of possible statuses for job or document. - * - * @return the status value. + * Cancelling. */ @Generated - public Status getStatus() { - return this.status; - } + public static final TranslationStatus CANCELLING = fromString("Cancelling"); /** - * Get the error property: This contains an outer error with error code, message, details, target and an - * inner error with more descriptive details. - * - * @return the error value. + * ValidationFailed. */ @Generated - public TranslationError getError() { - return this.error; - } + public static final TranslationStatus VALIDATION_FAILED = fromString("ValidationFailed"); /** - * Get the summary property: Status Summary. + * Creates a new instance of TranslationStatus value. * - * @return the summary value. + * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated - public StatusSummary getSummary() { - return this.summary; + @Deprecated + public TranslationStatus() { } /** - * {@inheritDoc} + * Creates or finds a TranslationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TranslationStatus. */ @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("createdDateTimeUtc", - this.createdDateTimeUtc == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdDateTimeUtc)); - jsonWriter.writeStringField("lastActionDateTimeUtc", - this.lastActionDateTimeUtc == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastActionDateTimeUtc)); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeJsonField("summary", this.summary); - jsonWriter.writeJsonField("error", this.error); - return jsonWriter.writeEndObject(); + public static TranslationStatus fromString(String name) { + return fromString(name, TranslationStatus.class); } /** - * Reads an instance of TranslationStatus from the JsonReader. + * Gets known TranslationStatus values. * - * @param jsonReader The JsonReader being read. - * @return An instance of TranslationStatus if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TranslationStatus. + * @return known TranslationStatus values. */ @Generated - public static TranslationStatus fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - OffsetDateTime createdDateTimeUtc = null; - OffsetDateTime lastActionDateTimeUtc = null; - Status status = null; - StatusSummary summary = null; - TranslationError error = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("createdDateTimeUtc".equals(fieldName)) { - createdDateTimeUtc = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("lastActionDateTimeUtc".equals(fieldName)) { - lastActionDateTimeUtc = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("status".equals(fieldName)) { - status = Status.fromString(reader.getString()); - } else if ("summary".equals(fieldName)) { - summary = StatusSummary.fromJson(reader); - } else if ("error".equals(fieldName)) { - error = TranslationError.fromJson(reader); - } else { - reader.skipChildren(); - } - } - TranslationStatus deserializedTranslationStatus - = new TranslationStatus(id, createdDateTimeUtc, lastActionDateTimeUtc, status, summary); - deserializedTranslationStatus.error = error; - return deserializedTranslationStatus; - }); + public static Collection values() { + return values(TranslationStatus.class); } } diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatusResult.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatusResult.java new file mode 100644 index 0000000000000..8ae853e888c6c --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatusResult.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Translation job status response. + */ +@Immutable +public final class TranslationStatusResult implements JsonSerializable { + /* + * Id of the translation operation. + */ + @Generated + private final String id; + + /* + * Operation created date time + */ + @Generated + private final OffsetDateTime createdOn; + + /* + * Date time in which the operation's status has been updated + */ + @Generated + private final OffsetDateTime lastUpdatedOn; + + /* + * List of possible statuses for job or document + */ + @Generated + private final TranslationStatus status; + + /* + * This contains an outer error with error code, message, details, target and an + * inner error with more descriptive details. + */ + @Generated + private TranslationError error; + + /* + * Status Summary + */ + @Generated + private final TranslationStatusSummary summary; + + /** + * Creates an instance of TranslationStatusResult class. + * + * @param id the id value to set. + * @param createdOn the createdOn value to set. + * @param lastUpdatedOn the lastUpdatedOn value to set. + * @param status the status value to set. + * @param summary the summary value to set. + */ + @Generated + private TranslationStatusResult(String id, OffsetDateTime createdOn, OffsetDateTime lastUpdatedOn, + TranslationStatus status, TranslationStatusSummary summary) { + this.id = id; + this.createdOn = createdOn; + this.lastUpdatedOn = lastUpdatedOn; + this.status = status; + this.summary = summary; + } + + /** + * Get the id property: Id of the translation operation. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the createdOn property: Operation created date time. + * + * @return the createdOn value. + */ + @Generated + public OffsetDateTime getCreatedOn() { + return this.createdOn; + } + + /** + * Get the lastUpdatedOn property: Date time in which the operation's status has been updated. + * + * @return the lastUpdatedOn value. + */ + @Generated + public OffsetDateTime getLastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Get the status property: List of possible statuses for job or document. + * + * @return the status value. + */ + @Generated + public TranslationStatus getStatus() { + return this.status; + } + + /** + * Get the error property: This contains an outer error with error code, message, details, target and an + * inner error with more descriptive details. + * + * @return the error value. + */ + @Generated + public TranslationError getError() { + return this.error; + } + + /** + * Get the summary property: Status Summary. + * + * @return the summary value. + */ + @Generated + public TranslationStatusSummary getSummary() { + return this.summary; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("createdDateTimeUtc", + this.createdOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdOn)); + jsonWriter.writeStringField("lastActionDateTimeUtc", + this.lastUpdatedOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedOn)); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("summary", this.summary); + jsonWriter.writeJsonField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TranslationStatusResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TranslationStatusResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TranslationStatusResult. + */ + @Generated + public static TranslationStatusResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; + TranslationStatus status = null; + TranslationStatusSummary summary = null; + TranslationError error = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("createdDateTimeUtc".equals(fieldName)) { + createdOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastActionDateTimeUtc".equals(fieldName)) { + lastUpdatedOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("status".equals(fieldName)) { + status = TranslationStatus.fromString(reader.getString()); + } else if ("summary".equals(fieldName)) { + summary = TranslationStatusSummary.fromJson(reader); + } else if ("error".equals(fieldName)) { + error = TranslationError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + TranslationStatusResult deserializedTranslationStatusResult + = new TranslationStatusResult(id, createdOn, lastUpdatedOn, status, summary); + deserializedTranslationStatusResult.error = error; + + return deserializedTranslationStatusResult; + }); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatusSummary.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatusSummary.java new file mode 100644 index 0000000000000..bf9e43cb87511 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStatusSummary.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Status Summary. + */ +@Immutable +public final class TranslationStatusSummary implements JsonSerializable { + /* + * Total count + */ + @Generated + private final int totalCount; + + /* + * Failed count + */ + @Generated + private final int failedCount; + + /* + * Number of Success + */ + @Generated + private final int successCount; + + /* + * Number of in progress + */ + @Generated + private final int inProgressCount; + + /* + * Count of not yet started + */ + @Generated + private final int notYetStartedCount; + + /* + * Number of cancelled + */ + @Generated + private final int cancelledCount; + + /* + * Total characters charged by the API + */ + @Generated + private final long totalCharactersChargedCount; + + /** + * Creates an instance of TranslationStatusSummary class. + * + * @param totalCount the totalCount value to set. + * @param failedCount the failedCount value to set. + * @param successCount the successCount value to set. + * @param inProgressCount the inProgressCount value to set. + * @param notYetStartedCount the notYetStartedCount value to set. + * @param cancelledCount the cancelledCount value to set. + * @param totalCharactersChargedCount the totalCharactersChargedCount value to set. + */ + @Generated + private TranslationStatusSummary(int totalCount, int failedCount, int successCount, int inProgressCount, + int notYetStartedCount, int cancelledCount, long totalCharactersChargedCount) { + this.totalCount = totalCount; + this.failedCount = failedCount; + this.successCount = successCount; + this.inProgressCount = inProgressCount; + this.notYetStartedCount = notYetStartedCount; + this.cancelledCount = cancelledCount; + this.totalCharactersChargedCount = totalCharactersChargedCount; + } + + /** + * Get the totalCount property: Total count. + * + * @return the totalCount value. + */ + @Generated + public int getTotalCount() { + return this.totalCount; + } + + /** + * Get the failedCount property: Failed count. + * + * @return the failedCount value. + */ + @Generated + public int getFailedCount() { + return this.failedCount; + } + + /** + * Get the successCount property: Number of Success. + * + * @return the successCount value. + */ + @Generated + public int getSuccessCount() { + return this.successCount; + } + + /** + * Get the inProgressCount property: Number of in progress. + * + * @return the inProgressCount value. + */ + @Generated + public int getInProgressCount() { + return this.inProgressCount; + } + + /** + * Get the notYetStartedCount property: Count of not yet started. + * + * @return the notYetStartedCount value. + */ + @Generated + public int getNotYetStartedCount() { + return this.notYetStartedCount; + } + + /** + * Get the cancelledCount property: Number of cancelled. + * + * @return the cancelledCount value. + */ + @Generated + public int getCancelledCount() { + return this.cancelledCount; + } + + /** + * Get the totalCharactersChargedCount property: Total characters charged by the API. + * + * @return the totalCharactersChargedCount value. + */ + @Generated + public long getTotalCharactersChargedCount() { + return this.totalCharactersChargedCount; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("total", this.totalCount); + jsonWriter.writeIntField("failed", this.failedCount); + jsonWriter.writeIntField("success", this.successCount); + jsonWriter.writeIntField("inProgress", this.inProgressCount); + jsonWriter.writeIntField("notYetStarted", this.notYetStartedCount); + jsonWriter.writeIntField("cancelled", this.cancelledCount); + jsonWriter.writeLongField("totalCharacterCharged", this.totalCharactersChargedCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TranslationStatusSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TranslationStatusSummary if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TranslationStatusSummary. + */ + @Generated + public static TranslationStatusSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int totalCount = 0; + int failedCount = 0; + int successCount = 0; + int inProgressCount = 0; + int notYetStartedCount = 0; + int cancelledCount = 0; + long totalCharactersChargedCount = 0L; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("total".equals(fieldName)) { + totalCount = reader.getInt(); + } else if ("failed".equals(fieldName)) { + failedCount = reader.getInt(); + } else if ("success".equals(fieldName)) { + successCount = reader.getInt(); + } else if ("inProgress".equals(fieldName)) { + inProgressCount = reader.getInt(); + } else if ("notYetStarted".equals(fieldName)) { + notYetStartedCount = reader.getInt(); + } else if ("cancelled".equals(fieldName)) { + cancelledCount = reader.getInt(); + } else if ("totalCharacterCharged".equals(fieldName)) { + totalCharactersChargedCount = reader.getLong(); + } else { + reader.skipChildren(); + } + } + return new TranslationStatusSummary(totalCount, failedCount, successCount, inProgressCount, + notYetStartedCount, cancelledCount, totalCharactersChargedCount); + }); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStorageSource.java b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStorageSource.java new file mode 100644 index 0000000000000..7e1c09b3d1713 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/src/main/java/com/azure/ai/translation/document/models/TranslationStorageSource.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.translation.document.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Storage Source. + */ +public final class TranslationStorageSource extends ExpandableStringEnum { + /** + * Azure blob storage source. + */ + @Generated + public static final TranslationStorageSource AZURE_BLOB = fromString("AzureBlob"); + + /** + * Creates a new instance of TranslationStorageSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TranslationStorageSource() { + } + + /** + * Creates or finds a TranslationStorageSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding TranslationStorageSource. + */ + @Generated + public static TranslationStorageSource fromString(String name) { + return fromString(name, TranslationStorageSource.class); + } + + /** + * Gets known TranslationStorageSource values. + * + * @return known TranslationStorageSource values. + */ + @Generated + public static Collection values() { + return values(TranslationStorageSource.class); + } +} diff --git a/sdk/translation/azure-ai-translation-document/src/main/java/module-info.java b/sdk/translation/azure-ai-translation-document/src/main/java/module-info.java index 298aa758544c5..9191976cfdfff 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/java/module-info.java +++ b/sdk/translation/azure-ai-translation-document/src/main/java/module-info.java @@ -9,4 +9,5 @@ exports com.azure.ai.translation.document.models; opens com.azure.ai.translation.document.models to com.azure.core; + opens com.azure.ai.translation.document.implementation.models to com.azure.core; } diff --git a/sdk/translation/azure-ai-translation-document/src/main/resources/META-INF/azure-ai-translation-document_apiview_properties.json b/sdk/translation/azure-ai-translation-document/src/main/resources/META-INF/azure-ai-translation-document_apiview_properties.json index c7c7e18a2e90b..42f3ff2692a00 100644 --- a/sdk/translation/azure-ai-translation-document/src/main/resources/META-INF/azure-ai-translation-document_apiview_properties.json +++ b/sdk/translation/azure-ai-translation-document/src/main/resources/META-INF/azure-ai-translation-document_apiview_properties.json @@ -2,59 +2,59 @@ "flavor": "azure", "CrossLanguageDefinitionId": { "com.azure.ai.translation.document.DocumentTranslationAsyncClient": "ClientCustomizations.DocumentTranslationClient", - "com.azure.ai.translation.document.DocumentTranslationAsyncClient.beginStartTranslation": "ClientCustomizations.DocumentTranslationClient.startTranslation", - "com.azure.ai.translation.document.DocumentTranslationAsyncClient.beginStartTranslationWithModel": "ClientCustomizations.DocumentTranslationClient.startTranslation", + "com.azure.ai.translation.document.DocumentTranslationAsyncClient.beginBeginTranslation": "ClientCustomizations.DocumentTranslationClient.startTranslation", + "com.azure.ai.translation.document.DocumentTranslationAsyncClient.beginBeginTranslationWithModel": "ClientCustomizations.DocumentTranslationClient.startTranslation", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.cancelTranslation": "ClientCustomizations.DocumentTranslationClient.cancelTranslation", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.cancelTranslationWithResponse": "ClientCustomizations.DocumentTranslationClient.cancelTranslation", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getDocumentStatus": "ClientCustomizations.DocumentTranslationClient.getDocumentStatus", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getDocumentStatusWithResponse": "ClientCustomizations.DocumentTranslationClient.getDocumentStatus", - "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getDocumentsStatus": "ClientCustomizations.DocumentTranslationClient.getDocumentsStatus", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getSupportedFormats": "ClientCustomizations.DocumentTranslationClient.getSupportedFormats", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getSupportedFormatsWithResponse": "ClientCustomizations.DocumentTranslationClient.getSupportedFormats", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getTranslationStatus": "ClientCustomizations.DocumentTranslationClient.getTranslationStatus", "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getTranslationStatusWithResponse": "ClientCustomizations.DocumentTranslationClient.getTranslationStatus", - "com.azure.ai.translation.document.DocumentTranslationAsyncClient.getTranslationsStatus": "ClientCustomizations.DocumentTranslationClient.getTranslationsStatus", + "com.azure.ai.translation.document.DocumentTranslationAsyncClient.listDocumentStatuses": "ClientCustomizations.DocumentTranslationClient.getDocumentsStatus", + "com.azure.ai.translation.document.DocumentTranslationAsyncClient.listTranslationStatuses": "ClientCustomizations.DocumentTranslationClient.getTranslationsStatus", "com.azure.ai.translation.document.DocumentTranslationClient": "ClientCustomizations.DocumentTranslationClient", - "com.azure.ai.translation.document.DocumentTranslationClient.beginStartTranslation": "ClientCustomizations.DocumentTranslationClient.startTranslation", - "com.azure.ai.translation.document.DocumentTranslationClient.beginStartTranslationWithModel": "ClientCustomizations.DocumentTranslationClient.startTranslation", + "com.azure.ai.translation.document.DocumentTranslationClient.beginBeginTranslation": "ClientCustomizations.DocumentTranslationClient.startTranslation", + "com.azure.ai.translation.document.DocumentTranslationClient.beginBeginTranslationWithModel": "ClientCustomizations.DocumentTranslationClient.startTranslation", "com.azure.ai.translation.document.DocumentTranslationClient.cancelTranslation": "ClientCustomizations.DocumentTranslationClient.cancelTranslation", "com.azure.ai.translation.document.DocumentTranslationClient.cancelTranslationWithResponse": "ClientCustomizations.DocumentTranslationClient.cancelTranslation", "com.azure.ai.translation.document.DocumentTranslationClient.getDocumentStatus": "ClientCustomizations.DocumentTranslationClient.getDocumentStatus", "com.azure.ai.translation.document.DocumentTranslationClient.getDocumentStatusWithResponse": "ClientCustomizations.DocumentTranslationClient.getDocumentStatus", - "com.azure.ai.translation.document.DocumentTranslationClient.getDocumentsStatus": "ClientCustomizations.DocumentTranslationClient.getDocumentsStatus", "com.azure.ai.translation.document.DocumentTranslationClient.getSupportedFormats": "ClientCustomizations.DocumentTranslationClient.getSupportedFormats", "com.azure.ai.translation.document.DocumentTranslationClient.getSupportedFormatsWithResponse": "ClientCustomizations.DocumentTranslationClient.getSupportedFormats", "com.azure.ai.translation.document.DocumentTranslationClient.getTranslationStatus": "ClientCustomizations.DocumentTranslationClient.getTranslationStatus", "com.azure.ai.translation.document.DocumentTranslationClient.getTranslationStatusWithResponse": "ClientCustomizations.DocumentTranslationClient.getTranslationStatus", - "com.azure.ai.translation.document.DocumentTranslationClient.getTranslationsStatus": "ClientCustomizations.DocumentTranslationClient.getTranslationsStatus", + "com.azure.ai.translation.document.DocumentTranslationClient.listDocumentStatuses": "ClientCustomizations.DocumentTranslationClient.getDocumentsStatus", + "com.azure.ai.translation.document.DocumentTranslationClient.listTranslationStatuses": "ClientCustomizations.DocumentTranslationClient.getTranslationsStatus", "com.azure.ai.translation.document.DocumentTranslationClientBuilder": "ClientCustomizations.DocumentTranslationClient", "com.azure.ai.translation.document.SingleDocumentTranslationAsyncClient": "ClientCustomizations.SingleDocumentTranslationClient", - "com.azure.ai.translation.document.SingleDocumentTranslationAsyncClient.documentTranslate": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", - "com.azure.ai.translation.document.SingleDocumentTranslationAsyncClient.documentTranslateWithResponse": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", + "com.azure.ai.translation.document.SingleDocumentTranslationAsyncClient.translate": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", + "com.azure.ai.translation.document.SingleDocumentTranslationAsyncClient.translateWithResponse": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", "com.azure.ai.translation.document.SingleDocumentTranslationClient": "ClientCustomizations.SingleDocumentTranslationClient", - "com.azure.ai.translation.document.SingleDocumentTranslationClient.documentTranslate": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", - "com.azure.ai.translation.document.SingleDocumentTranslationClient.documentTranslateWithResponse": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", + "com.azure.ai.translation.document.SingleDocumentTranslationClient.translate": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", + "com.azure.ai.translation.document.SingleDocumentTranslationClient.translateWithResponse": "ClientCustomizations.SingleDocumentTranslationClient.documentTranslate", "com.azure.ai.translation.document.SingleDocumentTranslationClientBuilder": "ClientCustomizations.SingleDocumentTranslationClient", - "com.azure.ai.translation.document.models.BatchRequest": "DocumentTranslation.BatchRequest", + "com.azure.ai.translation.document.implementation.models.FileFormat": "DocumentTranslation.FileFormat", + "com.azure.ai.translation.document.implementation.models.FileFormatType": "DocumentTranslation.FileFormatType", + "com.azure.ai.translation.document.implementation.models.SupportedFileFormats": "DocumentTranslation.SupportedFileFormats", "com.azure.ai.translation.document.models.DocumentFileDetails": "null", "com.azure.ai.translation.document.models.DocumentFilter": "DocumentTranslation.DocumentFilter", "com.azure.ai.translation.document.models.DocumentStatus": "DocumentTranslation.DocumentStatus", "com.azure.ai.translation.document.models.DocumentTranslateContent": "DocumentTranslation.DocumentTranslateContent", - "com.azure.ai.translation.document.models.FileFormat": "DocumentTranslation.FileFormat", - "com.azure.ai.translation.document.models.FileFormatType": "DocumentTranslation.FileFormatType", + "com.azure.ai.translation.document.models.DocumentTranslationInput": "DocumentTranslation.BatchRequest", "com.azure.ai.translation.document.models.Glossary": "DocumentTranslation.Glossary", "com.azure.ai.translation.document.models.GlossaryFileDetails": "null", "com.azure.ai.translation.document.models.InnerTranslationError": "DocumentTranslation.InnerTranslationError", "com.azure.ai.translation.document.models.SourceInput": "DocumentTranslation.SourceInput", - "com.azure.ai.translation.document.models.StartTranslationDetails": "DocumentTranslation.StartTranslationDetails", - "com.azure.ai.translation.document.models.Status": "DocumentTranslation.Status", - "com.azure.ai.translation.document.models.StatusSummary": "DocumentTranslation.StatusSummary", "com.azure.ai.translation.document.models.StorageInputType": "DocumentTranslation.StorageInputType", - "com.azure.ai.translation.document.models.StorageSource": "DocumentTranslation.StorageSource", - "com.azure.ai.translation.document.models.SupportedFileFormats": "DocumentTranslation.SupportedFileFormats", "com.azure.ai.translation.document.models.TargetInput": "DocumentTranslation.TargetInput", + "com.azure.ai.translation.document.models.TranslationBatch": "DocumentTranslation.StartTranslationDetails", "com.azure.ai.translation.document.models.TranslationError": "DocumentTranslation.TranslationError", "com.azure.ai.translation.document.models.TranslationErrorCode": "DocumentTranslation.TranslationErrorCode", - "com.azure.ai.translation.document.models.TranslationStatus": "DocumentTranslation.TranslationStatus" + "com.azure.ai.translation.document.models.TranslationStatus": "DocumentTranslation.Status", + "com.azure.ai.translation.document.models.TranslationStatusResult": "DocumentTranslation.TranslationStatus", + "com.azure.ai.translation.document.models.TranslationStatusSummary": "DocumentTranslation.StatusSummary", + "com.azure.ai.translation.document.models.TranslationStorageSource": "DocumentTranslation.StorageSource" } } diff --git a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/CancelACurrentlyProcessingOrQueuedTranslation.java b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/CancelACurrentlyProcessingOrQueuedTranslation.java index 2dfca6b0b2773..265975b1014c8 100644 --- a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/CancelACurrentlyProcessingOrQueuedTranslation.java +++ b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/CancelACurrentlyProcessingOrQueuedTranslation.java @@ -6,7 +6,7 @@ import com.azure.ai.translation.document.DocumentTranslationClient; import com.azure.ai.translation.document.DocumentTranslationClientBuilder; -import com.azure.ai.translation.document.models.TranslationStatus; +import com.azure.ai.translation.document.models.TranslationStatusResult; import com.azure.identity.DefaultAzureCredentialBuilder; public class CancelACurrentlyProcessingOrQueuedTranslation { @@ -16,7 +16,7 @@ public static void main(String[] args) { .endpoint("{endpoint}") .buildClient(); // BEGIN:com.azure.ai.translation.document.generated.canceltranslation.cancelacurrentlyprocessingorqueuedtranslation - TranslationStatus response + TranslationStatusResult response = documentTranslationClient.cancelTranslation("727BF148-F327-47A0-9481-ABAE6362F11E"); // END:com.azure.ai.translation.document.generated.canceltranslation.cancelacurrentlyprocessingorqueuedtranslation } diff --git a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsAListOfBatchRequestsSubmittedAndTheStatusForEachRequest.java b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsAListOfBatchRequestsSubmittedAndTheStatusForEachRequest.java index 17703e5ba71fe..e4465ca33d255 100644 --- a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsAListOfBatchRequestsSubmittedAndTheStatusForEachRequest.java +++ b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsAListOfBatchRequestsSubmittedAndTheStatusForEachRequest.java @@ -6,7 +6,7 @@ import com.azure.ai.translation.document.DocumentTranslationClient; import com.azure.ai.translation.document.DocumentTranslationClientBuilder; -import com.azure.ai.translation.document.models.TranslationStatus; +import com.azure.ai.translation.document.models.TranslationStatusResult; import com.azure.core.http.rest.PagedIterable; import com.azure.identity.DefaultAzureCredentialBuilder; import java.time.OffsetDateTime; @@ -18,11 +18,11 @@ public static void main(String[] args) { = new DocumentTranslationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) .endpoint("{endpoint}") .buildClient(); - // BEGIN:com.azure.ai.translation.document.generated.gettranslationsstatus.returnsalistofbatchrequestssubmittedandthestatusforeachrequest - PagedIterable response = documentTranslationClient.getTranslationsStatus(1, 0, + // BEGIN:com.azure.ai.translation.document.generated.listtranslationstatuses.returnsalistofbatchrequestssubmittedandthestatusforeachrequest + PagedIterable response = documentTranslationClient.listTranslationStatuses(1, 0, Arrays.asList("273622bd-835c-4946-9798-fd8f19f6bbf2"), Arrays.asList("Succeeded"), OffsetDateTime.parse("2021-03-23T07:03:38.0136316Z"), OffsetDateTime.parse("2021-03-25T07:03:38.0136316Z"), Arrays.asList("CreatedDateTime asc")); - // END:com.azure.ai.translation.document.generated.gettranslationsstatus.returnsalistofbatchrequestssubmittedandthestatusforeachrequest + // END:com.azure.ai.translation.document.generated.listtranslationstatuses.returnsalistofbatchrequestssubmittedandthestatusforeachrequest } } diff --git a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForABatchDocumentTranslationRequest.java b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForABatchDocumentTranslationRequest.java index 070552b2ffdb7..34ec23e59153b 100644 --- a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForABatchDocumentTranslationRequest.java +++ b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForABatchDocumentTranslationRequest.java @@ -6,7 +6,7 @@ import com.azure.ai.translation.document.DocumentTranslationClient; import com.azure.ai.translation.document.DocumentTranslationClientBuilder; -import com.azure.ai.translation.document.models.TranslationStatus; +import com.azure.ai.translation.document.models.TranslationStatusResult; import com.azure.identity.DefaultAzureCredentialBuilder; public class ReturnsTheStatusForABatchDocumentTranslationRequest { @@ -16,7 +16,7 @@ public static void main(String[] args) { .endpoint("{endpoint}") .buildClient(); // BEGIN:com.azure.ai.translation.document.generated.gettranslationstatus.returnsthestatusforabatchdocumenttranslationrequest - TranslationStatus response + TranslationStatusResult response = documentTranslationClient.getTranslationStatus("727BF148-F327-47A0-9481-ABAE6362F11E"); // END:com.azure.ai.translation.document.generated.gettranslationstatus.returnsthestatusforabatchdocumenttranslationrequest } diff --git a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForAllDocumentsInABatchDocumentTranslationRequest.java b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForAllDocumentsInABatchDocumentTranslationRequest.java index c8637b9dc71af..7fae3de97cd6d 100644 --- a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForAllDocumentsInABatchDocumentTranslationRequest.java +++ b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/ReturnsTheStatusForAllDocumentsInABatchDocumentTranslationRequest.java @@ -18,12 +18,12 @@ public static void main(String[] args) { = new DocumentTranslationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) .endpoint("{endpoint}") .buildClient(); - // BEGIN:com.azure.ai.translation.document.generated.getdocumentsstatus.returnsthestatusforalldocumentsinabatchdocumenttranslationrequest + // BEGIN:com.azure.ai.translation.document.generated.listdocumentstatuses.returnsthestatusforalldocumentsinabatchdocumenttranslationrequest PagedIterable response - = documentTranslationClient.getDocumentsStatus("727BF148-F327-47A0-9481-ABAE6362F11E", 2, 0, + = documentTranslationClient.listDocumentStatuses("727BF148-F327-47A0-9481-ABAE6362F11E", 2, 0, Arrays.asList("273622bd-835c-4946-9798-fd8f19f6bbf2", "511b6a66-a6f8-4640-83e1-48c325e9fa29"), Arrays.asList("Succeeded"), OffsetDateTime.parse("2021-03-23T07:03:38.0136316Z"), OffsetDateTime.parse("2021-03-25T07:03:38.0136316Z"), Arrays.asList("CreatedDateTimeUtc asc")); - // END:com.azure.ai.translation.document.generated.getdocumentsstatus.returnsthestatusforalldocumentsinabatchdocumenttranslationrequest + // END:com.azure.ai.translation.document.generated.listdocumentstatuses.returnsthestatusforalldocumentsinabatchdocumenttranslationrequest } } diff --git a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/SubmitADocumentTranslationRequestToTheDocumentTranslationService.java b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/SubmitADocumentTranslationRequestToTheDocumentTranslationService.java index f7046d16bb08a..3d2ed4b7e5e92 100644 --- a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/SubmitADocumentTranslationRequestToTheDocumentTranslationService.java +++ b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/SubmitADocumentTranslationRequestToTheDocumentTranslationService.java @@ -6,15 +6,15 @@ import com.azure.ai.translation.document.DocumentTranslationClient; import com.azure.ai.translation.document.DocumentTranslationClientBuilder; -import com.azure.ai.translation.document.models.BatchRequest; import com.azure.ai.translation.document.models.DocumentFilter; +import com.azure.ai.translation.document.models.DocumentTranslationInput; import com.azure.ai.translation.document.models.Glossary; import com.azure.ai.translation.document.models.SourceInput; -import com.azure.ai.translation.document.models.StartTranslationDetails; import com.azure.ai.translation.document.models.StorageInputType; -import com.azure.ai.translation.document.models.StorageSource; import com.azure.ai.translation.document.models.TargetInput; -import com.azure.ai.translation.document.models.TranslationStatus; +import com.azure.ai.translation.document.models.TranslationBatch; +import com.azure.ai.translation.document.models.TranslationStatusResult; +import com.azure.ai.translation.document.models.TranslationStorageSource; import com.azure.core.util.polling.SyncPoller; import com.azure.identity.DefaultAzureCredentialBuilder; import java.util.Arrays; @@ -25,28 +25,28 @@ public static void main(String[] args) { = new DocumentTranslationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) .endpoint("{endpoint}") .buildClient(); - // BEGIN:com.azure.ai.translation.document.generated.starttranslation.submitadocumenttranslationrequesttothedocumenttranslationservice - SyncPoller response + // BEGIN:com.azure.ai.translation.document.generated.begintranslation.submitadocumenttranslationrequesttothedocumenttranslationservice + SyncPoller response = documentTranslationClient - .beginStartTranslation( - new StartTranslationDetails( + .beginBeginTranslation( + new TranslationBatch( Arrays - .asList(new BatchRequest( + .asList(new DocumentTranslationInput( new SourceInput("https://myblob.blob.core.windows.net/sourceContainer") .setFilter(new DocumentFilter().setPrefix("pre").setSuffix(".txt")) .setLanguage("en") - .setStorageSource(StorageSource.AZURE_BLOB), + .setStorageSource(TranslationStorageSource.AZURE_BLOB), Arrays.asList( new TargetInput("https://myblob.blob.core.windows.net/destinationContainer1", "fr") .setCategory("general") .setGlossaries(Arrays.asList(new Glossary( "https://myblob.blob.core.windows.net/myglossary/en_fr_glossary.xlf", - "XLIFF").setStorageSource(StorageSource.AZURE_BLOB))) - .setStorageSource(StorageSource.AZURE_BLOB), + "XLIFF").setStorageSource(TranslationStorageSource.AZURE_BLOB))) + .setStorageSource(TranslationStorageSource.AZURE_BLOB), new TargetInput("https://myblob.blob.core.windows.net/destinationContainer2", "es") .setCategory("general") - .setStorageSource(StorageSource.AZURE_BLOB))) + .setStorageSource(TranslationStorageSource.AZURE_BLOB))) .setStorageType(StorageInputType.FOLDER)))); - // END:com.azure.ai.translation.document.generated.starttranslation.submitadocumenttranslationrequesttothedocumenttranslationservice + // END:com.azure.ai.translation.document.generated.begintranslation.submitadocumenttranslationrequesttothedocumenttranslationservice } } diff --git a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/TranslateASingleDocument.java b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/TranslateASingleDocument.java index cda930d884d6b..7bb92fb581fb5 100644 --- a/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/TranslateASingleDocument.java +++ b/sdk/translation/azure-ai-translation-document/src/samples/java/com/azure/ai/translation/document/generated/TranslateASingleDocument.java @@ -16,8 +16,8 @@ public static void main(String[] args) { = new SingleDocumentTranslationClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) .buildClient(); - // BEGIN:com.azure.ai.translation.document.generated.documenttranslate.translateasingledocument - BinaryData response = singleDocumentTranslationClient.documentTranslate("es", null, "en", null, null); - // END:com.azure.ai.translation.document.generated.documenttranslate.translateasingledocument + // BEGIN:com.azure.ai.translation.document.generated.translate.translateasingledocument + BinaryData response = singleDocumentTranslationClient.translate("es", null, "en", null, null); + // END:com.azure.ai.translation.document.generated.translate.translateasingledocument } } diff --git a/sdk/translation/azure-ai-translation-document/tsp-location.yaml b/sdk/translation/azure-ai-translation-document/tsp-location.yaml index 0bfd6682e8541..223bee1adc1d5 100644 --- a/sdk/translation/azure-ai-translation-document/tsp-location.yaml +++ b/sdk/translation/azure-ai-translation-document/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/translation/Azure.AI.DocumentTranslation -commit: 08dcb2d13f39910ceab6c50bd08d7d5c12f99bf2 +commit: 2ecdbb5681e24d6bf1f08336c8513fe307ed2ce6 repo: Azure/azure-rest-api-specs +additionalDirectories: