diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c951a764fe52..f35950715d36 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -38,7 +38,7 @@ com.azure:azure-sdk-parent;1.6.0;1.6.0 com.azure:azure-client-sdk-parent;1.7.0;1.7.0 com.azure:azure-ai-anomalydetector;3.0.0-beta.5;3.0.0-beta.6 com.azure:azure-ai-contentsafety;1.0.9;1.1.0-beta.1 -com.azure:azure-ai-documentintelligence;1.0.0-beta.4;1.0.0-beta.5 +com.azure:azure-ai-documentintelligence;1.0.0-beta.4;1.0.0 com.azure:azure-ai-documenttranslator;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-ai-formrecognizer;4.1.12;4.2.0-beta.1 com.azure:azure-ai-formrecognizer-perf;1.0.0-beta.1;1.0.0-beta.1 diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md b/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md index 4fb4ab9ffdfa..ed13918b3939 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.5 (Unreleased) +## 1.0.0 (Unreleased) ### Features Added @@ -115,7 +115,7 @@ https://azure.github.io/azure-sdk/releases/latest/java.html. null, null, ContentFormat.MARKDOWN, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentRequest().setBytesSource(Files.readAllBytes(document.toPath()))); ``` For the complete sample, see [Sample: Markdown](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutput.java). @@ -133,7 +133,7 @@ https://azure.github.io/azure-sdk/releases/latest/java.html. Arrays.asList(DocumentAnalysisFeature.QUERY_FIELDS), Arrays.asList("Address", "InvoiceNumber"), null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentRequest().setBytesSource(Files.readAllBytes(document.toPath()))); ``` For the complete sample, see [Sample: Query Fields](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFields.java). @@ -204,7 +204,7 @@ https://azure.github.io/azure-sdk/releases/latest/java.html. Arrays.asList(DocumentAnalysisFeature.FORMULAS), null, null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentRequest().setBytesSource(Files.readAllBytes(document.toPath()))); ``` For the complete sample, see [Sample: KeyValuePair](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePair.java). diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md b/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md index 2b73dcd2c33a..3ee10c319ea5 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md @@ -38,14 +38,14 @@ SDK introduces a new enum _ContentFormat_ with value "text" or "markdown" to ind ```java File document = new File("{your-file-to-analyze}"); -SyncPoller analyzeLayoutResultPoller = +SyncPoller analyzeLayoutResultPoller = client.beginAnalyzeDocument("prebuilt-layout", null, null, null, null, null, - ContentFormat.MARKDOWN, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + DocumentContentFormat.MARKDOWN, + new AnalyzeDocumentOptions().setBytesSource(Files.readAllBytes(document.toPath()))); ``` For the complete sample, see [Sample: Markdown][Sample-AnalyzeLayoutMarkdownOutput]. @@ -57,14 +57,14 @@ existing fields defined by the model as fallback. ```java File document = new File("{your-file-to-analyze}"); -SyncPoller analyzeLayoutResultPoller = +SyncPoller analyzeLayoutResultPoller = client.beginAnalyzeDocument("prebuilt-layout", null, null, null, Arrays.asList(DocumentAnalysisFeature.QUERY_FIELDS), Arrays.asList("Address", "InvoiceNumber"), null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentOptions().setBytesSource(Files.readAllBytes(document.toPath()))); ``` For the complete sample, see [Sample: Query Fields][Sample-AnalyzeAddOnQueryFields]. @@ -170,14 +170,14 @@ the _Currency_ field in result has been removed. ```java File document = new File("{your-file-to-analyze}"); - SyncPoller analyzeLayoutResultPoller = + SyncPoller analyzeLayoutResultPoller = client.beginAnalyzeDocument("prebuilt-layout", null, null, null, Arrays.asList(DocumentAnalysisFeature.FORMULAS), null, null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentOptions().setBytesSource(Files.readAllBytes(document.toPath()))); ``` For the complete sample, see [Sample: KeyValuePair][Sample-AnalyzeAddOnKeyValuePair]. @@ -206,4 +206,4 @@ For additional samples please take a look at the [Document Intelligence Samples] [Sample-AnalyzeLayoutMarkdownOutput]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutput.java [service_supported_models]: https://aka.ms/azsdk/documentintelligence/models -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fdocumentintelligence%2Fazure-ai-documentintelligence%2Fmigration-guide.png) \ No newline at end of file +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fdocumentintelligence%2Fazure-ai-documentintelligence%2Fmigration-guide.png) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/README.md b/sdk/documentintelligence/azure-ai-documentintelligence/README.md index 6ce28a5368bb..e049985fffb0 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/README.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/README.md @@ -28,7 +28,7 @@ It includes the following main features: com.azure azure-ai-documentintelligence - 1.0.0-beta.4 + 1.0.0 ``` [//]: # ({x-version-update-end}) @@ -43,15 +43,16 @@ This table shows the relationship between SDK versions and supported API version | 1.0.0-beta.2 | 2024-02-29-preview | | 1.0.0-beta.3 | 2024-02-29-preview | | 1.0.0-beta.4 | 2024-07-31-preview | +| 1.0.0 | 2024-11-30 | > Note: Please rely on the older `azure-ai-formrecognizer` library through the older service API versions for retired > models, such as `"prebuilt-businessCard"` and `"prebuilt-document"`. For more information, see [Changelog][changelog]. > The below table describes the relationship of each client and its supported API version(s): -| API version | Supported clients | -|------------------------------------------------------------|-----------------------------------------------------------------------------------------------| -| 2023-10-31-preview, 2024-02-29-preview, 2024-07-31-preview | DocumentIntelligenceClient and DocumentIntelligenceAsyncClient | -| 2023-07-31 | DocumentAnalysisClient and DocumentModelAdministrationClient in `azure-ai-formrecognizer` SDK | +| API version | Supported clients | +|------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| +| 2023-10-31-preview, 2024-02-29-preview, 2024-07-31-preview, 2024-11-30 | DocumentIntelligenceClient and DocumentIntelligenceAsyncClient | +| 2023-07-31 | DocumentAnalysisClient and DocumentModelAdministrationClient in `azure-ai-formrecognizer` SDK | Please see the [Migration Guide][migration_guide] for more information about migrating from `azure-ai-formrecognizer` to `azure-ai-documentintelligence`. @@ -73,12 +74,11 @@ DocumentIntelligenceClient documentIntelligenceClient = new DocumentIntelligence .buildClient(); ``` or -```java readme-sample-createDocumentModelAdministrationClient -DocumentIntelligenceAdministrationClient client = - new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildClient(); +```java com.azure.ai.documentanalysis.readme.DocumentIntelligenceAdministrationClient +DocumentIntelligenceAdministrationClient documentIntelligenceAsyncClient = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new AzureKeyCredential("{key}")) + .endpoint("{endpoint}") + .buildClient(); ``` #### Create an Azure DocumentIntelligence client with Azure Active Directory credential @@ -165,16 +165,9 @@ File layoutDocument = new File("local/file_path/filename.png"); Path filePath = layoutDocument.toPath(); BinaryData layoutDocumentData = BinaryData.fromFile(filePath, (int) layoutDocument.length()); -SyncPoller analyzeLayoutResultPoller = +SyncPoller analyzeLayoutResultPoller = documentIntelligenceClient.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(layoutDocument.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(layoutDocument.toPath()))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); @@ -226,21 +219,14 @@ For example, to analyze fields from a sales receipt, into the `beginAnalyzeDocum File sourceFile = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/receipts/contoso-allinone.jpg"); -SyncPoller analyzeReceiptPoller = +SyncPoller analyzeReceiptPoller = documentIntelligenceClient.beginAnalyzeDocument("prebuilt-receipt", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(sourceFile.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(sourceFile.toPath()))); AnalyzeResult receiptResults = analyzeReceiptPoller.getFinalResult(); for (int i = 0; i < receiptResults.getDocuments().size(); i++) { - Document analyzedReceipt = receiptResults.getDocuments().get(i); + AnalyzedDocument analyzedReceipt = receiptResults.getDocuments().get(i); Map receiptFields = analyzedReceipt.getFields(); System.out.printf("----------- Analyzing receipt info %d -----------%n", i); DocumentField merchantNameField = receiptFields.get("MerchantName"); @@ -301,7 +287,7 @@ More details on setting up a container and required file structure can be found String blobContainerUrl = "{SAS_URL_of_your_container_in_blob_storage}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. SyncPoller buildOperationPoller = - administrationClient.beginBuildDocumentModel(new BuildDocumentModelRequest("modelID", DocumentBuildMode.TEMPLATE) + administrationClient.beginBuildDocumentModel(new BuildDocumentModelOptions("modelID", DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl))); DocumentModelDetails documentModelDetails = buildOperationPoller.getFinalResult(); @@ -309,10 +295,10 @@ DocumentModelDetails documentModelDetails = buildOperationPoller.getFinalResult( // Model Info System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); System.out.printf("Model Description: %s%n", documentModelDetails.getDescription()); -System.out.printf("Model created on: %s%n%n", documentModelDetails.getCreatedDateTime()); +System.out.printf("Model created on: %s%n%n", documentModelDetails.getCreatedOn()); -System.out.println("Document Fields:"); -documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { +System.out.println("AnalyzedDocument Fields:"); +documentModelDetails.getDocumentTypes().forEach((key, documentTypeDetails) -> { documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { System.out.printf("Field: %s", field); System.out.printf("Field type: %s", documentFieldSchema.getType()); @@ -328,23 +314,18 @@ was built on. ```java com.azure.ai.documentintelligence.readme.analyzeCustomModel String documentUrl = "{document-url}"; String modelId = "{custom-built-model-ID}"; -SyncPoller analyzeDocumentPoller = documentIntelligenceClient.beginAnalyzeDocument(modelId, - "1", - "en-US", - StringIndexType.TEXT_ELEMENTS, - Arrays.asList(DocumentAnalysisFeature.LANGUAGES), - null, - ContentFormat.TEXT, - null, - new AnalyzeDocumentRequest().setUrlSource(documentUrl)); +SyncPoller analyzeDocumentPoller = documentIntelligenceClient.beginAnalyzeDocument(modelId, + new AnalyzeDocumentOptions(documentUrl).setPages(Collections.singletonList("1")).setLocale("en-US") + .setStringIndexType(StringIndexType.TEXT_ELEMENTS).setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.LANGUAGES)) + .setOutputContentFormat(DocumentContentFormat.TEXT)); AnalyzeResult analyzeResult = analyzeDocumentPoller.getFinalResult(); for (int i = 0; i < analyzeResult.getDocuments().size(); i++) { - final Document analyzedDocument = analyzeResult.getDocuments().get(i); + final AnalyzedDocument analyzedDocument = analyzeResult.getDocuments().get(i); System.out.printf("----------- Analyzing custom document %d -----------%n", i); System.out.printf("Analyzed document has doc type %s with confidence : %.2f%n", - analyzedDocument.getDocType(), analyzedDocument.getConfidence()); + analyzedDocument.getDocumentType(), analyzedDocument.getConfidence()); } analyzeResult.getPages().forEach(documentPage -> { @@ -385,7 +366,7 @@ for (int i = 0; i < tables.size(); i++) { Manage the models in your Document Intelligence account. ```java com.azure.ai.documentintelligence.readme.manageModels -ResourceDetails resourceDetails = administrationClient.getResourceInfo(); +DocumentIntelligenceResourceDetails resourceDetails = administrationClient.getResourceDetails(); System.out.printf("The resource has %s models, and we can have at most %s models.%n", resourceDetails.getCustomDocumentModels().getCount(), resourceDetails.getCustomDocumentModels().getLimit()); @@ -398,9 +379,9 @@ customDocumentModels.forEach(documentModelInfo -> { DocumentModelDetails documentModel = administrationClient.getModel(documentModelInfo.getModelId()); System.out.printf("Model ID: %s%n", documentModel.getModelId()); System.out.printf("Model Description: %s%n", documentModel.getDescription()); - System.out.printf("Model created on: %s%n", documentModel.getCreatedDateTime()); - if (documentModel.getDocTypes() != null) { - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { + System.out.printf("Model created on: %s%n", documentModel.getCreatedOn()); + if (documentModel.getDocumentTypes() != null) { + documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> { documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { System.out.printf("Field: %s, ", field); System.out.printf("Field type: %s, ", documentFieldSchema.getType()); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/assets.json b/sdk/documentintelligence/azure-ai-documentintelligence/assets.json index bc6bace59660..956df47e68f3 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/assets.json +++ b/sdk/documentintelligence/azure-ai-documentintelligence/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/documentintelligence/azure-ai-documentintelligence", - "Tag": "java/documentintelligence/azure-ai-documentintelligence_4f742a2c4a" + "Tag": "java/documentintelligence/azure-ai-documentintelligence_b4bb23cfcf" } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/customization/src/main/java/DocumentIntelligenceCustomizations.java b/sdk/documentintelligence/azure-ai-documentintelligence/customization/src/main/java/DocumentIntelligenceCustomizations.java index cdcc30ea4d4a..a19de1df56ae 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/customization/src/main/java/DocumentIntelligenceCustomizations.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/customization/src/main/java/DocumentIntelligenceCustomizations.java @@ -1,10 +1,17 @@ +import com.azure.autorest.customization.ClassCustomization; import com.azure.autorest.customization.Customization; import com.azure.autorest.customization.LibraryCustomization; import com.azure.autorest.customization.PackageCustomization; import com.github.javaparser.StaticJavaParser; import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.BodyDeclaration; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.Statement; import com.github.javaparser.javadoc.Javadoc; +import com.github.javaparser.javadoc.JavadocBlockTag; import com.github.javaparser.javadoc.description.JavadocDescription; import com.github.javaparser.javadoc.description.JavadocSnippet; import org.slf4j.Logger; @@ -16,21 +23,215 @@ * This class contains the customization code to customize the AutoRest generated code for OpenAI. */ public class DocumentIntelligenceCustomizations extends Customization { + private static final String MODELS_PACKAGE = "com.azure.ai.documentintelligence.models"; @Override public void customize(LibraryCustomization customization, Logger logger) { - customizeAnalzyeResultOperation(customization, logger); + customizeAnalyzeOperation(customization, logger); + customizeAnalyzeBatchOperation(customization, logger); customizePollingStrategy(customization, logger); customizePollingUtils(customization, logger); + customizeModifierForOverloadMethods(customization, logger); + customizeMethodImplForOverload(customization, logger); + customizeAnalyzeDocumentOptions(customization, logger); + customizeAnalyzeBatchDocumentOptions(customization, logger); + customizeClassifyDocumentOptions(customization, logger); + customizeSamplesForOverload(customization, logger); } - private void customizeAnalzyeResultOperation(LibraryCustomization customization, Logger logger) { - logger.info("Customizing the AnalyzeResultOperation class"); + private void customizeSamplesForOverload(LibraryCustomization customization, Logger logger) { + logger.info("Removing samples using old overloads"); + customization.getRawEditor().removeFile("src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeBatchDocuments.java"); + customization.getRawEditor().removeFile("src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromBase64.java"); + customization.getRawEditor().removeFile("src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromUrl.java"); + customization.getRawEditor().removeFile("src/samples/java/com/azure/ai/documentintelligence/generated/ClassifyDocumentFromUrl.java"); + } + + private void customizeMethodImplForOverload(LibraryCustomization customization, Logger logger) { + logger.info("Customizing to call internal method implementation"); + PackageCustomization models = customization.getPackage("com.azure.ai.documentintelligence"); + ClassCustomization classCustomization = models.getClass("DocumentIntelligenceClient"); + customizeImpl(classCustomization, "DocumentIntelligenceClient"); + ClassCustomization asynClassCustomization = models.getClass("DocumentIntelligenceAsyncClient"); + customizeImpl(asynClassCustomization, "DocumentIntelligenceAsyncClient"); + } + + private static void customizeImpl(ClassCustomization classCustomization, String className) { + classCustomization.customizeAst(compilationUnit -> { + ClassOrInterfaceDeclaration documentIntelligenceClient = compilationUnit.getClassByName(className).get(); + documentIntelligenceClient.getMethodsByName("beginAnalyzeDocument").forEach(methodDeclaration -> { + if (methodDeclaration.getParameters().size() == 2) { + methodDeclaration.getParameterByName("analyzeRequest").get().setName("analyzeDocumentOptions"); + methodDeclaration.setBody(StaticJavaParser.parseBlock(String.join("\n", + "{", "Objects.requireNonNull(analyzeDocumentOptions, \"'analyzeDocumentOptions' cannot be null.\");\n" + + " return this.beginAnalyzeDocument(modelId, analyzeDocumentOptions, analyzeDocumentOptions.getPages() != null ? CoreUtils.stringJoin(\",\", analyzeDocumentOptions.getPages()) : null, analyzeDocumentOptions.getLocale(), analyzeDocumentOptions.getStringIndexType(), analyzeDocumentOptions.getDocumentAnalysisFeatures(), analyzeDocumentOptions.getQueryFields(), analyzeDocumentOptions.getOutputContentFormat(), analyzeDocumentOptions.getOutput());\n" + + "}"))); + methodDeclaration.setJavadocComment("/**\n" + + " * Analyzes document with document model.\n" + + " *\n" + + " * @param modelId Unique document model name.\n" + + " * @param analyzeDocumentOptions Analyze request parameters.\n" + + " * @throws IllegalArgumentException thrown if parameters fail the validation.\n" + + " * @throws HttpResponseException thrown if the request is rejected by server.\n" + + " * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.\n" + + " * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.\n" + + " * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.\n" + + " * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.\n" + + " * @return the {@link SyncPoller} for polling of long-running operation.\n" + + " */"); + + } + }); + + documentIntelligenceClient.getMethodsByName("beginAnalyzeBatchDocuments").forEach(methodDeclaration -> { + if (methodDeclaration.getParameters().size() == 2) { + methodDeclaration.getParameterByName("analyzeBatchRequest").get().setName("analyzeBatchDocumentOptions"); + methodDeclaration.setBody(StaticJavaParser.parseBlock(String.join("\n", + "{", "Objects.requireNonNull(analyzeBatchDocumentOptions, \"'analyzeBatchDocumentOptions' cannot be null.\");\n" + + " return this.beginAnalyzeBatchDocuments(modelId, analyzeBatchDocumentOptions, analyzeBatchDocumentOptions.getPages() != null ? CoreUtils.stringJoin(\",\", analyzeBatchDocumentOptions.getPages()) : null, analyzeBatchDocumentOptions.getLocale(), analyzeBatchDocumentOptions.getStringIndexType(), analyzeBatchDocumentOptions.getDocumentAnalysisFeatures(), analyzeBatchDocumentOptions.getQueryFields(), analyzeBatchDocumentOptions.getOutputContentFormat(), analyzeBatchDocumentOptions.getOutput());\n" + + "}"))); + methodDeclaration.setJavadocComment("/**\n" + + " * Analyzes batch documents with document model.\n" + + " *\n" + + " * @param modelId Unique document model name.\n" + + " * @param analyzeBatchDocumentOptions Analyze batch request parameters.\n" + + " * @throws IllegalArgumentException thrown if parameters fail the validation.\n" + + " * @throws HttpResponseException thrown if the request is rejected by server.\n" + + " * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.\n" + + " * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.\n" + + " * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.\n" + + " * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.\n" + + " * @return the {@link SyncPoller} for polling of long-running operation.\n" + + " */"); + + } + }); + + documentIntelligenceClient.getMethodsByName("beginClassifyDocument").forEach(methodDeclaration -> { + if (methodDeclaration.getParameters().size() == 2) { + methodDeclaration.getParameterByName("classifyRequest").get().setName("classifyDocumentOptions"); + methodDeclaration.setBody(StaticJavaParser.parseBlock(String.join("\n", + "{", "Objects.requireNonNull(classifyDocumentOptions, \"'classifyDocumentOptions' cannot be null.\");\n" + + " return this.beginClassifyDocument(classifierId, classifyDocumentOptions, classifyDocumentOptions.getStringIndexType(), classifyDocumentOptions.getSplit(), classifyDocumentOptions.getPages() != null ? CoreUtils.stringJoin(\",\", classifyDocumentOptions.getPages()) : null);\n" + + "}"))); + methodDeclaration.setJavadocComment("/**\n" + + " * Classifies document with document classifier.\n" + + " *\n" + + " * @param classifierId Unique document classifier name.\n" + + " * @param classifyDocumentOptions Classify request parameters.\n" + + " * @throws IllegalArgumentException thrown if parameters fail the validation.\n" + + " * @throws HttpResponseException thrown if the request is rejected by server.\n" + + " * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.\n" + + " * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.\n" + + " * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.\n" + + " * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.\n" + + " * @return the {@link SyncPoller} for polling of long-running operation.\n" + + " */"); + } + }); + }); + } + + private void customizeAnalyzeDocumentOptions(LibraryCustomization customization, Logger logger) { + ClassCustomization classCustomization = customization.getPackage(MODELS_PACKAGE) + .getClass("AnalyzeDocumentOptions"); + classCustomization.getConstructor("AnalyzeDocumentOptions()") + .setModifier(0); + + classCustomization.getMethod("setUrlSource").setModifier(0); + classCustomization.getMethod("setBytesSource").setModifier(0); + //addConstructors(classCustomization); + } + + private void customizeAnalyzeBatchDocumentOptions(LibraryCustomization customization, Logger logger) { + ClassCustomization classCustomization = customization.getPackage(MODELS_PACKAGE) + .getClass("AnalyzeBatchDocumentsOptions"); + classCustomization.getConstructor("AnalyzeBatchDocumentsOptions(String resultContainerUrl)") + .setModifier(0); + + classCustomization.getMethod("setAzureBlobSource").setModifier(0); + classCustomization.getMethod("setAzureBlobFileListSource").setModifier(0); + //addConstructors(classCustomization); + } + + private void customizeClassifyDocumentOptions(LibraryCustomization customization, Logger logger) { + ClassCustomization classCustomization = customization.getPackage(MODELS_PACKAGE) + .getClass("ClassifyDocumentOptions"); + classCustomization.getConstructor("ClassifyDocumentOptions()") + .setModifier(0); + + classCustomization.getMethod("setUrlSource").setModifier(0); + classCustomization.getMethod("setBytesSource").setModifier(0); + //addConstructors(classCustomization); + } + + private void customizeModifierForOverloadMethods(LibraryCustomization customization, Logger logger) { + logger.info("Customizing to make overload methods package private"); + PackageCustomization models = customization.getPackage("com.azure.ai.documentintelligence"); + ClassCustomization classCustomization = models.getClass("DocumentIntelligenceClient"); + classCustomization.customizeAst(compilationUnit -> { + ClassOrInterfaceDeclaration documentIntelligenceClient = compilationUnit.getClassByName("DocumentIntelligenceClient").get(); + documentIntelligenceClient.getMethodsByName("beginAnalyzeDocument").forEach(methodDeclaration -> { + if (methodDeclaration.getParameterByName("outputContentFormat").isPresent()) { + methodDeclaration.removeModifier(Modifier.Keyword.PUBLIC); + } + }); + + documentIntelligenceClient.getMethodsByName("beginAnalyzeBatchDocuments").forEach(methodDeclaration -> { + if (methodDeclaration.getParameterByName("outputContentFormat").isPresent()) { + methodDeclaration.removeModifier(Modifier.Keyword.PUBLIC); + } + }); + + documentIntelligenceClient.getMethodsByName("beginClassifyDocument").forEach(methodDeclaration -> { + if (methodDeclaration.getParameterByName("split").isPresent()) { + methodDeclaration.removeModifier(Modifier.Keyword.PUBLIC); + } + }); + }); + ClassCustomization asyncClassCustomization = models.getClass("DocumentIntelligenceAsyncClient"); + asyncClassCustomization.customizeAst(compilationUnit1 -> { + ClassOrInterfaceDeclaration documentIntelligenceAsyncClient = compilationUnit1.getClassByName("DocumentIntelligenceAsyncClient").get(); + documentIntelligenceAsyncClient.getMethodsByName("beginAnalyzeDocument").forEach(methodDeclaration -> { + if (methodDeclaration.getParameterByName("outputContentFormat").isPresent()) { + methodDeclaration.removeModifier(Modifier.Keyword.PUBLIC); + } + }); + + documentIntelligenceAsyncClient.getMethodsByName("beginAnalyzeBatchDocuments").forEach(methodDeclaration -> { + if (methodDeclaration.getParameterByName("outputContentFormat").isPresent()) { + methodDeclaration.removeModifier(Modifier.Keyword.PUBLIC); + } + }); + + documentIntelligenceAsyncClient.getMethodsByName("beginClassifyDocument").forEach(methodDeclaration -> { + if (methodDeclaration.getParameterByName("split").isPresent()) { + methodDeclaration.removeModifier(Modifier.Keyword.PUBLIC); + } + }); + }); + } + + private void customizeAnalyzeOperation(LibraryCustomization customization, Logger logger) { + logger.info("Customizing the AnalyzeOperation class"); + PackageCustomization packageCustomization = customization.getPackage("com.azure.ai.documentintelligence.models"); + packageCustomization.getClass("AnalyzeOperation") + .removeAnnotation("Immutable") + .customizeAst(ast -> + ast.getClassByName("AnalyzeOperation").ifPresent(clazz -> { + addOperationIdField(clazz); + addOperationIdGetter(clazz); + addOperationIdSetter(clazz); + })); + } + + private void customizeAnalyzeBatchOperation(LibraryCustomization customization, Logger logger) { + logger.info("Customizing the AnalyzeBatchOperation class"); PackageCustomization packageCustomization = customization.getPackage("com.azure.ai.documentintelligence.models"); - packageCustomization.getClass("AnalyzeResultOperation") + packageCustomization.getClass("AnalyzeBatchOperation") .removeAnnotation("Immutable") .customizeAst(ast -> - ast.getClassByName("AnalyzeResultOperation").ifPresent(clazz -> { + ast.getClassByName("AnalyzeBatchOperation").ifPresent(clazz -> { addOperationIdField(clazz); addOperationIdGetter(clazz); addOperationIdSetter(clazz); @@ -101,7 +302,8 @@ private void customizePollingStrategy(LibraryCustomization customization, Logger PackageCustomization packageCustomization = customization.getPackage("com.azure.ai.documentintelligence.implementation"); packageCustomization.getClass("SyncOperationLocationPollingStrategy").customizeAst(ast -> ast.getClassByName("SyncOperationLocationPollingStrategy").ifPresent(clazz -> { - ast.addImport("com.azure.ai.documentintelligence.models.AnalyzeResultOperation"); + ast.addImport("com.azure.ai.documentintelligence.models.AnalyzeOperation"); + ast.addImport("com.azure.ai.documentintelligence.models.AnalyzeBatchOperation"); ast.addImport("static com.azure.ai.documentintelligence.implementation.PollingUtils.parseOperationId"); addSyncPollOverrideMethod(clazz); })); @@ -109,7 +311,8 @@ private void customizePollingStrategy(LibraryCustomization customization, Logger logger.info("Customizing the OperationLocationPollingStrategy class"); packageCustomization.getClass("OperationLocationPollingStrategy").customizeAst(ast -> ast.getClassByName("OperationLocationPollingStrategy").ifPresent(clazz -> { - ast.addImport("com.azure.ai.documentintelligence.models.AnalyzeResultOperation"); + ast.addImport("com.azure.ai.documentintelligence.models.AnalyzeOperation"); + ast.addImport("com.azure.ai.documentintelligence.models.AnalyzeBatchOperation"); ast.addImport("static com.azure.ai.documentintelligence.implementation.PollingUtils.parseOperationId"); addAsyncPollOverrideMethod(clazz); })); @@ -131,8 +334,12 @@ private void addAsyncPollOverrideMethod(ClassOrInterfaceDeclaration clazz) { " if (operationLocationHeader != null) {", " operationId = parseOperationId(operationLocationHeader);", " }", - " if (pollResponse.getValue() instanceof AnalyzeResultOperation) {", - " AnalyzeResultOperation operation = (AnalyzeResultOperation) pollResponse.getValue();", + " if (pollResponse.getValue() instanceof AnalyzeOperation) {", + " AnalyzeOperation operation = (AnalyzeOperation) pollResponse.getValue();", + " operation.setOperationId(operationId);", + " }", + " if (pollResponse.getValue() instanceof AnalyzeBatchOperation) {", + " AnalyzeBatchOperation operation = (AnalyzeBatchOperation) pollResponse.getValue();", " operation.setOperationId(operationId);", " }", " return pollResponse;", @@ -141,9 +348,6 @@ private void addAsyncPollOverrideMethod(ClassOrInterfaceDeclaration clazz) { } private void addSyncPollOverrideMethod(ClassOrInterfaceDeclaration clazz) { - clazz.findCompilationUnit().ifPresent(ast -> - ast.addImport("com.azure.communication.common.implementation.HmacAuthenticationPolicy")); - clazz.addMethod("poll", Modifier.Keyword.PUBLIC) .setType("PollResponse") .addParameter("PollingContext", "pollingContext") @@ -157,11 +361,17 @@ private void addSyncPollOverrideMethod(ClassOrInterfaceDeclaration clazz) { "if (operationLocationHeader != null) {", " operationId = parseOperationId(operationLocationHeader);", "}", - "if (pollResponse.getValue() instanceof AnalyzeResultOperation) {", - " AnalyzeResultOperation operation = (AnalyzeResultOperation) pollResponse.getValue();", + "if (pollResponse.getValue() instanceof AnalyzeOperation) {", + " AnalyzeOperation operation = (AnalyzeOperation) pollResponse.getValue();", + " operation.setOperationId(operationId);", + "}", + "if (pollResponse.getValue() instanceof AnalyzeBatchOperation) {", + " AnalyzeBatchOperation operation = (AnalyzeBatchOperation) pollResponse.getValue();", " operation.setOperationId(operationId);", "}", "return pollResponse;", "}"))); } + + } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml b/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml index 936a64eaf212..801065eb6918 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml +++ b/sdk/documentintelligence/azure-ai-documentintelligence/pom.xml @@ -13,7 +13,7 @@ com.azure azure-ai-documentintelligence - 1.0.0-beta.5 + 1.0.0 Microsoft Azure client library for Document Intelligence This package contains the Microsoft Azure AI Document Intelligence SDK. @@ -33,14 +33,12 @@ + UTF-8 --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED --add-opens com.azure.ai.documentintelligence/com.azure.ai.documentintelligence=ALL-UNNAMED - 0.24 - 0.24 - same_thread false checkstyle-suppressions.xml diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/spotbugs-exclude.xml b/sdk/documentintelligence/azure-ai-documentintelligence/spotbugs-exclude.xml index 3e3e988f3cae..03e340c942de 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/spotbugs-exclude.xml +++ b/sdk/documentintelligence/azure-ai-documentintelligence/spotbugs-exclude.xml @@ -44,6 +44,13 @@ + + + + + + + @@ -58,6 +65,11 @@ + + + + + diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationAsyncClient.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationAsyncClient.java index fa1a41863da2..0171fb5e8ba1 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationAsyncClient.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationAsyncClient.java @@ -1,26 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence; import com.azure.ai.documentintelligence.implementation.DocumentIntelligenceAdministrationClientImpl; -import com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; +import com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyOptions; +import com.azure.ai.documentintelligence.models.AuthorizeModelCopyOptions; +import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization; import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; -import com.azure.ai.documentintelligence.models.CopyAuthorization; import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierCopyToOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceOperationDetails; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceResourceDetails; import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelComposeOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelCopyToOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.ai.documentintelligence.models.OperationDetails; -import com.azure.ai.documentintelligence.models.ResourceDetails; +import com.azure.ai.documentintelligence.models.ModelCopyAuthorization; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; @@ -46,12 +45,13 @@ */ @ServiceClient(builder = DocumentIntelligenceAdministrationClientBuilder.class, isAsync = true) public final class DocumentIntelligenceAdministrationAsyncClient { + @Generated private final DocumentIntelligenceAdministrationClientImpl serviceClient; /** * Initializes an instance of DocumentIntelligenceAdministrationAsyncClient class. - * + * * @param serviceClient the service client implementation. */ @Generated @@ -68,7 +68,7 @@ public final class DocumentIntelligenceAdministrationAsyncClient { * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -85,7 +85,7 @@ public final class DocumentIntelligenceAdministrationAsyncClient { * } * } * - * + * * @param buildRequest Build request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -115,7 +115,7 @@ public PollerFlux beginBuildDocumentModel(BinaryData bui * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -147,7 +147,7 @@ public PollerFlux beginBuildDocumentModel(BinaryData bui * } * } * - * + * * @param composeRequest Compose request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -194,7 +194,7 @@ public PollerFlux beginComposeModel(BinaryData composeRe * } * } * - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -227,7 +227,7 @@ public Mono> authorizeModelCopyWithResponse(BinaryData auth * } * } * - * + * * @param modelId Unique document model name. * @param copyToRequest Copy to request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -255,11 +255,12 @@ public PollerFlux beginCopyModelTo(String modelId, Binar * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -273,7 +274,7 @@ public PollerFlux beginCopyModelTo(String modelId, Binar * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -310,7 +311,7 @@ public PollerFlux beginCopyModelTo(String modelId, Binar * } * } * - * + * * @param modelId Unique document model name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -336,11 +337,12 @@ public Mono> getModelWithResponse(String modelId, RequestOp * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -354,7 +356,7 @@ public Mono> getModelWithResponse(String modelId, RequestOp * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -391,7 +393,7 @@ public Mono> getModelWithResponse(String modelId, RequestOp * } * } * - * + * * @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. @@ -407,7 +409,7 @@ public PagedFlux listModels(RequestOptions requestOptions) { /** * Deletes document model. - * + * * @param modelId Unique document model name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -436,7 +438,7 @@ public Mono> deleteModelWithResponse(String modelId, RequestOptio * } * } * - * + * * @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. @@ -447,8 +449,8 @@ public Mono> deleteModelWithResponse(String modelId, RequestOptio */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getResourceInfoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getResourceInfoWithResponseAsync(requestOptions); + public Mono> getResourceDetailsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getResourceDetailsWithResponseAsync(requestOptions); } /** @@ -460,7 +462,7 @@ public Mono> getResourceInfoWithResponse(RequestOptions req * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -485,7 +487,7 @@ public Mono> getResourceInfoWithResponse(RequestOptions req * } * } * - * + * * @param operationId 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. @@ -509,7 +511,7 @@ public Mono> getOperationWithResponse(String operationId, R * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -534,13 +536,14 @@ public Mono> getOperationWithResponse(String operationId, R * } * } * - * + * * @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 paged collection of OperationDetails items as paginated response with {@link PagedFlux}. + * @return paged collection of DocumentIntelligenceOperationDetails items as paginated response with + * {@link PagedFlux}. */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) @@ -575,7 +578,7 @@ public PagedFlux listOperations(RequestOptions requestOptions) { * } * } * - * + * * @param buildRequest Build request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -622,7 +625,7 @@ public PollerFlux beginBuildClassifier(BinaryData buildR * } * } * - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -655,7 +658,7 @@ public Mono> authorizeClassifierCopyWithResponse(BinaryData * } * } * - * + * * @param classifierId Unique document classifier name. * @param copyToRequest Copy to request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -683,6 +686,7 @@ public PollerFlux beginCopyClassifierTo(String classifie * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -708,7 +712,7 @@ public PollerFlux beginCopyClassifierTo(String classifie * } * } * - * + * * @param classifierId Unique document classifier name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -735,6 +739,7 @@ public Mono> getClassifierWithResponse(String classifierId, * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -760,7 +765,7 @@ public Mono> getClassifierWithResponse(String classifierId, * } * } * - * + * * @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. @@ -776,7 +781,7 @@ public PagedFlux listClassifiers(RequestOptions requestOptions) { /** * Deletes document classifier. - * + * * @param classifierId Unique document classifier name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -793,7 +798,7 @@ public Mono> deleteClassifierWithResponse(String classifierId, Re /** * Builds a custom document analysis model. - * + * * @param buildRequest Build request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -806,7 +811,7 @@ public Mono> deleteClassifierWithResponse(String classifierId, Re @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux - beginBuildDocumentModel(BuildDocumentModelRequest buildRequest) { + beginBuildDocumentModel(BuildDocumentModelOptions buildRequest) { // Generated convenience method for beginBuildDocumentModelWithModel RequestOptions requestOptions = new RequestOptions(); return serviceClient.beginBuildDocumentModelWithModelAsync(BinaryData.fromObject(buildRequest), requestOptions); @@ -814,7 +819,7 @@ public Mono> deleteClassifierWithResponse(String classifierId, Re /** * Creates a new document model from document types of existing document models. - * + * * @param composeRequest Compose request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -836,7 +841,7 @@ public Mono> deleteClassifierWithResponse(String classifierId, Re /** * Generates authorization to copy a document model to this location with * specified modelId and optional description. - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -849,17 +854,17 @@ public Mono> deleteClassifierWithResponse(String classifierId, Re */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono authorizeModelCopy(AuthorizeCopyRequest authorizeCopyRequest) { + public Mono authorizeModelCopy(AuthorizeModelCopyOptions authorizeCopyRequest) { // Generated convenience method for authorizeModelCopyWithResponse RequestOptions requestOptions = new RequestOptions(); return authorizeModelCopyWithResponse(BinaryData.fromObject(authorizeCopyRequest), requestOptions) .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CopyAuthorization.class)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelCopyAuthorization.class)); } /** * Copies document model to the target resource, region, and modelId. - * + * * @param modelId Unique document model name. * @param copyToRequest Copy to request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -873,7 +878,7 @@ public Mono authorizeModelCopy(AuthorizeCopyRequest authorize @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux beginCopyModelTo(String modelId, - CopyAuthorization copyToRequest) { + ModelCopyAuthorization copyToRequest) { // Generated convenience method for beginCopyModelToWithModel RequestOptions requestOptions = new RequestOptions(); return serviceClient.beginCopyModelToWithModelAsync(modelId, BinaryData.fromObject(copyToRequest), @@ -882,7 +887,7 @@ public PollerFlux beg /** * Gets detailed document model information. - * + * * @param modelId Unique document model name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -903,7 +908,7 @@ public Mono getModel(String modelId) { /** * List all document models. - * + * * @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. @@ -934,7 +939,7 @@ public PagedFlux listModels() { /** * Deletes document model. - * + * * @param modelId Unique document model name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -954,7 +959,7 @@ public Mono deleteModel(String modelId) { /** * Return information about the current resource. - * + * * @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. @@ -964,16 +969,16 @@ public Mono deleteModel(String modelId) { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getResourceInfo() { - // Generated convenience method for getResourceInfoWithResponse + public Mono getResourceDetails() { + // Generated convenience method for getResourceDetailsWithResponse RequestOptions requestOptions = new RequestOptions(); - return getResourceInfoWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ResourceDetails.class)); + return getResourceDetailsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DocumentIntelligenceResourceDetails.class)); } /** * Gets operation info. - * + * * @param operationId Operation ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -985,26 +990,27 @@ public Mono getResourceInfo() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getOperation(String operationId) { + public Mono getOperation(String operationId) { // Generated convenience method for getOperationWithResponse RequestOptions requestOptions = new RequestOptions(); return getOperationWithResponse(operationId, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(OperationDetails.class)); + .map(protocolMethodData -> protocolMethodData.toObject(DocumentIntelligenceOperationDetails.class)); } /** * Lists all operations. - * + * * @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 paged collection of OperationDetails items as paginated response with {@link PagedFlux}. + * @return paged collection of DocumentIntelligenceOperationDetails items as paginated response with + * {@link PagedFlux}. */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listOperations() { + public PagedFlux listOperations() { // Generated convenience method for listOperations RequestOptions requestOptions = new RequestOptions(); PagedFlux pagedFluxResponse = listOperations(requestOptions); @@ -1012,11 +1018,11 @@ public PagedFlux listOperations() { 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(), + return flux.map(pagedResponse -> new PagedResponseBase( + pagedResponse.getRequest(), pagedResponse.getStatusCode(), pagedResponse.getHeaders(), pagedResponse.getValue() .stream() - .map(protocolMethodData -> protocolMethodData.toObject(OperationDetails.class)) + .map(protocolMethodData -> protocolMethodData.toObject(DocumentIntelligenceOperationDetails.class)) .collect(Collectors.toList()), pagedResponse.getContinuationToken(), null)); }); @@ -1024,7 +1030,7 @@ public PagedFlux listOperations() { /** * Builds a custom document classifier. - * + * * @param buildRequest Build request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1037,7 +1043,7 @@ public PagedFlux listOperations() { @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux - beginBuildClassifier(BuildDocumentClassifierRequest buildRequest) { + beginBuildClassifier(BuildDocumentClassifierOptions buildRequest) { // Generated convenience method for beginBuildClassifierWithModel RequestOptions requestOptions = new RequestOptions(); return serviceClient.beginBuildClassifierWithModelAsync(BinaryData.fromObject(buildRequest), requestOptions); @@ -1046,7 +1052,7 @@ public PagedFlux listOperations() { /** * Generates authorization to copy a document classifier to this location with * specified classifierId and optional description. - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1060,7 +1066,7 @@ public PagedFlux listOperations() { @Generated @ServiceMethod(returns = ReturnType.SINGLE) public Mono - authorizeClassifierCopy(AuthorizeClassifierCopyRequest authorizeCopyRequest) { + authorizeClassifierCopy(AuthorizeClassifierCopyOptions authorizeCopyRequest) { // Generated convenience method for authorizeClassifierCopyWithResponse RequestOptions requestOptions = new RequestOptions(); return authorizeClassifierCopyWithResponse(BinaryData.fromObject(authorizeCopyRequest), requestOptions) @@ -1070,7 +1076,7 @@ public PagedFlux listOperations() { /** * Copies document classifier to the target resource, region, and classifierId. - * + * * @param classifierId Unique document classifier name. * @param copyToRequest Copy to request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1093,7 +1099,7 @@ public PagedFlux listOperations() { /** * Gets detailed document classifier information. - * + * * @param classifierId Unique document classifier name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1114,7 +1120,7 @@ public Mono getClassifier(String classifierId) { /** * List all document classifiers. - * + * * @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. @@ -1145,7 +1151,7 @@ public PagedFlux listClassifiers() { /** * Deletes document classifier. - * + * * @param classifierId Unique document classifier name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClient.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClient.java index 1b6e96ea1a81..b6d018c40bb7 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClient.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClient.java @@ -1,26 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence; import com.azure.ai.documentintelligence.implementation.DocumentIntelligenceAdministrationClientImpl; -import com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; +import com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyOptions; +import com.azure.ai.documentintelligence.models.AuthorizeModelCopyOptions; +import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization; import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; -import com.azure.ai.documentintelligence.models.CopyAuthorization; import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierCopyToOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceOperationDetails; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceResourceDetails; import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelComposeOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelCopyToOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.ai.documentintelligence.models.OperationDetails; -import com.azure.ai.documentintelligence.models.ResourceDetails; +import com.azure.ai.documentintelligence.models.ModelCopyAuthorization; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; @@ -40,12 +39,13 @@ */ @ServiceClient(builder = DocumentIntelligenceAdministrationClientBuilder.class) public final class DocumentIntelligenceAdministrationClient { + @Generated private final DocumentIntelligenceAdministrationClientImpl serviceClient; /** * Initializes an instance of DocumentIntelligenceAdministrationClient class. - * + * * @param serviceClient the service client implementation. */ @Generated @@ -62,7 +62,7 @@ public final class DocumentIntelligenceAdministrationClient { * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -79,7 +79,7 @@ public final class DocumentIntelligenceAdministrationClient { * } * } * - * + * * @param buildRequest Build request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -109,7 +109,7 @@ public SyncPoller beginBuildDocumentModel(BinaryData bui * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -141,7 +141,7 @@ public SyncPoller beginBuildDocumentModel(BinaryData bui * } * } * - * + * * @param composeRequest Compose request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -188,7 +188,7 @@ public SyncPoller beginComposeModel(BinaryData composeRe * } * } * - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -221,7 +221,7 @@ public Response authorizeModelCopyWithResponse(BinaryData authorizeC * } * } * - * + * * @param modelId Unique document model name. * @param copyToRequest Copy to request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -249,11 +249,12 @@ public SyncPoller beginCopyModelTo(String modelId, Binar * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -267,7 +268,7 @@ public SyncPoller beginCopyModelTo(String modelId, Binar * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -304,7 +305,7 @@ public SyncPoller beginCopyModelTo(String modelId, Binar * } * } * - * + * * @param modelId Unique document model name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -330,11 +331,12 @@ public Response getModelWithResponse(String modelId, RequestOptions * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -348,7 +350,7 @@ public Response getModelWithResponse(String modelId, RequestOptions * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -385,7 +387,7 @@ public Response getModelWithResponse(String modelId, RequestOptions * } * } * - * + * * @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. @@ -401,7 +403,7 @@ public PagedIterable listModels(RequestOptions requestOptions) { /** * Deletes document model. - * + * * @param modelId Unique document model name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -430,7 +432,7 @@ public Response deleteModelWithResponse(String modelId, RequestOptions req * } * } * - * + * * @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. @@ -440,8 +442,8 @@ public Response deleteModelWithResponse(String modelId, RequestOptions req */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getResourceInfoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getResourceInfoWithResponse(requestOptions); + public Response getResourceDetailsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getResourceDetailsWithResponse(requestOptions); } /** @@ -453,7 +455,7 @@ public Response getResourceInfoWithResponse(RequestOptions requestOp * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -478,7 +480,7 @@ public Response getResourceInfoWithResponse(RequestOptions requestOp * } * } * - * + * * @param operationId 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. @@ -502,7 +504,7 @@ public Response getOperationWithResponse(String operationId, Request * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -527,13 +529,14 @@ public Response getOperationWithResponse(String operationId, 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 paged collection of OperationDetails items as paginated response with {@link PagedIterable}. + * @return paged collection of DocumentIntelligenceOperationDetails items as paginated response with + * {@link PagedIterable}. */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) @@ -568,7 +571,7 @@ public PagedIterable listOperations(RequestOptions requestOptions) { * } * } * - * + * * @param buildRequest Build request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -615,7 +618,7 @@ public SyncPoller beginBuildClassifier(BinaryData buildR * } * } * - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -648,7 +651,7 @@ public Response authorizeClassifierCopyWithResponse(BinaryData autho * } * } * - * + * * @param classifierId Unique document classifier name. * @param copyToRequest Copy to request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -676,6 +679,7 @@ public SyncPoller beginCopyClassifierTo(String classifie * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -701,7 +705,7 @@ public SyncPoller beginCopyClassifierTo(String classifie * } * } * - * + * * @param classifierId Unique document classifier name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -727,6 +731,7 @@ public Response getClassifierWithResponse(String classifierId, Reque * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -752,7 +757,7 @@ public Response getClassifierWithResponse(String classifierId, Reque * } * } * - * + * * @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. @@ -768,7 +773,7 @@ public PagedIterable listClassifiers(RequestOptions requestOptions) /** * Deletes document classifier. - * + * * @param classifierId Unique document classifier name. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -785,7 +790,7 @@ public Response deleteClassifierWithResponse(String classifierId, RequestO /** * Builds a custom document analysis model. - * + * * @param buildRequest Build request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -798,7 +803,7 @@ public Response deleteClassifierWithResponse(String classifierId, RequestO @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller - beginBuildDocumentModel(BuildDocumentModelRequest buildRequest) { + beginBuildDocumentModel(BuildDocumentModelOptions buildRequest) { // Generated convenience method for beginBuildDocumentModelWithModel RequestOptions requestOptions = new RequestOptions(); return serviceClient.beginBuildDocumentModelWithModel(BinaryData.fromObject(buildRequest), requestOptions); @@ -806,7 +811,7 @@ public Response deleteClassifierWithResponse(String classifierId, RequestO /** * Creates a new document model from document types of existing document models. - * + * * @param composeRequest Compose request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -828,7 +833,7 @@ public Response deleteClassifierWithResponse(String classifierId, RequestO /** * Generates authorization to copy a document model to this location with * specified modelId and optional description. - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -841,16 +846,16 @@ public Response deleteClassifierWithResponse(String classifierId, RequestO */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public CopyAuthorization authorizeModelCopy(AuthorizeCopyRequest authorizeCopyRequest) { + public ModelCopyAuthorization authorizeModelCopy(AuthorizeModelCopyOptions authorizeCopyRequest) { // Generated convenience method for authorizeModelCopyWithResponse RequestOptions requestOptions = new RequestOptions(); return authorizeModelCopyWithResponse(BinaryData.fromObject(authorizeCopyRequest), requestOptions).getValue() - .toObject(CopyAuthorization.class); + .toObject(ModelCopyAuthorization.class); } /** * Copies document model to the target resource, region, and modelId. - * + * * @param modelId Unique document model name. * @param copyToRequest Copy to request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -864,7 +869,7 @@ public CopyAuthorization authorizeModelCopy(AuthorizeCopyRequest authorizeCopyRe @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller beginCopyModelTo(String modelId, - CopyAuthorization copyToRequest) { + ModelCopyAuthorization copyToRequest) { // Generated convenience method for beginCopyModelToWithModel RequestOptions requestOptions = new RequestOptions(); return serviceClient.beginCopyModelToWithModel(modelId, BinaryData.fromObject(copyToRequest), requestOptions); @@ -872,7 +877,7 @@ public SyncPoller beg /** * Gets detailed document model information. - * + * * @param modelId Unique document model name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -892,7 +897,7 @@ public DocumentModelDetails getModel(String modelId) { /** * List all document models. - * + * * @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. @@ -911,7 +916,7 @@ public PagedIterable listModels() { /** * Deletes document model. - * + * * @param modelId Unique document model name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -930,7 +935,7 @@ public void deleteModel(String modelId) { /** * Return information about the current resource. - * + * * @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. @@ -940,15 +945,16 @@ public void deleteModel(String modelId) { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceDetails getResourceInfo() { - // Generated convenience method for getResourceInfoWithResponse + public DocumentIntelligenceResourceDetails getResourceDetails() { + // Generated convenience method for getResourceDetailsWithResponse RequestOptions requestOptions = new RequestOptions(); - return getResourceInfoWithResponse(requestOptions).getValue().toObject(ResourceDetails.class); + return getResourceDetailsWithResponse(requestOptions).getValue() + .toObject(DocumentIntelligenceResourceDetails.class); } /** * Gets operation info. - * + * * @param operationId Operation ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -960,34 +966,36 @@ public ResourceDetails getResourceInfo() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public OperationDetails getOperation(String operationId) { + public DocumentIntelligenceOperationDetails getOperation(String operationId) { // Generated convenience method for getOperationWithResponse RequestOptions requestOptions = new RequestOptions(); - return getOperationWithResponse(operationId, requestOptions).getValue().toObject(OperationDetails.class); + return getOperationWithResponse(operationId, requestOptions).getValue() + .toObject(DocumentIntelligenceOperationDetails.class); } /** * Lists all operations. - * + * * @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 paged collection of OperationDetails items as paginated response with {@link PagedIterable}. + * @return paged collection of DocumentIntelligenceOperationDetails items as paginated response with + * {@link PagedIterable}. */ @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listOperations() { + public PagedIterable listOperations() { // Generated convenience method for listOperations RequestOptions requestOptions = new RequestOptions(); return serviceClient.listOperations(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(OperationDetails.class)); + .mapPage(bodyItemValue -> bodyItemValue.toObject(DocumentIntelligenceOperationDetails.class)); } /** * Builds a custom document classifier. - * + * * @param buildRequest Build request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1000,7 +1008,7 @@ public PagedIterable listOperations() { @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller - beginBuildClassifier(BuildDocumentClassifierRequest buildRequest) { + beginBuildClassifier(BuildDocumentClassifierOptions buildRequest) { // Generated convenience method for beginBuildClassifierWithModel RequestOptions requestOptions = new RequestOptions(); return serviceClient.beginBuildClassifierWithModel(BinaryData.fromObject(buildRequest), requestOptions); @@ -1009,7 +1017,7 @@ public PagedIterable listOperations() { /** * Generates authorization to copy a document classifier to this location with * specified classifierId and optional description. - * + * * @param authorizeCopyRequest Authorize copy request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1022,7 +1030,7 @@ public PagedIterable listOperations() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public ClassifierCopyAuthorization authorizeClassifierCopy(AuthorizeClassifierCopyRequest authorizeCopyRequest) { + public ClassifierCopyAuthorization authorizeClassifierCopy(AuthorizeClassifierCopyOptions authorizeCopyRequest) { // Generated convenience method for authorizeClassifierCopyWithResponse RequestOptions requestOptions = new RequestOptions(); return authorizeClassifierCopyWithResponse(BinaryData.fromObject(authorizeCopyRequest), requestOptions) @@ -1032,7 +1040,7 @@ public ClassifierCopyAuthorization authorizeClassifierCopy(AuthorizeClassifierCo /** * Copies document classifier to the target resource, region, and classifierId. - * + * * @param classifierId Unique document classifier name. * @param copyToRequest Copy to request parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1055,7 +1063,7 @@ public ClassifierCopyAuthorization authorizeClassifierCopy(AuthorizeClassifierCo /** * Gets detailed document classifier information. - * + * * @param classifierId Unique document classifier name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1076,7 +1084,7 @@ public DocumentClassifierDetails getClassifier(String classifierId) { /** * List all document classifiers. - * + * * @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. @@ -1095,7 +1103,7 @@ public PagedIterable listClassifiers() { /** * Deletes document classifier. - * + * * @param classifierId Unique document classifier name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClientBuilder.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClientBuilder.java index b4f65bd530a1..a6c61034a3db 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClientBuilder.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAdministrationClientBuilder.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence; import com.azure.ai.documentintelligence.implementation.DocumentIntelligenceAdministrationClientImpl; @@ -56,6 +55,7 @@ public final class DocumentIntelligenceAdministrationClientBuilder TokenCredentialTrait, KeyCredentialTrait, EndpointTrait { + @Generated private static final String SDK_NAME = "name"; @@ -246,7 +246,7 @@ public DocumentIntelligenceAdministrationClientBuilder endpoint(String endpoint) /** * Sets Service version. - * + * * @param serviceVersion the serviceVersion value. * @return the DocumentIntelligenceAdministrationClientBuilder. */ @@ -265,7 +265,7 @@ public DocumentIntelligenceAdministrationClientBuilder endpoint(String endpoint) /** * Sets The retry policy that will attempt to retry failed requests, if applicable. - * + * * @param retryPolicy the retryPolicy value. * @return the DocumentIntelligenceAdministrationClientBuilder. */ @@ -277,7 +277,7 @@ public DocumentIntelligenceAdministrationClientBuilder retryPolicy(RetryPolicy r /** * Builds an instance of DocumentIntelligenceAdministrationClientImpl with the provided parameters. - * + * * @return an instance of DocumentIntelligenceAdministrationClientImpl. */ @Generated @@ -341,7 +341,7 @@ private HttpPipeline createHttpPipeline() { /** * Builds an instance of DocumentIntelligenceAdministrationAsyncClient class. - * + * * @return an instance of DocumentIntelligenceAdministrationAsyncClient. */ @Generated @@ -351,7 +351,7 @@ public DocumentIntelligenceAdministrationAsyncClient buildAsyncClient() { /** * Builds an instance of DocumentIntelligenceAdministrationClient class. - * + * * @return an instance of DocumentIntelligenceAdministrationClient. */ @Generated diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClient.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClient.java index 098bd40548d9..11f1259d17ce 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClient.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClient.java @@ -1,20 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence; import com.azure.ai.documentintelligence.implementation.DocumentIntelligenceClientImpl; -import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest; +import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsOptions; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; import com.azure.ai.documentintelligence.models.AnalyzeBatchResult; -import com.azure.ai.documentintelligence.models.AnalyzeBatchResultOperation; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; -import com.azure.ai.documentintelligence.models.AnalyzeOutputOption; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOutputFormat; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.ClassifyDocumentRequest; -import com.azure.ai.documentintelligence.models.ContentFormat; +import com.azure.ai.documentintelligence.models.ClassifyDocumentOptions; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.DocumentContentFormat; import com.azure.ai.documentintelligence.models.SplitMode; import com.azure.ai.documentintelligence.models.StringIndexType; import com.azure.core.annotation.Generated; @@ -25,14 +24,20 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; import com.azure.core.util.FluxUtil; import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** @@ -40,12 +45,13 @@ */ @ServiceClient(builder = DocumentIntelligenceClientBuilder.class, isAsync = true) public final class DocumentIntelligenceAsyncClient { + @Generated private final DocumentIntelligenceClientImpl serviceClient; /** * Initializes an instance of DocumentIntelligenceAsyncClient class. - * + * * @param serviceClient the service client implementation. */ @Generated @@ -54,180 +60,211 @@ public final class DocumentIntelligenceAsyncClient { } /** - * Analyzes document with document model. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value - * may contain only - * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. - * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of - * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. - * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. - * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In - * the form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * + * Gets the generated searchable PDF output from document analysis. + *

Response Body Schema

+ * *
      * {@code
-     * {
-     *     urlSource: String (Optional)
-     *     base64Source: byte[] (Optional)
-     * }
+     * BinaryData
      * }
      * 
- * + * * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 PollerFlux} for polling of long-running operation. + * @return the generated searchable PDF output from document analysis along with {@link Response} on successful + * completion of {@link Mono}. */ @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeDocument(String modelId, RequestOptions requestOptions) { - return this.serviceClient.beginAnalyzeDocumentAsync(modelId, requestOptions); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnalyzeResultPdfWithResponse(String modelId, String resultId, + RequestOptions requestOptions) { + return this.serviceClient.getAnalyzeResultPdfWithResponseAsync(modelId, resultId, requestOptions); } /** - * Analyzes batch documents with document model. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value - * may contain only - * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. - * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of - * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. - * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. - * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In - * the form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * + * Gets the generated cropped image of specified figure from document analysis. + *

Response Body Schema

+ * *
      * {@code
-     * {
-     *     azureBlobSource (Optional): {
-     *         containerUrl: String (Required)
-     *         prefix: String (Optional)
-     *     }
-     *     azureBlobFileListSource (Optional): {
-     *         containerUrl: String (Required)
-     *         fileList: String (Required)
-     *     }
-     *     resultContainerUrl: String (Required)
-     *     resultPrefix: String (Optional)
-     *     overwriteExisting: Boolean (Optional)
-     * }
+     * BinaryData
      * }
      * 
- * + * * @param modelId Unique document model name. + * @param resultId Analyze operation result ID. + * @param figureId Figure 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 PollerFlux} for polling of long-running operation. + * @return the generated cropped image of specified figure from document analysis along with {@link Response} on + * successful completion of {@link Mono}. */ @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeBatchDocuments(String modelId, + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnalyzeResultFigureWithResponse(String modelId, String resultId, + String figureId, RequestOptions requestOptions) { + return this.serviceClient.getAnalyzeResultFigureWithResponseAsync(modelId, resultId, figureId, requestOptions); + } + + /** + * Mark the result of document analysis for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAnalyzeResultWithResponse(String modelId, String resultId, RequestOptions requestOptions) { - return this.serviceClient.beginAnalyzeBatchDocumentsAsync(modelId, requestOptions); + return this.serviceClient.deleteAnalyzeResultWithResponseAsync(modelId, resultId, requestOptions); } /** - * Gets the generated searchable PDF output from document analysis. + * List batch document analysis results. *

Response Body Schema

- * + * *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
- * + * * @param modelId Unique document model name. - * @param resultId Analyze operation result 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 generated searchable PDF output from document analysis along with {@link Response} on successful - * completion of {@link Mono}. + * @return paged collection of AnalyzeBatchOperation items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAnalyzeBatchResults(String modelId, RequestOptions requestOptions) { + return this.serviceClient.listAnalyzeBatchResultsAsync(modelId, requestOptions); + } + + /** + * Mark the batch document analysis result for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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 Response} on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnalyzeResultPdfWithResponse(String modelId, String resultId, + public Mono> deleteAnalyzeBatchResultWithResponse(String modelId, String resultId, RequestOptions requestOptions) { - return this.serviceClient.getAnalyzeResultPdfWithResponseAsync(modelId, resultId, requestOptions); + return this.serviceClient.deleteAnalyzeBatchResultWithResponseAsync(modelId, resultId, requestOptions); } /** - * Gets the generated cropped image of specified figure from document analysis. + * Gets the result of batch document analysis. *

Response Body Schema

- * + * *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
- * + * * @param modelId Unique document model name. - * @param resultId Analyze operation result ID. - * @param figureId Figure ID. + * @param resultId Analyze batch operation result 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 generated cropped image of specified figure from document analysis along with {@link Response} on - * successful completion of {@link Mono}. + * @return the result of batch document analysis along with {@link Response} on successful completion of + * {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnalyzeResultFigureWithResponse(String modelId, String resultId, - String figureId, RequestOptions requestOptions) { - return this.serviceClient.getAnalyzeResultFigureWithResponseAsync(modelId, resultId, figureId, requestOptions); + public Mono> getAnalyzeBatchResultWithResponse(String modelId, String resultId, + RequestOptions requestOptions) { + return this.serviceClient.getAnalyzeBatchResultWithResponseAsync(modelId, resultId, requestOptions); } /** @@ -240,12 +277,11 @@ public Mono> getAnalyzeResultFigureWithResponse(String mode * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

- * + * *
      * {@code
      * {
@@ -254,7 +290,7 @@ public Mono> getAnalyzeResultFigureWithResponse(String mode
      * }
      * }
      * 
- * + * * @param classifierId Unique document classifier name. * @param classifyRequest Classify request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -271,11 +307,346 @@ public PollerFlux beginClassifyDocument(String classifie return this.serviceClient.beginClassifyDocumentAsync(classifierId, classifyRequest, requestOptions); } + /** + * /** + * Analyzes document with document model. + * + * @param modelId Unique document model name. + * @param analyzeDocumentOptions Analyze request parameters. + * @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 the {@link SyncPoller} for polling of long-running operation. + * / + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginAnalyzeDocument(String modelId, + AnalyzeDocumentOptions analyzeDocumentOptions) { + Objects.requireNonNull(analyzeDocumentOptions, "'analyzeDocumentOptions' cannot be null."); + return this.beginAnalyzeDocument(modelId, analyzeDocumentOptions, + analyzeDocumentOptions.getPages() != null + ? CoreUtils.stringJoin(",", analyzeDocumentOptions.getPages()) + : null, + analyzeDocumentOptions.getLocale(), analyzeDocumentOptions.getStringIndexType(), + analyzeDocumentOptions.getDocumentAnalysisFeatures(), analyzeDocumentOptions.getQueryFields(), + analyzeDocumentOptions.getOutputContentFormat(), analyzeDocumentOptions.getOutput()); + } + + /** + * Gets the generated searchable PDF output from document analysis. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 the generated searchable PDF output from document analysis on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAnalyzeResultPdf(String modelId, String resultId) { + // Generated convenience method for getAnalyzeResultPdfWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnalyzeResultPdfWithResponse(modelId, resultId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Gets the generated cropped image of specified figure from document analysis. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result ID. + * @param figureId Figure 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 the generated cropped image of specified figure from document analysis on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAnalyzeResultFigure(String modelId, String resultId, String figureId) { + // Generated convenience method for getAnalyzeResultFigureWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnalyzeResultFigureWithResponse(modelId, resultId, figureId, requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * Mark the result of document analysis for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAnalyzeResult(String modelId, String resultId) { + // Generated convenience method for deleteAnalyzeResultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteAnalyzeResultWithResponse(modelId, resultId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * /** + * Analyzes batch documents with document model. + * + * @param modelId Unique document model name. + * @param analyzeBatchDocumentOptions Analyze batch request parameters. + * @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 the {@link SyncPoller} for polling of long-running operation. + * / + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginAnalyzeBatchDocuments(String modelId, + AnalyzeBatchDocumentsOptions analyzeBatchDocumentOptions) { + Objects.requireNonNull(analyzeBatchDocumentOptions, "'analyzeBatchDocumentOptions' cannot be null."); + return this.beginAnalyzeBatchDocuments(modelId, analyzeBatchDocumentOptions, + analyzeBatchDocumentOptions.getPages() != null + ? CoreUtils.stringJoin(",", analyzeBatchDocumentOptions.getPages()) + : null, + analyzeBatchDocumentOptions.getLocale(), analyzeBatchDocumentOptions.getStringIndexType(), + analyzeBatchDocumentOptions.getDocumentAnalysisFeatures(), analyzeBatchDocumentOptions.getQueryFields(), + analyzeBatchDocumentOptions.getOutputContentFormat(), analyzeBatchDocumentOptions.getOutput()); + } + + /** + * List batch document analysis results. + * + * @param modelId Unique document model name. + * @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 paged collection of AnalyzeBatchOperation items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAnalyzeBatchResults(String modelId) { + // Generated convenience method for listAnalyzeBatchResults + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listAnalyzeBatchResults(modelId, 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(AnalyzeBatchOperation.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Mark the batch document analysis result for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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 A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAnalyzeBatchResult(String modelId, String resultId) { + // Generated convenience method for deleteAnalyzeBatchResultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteAnalyzeBatchResultWithResponse(modelId, resultId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Gets the result of batch document analysis. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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 the result of batch document analysis on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAnalyzeBatchResult(String modelId, String resultId) { + // Generated convenience method for getAnalyzeBatchResultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnalyzeBatchResultWithResponse(modelId, resultId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AnalyzeBatchOperation.class)); + } + + /** + * /** + * Classifies document with document classifier. + * + * @param classifierId Unique document classifier name. + * @param classifyDocumentOptions Classify request parameters. + * @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 the {@link SyncPoller} for polling of long-running operation. + * / + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginClassifyDocument(String classifierId, + ClassifyDocumentOptions classifyDocumentOptions) { + Objects.requireNonNull(classifyDocumentOptions, "'classifyDocumentOptions' cannot be null."); + return this.beginClassifyDocument(classifierId, classifyDocumentOptions, + classifyDocumentOptions.getStringIndexType(), classifyDocumentOptions.getSplit(), + classifyDocumentOptions.getPages() != null + ? CoreUtils.stringJoin(",", classifyDocumentOptions.getPages()) + : null); + } + + /** + * Analyzes document with document model. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value + * may contain only + * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. + * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of + * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. + * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. + * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In + * the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     urlSource: String (Optional)
+     *     base64Source: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. + * @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 PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginAnalyzeDocument(String modelId, BinaryData analyzeRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginAnalyzeDocumentAsync(modelId, analyzeRequest, requestOptions); + } + + /** + * Analyzes batch documents with document model. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value + * may contain only + * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. + * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of + * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. + * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. + * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In + * the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     azureBlobSource (Optional): {
+     *         containerUrl: String (Required)
+     *         prefix: String (Optional)
+     *     }
+     *     azureBlobFileListSource (Optional): {
+     *         containerUrl: String (Required)
+     *         fileList: String (Required)
+     *     }
+     *     resultContainerUrl: String (Required)
+     *     resultPrefix: String (Optional)
+     *     overwriteExisting: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @param analyzeBatchRequest Analyze batch request parameters. + * @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 PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginAnalyzeBatchDocuments(String modelId, BinaryData analyzeBatchRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginAnalyzeBatchDocumentsAsync(modelId, analyzeBatchRequest, requestOptions); + } + /** * Analyzes document with document model. - * + * * @param modelId Unique document model name. - * @param pages List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". + * @param analyzeRequest Analyze request parameters. + * @param pages 1-based page numbers to analyze. Ex. "1-3,5,7-9". * @param locale Locale hint for text recognition and document analysis. Value may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). * @param stringIndexType Method used to compute string offset and length. @@ -283,7 +654,6 @@ public PollerFlux beginClassifyDocument(String classifie * @param queryFields List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". * @param outputContentFormat Format of the analyze result top-level content. * @param output Additional outputs to generate during analysis. - * @param analyzeRequest Analyze request parameters. * @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. @@ -294,10 +664,10 @@ public PollerFlux beginClassifyDocument(String classifie */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeDocument(String modelId, String pages, - String locale, StringIndexType stringIndexType, List features, - List queryFields, ContentFormat outputContentFormat, List output, - AnalyzeDocumentRequest analyzeRequest) { + PollerFlux beginAnalyzeDocument(String modelId, + AnalyzeDocumentOptions analyzeRequest, String pages, String locale, StringIndexType stringIndexType, + List features, List queryFields, DocumentContentFormat outputContentFormat, + List output) { // Generated convenience method for beginAnalyzeDocumentWithModel RequestOptions requestOptions = new RequestOptions(); if (pages != null) { @@ -333,37 +703,16 @@ public PollerFlux beginAnalyzeDocument(St .collect(Collectors.joining(",")), false); } - if (analyzeRequest != null) { - requestOptions.setBody(BinaryData.fromObject(analyzeRequest)); - } - return serviceClient.beginAnalyzeDocumentWithModelAsync(modelId, requestOptions); - } - - /** - * Analyzes document with document model. - * - * @param modelId Unique document model name. - * @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 the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeDocument(String modelId) { - // Generated convenience method for beginAnalyzeDocumentWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginAnalyzeDocumentWithModelAsync(modelId, requestOptions); + return serviceClient.beginAnalyzeDocumentWithModelAsync(modelId, BinaryData.fromObject(analyzeRequest), + requestOptions); } /** * Analyzes batch documents with document model. - * + * * @param modelId Unique document model name. - * @param pages List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". + * @param analyzeBatchRequest Analyze batch request parameters. + * @param pages 1-based page numbers to analyze. Ex. "1-3,5,7-9". * @param locale Locale hint for text recognition and document analysis. Value may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). * @param stringIndexType Method used to compute string offset and length. @@ -371,7 +720,6 @@ public PollerFlux beginAnalyzeDocument(St * @param queryFields List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". * @param outputContentFormat Format of the analyze result top-level content. * @param output Additional outputs to generate during analysis. - * @param analyzeBatchRequest Analyze batch request parameters. * @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. @@ -382,10 +730,10 @@ public PollerFlux beginAnalyzeDocument(St */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeBatchDocuments(String modelId, - String pages, String locale, StringIndexType stringIndexType, List features, - List queryFields, ContentFormat outputContentFormat, List output, - AnalyzeBatchDocumentsRequest analyzeBatchRequest) { + PollerFlux beginAnalyzeBatchDocuments(String modelId, + AnalyzeBatchDocumentsOptions analyzeBatchRequest, String pages, String locale, StringIndexType stringIndexType, + List features, List queryFields, DocumentContentFormat outputContentFormat, + List output) { // Generated convenience method for beginAnalyzeBatchDocumentsWithModel RequestOptions requestOptions = new RequestOptions(); if (pages != null) { @@ -421,85 +769,18 @@ public PollerFlux beginAnalyzeB .collect(Collectors.joining(",")), false); } - if (analyzeBatchRequest != null) { - requestOptions.setBody(BinaryData.fromObject(analyzeBatchRequest)); - } - return serviceClient.beginAnalyzeBatchDocumentsWithModelAsync(modelId, requestOptions); - } - - /** - * Analyzes batch documents with document model. - * - * @param modelId Unique document model name. - * @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 the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeBatchDocuments(String modelId) { - // Generated convenience method for beginAnalyzeBatchDocumentsWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginAnalyzeBatchDocumentsWithModelAsync(modelId, requestOptions); - } - - /** - * Gets the generated searchable PDF output from document analysis. - * - * @param modelId Unique document model name. - * @param resultId Analyze operation result 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 the generated searchable PDF output from document analysis on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAnalyzeResultPdf(String modelId, String resultId) { - // Generated convenience method for getAnalyzeResultPdfWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnalyzeResultPdfWithResponse(modelId, resultId, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Gets the generated cropped image of specified figure from document analysis. - * - * @param modelId Unique document model name. - * @param resultId Analyze operation result ID. - * @param figureId Figure 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 the generated cropped image of specified figure from document analysis on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAnalyzeResultFigure(String modelId, String resultId, String figureId) { - // Generated convenience method for getAnalyzeResultFigureWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnalyzeResultFigureWithResponse(modelId, resultId, figureId, requestOptions) - .flatMap(FluxUtil::toMono); + return serviceClient.beginAnalyzeBatchDocumentsWithModelAsync(modelId, + BinaryData.fromObject(analyzeBatchRequest), requestOptions); } /** * Classifies document with document classifier. - * + * * @param classifierId Unique document classifier name. * @param classifyRequest Classify request parameters. * @param stringIndexType Method used to compute string offset and length. * @param split Document splitting mode. - * @param pages List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". + * @param pages 1-based page numbers to analyze. Ex. "1-3,5,7-9". * @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. @@ -510,8 +791,8 @@ public Mono getAnalyzeResultFigure(String modelId, String resultId, */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginClassifyDocument(String classifierId, - ClassifyDocumentRequest classifyRequest, StringIndexType stringIndexType, SplitMode split, String pages) { + PollerFlux beginClassifyDocument(String classifierId, + ClassifyDocumentOptions classifyRequest, StringIndexType stringIndexType, SplitMode split, String pages) { // Generated convenience method for beginClassifyDocumentWithModel RequestOptions requestOptions = new RequestOptions(); if (stringIndexType != null) { @@ -526,27 +807,4 @@ public PollerFlux beginClassifyDocument(S return serviceClient.beginClassifyDocumentWithModelAsync(classifierId, BinaryData.fromObject(classifyRequest), requestOptions); } - - /** - * Classifies document with document classifier. - * - * @param classifierId Unique document classifier name. - * @param classifyRequest Classify request parameters. - * @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 the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginClassifyDocument(String classifierId, - ClassifyDocumentRequest classifyRequest) { - // Generated convenience method for beginClassifyDocumentWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginClassifyDocumentWithModelAsync(classifierId, BinaryData.fromObject(classifyRequest), - requestOptions); - } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClient.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClient.java index bf246a39c428..903070235c51 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClient.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClient.java @@ -1,20 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence; import com.azure.ai.documentintelligence.implementation.DocumentIntelligenceClientImpl; -import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest; +import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsOptions; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; import com.azure.ai.documentintelligence.models.AnalyzeBatchResult; -import com.azure.ai.documentintelligence.models.AnalyzeBatchResultOperation; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; -import com.azure.ai.documentintelligence.models.AnalyzeOutputOption; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOutputFormat; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.ClassifyDocumentRequest; -import com.azure.ai.documentintelligence.models.ContentFormat; +import com.azure.ai.documentintelligence.models.ClassifyDocumentOptions; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.DocumentContentFormat; import com.azure.ai.documentintelligence.models.SplitMode; import com.azure.ai.documentintelligence.models.StringIndexType; import com.azure.core.annotation.Generated; @@ -25,9 +24,11 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; import com.azure.core.util.polling.SyncPoller; import java.util.List; import java.util.Objects; @@ -38,12 +39,13 @@ */ @ServiceClient(builder = DocumentIntelligenceClientBuilder.class) public final class DocumentIntelligenceClient { + @Generated private final DocumentIntelligenceClientImpl serviceClient; /** * Initializes an instance of DocumentIntelligenceClient class. - * + * * @param serviceClient the service client implementation. */ @Generated @@ -52,178 +54,208 @@ public final class DocumentIntelligenceClient { } /** - * Analyzes document with document model. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value - * may contain only - * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. - * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of - * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. - * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. - * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In - * the form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * + * Gets the generated searchable PDF output from document analysis. + *

Response Body Schema

+ * *
      * {@code
-     * {
-     *     urlSource: String (Optional)
-     *     base64Source: byte[] (Optional)
-     * }
+     * BinaryData
      * }
      * 
- * + * * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 the generated searchable PDF output from document analysis along with {@link Response}. */ @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeDocument(String modelId, RequestOptions requestOptions) { - return this.serviceClient.beginAnalyzeDocument(modelId, requestOptions); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnalyzeResultPdfWithResponse(String modelId, String resultId, + RequestOptions requestOptions) { + return this.serviceClient.getAnalyzeResultPdfWithResponse(modelId, resultId, requestOptions); } /** - * Analyzes batch documents with document model. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value - * may contain only - * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. - * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of - * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. - * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. - * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In - * the form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * + * Gets the generated cropped image of specified figure from document analysis. + *

Response Body Schema

+ * *
      * {@code
-     * {
-     *     azureBlobSource (Optional): {
-     *         containerUrl: String (Required)
-     *         prefix: String (Optional)
-     *     }
-     *     azureBlobFileListSource (Optional): {
-     *         containerUrl: String (Required)
-     *         fileList: String (Required)
-     *     }
-     *     resultContainerUrl: String (Required)
-     *     resultPrefix: String (Optional)
-     *     overwriteExisting: Boolean (Optional)
-     * }
+     * BinaryData
      * }
      * 
- * + * * @param modelId Unique document model name. + * @param resultId Analyze operation result ID. + * @param figureId Figure 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 the generated cropped image of specified figure from document analysis along with {@link Response}. */ @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeBatchDocuments(String modelId, + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnalyzeResultFigureWithResponse(String modelId, String resultId, String figureId, RequestOptions requestOptions) { - return this.serviceClient.beginAnalyzeBatchDocuments(modelId, requestOptions); + return this.serviceClient.getAnalyzeResultFigureWithResponse(modelId, resultId, figureId, requestOptions); } /** - * Gets the generated searchable PDF output from document analysis. + * Mark the result of document analysis for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAnalyzeResultWithResponse(String modelId, String resultId, + RequestOptions requestOptions) { + return this.serviceClient.deleteAnalyzeResultWithResponse(modelId, resultId, requestOptions); + } + + /** + * List batch document analysis results. *

Response Body Schema

- * + * *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
- * + * * @param modelId Unique document model name. - * @param resultId Analyze operation result 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 generated searchable PDF output from document analysis along with {@link Response}. + * @return paged collection of AnalyzeBatchOperation items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAnalyzeBatchResults(String modelId, RequestOptions requestOptions) { + return this.serviceClient.listAnalyzeBatchResults(modelId, requestOptions); + } + + /** + * Mark the batch document analysis result for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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 Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnalyzeResultPdfWithResponse(String modelId, String resultId, + public Response deleteAnalyzeBatchResultWithResponse(String modelId, String resultId, RequestOptions requestOptions) { - return this.serviceClient.getAnalyzeResultPdfWithResponse(modelId, resultId, requestOptions); + return this.serviceClient.deleteAnalyzeBatchResultWithResponse(modelId, resultId, requestOptions); } /** - * Gets the generated cropped image of specified figure from document analysis. + * Gets the result of batch document analysis. *

Response Body Schema

- * + * *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
- * + * * @param modelId Unique document model name. - * @param resultId Analyze operation result ID. - * @param figureId Figure ID. + * @param resultId Analyze batch operation result 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 generated cropped image of specified figure from document analysis along with {@link Response}. + * @return the result of batch document analysis along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnalyzeResultFigureWithResponse(String modelId, String resultId, String figureId, + public Response getAnalyzeBatchResultWithResponse(String modelId, String resultId, RequestOptions requestOptions) { - return this.serviceClient.getAnalyzeResultFigureWithResponse(modelId, resultId, figureId, requestOptions); + return this.serviceClient.getAnalyzeBatchResultWithResponse(modelId, resultId, requestOptions); } /** @@ -236,12 +268,11 @@ public Response getAnalyzeResultFigureWithResponse(String modelId, S * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

- * + * *
      * {@code
      * {
@@ -250,7 +281,7 @@ public Response getAnalyzeResultFigureWithResponse(String modelId, S
      * }
      * }
      * 
- * + * * @param classifierId Unique document classifier name. * @param classifyRequest Classify request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. @@ -267,11 +298,307 @@ public SyncPoller beginClassifyDocument(String classifie return this.serviceClient.beginClassifyDocument(classifierId, classifyRequest, requestOptions); } + /** + * Gets the generated searchable PDF output from document analysis. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 the generated searchable PDF output from document analysis. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getAnalyzeResultPdf(String modelId, String resultId) { + // Generated convenience method for getAnalyzeResultPdfWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnalyzeResultPdfWithResponse(modelId, resultId, requestOptions).getValue(); + } + + /** + * Gets the generated cropped image of specified figure from document analysis. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result ID. + * @param figureId Figure 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 the generated cropped image of specified figure from document analysis. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getAnalyzeResultFigure(String modelId, String resultId, String figureId) { + // Generated convenience method for getAnalyzeResultFigureWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnalyzeResultFigureWithResponse(modelId, resultId, figureId, requestOptions).getValue(); + } + + /** + * Mark the result of document analysis for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteAnalyzeResult(String modelId, String resultId) { + // Generated convenience method for deleteAnalyzeResultWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteAnalyzeResultWithResponse(modelId, resultId, requestOptions).getValue(); + } + + /** + * List batch document analysis results. + * + * @param modelId Unique document model name. + * @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 paged collection of AnalyzeBatchOperation items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAnalyzeBatchResults(String modelId) { + // Generated convenience method for listAnalyzeBatchResults + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listAnalyzeBatchResults(modelId, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(AnalyzeBatchOperation.class)); + } + + /** + * Mark the batch document analysis result for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteAnalyzeBatchResult(String modelId, String resultId) { + // Generated convenience method for deleteAnalyzeBatchResultWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteAnalyzeBatchResultWithResponse(modelId, resultId, requestOptions).getValue(); + } + + /** + * Gets the result of batch document analysis. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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 the result of batch document analysis. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeBatchOperation getAnalyzeBatchResult(String modelId, String resultId) { + // Generated convenience method for getAnalyzeBatchResultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnalyzeBatchResultWithResponse(modelId, resultId, requestOptions).getValue() + .toObject(AnalyzeBatchOperation.class); + } + + /** + * Classifies document with document classifier. + * + * @param classifierId Unique document classifier name. + * @param classifyRequest Classify request parameters. + * @param stringIndexType Method used to compute string offset and length. + * @param split Document splitting mode. + * @param pages 1-based page numbers to analyze. Ex. "1-3,5,7-9". + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller beginClassifyDocument(String classifierId, + ClassifyDocumentOptions classifyRequest, StringIndexType stringIndexType, SplitMode split, String pages) { + // Generated convenience method for beginClassifyDocumentWithModel + RequestOptions requestOptions = new RequestOptions(); + if (stringIndexType != null) { + requestOptions.addQueryParam("stringIndexType", stringIndexType.toString(), false); + } + if (split != null) { + requestOptions.addQueryParam("split", split.toString(), false); + } + if (pages != null) { + requestOptions.addQueryParam("pages", pages, false); + } + return serviceClient.beginClassifyDocumentWithModel(classifierId, BinaryData.fromObject(classifyRequest), + requestOptions); + } + + /** + * /** + * Classifies document with document classifier. + * + * @param classifierId Unique document classifier name. + * @param classifyDocumentOptions Classify request parameters. + * @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 the {@link SyncPoller} for polling of long-running operation. + * / + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginClassifyDocument(String classifierId, + ClassifyDocumentOptions classifyDocumentOptions) { + Objects.requireNonNull(classifyDocumentOptions, "'classifyDocumentOptions' cannot be null."); + return this.beginClassifyDocument(classifierId, classifyDocumentOptions, + classifyDocumentOptions.getStringIndexType(), classifyDocumentOptions.getSplit(), + classifyDocumentOptions.getPages() != null + ? CoreUtils.stringJoin(",", classifyDocumentOptions.getPages()) + : null); + } + /** * Analyzes document with document model. - * + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value + * may contain only + * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. + * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of + * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. + * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. + * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In + * the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     urlSource: String (Optional)
+     *     base64Source: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. + * @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 beginAnalyzeDocument(String modelId, BinaryData analyzeRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginAnalyzeDocument(modelId, analyzeRequest, requestOptions); + } + + /** + * Analyzes batch documents with document model. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value + * may contain only + * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
stringIndexTypeStringNoMethod used to compute string offset and length. + * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".
featuresList<String>NoList of optional analysis features. In the form of + * "," separated string.
queryFieldsList<String>NoList of additional fields to extract. Ex. + * "NumberOfGuests,StoreNumber". In the form of "," separated string.
outputContentFormatStringNoFormat of the analyze result top-level content. + * Allowed values: "text", "markdown".
outputList<String>NoAdditional outputs to generate during analysis. In + * the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     azureBlobSource (Optional): {
+     *         containerUrl: String (Required)
+     *         prefix: String (Optional)
+     *     }
+     *     azureBlobFileListSource (Optional): {
+     *         containerUrl: String (Required)
+     *         fileList: String (Required)
+     *     }
+     *     resultContainerUrl: String (Required)
+     *     resultPrefix: String (Optional)
+     *     overwriteExisting: Boolean (Optional)
+     * }
+     * }
+     * 
+ * * @param modelId Unique document model name. - * @param pages List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". + * @param analyzeBatchRequest Analyze batch request parameters. + * @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 beginAnalyzeBatchDocuments(String modelId, BinaryData analyzeBatchRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginAnalyzeBatchDocuments(modelId, analyzeBatchRequest, requestOptions); + } + + /** + * Analyzes document with document model. + * + * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. + * @param pages 1-based page numbers to analyze. Ex. "1-3,5,7-9". * @param locale Locale hint for text recognition and document analysis. Value may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). * @param stringIndexType Method used to compute string offset and length. @@ -279,7 +606,6 @@ public SyncPoller beginClassifyDocument(String classifie * @param queryFields List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". * @param outputContentFormat Format of the analyze result top-level content. * @param output Additional outputs to generate during analysis. - * @param analyzeRequest Analyze request parameters. * @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. @@ -290,10 +616,10 @@ public SyncPoller beginClassifyDocument(String classifie */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeDocument(String modelId, String pages, - String locale, StringIndexType stringIndexType, List features, - List queryFields, ContentFormat outputContentFormat, List output, - AnalyzeDocumentRequest analyzeRequest) { + SyncPoller beginAnalyzeDocument(String modelId, + AnalyzeDocumentOptions analyzeRequest, String pages, String locale, StringIndexType stringIndexType, + List features, List queryFields, DocumentContentFormat outputContentFormat, + List output) { // Generated convenience method for beginAnalyzeDocumentWithModel RequestOptions requestOptions = new RequestOptions(); if (pages != null) { @@ -329,16 +655,16 @@ public SyncPoller beginAnalyzeDocument(St .collect(Collectors.joining(",")), false); } - if (analyzeRequest != null) { - requestOptions.setBody(BinaryData.fromObject(analyzeRequest)); - } - return serviceClient.beginAnalyzeDocumentWithModel(modelId, requestOptions); + return serviceClient.beginAnalyzeDocumentWithModel(modelId, BinaryData.fromObject(analyzeRequest), + requestOptions); } /** + * /** * Analyzes document with document model. - * + * * @param modelId Unique document model name. + * @param analyzeDocumentOptions Analyze request parameters. * @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. @@ -346,20 +672,28 @@ public SyncPoller beginAnalyzeDocument(St * @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 the {@link SyncPoller} for polling of long-running operation. + * / */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeDocument(String modelId) { - // Generated convenience method for beginAnalyzeDocumentWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginAnalyzeDocumentWithModel(modelId, requestOptions); + public SyncPoller beginAnalyzeDocument(String modelId, + AnalyzeDocumentOptions analyzeDocumentOptions) { + Objects.requireNonNull(analyzeDocumentOptions, "'analyzeDocumentOptions' cannot be null."); + return this.beginAnalyzeDocument(modelId, analyzeDocumentOptions, + analyzeDocumentOptions.getPages() != null + ? CoreUtils.stringJoin(",", analyzeDocumentOptions.getPages()) + : null, + analyzeDocumentOptions.getLocale(), analyzeDocumentOptions.getStringIndexType(), + analyzeDocumentOptions.getDocumentAnalysisFeatures(), analyzeDocumentOptions.getQueryFields(), + analyzeDocumentOptions.getOutputContentFormat(), analyzeDocumentOptions.getOutput()); } /** * Analyzes batch documents with document model. - * + * * @param modelId Unique document model name. - * @param pages List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". + * @param analyzeBatchRequest Analyze batch request parameters. + * @param pages 1-based page numbers to analyze. Ex. "1-3,5,7-9". * @param locale Locale hint for text recognition and document analysis. Value may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). * @param stringIndexType Method used to compute string offset and length. @@ -367,7 +701,6 @@ public SyncPoller beginAnalyzeDocument(St * @param queryFields List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". * @param outputContentFormat Format of the analyze result top-level content. * @param output Additional outputs to generate during analysis. - * @param analyzeBatchRequest Analyze batch request parameters. * @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. @@ -378,10 +711,10 @@ public SyncPoller beginAnalyzeDocument(St */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeBatchDocuments(String modelId, - String pages, String locale, StringIndexType stringIndexType, List features, - List queryFields, ContentFormat outputContentFormat, List output, - AnalyzeBatchDocumentsRequest analyzeBatchRequest) { + SyncPoller beginAnalyzeBatchDocuments(String modelId, + AnalyzeBatchDocumentsOptions analyzeBatchRequest, String pages, String locale, StringIndexType stringIndexType, + List features, List queryFields, DocumentContentFormat outputContentFormat, + List output) { // Generated convenience method for beginAnalyzeBatchDocumentsWithModel RequestOptions requestOptions = new RequestOptions(); if (pages != null) { @@ -417,16 +750,16 @@ public SyncPoller beginAnalyzeB .collect(Collectors.joining(",")), false); } - if (analyzeBatchRequest != null) { - requestOptions.setBody(BinaryData.fromObject(analyzeBatchRequest)); - } - return serviceClient.beginAnalyzeBatchDocumentsWithModel(modelId, requestOptions); + return serviceClient.beginAnalyzeBatchDocumentsWithModel(modelId, BinaryData.fromObject(analyzeBatchRequest), + requestOptions); } /** + * /** * Analyzes batch documents with document model. - * + * * @param modelId Unique document model name. + * @param analyzeBatchDocumentOptions Analyze batch request parameters. * @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. @@ -434,113 +767,19 @@ public SyncPoller beginAnalyzeB * @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 the {@link SyncPoller} for polling of long-running operation. + * / */ @Generated @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeBatchDocuments(String modelId) { - // Generated convenience method for beginAnalyzeBatchDocumentsWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginAnalyzeBatchDocumentsWithModel(modelId, requestOptions); - } - - /** - * Gets the generated searchable PDF output from document analysis. - * - * @param modelId Unique document model name. - * @param resultId Analyze operation result 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 the generated searchable PDF output from document analysis. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData getAnalyzeResultPdf(String modelId, String resultId) { - // Generated convenience method for getAnalyzeResultPdfWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnalyzeResultPdfWithResponse(modelId, resultId, requestOptions).getValue(); - } - - /** - * Gets the generated cropped image of specified figure from document analysis. - * - * @param modelId Unique document model name. - * @param resultId Analyze operation result ID. - * @param figureId Figure 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 the generated cropped image of specified figure from document analysis. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData getAnalyzeResultFigure(String modelId, String resultId, String figureId) { - // Generated convenience method for getAnalyzeResultFigureWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnalyzeResultFigureWithResponse(modelId, resultId, figureId, requestOptions).getValue(); - } - - /** - * Classifies document with document classifier. - * - * @param classifierId Unique document classifier name. - * @param classifyRequest Classify request parameters. - * @param stringIndexType Method used to compute string offset and length. - * @param split Document splitting mode. - * @param pages List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". - * @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 the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginClassifyDocument(String classifierId, - ClassifyDocumentRequest classifyRequest, StringIndexType stringIndexType, SplitMode split, String pages) { - // Generated convenience method for beginClassifyDocumentWithModel - RequestOptions requestOptions = new RequestOptions(); - if (stringIndexType != null) { - requestOptions.addQueryParam("stringIndexType", stringIndexType.toString(), false); - } - if (split != null) { - requestOptions.addQueryParam("split", split.toString(), false); - } - if (pages != null) { - requestOptions.addQueryParam("pages", pages, false); - } - return serviceClient.beginClassifyDocumentWithModel(classifierId, BinaryData.fromObject(classifyRequest), - requestOptions); - } - - /** - * Classifies document with document classifier. - * - * @param classifierId Unique document classifier name. - * @param classifyRequest Classify request parameters. - * @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 the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginClassifyDocument(String classifierId, - ClassifyDocumentRequest classifyRequest) { - // Generated convenience method for beginClassifyDocumentWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginClassifyDocumentWithModel(classifierId, BinaryData.fromObject(classifyRequest), - requestOptions); + public SyncPoller beginAnalyzeBatchDocuments(String modelId, + AnalyzeBatchDocumentsOptions analyzeBatchDocumentOptions) { + Objects.requireNonNull(analyzeBatchDocumentOptions, "'analyzeBatchDocumentOptions' cannot be null."); + return this.beginAnalyzeBatchDocuments(modelId, analyzeBatchDocumentOptions, + analyzeBatchDocumentOptions.getPages() != null + ? CoreUtils.stringJoin(",", analyzeBatchDocumentOptions.getPages()) + : null, + analyzeBatchDocumentOptions.getLocale(), analyzeBatchDocumentOptions.getStringIndexType(), + analyzeBatchDocumentOptions.getDocumentAnalysisFeatures(), analyzeBatchDocumentOptions.getQueryFields(), + analyzeBatchDocumentOptions.getOutputContentFormat(), analyzeBatchDocumentOptions.getOutput()); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientBuilder.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientBuilder.java index 149f15d6a027..5422c315f108 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientBuilder.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientBuilder.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence; import com.azure.ai.documentintelligence.implementation.DocumentIntelligenceClientImpl; @@ -50,6 +49,7 @@ public final class DocumentIntelligenceClientBuilder implements HttpTrait, ConfigurationTrait, TokenCredentialTrait, KeyCredentialTrait, EndpointTrait { + @Generated private static final String SDK_NAME = "name"; @@ -240,7 +240,7 @@ public DocumentIntelligenceClientBuilder endpoint(String endpoint) { /** * Sets Service version. - * + * * @param serviceVersion the serviceVersion value. * @return the DocumentIntelligenceClientBuilder. */ @@ -258,7 +258,7 @@ public DocumentIntelligenceClientBuilder serviceVersion(DocumentIntelligenceServ /** * Sets The retry policy that will attempt to retry failed requests, if applicable. - * + * * @param retryPolicy the retryPolicy value. * @return the DocumentIntelligenceClientBuilder. */ @@ -270,7 +270,7 @@ public DocumentIntelligenceClientBuilder retryPolicy(RetryPolicy retryPolicy) { /** * Builds an instance of DocumentIntelligenceClientImpl with the provided parameters. - * + * * @return an instance of DocumentIntelligenceClientImpl. */ @Generated @@ -334,7 +334,7 @@ private HttpPipeline createHttpPipeline() { /** * Builds an instance of DocumentIntelligenceAsyncClient class. - * + * * @return an instance of DocumentIntelligenceAsyncClient. */ @Generated @@ -344,7 +344,7 @@ public DocumentIntelligenceAsyncClient buildAsyncClient() { /** * Builds an instance of DocumentIntelligenceClient class. - * + * * @return an instance of DocumentIntelligenceClient. */ @Generated diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceServiceVersion.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceServiceVersion.java index f3076e672d3d..a2450d6b33f7 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceServiceVersion.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/DocumentIntelligenceServiceVersion.java @@ -11,9 +11,9 @@ */ public enum DocumentIntelligenceServiceVersion implements ServiceVersion { /** - * Enum value 2024-07-31-preview. + * Enum value 2024-11-30. */ - V2024_07_31_PREVIEW("2024-07-31-preview"); + V2024_11_30("2024-11-30"); private final String version; @@ -35,6 +35,6 @@ public String getVersion() { * @return The latest {@link DocumentIntelligenceServiceVersion}. */ public static DocumentIntelligenceServiceVersion getLatest() { - return V2024_07_31_PREVIEW; + return V2024_11_30; } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceAdministrationClientImpl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceAdministrationClientImpl.java index 3eefbe1ad979..30611fa9c936 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceAdministrationClientImpl.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceAdministrationClientImpl.java @@ -324,7 +324,7 @@ Response deleteModelSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getResourceInfo(@HostParam("endpoint") String endpoint, + Mono> getResourceDetails(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -334,7 +334,7 @@ Mono> getResourceInfo(@HostParam("endpoint") String endpoin @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getResourceInfoSync(@HostParam("endpoint") String endpoint, + Response getResourceDetailsSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @@ -574,7 +574,7 @@ Response listClassifiersNextSync(@PathParam(value = "nextLink", enco * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -618,7 +618,7 @@ private Mono> buildDocumentModelWithResponseAsync(BinaryData buil * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -661,7 +661,7 @@ private Response buildDocumentModelWithResponse(BinaryData buildRequest, R * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -712,7 +712,7 @@ public PollerFlux beginBuildDocumentModelAsync(BinaryDat * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -763,7 +763,7 @@ public SyncPoller beginBuildDocumentModel(BinaryData bui * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -815,7 +815,7 @@ public SyncPoller beginBuildDocumentModel(BinaryData bui * { * modelId: String (Required) * description: String (Optional) - * buildMode: String(template/neural/generative) (Required) + * buildMode: String(template/neural) (Required) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -872,7 +872,7 @@ public SyncPoller beginBuildDocumentModel(BinaryData bui * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -936,7 +936,7 @@ private Mono> composeModelWithResponseAsync(BinaryData composeReq * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -999,7 +999,7 @@ private Response composeModelWithResponse(BinaryData composeRequest, Reque * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1070,7 +1070,7 @@ public PollerFlux beginComposeModelAsync(BinaryData comp * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1141,7 +1141,7 @@ public SyncPoller beginComposeModel(BinaryData composeRe * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1213,7 +1213,7 @@ public SyncPoller beginComposeModel(BinaryData composeRe * docTypes (Required): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1623,11 +1623,12 @@ public SyncPoller beginCopyModelTo(String modelId, Binar * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -1641,7 +1642,7 @@ public SyncPoller beginCopyModelTo(String modelId, Binar * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1705,11 +1706,12 @@ public Mono> getModelWithResponseAsync(String modelId, Requ * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -1723,7 +1725,7 @@ public Mono> getModelWithResponseAsync(String modelId, Requ * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1787,11 +1789,12 @@ public Response getModelWithResponse(String modelId, RequestOptions * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -1805,7 +1808,7 @@ public Response getModelWithResponse(String modelId, RequestOptions * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1872,11 +1875,12 @@ private Mono> listModelsSinglePageAsync(RequestOptions * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -1890,7 +1894,7 @@ private Mono> listModelsSinglePageAsync(RequestOptions * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -1955,11 +1959,12 @@ public PagedFlux listModelsAsync(RequestOptions requestOptions) { * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -1973,7 +1978,7 @@ public PagedFlux listModelsAsync(RequestOptions requestOptions) { * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -2038,11 +2043,12 @@ private PagedResponse listModelsSinglePage(RequestOptions requestOpt * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -2056,7 +2062,7 @@ private PagedResponse listModelsSinglePage(RequestOptions requestOpt * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -2170,9 +2176,9 @@ public Response deleteModelWithResponse(String modelId, RequestOptions req * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getResourceInfoWithResponseAsync(RequestOptions requestOptions) { + public Mono> getResourceDetailsWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getResourceInfo(this.getEndpoint(), + return FluxUtil.withContext(context -> service.getResourceDetails(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, requestOptions, context)); } @@ -2199,9 +2205,9 @@ public Mono> getResourceInfoWithResponseAsync(RequestOption * @return general information regarding the current resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getResourceInfoWithResponse(RequestOptions requestOptions) { + public Response getResourceDetailsWithResponse(RequestOptions requestOptions) { final String accept = "application/json"; - return service.getResourceInfoSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + return service.getResourceDetailsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); } @@ -2214,7 +2220,7 @@ public Response getResourceInfoWithResponse(RequestOptions requestOp * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -2264,7 +2270,7 @@ public Mono> getOperationWithResponseAsync(String operation * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -2314,7 +2320,7 @@ public Response getOperationWithResponse(String operationId, Request * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -2345,8 +2351,8 @@ public Response getOperationWithResponse(String operationId, Request * @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 paged collection of OperationDetails items along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return paged collection of DocumentIntelligenceOperationDetails items along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listOperationsSinglePageAsync(RequestOptions requestOptions) { @@ -2367,7 +2373,7 @@ private Mono> listOperationsSinglePageAsync(RequestOpt * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -2398,7 +2404,8 @@ private Mono> listOperationsSinglePageAsync(RequestOpt * @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 paged collection of OperationDetails items as paginated response with {@link PagedFlux}. + * @return paged collection of DocumentIntelligenceOperationDetails items as paginated response with + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listOperationsAsync(RequestOptions requestOptions) { @@ -2418,7 +2425,7 @@ public PagedFlux listOperationsAsync(RequestOptions requestOptions) * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -2449,7 +2456,7 @@ public PagedFlux listOperationsAsync(RequestOptions requestOptions) * @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 paged collection of OperationDetails items along with {@link PagedResponse}. + * @return paged collection of DocumentIntelligenceOperationDetails items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listOperationsSinglePage(RequestOptions requestOptions) { @@ -2469,7 +2476,7 @@ private PagedResponse listOperationsSinglePage(RequestOptions reques * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -2500,7 +2507,8 @@ private PagedResponse listOperationsSinglePage(RequestOptions reques * @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 paged collection of OperationDetails items as paginated response with {@link PagedIterable}. + * @return paged collection of DocumentIntelligenceOperationDetails items as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listOperations(RequestOptions requestOptions) { @@ -3163,6 +3171,7 @@ public SyncPoller beginCopyClassifierTo(String classifie * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -3217,6 +3226,7 @@ public Mono> getClassifierWithResponseAsync(String classifi * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -3269,6 +3279,7 @@ public Response getClassifierWithResponse(String classifierId, Reque * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -3324,6 +3335,7 @@ private Mono> listClassifiersSinglePageAsync(RequestOp * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -3377,6 +3389,7 @@ public PagedFlux listClassifiersAsync(RequestOptions requestOptions) * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -3430,6 +3443,7 @@ private PagedResponse listClassifiersSinglePage(RequestOptions reque * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -3519,11 +3533,12 @@ public Response deleteClassifierWithResponse(String classifierId, RequestO * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -3537,7 +3552,7 @@ public Response deleteClassifierWithResponse(String classifierId, RequestO * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -3606,11 +3621,12 @@ private Mono> listModelsNextSinglePageAsync(String nex * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Optional) * tags (Optional): { * String: String (Required) * } - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * azureBlobSource (Optional): { * containerUrl: String (Required) * prefix: String (Optional) @@ -3624,7 +3640,7 @@ private Mono> listModelsNextSinglePageAsync(String nex * docTypes (Optional): { * String (Required): { * description: String (Optional) - * buildMode: String(template/neural/generative) (Optional) + * buildMode: String(template/neural) (Optional) * fieldSchema (Optional): { * String (Required): { * type: String(string/date/time/phoneNumber/number/integer/selectionMark/countryRegion/signature/array/object/currency/address/boolean/selectionGroup) (Required) @@ -3688,7 +3704,7 @@ private PagedResponse listModelsNextSinglePage(String nextLink, Requ * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -3720,8 +3736,8 @@ private PagedResponse listModelsNextSinglePage(String nextLink, Requ * @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 paged collection of OperationDetails items along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return paged collection of DocumentIntelligenceOperationDetails items along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listOperationsNextSinglePageAsync(String nextLink, @@ -3743,7 +3759,7 @@ private Mono> listOperationsNextSinglePageAsync(String * { * kind: String(documentModelBuild/documentModelCompose/documentModelCopyTo/documentClassifierCopyTo/documentClassifierBuild) (Required) * operationId: String (Required) - * status: String(notStarted/running/failed/succeeded/completed/canceled) (Required) + * status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required) * percentCompleted: Integer (Optional) * createdDateTime: OffsetDateTime (Required) * lastUpdatedDateTime: OffsetDateTime (Required) @@ -3775,7 +3791,7 @@ private Mono> listOperationsNextSinglePageAsync(String * @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 paged collection of OperationDetails items along with {@link PagedResponse}. + * @return paged collection of DocumentIntelligenceOperationDetails items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listOperationsNextSinglePage(String nextLink, RequestOptions requestOptions) { @@ -3797,6 +3813,7 @@ private PagedResponse listOperationsNextSinglePage(String nextLink, * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { @@ -3854,6 +3871,7 @@ private Mono> listClassifiersNextSinglePageAsync(Strin * description: String (Optional) * createdDateTime: OffsetDateTime (Required) * expirationDateTime: OffsetDateTime (Optional) + * modifiedDateTime: OffsetDateTime (Optional) * apiVersion: String (Required) * baseClassifierId: String (Optional) * docTypes (Required): { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceClientImpl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceClientImpl.java index 277f647ef834..a2050d3ff884 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceClientImpl.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/DocumentIntelligenceClientImpl.java @@ -5,11 +5,12 @@ package com.azure.ai.documentintelligence.implementation; import com.azure.ai.documentintelligence.DocumentIntelligenceServiceVersion; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; import com.azure.ai.documentintelligence.models.AnalyzeBatchResult; -import com.azure.ai.documentintelligence.models.AnalyzeBatchResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; @@ -26,11 +27,14 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; @@ -44,6 +48,9 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.TypeReference; import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import reactor.core.publisher.Mono; /** @@ -167,7 +174,8 @@ public interface DocumentIntelligenceClientService { @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> analyzeDocument(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData analyzeRequest, RequestOptions requestOptions, Context context); @Post("/documentModels/{modelId}:analyze") @ExpectedResponses({ 202 }) @@ -177,8 +185,75 @@ Mono> analyzeDocument(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(HttpResponseException.class) Response analyzeDocumentSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData analyzeRequest, RequestOptions requestOptions, Context context); + + @Get("/documentModels/{modelId}/analyzeResults/{resultId}/pdf") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAnalyzeResultPdf(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/documentModels/{modelId}/analyzeResults/{resultId}/pdf") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAnalyzeResultPdfSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAnalyzeResultFigure(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @PathParam("resultId") String resultId, @PathParam("figureId") String figureId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAnalyzeResultFigureSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @PathParam("resultId") String resultId, @PathParam("figureId") String figureId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + @Delete("/documentModels/{modelId}/analyzeResults/{resultId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteAnalyzeResult(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Delete("/documentModels/{modelId}/analyzeResults/{resultId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteAnalyzeResultSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + @Post("/documentModels/{modelId}:analyzeBatch") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @@ -187,7 +262,9 @@ Response analyzeDocumentSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> analyzeBatchDocuments(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData analyzeBatchRequest, RequestOptions requestOptions, + Context context); @Post("/documentModels/{modelId}:analyzeBatch") @ExpectedResponses({ 202 }) @@ -196,52 +273,74 @@ Mono> analyzeBatchDocuments(@HostParam("endpoint") String endpoin @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response analyzeBatchDocumentsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData analyzeBatchRequest, RequestOptions requestOptions, + Context context); + + @Get("/documentModels/{modelId}/analyzeBatchResults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listAnalyzeBatchResults(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/documentModels/{modelId}/analyzeResults/{resultId}/pdf") + @Get("/documentModels/{modelId}/analyzeBatchResults") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAnalyzeResultPdf(@HostParam("endpoint") String endpoint, + Response listAnalyzeBatchResultsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Delete("/documentModels/{modelId}/analyzeBatchResults/{resultId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteAnalyzeBatchResult(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/documentModels/{modelId}/analyzeResults/{resultId}/pdf") - @ExpectedResponses({ 200 }) + @Delete("/documentModels/{modelId}/analyzeBatchResults/{resultId}") + @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAnalyzeResultPdfSync(@HostParam("endpoint") String endpoint, + Response deleteAnalyzeBatchResultSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}") + @Get("/documentModels/{modelId}/analyzeBatchResults/{resultId}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAnalyzeResultFigure(@HostParam("endpoint") String endpoint, + Mono> getAnalyzeBatchResult(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, - @PathParam("resultId") String resultId, @PathParam("figureId") String figureId, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); - @Get("/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}") + @Get("/documentModels/{modelId}/analyzeBatchResults/{resultId}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAnalyzeResultFigureSync(@HostParam("endpoint") String endpoint, + Response getAnalyzeBatchResultSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("modelId") String modelId, - @PathParam("resultId") String resultId, @PathParam("figureId") String figureId, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + @PathParam("resultId") String resultId, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); @Post("/documentClassifiers/{classifierId}:analyze") @ExpectedResponses({ 202 }) @@ -264,6 +363,26 @@ Response classifyDocumentSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("classifierId") String classifierId, @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData classifyRequest, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listAnalyzeBatchResultsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listAnalyzeBatchResultsNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); } /** @@ -272,8 +391,7 @@ Response classifyDocumentSync(@HostParam("endpoint") String endpoint, * * * - * + * * @@ -289,14 +407,6 @@ Response classifyDocumentSync(@HostParam("endpoint") String endpoint, * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -309,6 +419,7 @@ Response classifyDocumentSync(@HostParam("endpoint") String endpoint,
      * 
* * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. * @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. @@ -317,16 +428,13 @@ Response classifyDocumentSync(@HostParam("endpoint") String endpoint, * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> analyzeDocumentWithResponseAsync(String modelId, RequestOptions requestOptions) { + private Mono> analyzeDocumentWithResponseAsync(String modelId, BinaryData analyzeRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return FluxUtil.withContext(context -> service.analyzeDocument(this.getEndpoint(), - this.getServiceVersion().getVersion(), modelId, accept, requestOptionsLocal, context)); + return FluxUtil + .withContext(context -> service.analyzeDocument(this.getEndpoint(), this.getServiceVersion().getVersion(), + modelId, contentType, accept, analyzeRequest, requestOptions, context)); } /** @@ -335,8 +443,7 @@ private Mono> analyzeDocumentWithResponseAsync(String modelId, Re * * * - * + * * @@ -352,14 +459,6 @@ private Mono> analyzeDocumentWithResponseAsync(String modelId, Re * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -372,6 +471,7 @@ private Mono> analyzeDocumentWithResponseAsync(String modelId, Re
      * 
* * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. * @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. @@ -380,16 +480,12 @@ private Mono> analyzeDocumentWithResponseAsync(String modelId, Re * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Response analyzeDocumentWithResponse(String modelId, RequestOptions requestOptions) { + private Response analyzeDocumentWithResponse(String modelId, BinaryData analyzeRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return service.analyzeDocumentSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, accept, - requestOptionsLocal, Context.NONE); + return service.analyzeDocumentSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, + contentType, accept, analyzeRequest, requestOptions, Context.NONE); } /** @@ -398,8 +494,7 @@ private Response analyzeDocumentWithResponse(String modelId, RequestOption * * * - * + * * @@ -415,14 +510,6 @@ private Response analyzeDocumentWithResponse(String modelId, RequestOption * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -435,6 +522,7 @@ private Response analyzeDocumentWithResponse(String modelId, RequestOption
      * 
* * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. * @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. @@ -443,9 +531,10 @@ private Response analyzeDocumentWithResponse(String modelId, RequestOption * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeDocumentAsync(String modelId, RequestOptions requestOptions) { + public PollerFlux beginAnalyzeDocumentAsync(String modelId, BinaryData analyzeRequest, + RequestOptions requestOptions) { return PollerFlux.create(Duration.ofSeconds(1), - () -> this.analyzeDocumentWithResponseAsync(modelId, requestOptions), + () -> this.analyzeDocumentWithResponseAsync(modelId, analyzeRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.OperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -463,8 +552,7 @@ public PollerFlux beginAnalyzeDocumentAsync(String model * * * - * + * * @@ -480,14 +568,6 @@ public PollerFlux beginAnalyzeDocumentAsync(String model * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -500,6 +580,7 @@ public PollerFlux beginAnalyzeDocumentAsync(String model
      * 
* * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. * @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. @@ -508,9 +589,10 @@ public PollerFlux beginAnalyzeDocumentAsync(String model * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeDocument(String modelId, RequestOptions requestOptions) { + public SyncPoller beginAnalyzeDocument(String modelId, BinaryData analyzeRequest, + RequestOptions requestOptions) { return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.analyzeDocumentWithResponse(modelId, requestOptions), + () -> this.analyzeDocumentWithResponse(modelId, analyzeRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.SyncOperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -528,8 +610,7 @@ public SyncPoller beginAnalyzeDocument(String modelId, R * * * - * + * * @@ -545,14 +626,6 @@ public SyncPoller beginAnalyzeDocument(String modelId, R * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -565,6 +638,7 @@ public SyncPoller beginAnalyzeDocument(String modelId, R
      * 
* * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. * @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. @@ -573,10 +647,10 @@ public SyncPoller beginAnalyzeDocument(String modelId, R * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginAnalyzeDocumentWithModelAsync(String modelId, - RequestOptions requestOptions) { + public PollerFlux beginAnalyzeDocumentWithModelAsync(String modelId, + BinaryData analyzeRequest, RequestOptions requestOptions) { return PollerFlux.create(Duration.ofSeconds(1), - () -> this.analyzeDocumentWithResponseAsync(modelId, requestOptions), + () -> this.analyzeDocumentWithResponseAsync(modelId, analyzeRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.OperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -585,8 +659,7 @@ public PollerFlux beginAnalyzeDocumentWit : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion()), "analyzeResult"), - TypeReference.createInstance(AnalyzeResultOperation.class), - TypeReference.createInstance(AnalyzeResult.class)); + TypeReference.createInstance(AnalyzeOperation.class), TypeReference.createInstance(AnalyzeResult.class)); } /** @@ -595,8 +668,7 @@ public PollerFlux beginAnalyzeDocumentWit * * * - * + * * @@ -612,14 +684,6 @@ public PollerFlux beginAnalyzeDocumentWit * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -632,6 +696,7 @@ public PollerFlux beginAnalyzeDocumentWit
      * 
* * @param modelId Unique document model name. + * @param analyzeRequest Analyze request parameters. * @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. @@ -640,10 +705,10 @@ public PollerFlux beginAnalyzeDocumentWit * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeDocumentWithModel(String modelId, - RequestOptions requestOptions) { + public SyncPoller beginAnalyzeDocumentWithModel(String modelId, + BinaryData analyzeRequest, RequestOptions requestOptions) { return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.analyzeDocumentWithResponse(modelId, requestOptions), + () -> this.analyzeDocumentWithResponse(modelId, analyzeRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.SyncOperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -652,8 +717,159 @@ public SyncPoller beginAnalyzeDocumentWit : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion()), "analyzeResult"), - TypeReference.createInstance(AnalyzeResultOperation.class), - TypeReference.createInstance(AnalyzeResult.class)); + TypeReference.createInstance(AnalyzeOperation.class), TypeReference.createInstance(AnalyzeResult.class)); + } + + /** + * Gets the generated searchable PDF output from document analysis. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 generated searchable PDF output from document analysis along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnalyzeResultPdfWithResponseAsync(String modelId, String resultId, + RequestOptions requestOptions) { + final String accept = "application/pdf"; + return FluxUtil.withContext(context -> service.getAnalyzeResultPdf(this.getEndpoint(), + this.getServiceVersion().getVersion(), modelId, resultId, accept, requestOptions, context)); + } + + /** + * Gets the generated searchable PDF output from document analysis. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 generated searchable PDF output from document analysis along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnalyzeResultPdfWithResponse(String modelId, String resultId, + RequestOptions requestOptions) { + final String accept = "application/pdf"; + return service.getAnalyzeResultPdfSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, + resultId, accept, requestOptions, Context.NONE); + } + + /** + * Gets the generated cropped image of specified figure from document analysis. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @param resultId Analyze operation result ID. + * @param figureId Figure 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 generated cropped image of specified figure from document analysis along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnalyzeResultFigureWithResponseAsync(String modelId, String resultId, + String figureId, RequestOptions requestOptions) { + final String accept = "image/png"; + return FluxUtil.withContext(context -> service.getAnalyzeResultFigure(this.getEndpoint(), + this.getServiceVersion().getVersion(), modelId, resultId, figureId, accept, requestOptions, context)); + } + + /** + * Gets the generated cropped image of specified figure from document analysis. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @param resultId Analyze operation result ID. + * @param figureId Figure 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 generated cropped image of specified figure from document analysis along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnalyzeResultFigureWithResponse(String modelId, String resultId, String figureId, + RequestOptions requestOptions) { + final String accept = "image/png"; + return service.getAnalyzeResultFigureSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, + resultId, figureId, accept, requestOptions, Context.NONE); + } + + /** + * Mark the result of document analysis for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAnalyzeResultWithResponseAsync(String modelId, String resultId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteAnalyzeResult(this.getEndpoint(), + this.getServiceVersion().getVersion(), modelId, resultId, accept, requestOptions, context)); + } + + /** + * Mark the result of document analysis for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze operation result 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAnalyzeResultWithResponse(String modelId, String resultId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteAnalyzeResultSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, + resultId, accept, requestOptions, Context.NONE); } /** @@ -662,8 +878,7 @@ public SyncPoller beginAnalyzeDocumentWit * * * - * + * * @@ -679,14 +894,6 @@ public SyncPoller beginAnalyzeDocumentWit * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -708,6 +915,7 @@ public SyncPoller beginAnalyzeDocumentWit
      * 
* * @param modelId Unique document model name. + * @param analyzeBatchRequest Analyze batch request parameters. * @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. @@ -716,16 +924,13 @@ public SyncPoller beginAnalyzeDocumentWit * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> analyzeBatchDocumentsWithResponseAsync(String modelId, RequestOptions requestOptions) { + private Mono> analyzeBatchDocumentsWithResponseAsync(String modelId, BinaryData analyzeBatchRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return FluxUtil.withContext(context -> service.analyzeBatchDocuments(this.getEndpoint(), - this.getServiceVersion().getVersion(), modelId, accept, requestOptionsLocal, context)); + return FluxUtil.withContext( + context -> service.analyzeBatchDocuments(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, + contentType, accept, analyzeBatchRequest, requestOptions, context)); } /** @@ -734,8 +939,7 @@ private Mono> analyzeBatchDocumentsWithResponseAsync(String model * * * - * + * * @@ -751,14 +955,6 @@ private Mono> analyzeBatchDocumentsWithResponseAsync(String model * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -780,6 +976,7 @@ private Mono> analyzeBatchDocumentsWithResponseAsync(String model
      * 
* * @param modelId Unique document model name. + * @param analyzeBatchRequest Analyze batch request parameters. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. @@ -788,16 +985,12 @@ private Mono> analyzeBatchDocumentsWithResponseAsync(String model * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Response analyzeBatchDocumentsWithResponse(String modelId, RequestOptions requestOptions) { + private Response analyzeBatchDocumentsWithResponse(String modelId, BinaryData analyzeBatchRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); return service.analyzeBatchDocumentsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, - accept, requestOptionsLocal, Context.NONE); + contentType, accept, analyzeBatchRequest, requestOptions, Context.NONE); } /** @@ -806,8 +999,7 @@ private Response analyzeBatchDocumentsWithResponse(String modelId, Request * * * - * + * * @@ -823,14 +1015,6 @@ private Response analyzeBatchDocumentsWithResponse(String modelId, Request * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -852,6 +1036,7 @@ private Response analyzeBatchDocumentsWithResponse(String modelId, Request
      * 
* * @param modelId Unique document model name. + * @param analyzeBatchRequest Analyze batch request parameters. * @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. @@ -861,9 +1046,9 @@ private Response analyzeBatchDocumentsWithResponse(String modelId, Request */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux beginAnalyzeBatchDocumentsAsync(String modelId, - RequestOptions requestOptions) { + BinaryData analyzeBatchRequest, RequestOptions requestOptions) { return PollerFlux.create(Duration.ofSeconds(1), - () -> this.analyzeBatchDocumentsWithResponseAsync(modelId, requestOptions), + () -> this.analyzeBatchDocumentsWithResponseAsync(modelId, analyzeBatchRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.OperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -881,8 +1066,7 @@ public PollerFlux beginAnalyzeBatchDocumentsAsync(String * * * - * + * * @@ -898,14 +1082,6 @@ public PollerFlux beginAnalyzeBatchDocumentsAsync(String * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -927,6 +1103,7 @@ public PollerFlux beginAnalyzeBatchDocumentsAsync(String
      * 
* * @param modelId Unique document model name. + * @param analyzeBatchRequest Analyze batch request parameters. * @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. @@ -935,10 +1112,10 @@ public PollerFlux beginAnalyzeBatchDocumentsAsync(String * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginAnalyzeBatchDocuments(String modelId, + public SyncPoller beginAnalyzeBatchDocuments(String modelId, BinaryData analyzeBatchRequest, RequestOptions requestOptions) { return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.analyzeBatchDocumentsWithResponse(modelId, requestOptions), + () -> this.analyzeBatchDocumentsWithResponse(modelId, analyzeBatchRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.SyncOperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -956,8 +1133,7 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode * * * - * + * * @@ -973,14 +1149,6 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -1002,6 +1170,7 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode
      * 
* * @param modelId Unique document model name. + * @param analyzeBatchRequest Analyze batch request parameters. * @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. @@ -1010,10 +1179,10 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux - beginAnalyzeBatchDocumentsWithModelAsync(String modelId, RequestOptions requestOptions) { + public PollerFlux beginAnalyzeBatchDocumentsWithModelAsync( + String modelId, BinaryData analyzeBatchRequest, RequestOptions requestOptions) { return PollerFlux.create(Duration.ofSeconds(1), - () -> this.analyzeBatchDocumentsWithResponseAsync(modelId, requestOptions), + () -> this.analyzeBatchDocumentsWithResponseAsync(modelId, analyzeBatchRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.OperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -1022,7 +1191,7 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion()), "result"), - TypeReference.createInstance(AnalyzeBatchResultOperation.class), + TypeReference.createInstance(AnalyzeBatchOperation.class), TypeReference.createInstance(AnalyzeBatchResult.class)); } @@ -1032,8 +1201,7 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode * * * - * + * * @@ -1049,14 +1217,6 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode * the form of "," separated string. *
Query Parameters
NameTypeRequiredDescription
pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9"
pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9"
localeStringNoLocale hint for text recognition and document analysis. Value * may contain only * the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US").
* You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} *

Request Body Schema

* *
@@ -1078,6 +1238,7 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode
      * 
* * @param modelId Unique document model name. + * @param analyzeBatchRequest Analyze batch request parameters. * @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. @@ -1086,10 +1247,10 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller - beginAnalyzeBatchDocumentsWithModel(String modelId, RequestOptions requestOptions) { + public SyncPoller beginAnalyzeBatchDocumentsWithModel(String modelId, + BinaryData analyzeBatchRequest, RequestOptions requestOptions) { return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.analyzeBatchDocumentsWithResponse(modelId, requestOptions), + () -> this.analyzeBatchDocumentsWithResponse(modelId, analyzeBatchRequest, requestOptions), new com.azure.ai.documentintelligence.implementation.SyncOperationLocationPollingStrategy<>( new PollingStrategyOptions(this.getHttpPipeline()) .setEndpoint("{endpoint}/documentintelligence".replace("{endpoint}", this.getEndpoint())) @@ -1098,120 +1259,406 @@ public SyncPoller beginAnalyzeBatchDocuments(String mode : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion()), "result"), - TypeReference.createInstance(AnalyzeBatchResultOperation.class), + TypeReference.createInstance(AnalyzeBatchOperation.class), TypeReference.createInstance(AnalyzeBatchResult.class)); } /** - * Gets the generated searchable PDF output from document analysis. + * List batch document analysis results. *

Response Body Schema

* *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
* * @param modelId Unique document model name. - * @param resultId Analyze operation result 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 generated searchable PDF output from document analysis along with {@link Response} on successful - * completion of {@link Mono}. + * @return paged collection of AnalyzeBatchOperation items along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnalyzeResultPdfWithResponseAsync(String modelId, String resultId, + private Mono> listAnalyzeBatchResultsSinglePageAsync(String modelId, RequestOptions requestOptions) { - final String accept = "application/pdf"; - return FluxUtil.withContext(context -> service.getAnalyzeResultPdf(this.getEndpoint(), - this.getServiceVersion().getVersion(), modelId, resultId, accept, requestOptions, context)); + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAnalyzeBatchResults(this.getEndpoint(), + this.getServiceVersion().getVersion(), modelId, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Gets the generated searchable PDF output from document analysis. + * List batch document analysis results. *

Response Body Schema

* *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
* * @param modelId Unique document model name. - * @param resultId Analyze operation result 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 generated searchable PDF output from document analysis along with {@link Response}. + * @return paged collection of AnalyzeBatchOperation items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAnalyzeBatchResultsAsync(String modelId, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listAnalyzeBatchResultsSinglePageAsync(modelId, requestOptions), + nextLink -> listAnalyzeBatchResultsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List batch document analysis results. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @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 paged collection of AnalyzeBatchOperation items along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnalyzeResultPdfWithResponse(String modelId, String resultId, + private PagedResponse listAnalyzeBatchResultsSinglePage(String modelId, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listAnalyzeBatchResultsSync(this.getEndpoint(), + this.getServiceVersion().getVersion(), modelId, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List batch document analysis results. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param modelId Unique document model name. + * @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 paged collection of AnalyzeBatchOperation items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAnalyzeBatchResults(String modelId, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listAnalyzeBatchResultsSinglePage(modelId, requestOptions), + nextLink -> listAnalyzeBatchResultsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Mark the batch document analysis result for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteAnalyzeBatchResultWithResponseAsync(String modelId, String resultId, RequestOptions requestOptions) { - final String accept = "application/pdf"; - return service.getAnalyzeResultPdfSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteAnalyzeBatchResult(this.getEndpoint(), + this.getServiceVersion().getVersion(), modelId, resultId, accept, requestOptions, context)); + } + + /** + * Mark the batch document analysis result for deletion. + * + * @param modelId Unique document model name. + * @param resultId Analyze batch operation result 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteAnalyzeBatchResultWithResponse(String modelId, String resultId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteAnalyzeBatchResultSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, resultId, accept, requestOptions, Context.NONE); } /** - * Gets the generated cropped image of specified figure from document analysis. + * Gets the result of batch document analysis. *

Response Body Schema

* *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
* * @param modelId Unique document model name. - * @param resultId Analyze operation result ID. - * @param figureId Figure ID. + * @param resultId Analyze batch operation result 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 generated cropped image of specified figure from document analysis along with {@link Response} on - * successful completion of {@link Mono}. + * @return the result of batch document analysis along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnalyzeResultFigureWithResponseAsync(String modelId, String resultId, - String figureId, RequestOptions requestOptions) { - final String accept = "image/png"; - return FluxUtil.withContext(context -> service.getAnalyzeResultFigure(this.getEndpoint(), - this.getServiceVersion().getVersion(), modelId, resultId, figureId, accept, requestOptions, context)); + public Mono> getAnalyzeBatchResultWithResponseAsync(String modelId, String resultId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getAnalyzeBatchResult(this.getEndpoint(), + this.getServiceVersion().getVersion(), modelId, resultId, accept, requestOptions, context)); } /** - * Gets the generated cropped image of specified figure from document analysis. + * Gets the result of batch document analysis. *

Response Body Schema

* *
      * {@code
-     * BinaryData
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
      * }
      * 
* * @param modelId Unique document model name. - * @param resultId Analyze operation result ID. - * @param figureId Figure ID. + * @param resultId Analyze batch operation result 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 generated cropped image of specified figure from document analysis along with {@link Response}. + * @return the result of batch document analysis along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnalyzeResultFigureWithResponse(String modelId, String resultId, String figureId, + public Response getAnalyzeBatchResultWithResponse(String modelId, String resultId, RequestOptions requestOptions) { - final String accept = "image/png"; - return service.getAnalyzeResultFigureSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, - resultId, figureId, accept, requestOptions, Context.NONE); + final String accept = "application/json"; + return service.getAnalyzeBatchResultSync(this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, + resultId, accept, requestOptions, Context.NONE); } /** @@ -1224,8 +1671,7 @@ public Response getAnalyzeResultFigureWithResponse(String modelId, S * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -1268,8 +1714,7 @@ private Mono> classifyDocumentWithResponseAsync(String classifier * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -1311,8 +1756,7 @@ private Response classifyDocumentWithResponse(String classifierId, BinaryD * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -1361,8 +1805,7 @@ public PollerFlux beginClassifyDocumentAsync(String clas * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -1411,8 +1854,7 @@ public SyncPoller beginClassifyDocument(String classifie * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -1436,7 +1878,7 @@ public SyncPoller beginClassifyDocument(String classifie * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginClassifyDocumentWithModelAsync(String classifierId, + public PollerFlux beginClassifyDocumentWithModelAsync(String classifierId, BinaryData classifyRequest, RequestOptions requestOptions) { return PollerFlux.create(Duration.ofSeconds(1), () -> this.classifyDocumentWithResponseAsync(classifierId, classifyRequest, requestOptions), @@ -1448,8 +1890,7 @@ public PollerFlux beginClassifyDocumentWi : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion()), "analyzeResult"), - TypeReference.createInstance(AnalyzeResultOperation.class), - TypeReference.createInstance(AnalyzeResult.class)); + TypeReference.createInstance(AnalyzeOperation.class), TypeReference.createInstance(AnalyzeResult.class)); } /** @@ -1462,8 +1903,7 @@ public PollerFlux beginClassifyDocumentWi * Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit". * splitStringNoDocument splitting mode. Allowed values: "auto", "none", * "perPage". - * pagesStringNoList of 1-based page numbers to analyze. Ex. - * "1-3,5,7-9" + * pagesStringNo1-based page numbers to analyze. Ex. "1-3,5,7-9" * * You can add these to a request with {@link RequestOptions#addQueryParam} *

Request Body Schema

@@ -1487,7 +1927,7 @@ public PollerFlux beginClassifyDocumentWi * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginClassifyDocumentWithModel(String classifierId, + public SyncPoller beginClassifyDocumentWithModel(String classifierId, BinaryData classifyRequest, RequestOptions requestOptions) { return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.classifyDocumentWithResponse(classifierId, classifyRequest, requestOptions), @@ -1499,7 +1939,147 @@ public SyncPoller beginClassifyDocumentWi : Context.NONE) .setServiceVersion(this.getServiceVersion().getVersion()), "analyzeResult"), - TypeReference.createInstance(AnalyzeResultOperation.class), - TypeReference.createInstance(AnalyzeResult.class)); + TypeReference.createInstance(AnalyzeOperation.class), TypeReference.createInstance(AnalyzeResult.class)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of AnalyzeBatchOperation items along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAnalyzeBatchResultsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAnalyzeBatchResultsNext(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)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     resultId: String (Optional)
+     *     status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     lastUpdatedDateTime: OffsetDateTime (Required)
+     *     percentCompleted: Integer (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             message: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         succeededCount: int (Required)
+     *         failedCount: int (Required)
+     *         skippedCount: int (Required)
+     *         details (Optional): [
+     *              (Optional){
+     *                 status: String(notStarted/running/failed/succeeded/canceled/skipped) (Required)
+     *                 sourceUrl: String (Required)
+     *                 resultUrl: String (Optional)
+     *                 error (Optional): (recursive schema, see error above)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 paged collection of AnalyzeBatchOperation items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAnalyzeBatchResultsNextSinglePage(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listAnalyzeBatchResultsNextSync(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); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/OperationLocationPollingStrategy.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/OperationLocationPollingStrategy.java index 293e42300433..be988aae4b79 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/OperationLocationPollingStrategy.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/OperationLocationPollingStrategy.java @@ -5,7 +5,8 @@ import static com.azure.ai.documentintelligence.implementation.PollingUtils.parseOperationId; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.core.exception.AzureException; import com.azure.core.http.HttpHeader; import com.azure.core.http.rest.Response; @@ -148,8 +149,12 @@ public Mono> poll(PollingContext pollingContext, TypeReferenc if (operationLocationHeader != null) { operationId = parseOperationId(operationLocationHeader); } - if (pollResponse.getValue() instanceof AnalyzeResultOperation) { - AnalyzeResultOperation operation = (AnalyzeResultOperation) pollResponse.getValue(); + if (pollResponse.getValue() instanceof AnalyzeOperation) { + AnalyzeOperation operation = (AnalyzeOperation) pollResponse.getValue(); + operation.setOperationId(operationId); + } + if (pollResponse.getValue() instanceof AnalyzeBatchOperation) { + AnalyzeBatchOperation operation = (AnalyzeBatchOperation) pollResponse.getValue(); operation.setOperationId(operationId); } return pollResponse; diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/SyncOperationLocationPollingStrategy.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/SyncOperationLocationPollingStrategy.java index b5e1afd7e688..29d5ae467954 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/SyncOperationLocationPollingStrategy.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/SyncOperationLocationPollingStrategy.java @@ -5,7 +5,8 @@ import static com.azure.ai.documentintelligence.implementation.PollingUtils.parseOperationId; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.core.exception.AzureException; import com.azure.core.http.HttpHeader; import com.azure.core.http.rest.Response; @@ -139,8 +140,12 @@ public PollResponse poll(PollingContext pollingContext, TypeReference p if (operationLocationHeader != null) { operationId = parseOperationId(operationLocationHeader); } - if (pollResponse.getValue() instanceof AnalyzeResultOperation) { - AnalyzeResultOperation operation = (AnalyzeResultOperation) pollResponse.getValue(); + if (pollResponse.getValue() instanceof AnalyzeOperation) { + AnalyzeOperation operation = (AnalyzeOperation) pollResponse.getValue(); + operation.setOperationId(operationId); + } + if (pollResponse.getValue() instanceof AnalyzeBatchOperation) { + AnalyzeBatchOperation operation = (AnalyzeBatchOperation) pollResponse.getValue(); operation.setOperationId(operationId); } return pollResponse; diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/package-info.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/package-info.java index d3c1bd308966..646fc63d008f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/package-info.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/implementation/package-info.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - /** * Package containing the implementations for DocumentIntelligence. * Extracts content, layout, and structured data from documents. diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AddressValue.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AddressValue.java index 374d1bf2dd38..c0f819b82d98 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AddressValue.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AddressValue.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -17,6 +16,7 @@ */ @Immutable public final class AddressValue implements JsonSerializable { + /* * House or building number. */ @@ -111,7 +111,7 @@ private AddressValue() { /** * Get the houseNumber property: House or building number. - * + * * @return the houseNumber value. */ @Generated @@ -121,7 +121,7 @@ public String getHouseNumber() { /** * Get the poBox property: Post office box number. - * + * * @return the poBox value. */ @Generated @@ -131,7 +131,7 @@ public String getPoBox() { /** * Get the road property: Street name. - * + * * @return the road value. */ @Generated @@ -141,7 +141,7 @@ public String getRoad() { /** * Get the city property: Name of city, town, village, etc. - * + * * @return the city value. */ @Generated @@ -151,7 +151,7 @@ public String getCity() { /** * Get the state property: First-level administrative division. - * + * * @return the state value. */ @Generated @@ -161,7 +161,7 @@ public String getState() { /** * Get the postalCode property: Postal code used for mail sorting. - * + * * @return the postalCode value. */ @Generated @@ -171,7 +171,7 @@ public String getPostalCode() { /** * Get the countryRegion property: Country/region. - * + * * @return the countryRegion value. */ @Generated @@ -181,7 +181,7 @@ public String getCountryRegion() { /** * Get the streetAddress property: Street-level address, excluding city, state, countryRegion, and postalCode. - * + * * @return the streetAddress value. */ @Generated @@ -191,7 +191,7 @@ public String getStreetAddress() { /** * Get the unit property: Apartment or office number. - * + * * @return the unit value. */ @Generated @@ -202,7 +202,7 @@ public String getUnit() { /** * Get the cityDistrict property: Districts or boroughs within a city, such as Brooklyn in New York City or City * of Westminster in London. - * + * * @return the cityDistrict value. */ @Generated @@ -212,7 +212,7 @@ public String getCityDistrict() { /** * Get the stateDistrict property: Second-level administrative division used in certain locales. - * + * * @return the stateDistrict value. */ @Generated @@ -222,7 +222,7 @@ public String getStateDistrict() { /** * Get the suburb property: Unofficial neighborhood name, like Chinatown. - * + * * @return the suburb value. */ @Generated @@ -232,7 +232,7 @@ public String getSuburb() { /** * Get the house property: Build name, such as World Trade Center. - * + * * @return the house value. */ @Generated @@ -242,7 +242,7 @@ public String getHouse() { /** * Get the level property: Floor number, such as 3F. - * + * * @return the level value. */ @Generated @@ -276,7 +276,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of AddressValue from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of AddressValue if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -289,7 +289,6 @@ public static AddressValue fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("houseNumber".equals(fieldName)) { deserializedAddressValue.houseNumber = reader.getString(); } else if ("poBox".equals(fieldName)) { @@ -322,7 +321,6 @@ public static AddressValue fromJson(JsonReader jsonReader) throws IOException { reader.skipChildren(); } } - return deserializedAddressValue; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchDocumentsOptions.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchDocumentsOptions.java new file mode 100644 index 000000000000..32f7106ac384 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchDocumentsOptions.java @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.documentintelligence.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.Arrays; +import java.util.List; +import java.util.Objects; + +/** + * Batch document analysis parameters. + */ +@Fluent +public final class AnalyzeBatchDocumentsOptions implements JsonSerializable { + + private List pages; + + private String locale; + + private List documentAnalysisFeatures; + + private StringIndexType stringIndexType; + + private List queryFields; + + private DocumentContentFormat outputContentFormat; + + private List output; + + /* + * Azure Blob Storage location containing the batch documents. Either + * azureBlobSource or azureBlobFileListSource must be specified. + */ + @Generated + private AzureBlobContentSource azureBlobSource; + + /* + * Azure Blob Storage file list specifying the batch documents. Either + * azureBlobSource or azureBlobFileListSource must be specified. + */ + @Generated + private AzureBlobFileListContentSource azureBlobFileListSource; + + /* + * Azure Blob Storage container URL where analyze result files will be stored. + */ + @Generated + private final String resultContainerUrl; + + /* + * Blob name prefix of result files. + */ + @Generated + private String resultPrefix; + + /* + * Overwrite existing analyze result files? + */ + @Generated + private Boolean overwriteExisting; + + /** + * Creates an instance of AnalyzeBatchDocumentsOptions with the specified Azure Blob source and result container + * URL. + * + * @param azureBlobSource the Azure Blob Storage location containing the batch documents. Cannot be null. + * @param resultContainerUrl the Azure Blob Storage container URL where analyze result files will be stored. Cannot + * be null. + */ + public AnalyzeBatchDocumentsOptions(AzureBlobContentSource azureBlobSource, String resultContainerUrl) { + Objects.requireNonNull(azureBlobSource, "'azureBlobSource' cannot be null"); + Objects.requireNonNull(resultContainerUrl, "'resultContainerUrl' cannot be null"); + this.azureBlobSource = azureBlobSource; + this.resultContainerUrl = resultContainerUrl; + } + + /** + * Creates an instance of AnalyzeBatchDocumentsOptions with the specified result container URL and Azure Blob file + * list source. + * + * @param azureBlobFileListSource the Azure Blob Storage file list specifying the batch documents. Cannot be null. + * @param resultContainerUrl the Azure Blob Storage container URL where analyze result files will be stored. Cannot + * be null. + */ + public AnalyzeBatchDocumentsOptions(AzureBlobFileListContentSource azureBlobFileListSource, + String resultContainerUrl) { + Objects.requireNonNull(azureBlobFileListSource, "'azureBlobFileListSource' cannot be null"); + Objects.requireNonNull(resultContainerUrl, "'resultContainerUrl' cannot be null"); + this.resultContainerUrl = resultContainerUrl; + this.azureBlobFileListSource = azureBlobFileListSource; + } + + /** + * Creates an instance of AnalyzeBatchDocumentsOptions class. + * + * @param resultContainerUrl the resultContainerUrl value to set. + */ + @Generated + AnalyzeBatchDocumentsOptions(String resultContainerUrl) { + this.resultContainerUrl = resultContainerUrl; + } + + /** + * Get the azureBlobSource property: Azure Blob Storage location containing the batch documents. Either + * azureBlobSource or azureBlobFileListSource must be specified. + * + * @return the azureBlobSource value. + */ + @Generated + public AzureBlobContentSource getAzureBlobSource() { + return this.azureBlobSource; + } + + /** + * Get the azureBlobFileListSource property: Azure Blob Storage file list specifying the batch documents. Either + * azureBlobSource or azureBlobFileListSource must be specified. + * + * @return the azureBlobFileListSource value. + */ + @Generated + public AzureBlobFileListContentSource getAzureBlobFileListSource() { + return this.azureBlobFileListSource; + } + + /** + * Get the resultContainerUrl property: Azure Blob Storage container URL where analyze result files will be stored. + * + * @return the resultContainerUrl value. + */ + @Generated + public String getResultContainerUrl() { + return this.resultContainerUrl; + } + + /** + * Get the resultPrefix property: Blob name prefix of result files. + * + * @return the resultPrefix value. + */ + @Generated + public String getResultPrefix() { + return this.resultPrefix; + } + + /** + * Set the resultPrefix property: Blob name prefix of result files. + * + * @param resultPrefix the resultPrefix value to set. + * @return the AnalyzeBatchDocumentsOptions object itself. + */ + @Generated + public AnalyzeBatchDocumentsOptions setResultPrefix(String resultPrefix) { + this.resultPrefix = resultPrefix; + return this; + } + + /** + * Get the overwriteExisting property: Overwrite existing analyze result files?. + * + * @return the overwriteExisting value. + */ + @Generated + public Boolean isOverwriteExisting() { + return this.overwriteExisting; + } + + /** + * Set the overwriteExisting property: Overwrite existing analyze result files?. + * + * @param overwriteExisting the overwriteExisting value to set. + * @return the AnalyzeBatchDocumentsOptions object itself. + */ + @Generated + public AnalyzeBatchDocumentsOptions setOverwriteExisting(Boolean overwriteExisting) { + this.overwriteExisting = overwriteExisting; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resultContainerUrl", this.resultContainerUrl); + jsonWriter.writeJsonField("azureBlobSource", this.azureBlobSource); + jsonWriter.writeJsonField("azureBlobFileListSource", this.azureBlobFileListSource); + jsonWriter.writeStringField("resultPrefix", this.resultPrefix); + jsonWriter.writeBooleanField("overwriteExisting", this.overwriteExisting); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyzeBatchDocumentsOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyzeBatchDocumentsOptions 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 AnalyzeBatchDocumentsOptions. + */ + @Generated + public static AnalyzeBatchDocumentsOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String resultContainerUrl = null; + AzureBlobContentSource azureBlobSource = null; + AzureBlobFileListContentSource azureBlobFileListSource = null; + String resultPrefix = null; + Boolean overwriteExisting = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("resultContainerUrl".equals(fieldName)) { + resultContainerUrl = reader.getString(); + } else if ("azureBlobSource".equals(fieldName)) { + azureBlobSource = AzureBlobContentSource.fromJson(reader); + } else if ("azureBlobFileListSource".equals(fieldName)) { + azureBlobFileListSource = AzureBlobFileListContentSource.fromJson(reader); + } else if ("resultPrefix".equals(fieldName)) { + resultPrefix = reader.getString(); + } else if ("overwriteExisting".equals(fieldName)) { + overwriteExisting = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + AnalyzeBatchDocumentsOptions deserializedAnalyzeBatchDocumentsOptions + = new AnalyzeBatchDocumentsOptions(resultContainerUrl); + deserializedAnalyzeBatchDocumentsOptions.azureBlobSource = azureBlobSource; + deserializedAnalyzeBatchDocumentsOptions.azureBlobFileListSource = azureBlobFileListSource; + deserializedAnalyzeBatchDocumentsOptions.resultPrefix = resultPrefix; + deserializedAnalyzeBatchDocumentsOptions.overwriteExisting = overwriteExisting; + return deserializedAnalyzeBatchDocumentsOptions; + }); + } + + /** + * Gets the list of additional fields to include in the result. + * + * @return the list of additional fields to include in the result. + */ + public List getQueryFields() { + return queryFields; + } + + /** + * Sets the list of additional fields to include in the result. + * + * @param queryFields the list of additional fields to include in the result. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions setQueryFields(List queryFields) { + this.queryFields = queryFields; + return this; + } + + /** + * Gets the output content format. + * + * @return the output content format. + */ + public DocumentContentFormat getOutputContentFormat() { + return outputContentFormat; + } + + /** + * Sets the output content format. + * + * @param outputContentFormat the output content format to set. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions setOutputContentFormat(DocumentContentFormat outputContentFormat) { + this.outputContentFormat = outputContentFormat; + return this; + } + + /** + * Gets the list of output formats. + * + * @return the list of output formats. + */ + public List getOutput() { + return output; + } + + /** + * Sets the list of output formats. + * + * @param output the list of output formats to set. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions setOutput(List output) { + this.output = output; + return this; + } + + /** + * Gets the string index type. + * + * @return the string index type. + */ + public StringIndexType getStringIndexType() { + return stringIndexType; + } + + /** + * Sets the string index type. + * + * @param stringIndexType the string index type to set. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions setStringIndexType(StringIndexType stringIndexType) { + this.stringIndexType = stringIndexType; + return this; + } + + /** + * Get the custom page numbers for multipage documents(PDF/TIFF). Input the number of the + * pages you want to get the recognized result for. + *

For a range of pages, use a hyphen, ex - ["1-3"]. Separate each page or a page + * range with a comma, ex - ["1-3", 4].

+ * + * @return the list of custom page numbers for a multipage document. + */ + public List getPages() { + return pages; + } + + /** + * Set the custom page numbers for multipage documents(PDF/TIFF). Input the number of the + * pages you want to get the recognized result for. + *

For a range of pages, use a hyphen, ex - ["1-3"]. Separate each page or a page + * range with a comma, ex - ["1-3", 4].

+ * + * @param pages the custom page numbers value to set. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions setPages(List pages) { + this.pages = pages; + return this; + } + + /** + * Get the locale hint for text recognition and document analysis. + * Value may contain only the language code (ex. \"en\", \"fr\") or BCP 47 language tag (ex. \"en-US\"). + * + * @return the locale value. + */ + public String getLocale() { + return locale; + } + + /** + * Set the locale value. + * Supported locales include: en-AU, en-CA, en-GB, en-IN, en-US. + * + * @param locale the locale value to set. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions setLocale(String locale) { + this.locale = locale; + return this; + } + + /** + * Get the list of optional analysis features. + * + * @return List of optional analysis features. + */ + public List getDocumentAnalysisFeatures() { + return documentAnalysisFeatures; + } + + /** + * Set the list of optional analysis features. + * + * @param documentAnalysisFeatures List of optional analysis features. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions + setDocumentAnalysisFeatures(List documentAnalysisFeatures) { + this.documentAnalysisFeatures = documentAnalysisFeatures; + return this; + } + + /** + * Set optional analysis features. + * + * @param documentAnalysisFeatures List of optional analysis features. + * @return the updated {@code AnalyzeBatchDocumentsOptions} value. + */ + public AnalyzeBatchDocumentsOptions + setDocumentAnalysisFeatures(DocumentAnalysisFeature... documentAnalysisFeatures) { + if (documentAnalysisFeatures != null) { + this.documentAnalysisFeatures = Arrays.asList(documentAnalysisFeatures); + } + return this; + } + + /** + * Set the azureBlobSource property: Azure Blob Storage location containing the batch documents. Either + * azureBlobSource or azureBlobFileListSource must be specified. + * + * @param azureBlobSource the azureBlobSource value to set. + * @return the AnalyzeBatchDocumentsOptions object itself. + */ + @Generated + AnalyzeBatchDocumentsOptions setAzureBlobSource(AzureBlobContentSource azureBlobSource) { + this.azureBlobSource = azureBlobSource; + return this; + } + + /** + * Set the azureBlobFileListSource property: Azure Blob Storage file list specifying the batch documents. Either + * azureBlobSource or azureBlobFileListSource must be specified. + * + * @param azureBlobFileListSource the azureBlobFileListSource value to set. + * @return the AnalyzeBatchDocumentsOptions object itself. + */ + @Generated + AnalyzeBatchDocumentsOptions setAzureBlobFileListSource(AzureBlobFileListContentSource azureBlobFileListSource) { + this.azureBlobFileListSource = azureBlobFileListSource; + return this; + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchDocumentsRequest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchDocumentsRequest.java deleted file mode 100644 index 7df298812a19..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchDocumentsRequest.java +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.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; - -/** - * Batch document analysis parameters. - */ -@Fluent -public final class AnalyzeBatchDocumentsRequest implements JsonSerializable { - /* - * Azure Blob Storage location containing the batch documents. Either - * azureBlobSource or azureBlobFileListSource must be specified. - */ - @Generated - private AzureBlobContentSource azureBlobSource; - - /* - * Azure Blob Storage file list specifying the batch documents. Either - * azureBlobSource or azureBlobFileListSource must be specified. - */ - @Generated - private AzureBlobFileListContentSource azureBlobFileListSource; - - /* - * Azure Blob Storage container URL where analyze result files will be stored. - */ - @Generated - private final String resultContainerUrl; - - /* - * Blob name prefix of result files. - */ - @Generated - private String resultPrefix; - - /* - * Overwrite existing analyze result files? - */ - @Generated - private Boolean overwriteExisting; - - /** - * Creates an instance of AnalyzeBatchDocumentsRequest class. - * - * @param resultContainerUrl the resultContainerUrl value to set. - */ - @Generated - public AnalyzeBatchDocumentsRequest(String resultContainerUrl) { - this.resultContainerUrl = resultContainerUrl; - } - - /** - * Get the azureBlobSource property: Azure Blob Storage location containing the batch documents. Either - * azureBlobSource or azureBlobFileListSource must be specified. - * - * @return the azureBlobSource value. - */ - @Generated - public AzureBlobContentSource getAzureBlobSource() { - return this.azureBlobSource; - } - - /** - * Set the azureBlobSource property: Azure Blob Storage location containing the batch documents. Either - * azureBlobSource or azureBlobFileListSource must be specified. - * - * @param azureBlobSource the azureBlobSource value to set. - * @return the AnalyzeBatchDocumentsRequest object itself. - */ - @Generated - public AnalyzeBatchDocumentsRequest setAzureBlobSource(AzureBlobContentSource azureBlobSource) { - this.azureBlobSource = azureBlobSource; - return this; - } - - /** - * Get the azureBlobFileListSource property: Azure Blob Storage file list specifying the batch documents. Either - * azureBlobSource or azureBlobFileListSource must be specified. - * - * @return the azureBlobFileListSource value. - */ - @Generated - public AzureBlobFileListContentSource getAzureBlobFileListSource() { - return this.azureBlobFileListSource; - } - - /** - * Set the azureBlobFileListSource property: Azure Blob Storage file list specifying the batch documents. Either - * azureBlobSource or azureBlobFileListSource must be specified. - * - * @param azureBlobFileListSource the azureBlobFileListSource value to set. - * @return the AnalyzeBatchDocumentsRequest object itself. - */ - @Generated - public AnalyzeBatchDocumentsRequest - setAzureBlobFileListSource(AzureBlobFileListContentSource azureBlobFileListSource) { - this.azureBlobFileListSource = azureBlobFileListSource; - return this; - } - - /** - * Get the resultContainerUrl property: Azure Blob Storage container URL where analyze result files will be stored. - * - * @return the resultContainerUrl value. - */ - @Generated - public String getResultContainerUrl() { - return this.resultContainerUrl; - } - - /** - * Get the resultPrefix property: Blob name prefix of result files. - * - * @return the resultPrefix value. - */ - @Generated - public String getResultPrefix() { - return this.resultPrefix; - } - - /** - * Set the resultPrefix property: Blob name prefix of result files. - * - * @param resultPrefix the resultPrefix value to set. - * @return the AnalyzeBatchDocumentsRequest object itself. - */ - @Generated - public AnalyzeBatchDocumentsRequest setResultPrefix(String resultPrefix) { - this.resultPrefix = resultPrefix; - return this; - } - - /** - * Get the overwriteExisting property: Overwrite existing analyze result files?. - * - * @return the overwriteExisting value. - */ - @Generated - public Boolean isOverwriteExisting() { - return this.overwriteExisting; - } - - /** - * Set the overwriteExisting property: Overwrite existing analyze result files?. - * - * @param overwriteExisting the overwriteExisting value to set. - * @return the AnalyzeBatchDocumentsRequest object itself. - */ - @Generated - public AnalyzeBatchDocumentsRequest setOverwriteExisting(Boolean overwriteExisting) { - this.overwriteExisting = overwriteExisting; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("resultContainerUrl", this.resultContainerUrl); - jsonWriter.writeJsonField("azureBlobSource", this.azureBlobSource); - jsonWriter.writeJsonField("azureBlobFileListSource", this.azureBlobFileListSource); - jsonWriter.writeStringField("resultPrefix", this.resultPrefix); - jsonWriter.writeBooleanField("overwriteExisting", this.overwriteExisting); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AnalyzeBatchDocumentsRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AnalyzeBatchDocumentsRequest 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 AnalyzeBatchDocumentsRequest. - */ - @Generated - public static AnalyzeBatchDocumentsRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String resultContainerUrl = null; - AzureBlobContentSource azureBlobSource = null; - AzureBlobFileListContentSource azureBlobFileListSource = null; - String resultPrefix = null; - Boolean overwriteExisting = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("resultContainerUrl".equals(fieldName)) { - resultContainerUrl = reader.getString(); - } else if ("azureBlobSource".equals(fieldName)) { - azureBlobSource = AzureBlobContentSource.fromJson(reader); - } else if ("azureBlobFileListSource".equals(fieldName)) { - azureBlobFileListSource = AzureBlobFileListContentSource.fromJson(reader); - } else if ("resultPrefix".equals(fieldName)) { - resultPrefix = reader.getString(); - } else if ("overwriteExisting".equals(fieldName)) { - overwriteExisting = reader.getNullable(JsonReader::getBoolean); - } else { - reader.skipChildren(); - } - } - AnalyzeBatchDocumentsRequest deserializedAnalyzeBatchDocumentsRequest - = new AnalyzeBatchDocumentsRequest(resultContainerUrl); - deserializedAnalyzeBatchDocumentsRequest.azureBlobSource = azureBlobSource; - deserializedAnalyzeBatchDocumentsRequest.azureBlobFileListSource = azureBlobFileListSource; - deserializedAnalyzeBatchDocumentsRequest.resultPrefix = resultPrefix; - deserializedAnalyzeBatchDocumentsRequest.overwriteExisting = overwriteExisting; - - return deserializedAnalyzeBatchDocumentsRequest; - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchResultOperation.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchOperation.java similarity index 51% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchResultOperation.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchOperation.java index 6aa4e2a6501a..d52baebca948 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchResultOperation.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchOperation.java @@ -1,11 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.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; @@ -18,25 +16,31 @@ /** * Status and result of the analyze batch operation. */ -@Immutable -public final class AnalyzeBatchResultOperation implements JsonSerializable { +public final class AnalyzeBatchOperation implements JsonSerializable { + + /* + * Analyze batch operation result ID. + */ + @Generated + private String resultId; + /* - * Operation status. notStarted, running, completed, or failed + * Operation status. notStarted, running, succeeded, or failed */ @Generated - private final OperationStatus status; + private final DocumentIntelligenceOperationStatus status; /* * Date and time (UTC) when the operation was submitted. */ @Generated - private final OffsetDateTime createdDateTime; + private final OffsetDateTime createdOn; /* * Date and time (UTC) when the status was last updated. */ @Generated - private final OffsetDateTime lastUpdatedDateTime; + private final OffsetDateTime lastUpdatedOn; /* * Operation progress (0-100). @@ -48,7 +52,7 @@ public final class AnalyzeBatchResultOperation implements JsonSerializable { - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; + String resultId = null; Integer percentCompleted = null; - Error error = null; + DocumentIntelligenceError error = null; AnalyzeBatchResult result = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("resultId".equals(fieldName)) { + resultId = reader.getString(); } else if ("percentCompleted".equals(fieldName)) { percentCompleted = reader.getNullable(JsonReader::getInt); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else if ("result".equals(fieldName)) { result = AnalyzeBatchResult.fromJson(reader); } else { reader.skipChildren(); } } - AnalyzeBatchResultOperation deserializedAnalyzeBatchResultOperation - = new AnalyzeBatchResultOperation(status, createdDateTime, lastUpdatedDateTime); - deserializedAnalyzeBatchResultOperation.percentCompleted = percentCompleted; - deserializedAnalyzeBatchResultOperation.error = error; - deserializedAnalyzeBatchResultOperation.result = result; - - return deserializedAnalyzeBatchResultOperation; + AnalyzeBatchOperation deserializedAnalyzeBatchOperation + = new AnalyzeBatchOperation(status, createdOn, lastUpdatedOn); + deserializedAnalyzeBatchOperation.resultId = resultId; + deserializedAnalyzeBatchOperation.percentCompleted = percentCompleted; + deserializedAnalyzeBatchOperation.error = error; + deserializedAnalyzeBatchOperation.result = result; + return deserializedAnalyzeBatchOperation; }); } + + private String operationId; + + /** + * Gets the operationId property: Operation ID. + * + * @return the operationId value. + */ + public String getOperationId() { + return operationId; + } + + /** + * Sets the operationId property: Operation ID. + * + * @param operationId the operationId value to set. + */ + public void setOperationId(String operationId) { + this.operationId = operationId; + } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchOperationDetail.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchOperationDetail.java index 34d645a839a3..c5e6c1e28f8a 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchOperationDetail.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchOperationDetail.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -17,11 +16,12 @@ */ @Immutable public final class AnalyzeBatchOperationDetail implements JsonSerializable { + /* * Analyze status. succeeded, failed, or skipped */ @Generated - private final OperationStatus status; + private final DocumentIntelligenceOperationStatus status; /* * URL of the source document. @@ -39,33 +39,33 @@ public final class AnalyzeBatchOperationDetail implements JsonSerializable { - OperationStatus status = null; + DocumentIntelligenceOperationStatus status = null; String sourceUrl = null; String resultUrl = null; - Error error = null; + DocumentIntelligenceError error = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("sourceUrl".equals(fieldName)) { sourceUrl = reader.getString(); } else if ("resultUrl".equals(fieldName)) { resultUrl = reader.getString(); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else { reader.skipChildren(); } @@ -143,7 +142,6 @@ public static AnalyzeBatchOperationDetail fromJson(JsonReader jsonReader) throws = new AnalyzeBatchOperationDetail(status, sourceUrl); deserializedAnalyzeBatchOperationDetail.resultUrl = resultUrl; deserializedAnalyzeBatchOperationDetail.error = error; - return deserializedAnalyzeBatchOperationDetail; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchResult.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchResult.java index e248d814ce08..232e77052ac4 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchResult.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeBatchResult.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class AnalyzeBatchResult implements JsonSerializable { + /* * Number of documents that completed with status succeeded. */ @@ -40,28 +40,25 @@ public final class AnalyzeBatchResult implements JsonSerializable details; + private List details; /** * Creates an instance of AnalyzeBatchResult class. - * + * * @param succeededCount the succeededCount value to set. * @param failedCount the failedCount value to set. * @param skippedCount the skippedCount value to set. - * @param details the details value to set. */ @Generated - private AnalyzeBatchResult(int succeededCount, int failedCount, int skippedCount, - List details) { + private AnalyzeBatchResult(int succeededCount, int failedCount, int skippedCount) { this.succeededCount = succeededCount; this.failedCount = failedCount; this.skippedCount = skippedCount; - this.details = details; } /** * Get the succeededCount property: Number of documents that completed with status succeeded. - * + * * @return the succeededCount value. */ @Generated @@ -71,7 +68,7 @@ public int getSucceededCount() { /** * Get the failedCount property: Number of documents that completed with status failed. - * + * * @return the failedCount value. */ @Generated @@ -81,7 +78,7 @@ public int getFailedCount() { /** * Get the skippedCount property: Number of documents that completed with status skipped. - * + * * @return the skippedCount value. */ @Generated @@ -91,7 +88,7 @@ public int getSkippedCount() { /** * Get the details property: Operation detail for each document in the batch. - * + * * @return the details value. */ @Generated @@ -115,7 +112,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of AnalyzeBatchResult from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of AnalyzeBatchResult if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -132,7 +129,6 @@ public static AnalyzeBatchResult fromJson(JsonReader jsonReader) throws IOExcept while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("succeededCount".equals(fieldName)) { succeededCount = reader.getInt(); } else if ("failedCount".equals(fieldName)) { @@ -145,7 +141,10 @@ public static AnalyzeBatchResult fromJson(JsonReader jsonReader) throws IOExcept reader.skipChildren(); } } - return new AnalyzeBatchResult(succeededCount, failedCount, skippedCount, details); + AnalyzeBatchResult deserializedAnalyzeBatchResult + = new AnalyzeBatchResult(succeededCount, failedCount, skippedCount); + deserializedAnalyzeBatchResult.details = details; + return deserializedAnalyzeBatchResult; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeDocumentOptions.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeDocumentOptions.java new file mode 100644 index 000000000000..155de6a320a0 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeDocumentOptions.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.documentintelligence.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.util.Arrays; +import java.util.List; + +/** + * Document analysis parameters. + */ +@Fluent +public final class AnalyzeDocumentOptions implements JsonSerializable { + + private List pages; + + private String locale; + + private List documentAnalysisFeatures; + + private StringIndexType stringIndexType; + + private List queryFields; + + private DocumentContentFormat outputContentFormat; + + private List output; + + /* + * Document URL to analyze. Either urlSource or base64Source must be specified. + */ + @Generated + private String urlSource; + + /* + * Base64 encoding of the document to analyze. Either urlSource or base64Source + * must be specified. + */ + @Generated + private byte[] bytesSource; + + /** + * Creates an instance of AnalyzeDocumentOptions class. + */ + @Generated + AnalyzeDocumentOptions() { + } + + /** + * Creates an instance of AnalyzeDocumentOptions with the specified URL source. + * + * @param urlSource the URL of the document to classify. + */ + public AnalyzeDocumentOptions(String urlSource) { + this.urlSource = urlSource; + } + + /** + * Creates an instance of AnalyzeDocumentOptions with the specified Base64 encoded source. + * + * @param bytesSource the Base64 encoded bytes of the document to classify. + */ + public AnalyzeDocumentOptions(byte[] bytesSource) { + this.bytesSource = bytesSource; + } + + /** + * Get the urlSource property: Document URL to analyze. Either urlSource or base64Source must be specified. + * + * @return the urlSource value. + */ + @Generated + public String getUrlSource() { + return this.urlSource; + } + + /** + * Set the urlSource property: Document URL to analyze. Either urlSource or base64Source must be specified. + * + * @param urlSource the urlSource value to set. + * @return the AnalyzeDocumentOptions object itself. + */ + @Generated + AnalyzeDocumentOptions setUrlSource(String urlSource) { + this.urlSource = urlSource; + return this; + } + + /** + * Get the bytesSource property: Base64 encoding of the document to analyze. Either urlSource or base64Source + * must be specified. + * + * @return the bytesSource value. + */ + @Generated + public byte[] getBytesSource() { + return CoreUtils.clone(this.bytesSource); + } + + /** + * Set the bytesSource property: Base64 encoding of the document to analyze. Either urlSource or base64Source + * must be specified. + * + * @param bytesSource the bytesSource value to set. + * @return the AnalyzeDocumentOptions object itself. + */ + @Generated + AnalyzeDocumentOptions setBytesSource(byte[] bytesSource) { + this.bytesSource = CoreUtils.clone(bytesSource); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("urlSource", this.urlSource); + jsonWriter.writeBinaryField("base64Source", this.bytesSource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyzeDocumentOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyzeDocumentOptions if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AnalyzeDocumentOptions. + */ + @Generated + public static AnalyzeDocumentOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnalyzeDocumentOptions deserializedAnalyzeDocumentOptions = new AnalyzeDocumentOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("urlSource".equals(fieldName)) { + deserializedAnalyzeDocumentOptions.urlSource = reader.getString(); + } else if ("base64Source".equals(fieldName)) { + deserializedAnalyzeDocumentOptions.bytesSource = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + return deserializedAnalyzeDocumentOptions; + }); + } + + /** + * Gets the list of additional fields to include in the result. + * + * @return the list of additional fields to include in the result. + */ + public List getQueryFields() { + return queryFields; + } + + /** + * Sets the list of additional fields to include in the result. + * + * @param queryFields the list of additional fields to include in the result. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setQueryFields(List queryFields) { + this.queryFields = queryFields; + return this; + } + + /** + * Gets the output content format. + * + * @return the output content format. + */ + public DocumentContentFormat getOutputContentFormat() { + return outputContentFormat; + } + + /** + * Sets the output content format. + * + * @param outputContentFormat the output content format to set. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setOutputContentFormat(DocumentContentFormat outputContentFormat) { + this.outputContentFormat = outputContentFormat; + return this; + } + + /** + * Gets the list of output formats. + * + * @return the list of output formats. + */ + public List getOutput() { + return output; + } + + /** + * Sets the list of output formats. + * + * @param output the list of output formats to set. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setOutput(List output) { + this.output = output; + return this; + } + + /** + * Gets the string index type. + * + * @return the string index type. + */ + public StringIndexType getStringIndexType() { + return stringIndexType; + } + + /** + * Sets the string index type. + * + * @param stringIndexType the string index type to set. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setStringIndexType(StringIndexType stringIndexType) { + this.stringIndexType = stringIndexType; + return this; + } + + /** + * Get the custom page numbers for multipage documents(PDF/TIFF). Input the number of the + * pages you want to get the recognized result for. + *

For a range of pages, use a hyphen, ex - ["1-3"]. Separate each page or a page + * range with a comma, ex - ["1-3", 4].

+ * + * @return the list of custom page numbers for a multipage document. + */ + public List getPages() { + return pages; + } + + /** + * Set the custom page numbers for multipage documents(PDF/TIFF). Input the number of the + * pages you want to get the recognized result for. + *

For a range of pages, use a hyphen, ex - ["1-3"]. Separate each page or a page + * range with a comma, ex - ["1-3", 4].

+ * + * @param pages the custom page numbers value to set. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setPages(List pages) { + this.pages = pages; + return this; + } + + /** + * Get the locale hint for text recognition and document analysis. + * Value may contain only the language code (ex. \"en\", \"fr\") or BCP 47 language tag (ex. \"en-US\"). + * + * @return the locale value. + */ + public String getLocale() { + return locale; + } + + /** + * Set the locale value. + * Supported locales include: en-AU, en-CA, en-GB, en-IN, en-US. + * + * @param locale the locale value to set. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setLocale(String locale) { + this.locale = locale; + return this; + } + + /** + * Get the list of optional analysis features. + * + * @return List of optional analysis features. + */ + public List getDocumentAnalysisFeatures() { + return documentAnalysisFeatures; + } + + /** + * Set the list of optional analysis features. + * + * @param documentAnalysisFeatures List of optional analysis features. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setDocumentAnalysisFeatures(List documentAnalysisFeatures) { + this.documentAnalysisFeatures = documentAnalysisFeatures; + return this; + } + + /** + * Set optional analysis features. + * + * @param documentAnalysisFeatures List of optional analysis features. + * @return the updated {@code AnalyzeDocumentOptions} value. + */ + public AnalyzeDocumentOptions setDocumentAnalysisFeatures(DocumentAnalysisFeature... documentAnalysisFeatures) { + if (documentAnalysisFeatures != null) { + this.documentAnalysisFeatures = Arrays.asList(documentAnalysisFeatures); + } + return this; + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeDocumentRequest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeDocumentRequest.java deleted file mode 100644 index 3b961bc444e4..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeDocumentRequest.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -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; - -/** - * Document analysis parameters. - */ -@Fluent -public final class AnalyzeDocumentRequest implements JsonSerializable { - /* - * Document URL to analyze. Either urlSource or base64Source must be specified. - */ - @Generated - private String urlSource; - - /* - * Base64 encoding of the document to analyze. Either urlSource or base64Source - * must be specified. - */ - @Generated - private byte[] base64Source; - - /** - * Creates an instance of AnalyzeDocumentRequest class. - */ - @Generated - public AnalyzeDocumentRequest() { - } - - /** - * Get the urlSource property: Document URL to analyze. Either urlSource or base64Source must be specified. - * - * @return the urlSource value. - */ - @Generated - public String getUrlSource() { - return this.urlSource; - } - - /** - * Set the urlSource property: Document URL to analyze. Either urlSource or base64Source must be specified. - * - * @param urlSource the urlSource value to set. - * @return the AnalyzeDocumentRequest object itself. - */ - @Generated - public AnalyzeDocumentRequest setUrlSource(String urlSource) { - this.urlSource = urlSource; - return this; - } - - /** - * Get the base64Source property: Base64 encoding of the document to analyze. Either urlSource or base64Source - * must be specified. - * - * @return the base64Source value. - */ - @Generated - public byte[] getBase64Source() { - return CoreUtils.clone(this.base64Source); - } - - /** - * Set the base64Source property: Base64 encoding of the document to analyze. Either urlSource or base64Source - * must be specified. - * - * @param base64Source the base64Source value to set. - * @return the AnalyzeDocumentRequest object itself. - */ - @Generated - public AnalyzeDocumentRequest setBase64Source(byte[] base64Source) { - this.base64Source = CoreUtils.clone(base64Source); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("urlSource", this.urlSource); - jsonWriter.writeBinaryField("base64Source", this.base64Source); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AnalyzeDocumentRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AnalyzeDocumentRequest if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the AnalyzeDocumentRequest. - */ - @Generated - public static AnalyzeDocumentRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - AnalyzeDocumentRequest deserializedAnalyzeDocumentRequest = new AnalyzeDocumentRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("urlSource".equals(fieldName)) { - deserializedAnalyzeDocumentRequest.urlSource = reader.getString(); - } else if ("base64Source".equals(fieldName)) { - deserializedAnalyzeDocumentRequest.base64Source = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - - return deserializedAnalyzeDocumentRequest; - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeResultOperation.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOperation.java similarity index 61% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeResultOperation.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOperation.java index e79dc017d7ce..9b42ac86311d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeResultOperation.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOperation.java @@ -16,31 +16,31 @@ /** * Status and result of the analyze operation. */ -public final class AnalyzeResultOperation implements JsonSerializable { +public final class AnalyzeOperation implements JsonSerializable { /* * Operation status. notStarted, running, succeeded, or failed */ @Generated - private final OperationStatus status; + private final DocumentIntelligenceOperationStatus status; /* * Date and time (UTC) when the analyze operation was submitted. */ @Generated - private final OffsetDateTime createdDateTime; + private final OffsetDateTime createdOn; /* * Date and time (UTC) when the status was last updated. */ @Generated - private final OffsetDateTime lastUpdatedDateTime; + private final OffsetDateTime lastUpdatedOn; /* * Encountered error during document analysis. */ @Generated - private Error error; + private DocumentIntelligenceError error; /* * Document analysis result. @@ -49,18 +49,18 @@ public final class AnalyzeResultOperation implements JsonSerializable { - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; - Error error = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; + DocumentIntelligenceError error = null; AnalyzeResult analyzeResult = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else if ("analyzeResult".equals(fieldName)) { analyzeResult = AnalyzeResult.fromJson(reader); } else { reader.skipChildren(); } } - AnalyzeResultOperation deserializedAnalyzeResultOperation - = new AnalyzeResultOperation(status, createdDateTime, lastUpdatedDateTime); - deserializedAnalyzeResultOperation.error = error; - deserializedAnalyzeResultOperation.analyzeResult = analyzeResult; - return deserializedAnalyzeResultOperation; + AnalyzeOperation deserializedAnalyzeOperation = new AnalyzeOperation(status, createdOn, lastUpdatedOn); + deserializedAnalyzeOperation.error = error; + deserializedAnalyzeOperation.analyzeResult = analyzeResult; + return deserializedAnalyzeOperation; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOutputOption.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOutputFormat.java similarity index 50% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOutputOption.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOutputFormat.java index 84148bc55fdd..f1809353a17e 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOutputOption.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeOutputFormat.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -11,47 +10,48 @@ /** * Additional output to generate during analysis. */ -public final class AnalyzeOutputOption extends ExpandableStringEnum { +public final class AnalyzeOutputFormat extends ExpandableStringEnum { + /** * Generate searchable PDF output. */ @Generated - public static final AnalyzeOutputOption PDF = fromString("pdf"); + public static final AnalyzeOutputFormat PDF = fromString("pdf"); /** * Generate cropped images of detected figures. */ @Generated - public static final AnalyzeOutputOption FIGURES = fromString("figures"); + public static final AnalyzeOutputFormat FIGURES = fromString("figures"); /** - * Creates a new instance of AnalyzeOutputOption value. - * + * Creates a new instance of AnalyzeOutputFormat value. + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @Deprecated - public AnalyzeOutputOption() { + public AnalyzeOutputFormat() { } /** - * Creates or finds a AnalyzeOutputOption from its string representation. - * + * Creates or finds a AnalyzeOutputFormat from its string representation. + * * @param name a name to look for. - * @return the corresponding AnalyzeOutputOption. + * @return the corresponding AnalyzeOutputFormat. */ @Generated - public static AnalyzeOutputOption fromString(String name) { - return fromString(name, AnalyzeOutputOption.class); + public static AnalyzeOutputFormat fromString(String name) { + return fromString(name, AnalyzeOutputFormat.class); } /** - * Gets known AnalyzeOutputOption values. - * - * @return known AnalyzeOutputOption values. + * Gets known AnalyzeOutputFormat values. + * + * @return known AnalyzeOutputFormat values. */ @Generated - public static Collection values() { - return values(AnalyzeOutputOption.class); + public static Collection values() { + return values(AnalyzeOutputFormat.class); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeResult.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeResult.java index e11a47890fd9..522f5ff3754c 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeResult.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzeResult.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class AnalyzeResult implements JsonSerializable { + /* * API version used to produce this result. */ @@ -40,7 +40,7 @@ public final class AnalyzeResult implements JsonSerializable { * Format of the analyze result top-level content. */ @Generated - private ContentFormat contentFormat; + private DocumentContentFormat contentFormat; /* * Concatenate string representation of all textual and visual elements in reading @@ -101,17 +101,17 @@ public final class AnalyzeResult implements JsonSerializable { * Extracted documents. */ @Generated - private List documents; + private List documents; /* * List of warnings encountered. */ @Generated - private List warnings; + private List warnings; /** * Creates an instance of AnalyzeResult class. - * + * * @param apiVersion the apiVersion value to set. * @param modelId the modelId value to set. * @param stringIndexType the stringIndexType value to set. @@ -130,7 +130,7 @@ private AnalyzeResult(String apiVersion, String modelId, StringIndexType stringI /** * Get the apiVersion property: API version used to produce this result. - * + * * @return the apiVersion value. */ @Generated @@ -140,7 +140,7 @@ public String getApiVersion() { /** * Get the modelId property: Document model ID used to produce this result. - * + * * @return the modelId value. */ @Generated @@ -150,7 +150,7 @@ public String getModelId() { /** * Get the stringIndexType property: Method used to compute string offset and length. - * + * * @return the stringIndexType value. */ @Generated @@ -160,18 +160,18 @@ public StringIndexType getStringIndexType() { /** * Get the contentFormat property: Format of the analyze result top-level content. - * + * * @return the contentFormat value. */ @Generated - public ContentFormat getContentFormat() { + public DocumentContentFormat getContentFormat() { return this.contentFormat; } /** * Get the content property: Concatenate string representation of all textual and visual elements in reading * order. - * + * * @return the content value. */ @Generated @@ -181,7 +181,7 @@ public String getContent() { /** * Get the pages property: Analyzed pages. - * + * * @return the pages value. */ @Generated @@ -191,7 +191,7 @@ public List getPages() { /** * Get the paragraphs property: Extracted paragraphs. - * + * * @return the paragraphs value. */ @Generated @@ -201,7 +201,7 @@ public List getParagraphs() { /** * Get the tables property: Extracted tables. - * + * * @return the tables value. */ @Generated @@ -211,7 +211,7 @@ public List getTables() { /** * Get the figures property: Extracted figures. - * + * * @return the figures value. */ @Generated @@ -221,7 +221,7 @@ public List getFigures() { /** * Get the sections property: Extracted sections. - * + * * @return the sections value. */ @Generated @@ -231,7 +231,7 @@ public List getSections() { /** * Get the keyValuePairs property: Extracted key-value pairs. - * + * * @return the keyValuePairs value. */ @Generated @@ -241,7 +241,7 @@ public List getKeyValuePairs() { /** * Get the styles property: Extracted font styles. - * + * * @return the styles value. */ @Generated @@ -251,7 +251,7 @@ public List getStyles() { /** * Get the languages property: Detected languages. - * + * * @return the languages value. */ @Generated @@ -261,21 +261,21 @@ public List getLanguages() { /** * Get the documents property: Extracted documents. - * + * * @return the documents value. */ @Generated - public List getDocuments() { + public List getDocuments() { return this.documents; } /** * Get the warnings property: List of warnings encountered. - * + * * @return the warnings value. */ @Generated - public List getWarnings() { + public List getWarnings() { return this.warnings; } @@ -307,7 +307,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of AnalyzeResult from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of AnalyzeResult if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -322,7 +322,7 @@ public static AnalyzeResult fromJson(JsonReader jsonReader) throws IOException { StringIndexType stringIndexType = null; String content = null; List pages = null; - ContentFormat contentFormat = null; + DocumentContentFormat contentFormat = null; List paragraphs = null; List tables = null; List figures = null; @@ -330,12 +330,11 @@ public static AnalyzeResult fromJson(JsonReader jsonReader) throws IOException { List keyValuePairs = null; List styles = null; List languages = null; - List documents = null; - List warnings = null; + List documents = null; + List warnings = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("apiVersion".equals(fieldName)) { apiVersion = reader.getString(); } else if ("modelId".equals(fieldName)) { @@ -347,7 +346,7 @@ public static AnalyzeResult fromJson(JsonReader jsonReader) throws IOException { } else if ("pages".equals(fieldName)) { pages = reader.readArray(reader1 -> DocumentPage.fromJson(reader1)); } else if ("contentFormat".equals(fieldName)) { - contentFormat = ContentFormat.fromString(reader.getString()); + contentFormat = DocumentContentFormat.fromString(reader.getString()); } else if ("paragraphs".equals(fieldName)) { paragraphs = reader.readArray(reader1 -> DocumentParagraph.fromJson(reader1)); } else if ("tables".equals(fieldName)) { @@ -363,9 +362,9 @@ public static AnalyzeResult fromJson(JsonReader jsonReader) throws IOException { } else if ("languages".equals(fieldName)) { languages = reader.readArray(reader1 -> DocumentLanguage.fromJson(reader1)); } else if ("documents".equals(fieldName)) { - documents = reader.readArray(reader1 -> Document.fromJson(reader1)); + documents = reader.readArray(reader1 -> AnalyzedDocument.fromJson(reader1)); } else if ("warnings".equals(fieldName)) { - warnings = reader.readArray(reader1 -> Warning.fromJson(reader1)); + warnings = reader.readArray(reader1 -> DocumentIntelligenceWarning.fromJson(reader1)); } else { reader.skipChildren(); } @@ -382,7 +381,6 @@ public static AnalyzeResult fromJson(JsonReader jsonReader) throws IOException { deserializedAnalyzeResult.languages = languages; deserializedAnalyzeResult.documents = documents; deserializedAnalyzeResult.warnings = warnings; - return deserializedAnalyzeResult; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/Document.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzedDocument.java similarity index 76% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/Document.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzedDocument.java index 8ed4f63ef8ea..4647ce5c13b4 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/Document.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AnalyzedDocument.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,12 +17,13 @@ * An object describing the location and semantic content of a document. */ @Immutable -public final class Document implements JsonSerializable { +public final class AnalyzedDocument implements JsonSerializable { + /* * Document type. */ @Generated - private final String docType; + private final String documentType; /* * Bounding regions covering the document. @@ -50,32 +50,32 @@ public final class Document implements JsonSerializable { private final double confidence; /** - * Creates an instance of Document class. - * - * @param docType the docType value to set. + * Creates an instance of AnalyzedDocument class. + * + * @param documentType the documentType value to set. * @param spans the spans value to set. * @param confidence the confidence value to set. */ @Generated - private Document(String docType, List spans, double confidence) { - this.docType = docType; + private AnalyzedDocument(String documentType, List spans, double confidence) { + this.documentType = documentType; this.spans = spans; this.confidence = confidence; } /** - * Get the docType property: Document type. - * - * @return the docType value. + * Get the documentType property: Document type. + * + * @return the documentType value. */ @Generated - public String getDocType() { - return this.docType; + public String getDocumentType() { + return this.documentType; } /** * Get the boundingRegions property: Bounding regions covering the document. - * + * * @return the boundingRegions value. */ @Generated @@ -85,7 +85,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the document in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -95,7 +95,7 @@ public List getSpans() { /** * Get the fields property: Dictionary of named field values. - * + * * @return the fields value. */ @Generated @@ -105,7 +105,7 @@ public Map getFields() { /** * Get the confidence property: Confidence of correctly extracting the document. - * + * * @return the confidence value. */ @Generated @@ -120,7 +120,7 @@ public double getConfidence() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("docType", this.docType); + jsonWriter.writeStringField("docType", this.documentType); jsonWriter.writeArrayField("spans", this.spans, (writer, element) -> writer.writeJson(element)); jsonWriter.writeDoubleField("confidence", this.confidence); jsonWriter.writeArrayField("boundingRegions", this.boundingRegions, @@ -130,18 +130,18 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of Document from the JsonReader. - * + * Reads an instance of AnalyzedDocument from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of Document if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. + * @return An instance of AnalyzedDocument 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 Document. + * @throws IOException If an error occurs while reading the AnalyzedDocument. */ @Generated - public static Document fromJson(JsonReader jsonReader) throws IOException { + public static AnalyzedDocument fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - String docType = null; + String documentType = null; List spans = null; double confidence = 0.0; List boundingRegions = null; @@ -149,9 +149,8 @@ public static Document fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("docType".equals(fieldName)) { - docType = reader.getString(); + documentType = reader.getString(); } else if ("spans".equals(fieldName)) { spans = reader.readArray(reader1 -> DocumentSpan.fromJson(reader1)); } else if ("confidence".equals(fieldName)) { @@ -164,11 +163,10 @@ public static Document fromJson(JsonReader jsonReader) throws IOException { reader.skipChildren(); } } - Document deserializedDocument = new Document(docType, spans, confidence); - deserializedDocument.boundingRegions = boundingRegions; - deserializedDocument.fields = fields; - - return deserializedDocument; + AnalyzedDocument deserializedAnalyzedDocument = new AnalyzedDocument(documentType, spans, confidence); + deserializedAnalyzedDocument.boundingRegions = boundingRegions; + deserializedAnalyzedDocument.fields = fields; + return deserializedAnalyzedDocument; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeClassifierCopyRequest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeClassifierCopyOptions.java similarity index 77% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeClassifierCopyRequest.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeClassifierCopyOptions.java index 8ce19e8f9074..bc36001b9d01 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeClassifierCopyRequest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeClassifierCopyOptions.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Fluent; @@ -17,7 +16,8 @@ * Request body to authorize document classifier copy. */ @Fluent -public final class AuthorizeClassifierCopyRequest implements JsonSerializable { +public final class AuthorizeClassifierCopyOptions implements JsonSerializable { + /* * Unique document classifier name. */ @@ -37,18 +37,18 @@ public final class AuthorizeClassifierCopyRequest implements JsonSerializable tags; /** - * Creates an instance of AuthorizeClassifierCopyRequest class. - * + * Creates an instance of AuthorizeClassifierCopyOptions class. + * * @param classifierId the classifierId value to set. */ @Generated - public AuthorizeClassifierCopyRequest(String classifierId) { + public AuthorizeClassifierCopyOptions(String classifierId) { this.classifierId = classifierId; } /** * Get the classifierId property: Unique document classifier name. - * + * * @return the classifierId value. */ @Generated @@ -58,7 +58,7 @@ public String getClassifierId() { /** * Get the description property: Document classifier description. - * + * * @return the description value. */ @Generated @@ -68,19 +68,19 @@ public String getDescription() { /** * Set the description property: Document classifier description. - * + * * @param description the description value to set. - * @return the AuthorizeClassifierCopyRequest object itself. + * @return the AuthorizeClassifierCopyOptions object itself. */ @Generated - public AuthorizeClassifierCopyRequest setDescription(String description) { + public AuthorizeClassifierCopyOptions setDescription(String description) { this.description = description; return this; } /** * Get the tags property: List of key-value tag attributes associated with the document classifier. - * + * * @return the tags value. */ @Generated @@ -90,12 +90,12 @@ public Map getTags() { /** * Set the tags property: List of key-value tag attributes associated with the document classifier. - * + * * @param tags the tags value to set. - * @return the AuthorizeClassifierCopyRequest object itself. + * @return the AuthorizeClassifierCopyOptions object itself. */ @Generated - public AuthorizeClassifierCopyRequest setTags(Map tags) { + public AuthorizeClassifierCopyOptions setTags(Map tags) { this.tags = tags; return this; } @@ -114,16 +114,16 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of AuthorizeClassifierCopyRequest from the JsonReader. - * + * Reads an instance of AuthorizeClassifierCopyOptions from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of AuthorizeClassifierCopyRequest if the JsonReader was pointing to an instance of it, or + * @return An instance of AuthorizeClassifierCopyOptions 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 AuthorizeClassifierCopyRequest. + * @throws IOException If an error occurs while reading the AuthorizeClassifierCopyOptions. */ @Generated - public static AuthorizeClassifierCopyRequest fromJson(JsonReader jsonReader) throws IOException { + public static AuthorizeClassifierCopyOptions fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String classifierId = null; String description = null; @@ -131,7 +131,6 @@ public static AuthorizeClassifierCopyRequest fromJson(JsonReader jsonReader) thr while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("classifierId".equals(fieldName)) { classifierId = reader.getString(); } else if ("description".equals(fieldName)) { @@ -142,12 +141,11 @@ public static AuthorizeClassifierCopyRequest fromJson(JsonReader jsonReader) thr reader.skipChildren(); } } - AuthorizeClassifierCopyRequest deserializedAuthorizeClassifierCopyRequest - = new AuthorizeClassifierCopyRequest(classifierId); - deserializedAuthorizeClassifierCopyRequest.description = description; - deserializedAuthorizeClassifierCopyRequest.tags = tags; - - return deserializedAuthorizeClassifierCopyRequest; + AuthorizeClassifierCopyOptions deserializedAuthorizeClassifierCopyOptions + = new AuthorizeClassifierCopyOptions(classifierId); + deserializedAuthorizeClassifierCopyOptions.description = description; + deserializedAuthorizeClassifierCopyOptions.tags = tags; + return deserializedAuthorizeClassifierCopyOptions; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeModelCopyOptions.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeModelCopyOptions.java new file mode 100644 index 000000000000..cfec6d9db817 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AuthorizeModelCopyOptions.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.documentintelligence.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.Map; + +/** + * Request body to authorize document model copy. + */ +@Fluent +public final class AuthorizeModelCopyOptions implements JsonSerializable { + + /* + * Unique document model name. + */ + @Generated + private final String modelId; + + /* + * Document model description. + */ + @Generated + private String description; + + /* + * List of key-value tag attributes associated with the document model. + */ + @Generated + private Map tags; + + /** + * Creates an instance of AuthorizeModelCopyOptions class. + * + * @param modelId the modelId value to set. + */ + @Generated + public AuthorizeModelCopyOptions(String modelId) { + this.modelId = modelId; + } + + /** + * Get the modelId property: Unique document model name. + * + * @return the modelId value. + */ + @Generated + public String getModelId() { + return this.modelId; + } + + /** + * Get the description property: Document model description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Document model description. + * + * @param description the description value to set. + * @return the AuthorizeModelCopyOptions object itself. + */ + @Generated + public AuthorizeModelCopyOptions setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the tags property: List of key-value tag attributes associated with the document model. + * + * @return the tags value. + */ + @Generated + public Map getTags() { + return this.tags; + } + + /** + * Set the tags property: List of key-value tag attributes associated with the document model. + * + * @param tags the tags value to set. + * @return the AuthorizeModelCopyOptions object itself. + */ + @Generated + public AuthorizeModelCopyOptions setTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("modelId", this.modelId); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AuthorizeModelCopyOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AuthorizeModelCopyOptions 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 AuthorizeModelCopyOptions. + */ + @Generated + public static AuthorizeModelCopyOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String modelId = null; + String description = null; + Map tags = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("modelId".equals(fieldName)) { + modelId = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("tags".equals(fieldName)) { + tags = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + AuthorizeModelCopyOptions deserializedAuthorizeModelCopyOptions = new AuthorizeModelCopyOptions(modelId); + deserializedAuthorizeModelCopyOptions.description = description; + deserializedAuthorizeModelCopyOptions.tags = tags; + return deserializedAuthorizeModelCopyOptions; + }); + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AzureBlobContentSource.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AzureBlobContentSource.java index 789b78dccafc..a5cf6c544612 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AzureBlobContentSource.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/AzureBlobContentSource.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Fluent; @@ -17,6 +16,7 @@ */ @Fluent public final class AzureBlobContentSource implements JsonSerializable { + /* * Azure Blob Storage container URL. */ @@ -31,7 +31,7 @@ public final class AzureBlobContentSource implements JsonSerializable { + /* * Azure Blob Storage container URL. */ @@ -31,7 +31,7 @@ public final class AzureBlobFileListContentSource implements JsonSerializable { + /* * 1-based page number of page containing the bounding region. */ @@ -35,7 +35,7 @@ public final class BoundingRegion implements JsonSerializable { /** * Creates an instance of BoundingRegion class. - * + * * @param pageNumber the pageNumber value to set. * @param polygon the polygon value to set. */ @@ -47,7 +47,7 @@ private BoundingRegion(int pageNumber, List polygon) { /** * Get the pageNumber property: 1-based page number of page containing the bounding region. - * + * * @return the pageNumber value. */ @Generated @@ -60,7 +60,7 @@ public int getPageNumber() { * Coordinates specified relative to the top-left of the page. The numbers * represent the x, y values of the polygon vertices, clockwise from the left * (-180 degrees inclusive) relative to the element orientation. - * + * * @return the polygon value. */ @Generated @@ -82,7 +82,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of BoundingRegion from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of BoundingRegion if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -97,7 +97,6 @@ public static BoundingRegion fromJson(JsonReader jsonReader) throws IOException while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("pageNumber".equals(fieldName)) { pageNumber = reader.getInt(); } else if ("polygon".equals(fieldName)) { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentClassifierRequest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentClassifierOptions.java similarity index 72% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentClassifierRequest.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentClassifierOptions.java index ff286dff4d4a..cff92ffa3908 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentClassifierRequest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentClassifierOptions.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Fluent; @@ -17,7 +16,8 @@ * Request body to build a new custom document classifier. */ @Fluent -public final class BuildDocumentClassifierRequest implements JsonSerializable { +public final class BuildDocumentClassifierOptions implements JsonSerializable { + /* * Unique document classifier name. */ @@ -40,7 +40,7 @@ public final class BuildDocumentClassifierRequest implements JsonSerializable docTypes; + private final Map documentTypes; /* * Allow overwriting an existing classifier with the same name. @@ -49,20 +49,21 @@ public final class BuildDocumentClassifierRequest implements JsonSerializable docTypes) { + public BuildDocumentClassifierOptions(String classifierId, + Map documentTypes) { this.classifierId = classifierId; - this.docTypes = docTypes; + this.documentTypes = documentTypes; } /** * Get the classifierId property: Unique document classifier name. - * + * * @return the classifierId value. */ @Generated @@ -72,7 +73,7 @@ public String getClassifierId() { /** * Get the description property: Document classifier description. - * + * * @return the description value. */ @Generated @@ -82,19 +83,19 @@ public String getDescription() { /** * Set the description property: Document classifier description. - * + * * @param description the description value to set. - * @return the BuildDocumentClassifierRequest object itself. + * @return the BuildDocumentClassifierOptions object itself. */ @Generated - public BuildDocumentClassifierRequest setDescription(String description) { + public BuildDocumentClassifierOptions setDescription(String description) { this.description = description; return this; } /** * Get the baseClassifierId property: Base classifierId on top of which to train the classifier. - * + * * @return the baseClassifierId value. */ @Generated @@ -104,29 +105,29 @@ public String getBaseClassifierId() { /** * Set the baseClassifierId property: Base classifierId on top of which to train the classifier. - * + * * @param baseClassifierId the baseClassifierId value to set. - * @return the BuildDocumentClassifierRequest object itself. + * @return the BuildDocumentClassifierOptions object itself. */ @Generated - public BuildDocumentClassifierRequest setBaseClassifierId(String baseClassifierId) { + public BuildDocumentClassifierOptions setBaseClassifierId(String baseClassifierId) { this.baseClassifierId = baseClassifierId; return this; } /** - * Get the docTypes property: List of document types to classify against. - * - * @return the docTypes value. + * Get the documentTypes property: List of document types to classify against. + * + * @return the documentTypes value. */ @Generated - public Map getDocTypes() { - return this.docTypes; + public Map getDocumentTypes() { + return this.documentTypes; } /** * Get the allowOverwrite property: Allow overwriting an existing classifier with the same name. - * + * * @return the allowOverwrite value. */ @Generated @@ -136,12 +137,12 @@ public Boolean isAllowOverwrite() { /** * Set the allowOverwrite property: Allow overwriting an existing classifier with the same name. - * + * * @param allowOverwrite the allowOverwrite value to set. - * @return the BuildDocumentClassifierRequest object itself. + * @return the BuildDocumentClassifierOptions object itself. */ @Generated - public BuildDocumentClassifierRequest setAllowOverwrite(Boolean allowOverwrite) { + public BuildDocumentClassifierOptions setAllowOverwrite(Boolean allowOverwrite) { this.allowOverwrite = allowOverwrite; return this; } @@ -154,7 +155,7 @@ public BuildDocumentClassifierRequest setAllowOverwrite(Boolean allowOverwrite) public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("classifierId", this.classifierId); - jsonWriter.writeMapField("docTypes", this.docTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("docTypes", this.documentTypes, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("description", this.description); jsonWriter.writeStringField("baseClassifierId", this.baseClassifierId); jsonWriter.writeBooleanField("allowOverwrite", this.allowOverwrite); @@ -162,30 +163,29 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of BuildDocumentClassifierRequest from the JsonReader. - * + * Reads an instance of BuildDocumentClassifierOptions from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of BuildDocumentClassifierRequest if the JsonReader was pointing to an instance of it, or + * @return An instance of BuildDocumentClassifierOptions 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 BuildDocumentClassifierRequest. + * @throws IOException If an error occurs while reading the BuildDocumentClassifierOptions. */ @Generated - public static BuildDocumentClassifierRequest fromJson(JsonReader jsonReader) throws IOException { + public static BuildDocumentClassifierOptions fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String classifierId = null; - Map docTypes = null; + Map documentTypes = null; String description = null; String baseClassifierId = null; Boolean allowOverwrite = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("classifierId".equals(fieldName)) { classifierId = reader.getString(); } else if ("docTypes".equals(fieldName)) { - docTypes = reader.readMap(reader1 -> ClassifierDocumentTypeDetails.fromJson(reader1)); + documentTypes = reader.readMap(reader1 -> ClassifierDocumentTypeDetails.fromJson(reader1)); } else if ("description".equals(fieldName)) { description = reader.getString(); } else if ("baseClassifierId".equals(fieldName)) { @@ -196,13 +196,12 @@ public static BuildDocumentClassifierRequest fromJson(JsonReader jsonReader) thr reader.skipChildren(); } } - BuildDocumentClassifierRequest deserializedBuildDocumentClassifierRequest - = new BuildDocumentClassifierRequest(classifierId, docTypes); - deserializedBuildDocumentClassifierRequest.description = description; - deserializedBuildDocumentClassifierRequest.baseClassifierId = baseClassifierId; - deserializedBuildDocumentClassifierRequest.allowOverwrite = allowOverwrite; - - return deserializedBuildDocumentClassifierRequest; + BuildDocumentClassifierOptions deserializedBuildDocumentClassifierOptions + = new BuildDocumentClassifierOptions(classifierId, documentTypes); + deserializedBuildDocumentClassifierOptions.description = description; + deserializedBuildDocumentClassifierOptions.baseClassifierId = baseClassifierId; + deserializedBuildDocumentClassifierOptions.allowOverwrite = allowOverwrite; + return deserializedBuildDocumentClassifierOptions; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentModelRequest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentModelOptions.java similarity index 83% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentModelRequest.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentModelOptions.java index 673cc9ee13a1..ba7d947f3d75 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentModelRequest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/BuildDocumentModelOptions.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Fluent; @@ -17,7 +16,8 @@ * Request body to build a new custom document model. */ @Fluent -public final class BuildDocumentModelRequest implements JsonSerializable { +public final class BuildDocumentModelOptions implements JsonSerializable { + /* * Unique document model name. */ @@ -69,20 +69,20 @@ public final class BuildDocumentModelRequest implements JsonSerializable getTags() { /** * Set the tags property: List of key-value tag attributes associated with the document model. - * + * * @param tags the tags value to set. - * @return the BuildDocumentModelRequest object itself. + * @return the BuildDocumentModelOptions object itself. */ @Generated - public BuildDocumentModelRequest setTags(Map tags) { + public BuildDocumentModelOptions setTags(Map tags) { this.tags = tags; return this; } @@ -196,7 +196,7 @@ public BuildDocumentModelRequest setTags(Map tags) { /** * Get the maxTrainingHours property: Max number of V100-equivalent GPU hours to use for model training. * Default=0.5. - * + * * @return the maxTrainingHours value. */ @Generated @@ -207,19 +207,19 @@ public Double getMaxTrainingHours() { /** * Set the maxTrainingHours property: Max number of V100-equivalent GPU hours to use for model training. * Default=0.5. - * + * * @param maxTrainingHours the maxTrainingHours value to set. - * @return the BuildDocumentModelRequest object itself. + * @return the BuildDocumentModelOptions object itself. */ @Generated - public BuildDocumentModelRequest setMaxTrainingHours(Double maxTrainingHours) { + public BuildDocumentModelOptions setMaxTrainingHours(Double maxTrainingHours) { this.maxTrainingHours = maxTrainingHours; return this; } /** * Get the allowOverwrite property: Allow overwriting an existing model with the same name. - * + * * @return the allowOverwrite value. */ @Generated @@ -229,12 +229,12 @@ public Boolean isAllowOverwrite() { /** * Set the allowOverwrite property: Allow overwriting an existing model with the same name. - * + * * @param allowOverwrite the allowOverwrite value to set. - * @return the BuildDocumentModelRequest object itself. + * @return the BuildDocumentModelOptions object itself. */ @Generated - public BuildDocumentModelRequest setAllowOverwrite(Boolean allowOverwrite) { + public BuildDocumentModelOptions setAllowOverwrite(Boolean allowOverwrite) { this.allowOverwrite = allowOverwrite; return this; } @@ -258,16 +258,16 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of BuildDocumentModelRequest from the JsonReader. - * + * Reads an instance of BuildDocumentModelOptions from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of BuildDocumentModelRequest if the JsonReader was pointing to an instance of it, or null if + * @return An instance of BuildDocumentModelOptions 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 BuildDocumentModelRequest. + * @throws IOException If an error occurs while reading the BuildDocumentModelOptions. */ @Generated - public static BuildDocumentModelRequest fromJson(JsonReader jsonReader) throws IOException { + public static BuildDocumentModelOptions fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String modelId = null; DocumentBuildMode buildMode = null; @@ -280,7 +280,6 @@ public static BuildDocumentModelRequest fromJson(JsonReader jsonReader) throws I while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("modelId".equals(fieldName)) { modelId = reader.getString(); } else if ("buildMode".equals(fieldName)) { @@ -301,16 +300,15 @@ public static BuildDocumentModelRequest fromJson(JsonReader jsonReader) throws I reader.skipChildren(); } } - BuildDocumentModelRequest deserializedBuildDocumentModelRequest - = new BuildDocumentModelRequest(modelId, buildMode); - deserializedBuildDocumentModelRequest.description = description; - deserializedBuildDocumentModelRequest.azureBlobSource = azureBlobSource; - deserializedBuildDocumentModelRequest.azureBlobFileListSource = azureBlobFileListSource; - deserializedBuildDocumentModelRequest.tags = tags; - deserializedBuildDocumentModelRequest.maxTrainingHours = maxTrainingHours; - deserializedBuildDocumentModelRequest.allowOverwrite = allowOverwrite; - - return deserializedBuildDocumentModelRequest; + BuildDocumentModelOptions deserializedBuildDocumentModelOptions + = new BuildDocumentModelOptions(modelId, buildMode); + deserializedBuildDocumentModelOptions.description = description; + deserializedBuildDocumentModelOptions.azureBlobSource = azureBlobSource; + deserializedBuildDocumentModelOptions.azureBlobFileListSource = azureBlobFileListSource; + deserializedBuildDocumentModelOptions.tags = tags; + deserializedBuildDocumentModelOptions.maxTrainingHours = maxTrainingHours; + deserializedBuildDocumentModelOptions.allowOverwrite = allowOverwrite; + return deserializedBuildDocumentModelOptions; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierCopyAuthorization.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierCopyAuthorization.java index f3e555875bf3..e237e58a2c97 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierCopyAuthorization.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierCopyAuthorization.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -21,6 +20,7 @@ */ @Immutable public final class ClassifierCopyAuthorization implements JsonSerializable { + /* * ID of the target Azure resource where the document classifier should be copied to. */ @@ -56,33 +56,33 @@ public final class ClassifierCopyAuthorization implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else { reader.skipChildren(); } } return new ClassifierCopyAuthorization(targetResourceId, targetResourceRegion, targetClassifierId, - targetClassifierLocation, accessToken, expirationDateTime); + targetClassifierLocation, accessToken, expiresOn); }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierDocumentTypeDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierDocumentTypeDetails.java index 1dff8cbe528b..41762d3108d8 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierDocumentTypeDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifierDocumentTypeDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Fluent; @@ -17,6 +16,7 @@ */ @Fluent public final class ClassifierDocumentTypeDetails implements JsonSerializable { + /* * Type of training data source. */ @@ -48,7 +48,7 @@ public ClassifierDocumentTypeDetails() { /** * Get the sourceKind property: Type of training data source. - * + * * @return the sourceKind value. */ @Generated @@ -58,7 +58,7 @@ public ContentSourceKind getSourceKind() { /** * Set the sourceKind property: Type of training data source. - * + * * @param sourceKind the sourceKind value to set. * @return the ClassifierDocumentTypeDetails object itself. */ @@ -72,7 +72,7 @@ public ClassifierDocumentTypeDetails setSourceKind(ContentSourceKind sourceKind) * Get the azureBlobSource property: Azure Blob Storage location containing the training data for a classifier * document type. Either azureBlobSource or azureBlobFileListSource must be * specified. - * + * * @return the azureBlobSource value. */ @Generated @@ -84,7 +84,7 @@ public AzureBlobContentSource getAzureBlobSource() { * Set the azureBlobSource property: Azure Blob Storage location containing the training data for a classifier * document type. Either azureBlobSource or azureBlobFileListSource must be * specified. - * + * * @param azureBlobSource the azureBlobSource value to set. * @return the ClassifierDocumentTypeDetails object itself. */ @@ -99,7 +99,7 @@ public ClassifierDocumentTypeDetails setAzureBlobSource(AzureBlobContentSource a * classifier * document type. Either azureBlobSource or azureBlobFileListSource must be * specified. - * + * * @return the azureBlobFileListSource value. */ @Generated @@ -112,7 +112,7 @@ public AzureBlobFileListContentSource getAzureBlobFileListSource() { * classifier * document type. Either azureBlobSource or azureBlobFileListSource must be * specified. - * + * * @param azureBlobFileListSource the azureBlobFileListSource value to set. * @return the ClassifierDocumentTypeDetails object itself. */ @@ -138,7 +138,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of ClassifierDocumentTypeDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of ClassifierDocumentTypeDetails if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. @@ -152,7 +152,6 @@ public static ClassifierDocumentTypeDetails fromJson(JsonReader jsonReader) thro while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("sourceKind".equals(fieldName)) { deserializedClassifierDocumentTypeDetails.sourceKind = ContentSourceKind.fromString(reader.getString()); @@ -165,7 +164,6 @@ public static ClassifierDocumentTypeDetails fromJson(JsonReader jsonReader) thro reader.skipChildren(); } } - return deserializedClassifierDocumentTypeDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifyDocumentOptions.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifyDocumentOptions.java new file mode 100644 index 000000000000..51d59b8702cd --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifyDocumentOptions.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.documentintelligence.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +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.util.List; + +/** + * Document classification parameters. + */ +@Fluent +public final class ClassifyDocumentOptions implements JsonSerializable { + + private StringIndexType stringIndexType; + + private SplitMode split; + + private List pages; + + /* + * Document URL to classify. Either urlSource or base64Source must be specified. + */ + @Generated + private String urlSource; + + /* + * Base64 encoding of the document to classify. Either urlSource or base64Source + * must be specified. + */ + @Generated + private byte[] bytesSource; + + /** + * Creates an instance of ClassifyDocumentOptions class. + */ + @Generated + ClassifyDocumentOptions() { + } + + /** + * Creates an instance of ClassifyDocumentOptions with the specified URL source. + * + * @param urlSource the URL of the document to classify. + */ + public ClassifyDocumentOptions(String urlSource) { + this.urlSource = urlSource; + } + + /** + * Creates an instance of ClassifyDocumentOptions with the specified Base64 encoded source. + * + * @param bytesSource the Base64 encoded bytes of the document to classify. + */ + public ClassifyDocumentOptions(byte[] bytesSource) { + this.bytesSource = bytesSource; + } + + /** + * Get the urlSource property: Document URL to classify. Either urlSource or base64Source must be specified. + * + * @return the urlSource value. + */ + @Generated + public String getUrlSource() { + return this.urlSource; + } + + /** + * Get the bytesSource property: Base64 encoding of the document to classify. Either urlSource or base64Source + * must be specified. + * + * @return the bytesSource value. + */ + @Generated + public byte[] getBytesSource() { + return CoreUtils.clone(this.bytesSource); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("urlSource", this.urlSource); + jsonWriter.writeBinaryField("base64Source", this.bytesSource); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClassifyDocumentOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClassifyDocumentOptions if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ClassifyDocumentOptions. + */ + @Generated + public static ClassifyDocumentOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClassifyDocumentOptions deserializedClassifyDocumentOptions = new ClassifyDocumentOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("urlSource".equals(fieldName)) { + deserializedClassifyDocumentOptions.urlSource = reader.getString(); + } else if ("base64Source".equals(fieldName)) { + deserializedClassifyDocumentOptions.bytesSource = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + return deserializedClassifyDocumentOptions; + }); + } + + /** + * Gets the string index type. + * + * @return the string index type. + */ + public StringIndexType getStringIndexType() { + return stringIndexType; + } + + /** + * Sets the string index type. + * + * @param stringIndexType the string index type to set. + * @return the updated {@code ClassifyDocumentOptions} value. + */ + public ClassifyDocumentOptions setStringIndexType(StringIndexType stringIndexType) { + this.stringIndexType = stringIndexType; + return this; + } + + /** + * Gets the split mode. + * + * @return the split mode. + */ + public SplitMode getSplit() { + return split; + } + + /** + * Sets the split mode. + * + * @param split the split mode to set. + * @return the updated {@code ClassifyDocumentOptions} value. + */ + public ClassifyDocumentOptions setSplit(SplitMode split) { + this.split = split; + return this; + } + + /** + * Gets the pages. + * + * @return the pages. + */ + public List getPages() { + return pages; + } + + /** + * Sets the pages. + * + * @param pages the pages to set. + * @return the updated {@code ClassifyDocumentOptions} value. + */ + public ClassifyDocumentOptions setPages(List pages) { + this.pages = pages; + return this; + } + + /** + * Set the urlSource property: Document URL to classify. Either urlSource or base64Source must be specified. + * + * @param urlSource the urlSource value to set. + * @return the ClassifyDocumentOptions object itself. + */ + @Generated + ClassifyDocumentOptions setUrlSource(String urlSource) { + this.urlSource = urlSource; + return this; + } + + /** + * Set the bytesSource property: Base64 encoding of the document to classify. Either urlSource or base64Source + * must be specified. + * + * @param bytesSource the bytesSource value to set. + * @return the ClassifyDocumentOptions object itself. + */ + @Generated + ClassifyDocumentOptions setBytesSource(byte[] bytesSource) { + this.bytesSource = CoreUtils.clone(bytesSource); + return this; + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifyDocumentRequest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifyDocumentRequest.java deleted file mode 100644 index 726177d775da..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ClassifyDocumentRequest.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -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; - -/** - * Document classification parameters. - */ -@Fluent -public final class ClassifyDocumentRequest implements JsonSerializable { - /* - * Document URL to classify. Either urlSource or base64Source must be specified. - */ - @Generated - private String urlSource; - - /* - * Base64 encoding of the document to classify. Either urlSource or base64Source - * must be specified. - */ - @Generated - private byte[] base64Source; - - /** - * Creates an instance of ClassifyDocumentRequest class. - */ - @Generated - public ClassifyDocumentRequest() { - } - - /** - * Get the urlSource property: Document URL to classify. Either urlSource or base64Source must be specified. - * - * @return the urlSource value. - */ - @Generated - public String getUrlSource() { - return this.urlSource; - } - - /** - * Set the urlSource property: Document URL to classify. Either urlSource or base64Source must be specified. - * - * @param urlSource the urlSource value to set. - * @return the ClassifyDocumentRequest object itself. - */ - @Generated - public ClassifyDocumentRequest setUrlSource(String urlSource) { - this.urlSource = urlSource; - return this; - } - - /** - * Get the base64Source property: Base64 encoding of the document to classify. Either urlSource or base64Source - * must be specified. - * - * @return the base64Source value. - */ - @Generated - public byte[] getBase64Source() { - return CoreUtils.clone(this.base64Source); - } - - /** - * Set the base64Source property: Base64 encoding of the document to classify. Either urlSource or base64Source - * must be specified. - * - * @param base64Source the base64Source value to set. - * @return the ClassifyDocumentRequest object itself. - */ - @Generated - public ClassifyDocumentRequest setBase64Source(byte[] base64Source) { - this.base64Source = CoreUtils.clone(base64Source); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("urlSource", this.urlSource); - jsonWriter.writeBinaryField("base64Source", this.base64Source); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ClassifyDocumentRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ClassifyDocumentRequest if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the ClassifyDocumentRequest. - */ - @Generated - public static ClassifyDocumentRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ClassifyDocumentRequest deserializedClassifyDocumentRequest = new ClassifyDocumentRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("urlSource".equals(fieldName)) { - deserializedClassifyDocumentRequest.urlSource = reader.getString(); - } else if ("base64Source".equals(fieldName)) { - deserializedClassifyDocumentRequest.base64Source = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - - return deserializedClassifyDocumentRequest; - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ComponentDocumentModelDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ComponentDocumentModelDetails.java deleted file mode 100644 index c6d4d026d574..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ComponentDocumentModelDetails.java +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.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; - -/** - * A component of a composed document model. - */ -@Fluent -public final class ComponentDocumentModelDetails implements JsonSerializable { - /* - * Document type. - */ - @Generated - private String docType; - - /* - * Document model to use for analyzing documents with specified type. - */ - @Generated - private final String modelId; - - /* - * Maximum number of documents of specified type to analyze. Default=all. - */ - @Generated - private Integer maxDocumentsToAnalyze; - - /** - * Creates an instance of ComponentDocumentModelDetails class. - * - * @param modelId the modelId value to set. - */ - @Generated - public ComponentDocumentModelDetails(String modelId) { - this.modelId = modelId; - } - - /** - * Get the docType property: Document type. - * - * @return the docType value. - */ - @Generated - public String getDocType() { - return this.docType; - } - - /** - * Set the docType property: Document type. - * - * @param docType the docType value to set. - * @return the ComponentDocumentModelDetails object itself. - */ - @Generated - public ComponentDocumentModelDetails setDocType(String docType) { - this.docType = docType; - return this; - } - - /** - * Get the modelId property: Document model to use for analyzing documents with specified type. - * - * @return the modelId value. - */ - @Generated - public String getModelId() { - return this.modelId; - } - - /** - * Get the maxDocumentsToAnalyze property: Maximum number of documents of specified type to analyze. Default=all. - * - * @return the maxDocumentsToAnalyze value. - */ - @Generated - public Integer getMaxDocumentsToAnalyze() { - return this.maxDocumentsToAnalyze; - } - - /** - * Set the maxDocumentsToAnalyze property: Maximum number of documents of specified type to analyze. Default=all. - * - * @param maxDocumentsToAnalyze the maxDocumentsToAnalyze value to set. - * @return the ComponentDocumentModelDetails object itself. - */ - @Generated - public ComponentDocumentModelDetails setMaxDocumentsToAnalyze(Integer maxDocumentsToAnalyze) { - this.maxDocumentsToAnalyze = maxDocumentsToAnalyze; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("modelId", this.modelId); - jsonWriter.writeStringField("docType", this.docType); - jsonWriter.writeNumberField("maxDocumentsToAnalyze", this.maxDocumentsToAnalyze); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ComponentDocumentModelDetails from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ComponentDocumentModelDetails 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 ComponentDocumentModelDetails. - */ - @Generated - public static ComponentDocumentModelDetails fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String modelId = null; - String docType = null; - Integer maxDocumentsToAnalyze = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("modelId".equals(fieldName)) { - modelId = reader.getString(); - } else if ("docType".equals(fieldName)) { - docType = reader.getString(); - } else if ("maxDocumentsToAnalyze".equals(fieldName)) { - maxDocumentsToAnalyze = reader.getNullable(JsonReader::getInt); - } else { - reader.skipChildren(); - } - } - ComponentDocumentModelDetails deserializedComponentDocumentModelDetails - = new ComponentDocumentModelDetails(modelId); - deserializedComponentDocumentModelDetails.docType = docType; - deserializedComponentDocumentModelDetails.maxDocumentsToAnalyze = maxDocumentsToAnalyze; - - return deserializedComponentDocumentModelDetails; - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ComposeDocumentModelRequest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ComposeDocumentModelRequest.java index eff53ceb3a88..bebc1ffc6537 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ComposeDocumentModelRequest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ComposeDocumentModelRequest.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Fluent; @@ -18,6 +17,7 @@ */ @Fluent public final class ComposeDocumentModelRequest implements JsonSerializable { + /* * Unique document model name. */ @@ -46,7 +46,7 @@ public final class ComposeDocumentModelRequest implements JsonSerializable docTypes; + private final Map documentTypes; /* * List of key-value tag attributes associated with the document model. @@ -56,21 +56,22 @@ public final class ComposeDocumentModelRequest implements JsonSerializable docTypes) { + public ComposeDocumentModelRequest(String modelId, String classifierId, + Map documentTypes) { this.modelId = modelId; this.classifierId = classifierId; - this.docTypes = docTypes; + this.documentTypes = documentTypes; } /** * Get the modelId property: Unique document model name. - * + * * @return the modelId value. */ @Generated @@ -80,7 +81,7 @@ public String getModelId() { /** * Get the description property: Document model description. - * + * * @return the description value. */ @Generated @@ -90,7 +91,7 @@ public String getDescription() { /** * Set the description property: Document model description. - * + * * @param description the description value to set. * @return the ComposeDocumentModelRequest object itself. */ @@ -102,7 +103,7 @@ public ComposeDocumentModelRequest setDescription(String description) { /** * Get the classifierId property: Custom classifier to split and classify the input file. - * + * * @return the classifierId value. */ @Generated @@ -112,7 +113,7 @@ public String getClassifierId() { /** * Get the split property: File splitting behavior. - * + * * @return the split value. */ @Generated @@ -122,7 +123,7 @@ public SplitMode getSplit() { /** * Set the split property: File splitting behavior. - * + * * @param split the split value to set. * @return the ComposeDocumentModelRequest object itself. */ @@ -133,18 +134,18 @@ public ComposeDocumentModelRequest setSplit(SplitMode split) { } /** - * Get the docTypes property: Dictionary mapping supported docTypes to the corresponding document models. - * - * @return the docTypes value. + * Get the documentTypes property: Dictionary mapping supported docTypes to the corresponding document models. + * + * @return the documentTypes value. */ @Generated - public Map getDocTypes() { - return this.docTypes; + public Map getDocumentTypes() { + return this.documentTypes; } /** * Get the tags property: List of key-value tag attributes associated with the document model. - * + * * @return the tags value. */ @Generated @@ -154,7 +155,7 @@ public Map getTags() { /** * Set the tags property: List of key-value tag attributes associated with the document model. - * + * * @param tags the tags value to set. * @return the ComposeDocumentModelRequest object itself. */ @@ -173,7 +174,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("modelId", this.modelId); jsonWriter.writeStringField("classifierId", this.classifierId); - jsonWriter.writeMapField("docTypes", this.docTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("docTypes", this.documentTypes, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("description", this.description); jsonWriter.writeStringField("split", this.split == null ? null : this.split.toString()); jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); @@ -182,7 +183,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of ComposeDocumentModelRequest from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of ComposeDocumentModelRequest if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. @@ -194,20 +195,19 @@ public static ComposeDocumentModelRequest fromJson(JsonReader jsonReader) throws return jsonReader.readObject(reader -> { String modelId = null; String classifierId = null; - Map docTypes = null; + Map documentTypes = null; String description = null; SplitMode split = null; Map tags = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("modelId".equals(fieldName)) { modelId = reader.getString(); } else if ("classifierId".equals(fieldName)) { classifierId = reader.getString(); } else if ("docTypes".equals(fieldName)) { - docTypes = reader.readMap(reader1 -> DocumentTypeDetails.fromJson(reader1)); + documentTypes = reader.readMap(reader1 -> DocumentTypeDetails.fromJson(reader1)); } else if ("description".equals(fieldName)) { description = reader.getString(); } else if ("split".equals(fieldName)) { @@ -219,11 +219,10 @@ public static ComposeDocumentModelRequest fromJson(JsonReader jsonReader) throws } } ComposeDocumentModelRequest deserializedComposeDocumentModelRequest - = new ComposeDocumentModelRequest(modelId, classifierId, docTypes); + = new ComposeDocumentModelRequest(modelId, classifierId, documentTypes); deserializedComposeDocumentModelRequest.description = description; deserializedComposeDocumentModelRequest.split = split; deserializedComposeDocumentModelRequest.tags = tags; - return deserializedComposeDocumentModelRequest; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ContentSourceKind.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ContentSourceKind.java index 84c4c3f629d6..afe6445230e7 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ContentSourceKind.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ContentSourceKind.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Type of content source. */ public final class ContentSourceKind extends ExpandableStringEnum { + /** * Content at a specific URL. */ @@ -38,7 +38,7 @@ public final class ContentSourceKind extends ExpandableStringEnum { + /* * Currency amount. */ @@ -37,7 +37,7 @@ public final class CurrencyValue implements JsonSerializable { /** * Creates an instance of CurrencyValue class. - * + * * @param amount the amount value to set. */ @Generated @@ -47,7 +47,7 @@ private CurrencyValue(double amount) { /** * Get the amount property: Currency amount. - * + * * @return the amount value. */ @Generated @@ -57,7 +57,7 @@ public double getAmount() { /** * Get the currencySymbol property: Currency symbol label, if any. - * + * * @return the currencySymbol value. */ @Generated @@ -67,7 +67,7 @@ public String getCurrencySymbol() { /** * Get the currencyCode property: Resolved currency code (ISO 4217), if any. - * + * * @return the currencyCode value. */ @Generated @@ -90,7 +90,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CurrencyValue from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CurrencyValue if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -106,7 +106,6 @@ public static CurrencyValue fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("amount".equals(fieldName)) { amount = reader.getDouble(); } else if ("currencySymbol".equals(fieldName)) { @@ -120,7 +119,6 @@ public static CurrencyValue fromJson(JsonReader jsonReader) throws IOException { CurrencyValue deserializedCurrencyValue = new CurrencyValue(amount); deserializedCurrencyValue.currencySymbol = currencySymbol; deserializedCurrencyValue.currencyCode = currencyCode; - return deserializedCurrencyValue; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/CustomDocumentModelsDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/CustomDocumentModelsDetails.java index 275dc9a30a04..a702fcf6d0a0 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/CustomDocumentModelsDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/CustomDocumentModelsDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -17,6 +16,7 @@ */ @Immutable public final class CustomDocumentModelsDetails implements JsonSerializable { + /* * Number of custom document models in the current resource. */ @@ -31,7 +31,7 @@ public final class CustomDocumentModelsDetails implements JsonSerializable { + /** * Perform OCR at a higher resolution to handle documents with fine print. */ @@ -56,7 +56,7 @@ public final class DocumentAnalysisFeature extends ExpandableStringEnum { + /* * Barcode kind. */ @@ -53,7 +53,7 @@ public final class DocumentBarcode implements JsonSerializable /** * Creates an instance of DocumentBarcode class. - * + * * @param kind the kind value to set. * @param value the value value to set. * @param span the span value to set. @@ -69,7 +69,7 @@ private DocumentBarcode(DocumentBarcodeKind kind, String value, DocumentSpan spa /** * Get the kind property: Barcode kind. - * + * * @return the kind value. */ @Generated @@ -79,7 +79,7 @@ public DocumentBarcodeKind getKind() { /** * Get the value property: Barcode value. - * + * * @return the value value. */ @Generated @@ -92,7 +92,7 @@ public String getValue() { * top-left of the page. The numbers represent the x, y values of the polygon * vertices, clockwise from the left (-180 degrees inclusive) relative to the * element orientation. - * + * * @return the polygon value. */ @Generated @@ -102,7 +102,7 @@ public List getPolygon() { /** * Get the span property: Location of the barcode in the reading order concatenated content. - * + * * @return the span value. */ @Generated @@ -112,7 +112,7 @@ public DocumentSpan getSpan() { /** * Get the confidence property: Confidence of correctly extracting the barcode. - * + * * @return the confidence value. */ @Generated @@ -137,7 +137,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentBarcode from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentBarcode if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -155,7 +155,6 @@ public static DocumentBarcode fromJson(JsonReader jsonReader) throws IOException while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("kind".equals(fieldName)) { kind = DocumentBarcodeKind.fromString(reader.getString()); } else if ("value".equals(fieldName)) { @@ -172,7 +171,6 @@ public static DocumentBarcode fromJson(JsonReader jsonReader) throws IOException } DocumentBarcode deserializedDocumentBarcode = new DocumentBarcode(kind, value, span, confidence); deserializedDocumentBarcode.polygon = polygon; - return deserializedDocumentBarcode; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentBarcodeKind.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentBarcodeKind.java index ed67c60adb6d..69cc67b7e985 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentBarcodeKind.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentBarcodeKind.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Barcode kind. */ public final class DocumentBarcodeKind extends ExpandableStringEnum { + /** * QR code, as defined in ISO/IEC 18004:2015. */ @@ -116,7 +116,7 @@ public final class DocumentBarcodeKind extends ExpandableStringEnum { + /** * Target documents with similar visual templates. */ @@ -24,15 +24,9 @@ public final class DocumentBuildMode extends ExpandableStringEnum { + /* * Content of the caption. */ @@ -44,7 +44,7 @@ public final class DocumentCaption implements JsonSerializable /** * Creates an instance of DocumentCaption class. - * + * * @param content the content value to set. * @param spans the spans value to set. */ @@ -56,7 +56,7 @@ private DocumentCaption(String content, List spans) { /** * Get the content property: Content of the caption. - * + * * @return the content value. */ @Generated @@ -66,7 +66,7 @@ public String getContent() { /** * Get the boundingRegions property: Bounding regions covering the caption. - * + * * @return the boundingRegions value. */ @Generated @@ -76,7 +76,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the caption in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -86,7 +86,7 @@ public List getSpans() { /** * Get the elements property: Child elements of the caption. - * + * * @return the elements value. */ @Generated @@ -111,7 +111,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentCaption from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentCaption if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -128,7 +128,6 @@ public static DocumentCaption fromJson(JsonReader jsonReader) throws IOException while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("content".equals(fieldName)) { content = reader.getString(); } else if ("spans".equals(fieldName)) { @@ -144,7 +143,6 @@ public static DocumentCaption fromJson(JsonReader jsonReader) throws IOException DocumentCaption deserializedDocumentCaption = new DocumentCaption(content, spans); deserializedDocumentCaption.boundingRegions = boundingRegions; deserializedDocumentCaption.elements = elements; - return deserializedDocumentCaption; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierBuildOperationDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierBuildOperationDetails.java index 66ec457770a1..ea1450489fc6 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierBuildOperationDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierBuildOperationDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,7 +18,8 @@ * Get Operation response object. */ @Immutable -public final class DocumentClassifierBuildOperationDetails extends OperationDetails { +public final class DocumentClassifierBuildOperationDetails extends DocumentIntelligenceOperationDetails { + /* * Type of operation. */ @@ -34,21 +34,21 @@ public final class DocumentClassifierBuildOperationDetails extends OperationDeta /** * Creates an instance of DocumentClassifierBuildOperationDetails class. - * + * * @param status the status value to set. - * @param createdDateTime the createdDateTime value to set. - * @param lastUpdatedDateTime the lastUpdatedDateTime value to set. + * @param createdOn the createdOn value to set. + * @param lastUpdatedOn the lastUpdatedOn value to set. * @param resourceLocation the resourceLocation value to set. */ @Generated - private DocumentClassifierBuildOperationDetails(OperationStatus status, OffsetDateTime createdDateTime, - OffsetDateTime lastUpdatedDateTime, String resourceLocation) { - super(status, createdDateTime, lastUpdatedDateTime, resourceLocation); + private DocumentClassifierBuildOperationDetails(DocumentIntelligenceOperationStatus status, + OffsetDateTime createdOn, OffsetDateTime lastUpdatedOn, String resourceLocation) { + super(status, createdOn, lastUpdatedOn, resourceLocation); } /** * Get the kind property: Type of operation. - * + * * @return the kind value. */ @Generated @@ -59,7 +59,7 @@ public OperationKind getKind() { /** * Get the result property: Operation result upon success. - * + * * @return the result value. */ @Generated @@ -76,11 +76,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("status", getStatus() == null ? null : getStatus().toString()); jsonWriter.writeStringField("createdDateTime", - getCreatedDateTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedDateTime())); + getCreatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedOn())); jsonWriter.writeStringField("lastUpdatedDateTime", - getLastUpdatedDateTime() == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedDateTime())); + getLastUpdatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedOn())); jsonWriter.writeStringField("resourceLocation", getResourceLocation()); jsonWriter.writeNumberField("percentCompleted", getPercentCompleted()); jsonWriter.writeStringField("apiVersion", getApiVersion()); @@ -93,7 +91,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentClassifierBuildOperationDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentClassifierBuildOperationDetails if the JsonReader was pointing to an instance of * it, or null if it was pointing to JSON null. @@ -104,29 +102,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { public static DocumentClassifierBuildOperationDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String operationId = null; - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; String resourceLocation = null; Integer percentCompleted = null; String apiVersion = null; Map tags = null; - Error error = null; + DocumentIntelligenceError error = null; OperationKind kind = OperationKind.DOCUMENT_CLASSIFIER_BUILD; DocumentClassifierDetails result = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("operationId".equals(fieldName)) { operationId = reader.getString(); } else if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("resourceLocation".equals(fieldName)) { resourceLocation = reader.getString(); @@ -137,7 +134,7 @@ public static DocumentClassifierBuildOperationDetails fromJson(JsonReader jsonRe } else if ("tags".equals(fieldName)) { tags = reader.readMap(reader1 -> reader1.getString()); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else if ("kind".equals(fieldName)) { kind = OperationKind.fromString(reader.getString()); } else if ("result".equals(fieldName)) { @@ -147,8 +144,7 @@ public static DocumentClassifierBuildOperationDetails fromJson(JsonReader jsonRe } } DocumentClassifierBuildOperationDetails deserializedDocumentClassifierBuildOperationDetails - = new DocumentClassifierBuildOperationDetails(status, createdDateTime, lastUpdatedDateTime, - resourceLocation); + = new DocumentClassifierBuildOperationDetails(status, createdOn, lastUpdatedOn, resourceLocation); deserializedDocumentClassifierBuildOperationDetails.setOperationId(operationId); deserializedDocumentClassifierBuildOperationDetails.setPercentCompleted(percentCompleted); deserializedDocumentClassifierBuildOperationDetails.setApiVersion(apiVersion); @@ -156,7 +152,6 @@ public static DocumentClassifierBuildOperationDetails fromJson(JsonReader jsonRe deserializedDocumentClassifierBuildOperationDetails.setError(error); deserializedDocumentClassifierBuildOperationDetails.kind = kind; deserializedDocumentClassifierBuildOperationDetails.result = result; - return deserializedDocumentClassifierBuildOperationDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierCopyToOperationDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierCopyToOperationDetails.java index 6d8d23d645f2..99c3e6f59f30 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierCopyToOperationDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierCopyToOperationDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,7 +18,8 @@ * Get Operation response object. */ @Immutable -public final class DocumentClassifierCopyToOperationDetails extends OperationDetails { +public final class DocumentClassifierCopyToOperationDetails extends DocumentIntelligenceOperationDetails { + /* * Type of operation. */ @@ -34,21 +34,21 @@ public final class DocumentClassifierCopyToOperationDetails extends OperationDet /** * Creates an instance of DocumentClassifierCopyToOperationDetails class. - * + * * @param status the status value to set. - * @param createdDateTime the createdDateTime value to set. - * @param lastUpdatedDateTime the lastUpdatedDateTime value to set. + * @param createdOn the createdOn value to set. + * @param lastUpdatedOn the lastUpdatedOn value to set. * @param resourceLocation the resourceLocation value to set. */ @Generated - private DocumentClassifierCopyToOperationDetails(OperationStatus status, OffsetDateTime createdDateTime, - OffsetDateTime lastUpdatedDateTime, String resourceLocation) { - super(status, createdDateTime, lastUpdatedDateTime, resourceLocation); + private DocumentClassifierCopyToOperationDetails(DocumentIntelligenceOperationStatus status, + OffsetDateTime createdOn, OffsetDateTime lastUpdatedOn, String resourceLocation) { + super(status, createdOn, lastUpdatedOn, resourceLocation); } /** * Get the kind property: Type of operation. - * + * * @return the kind value. */ @Generated @@ -59,7 +59,7 @@ public OperationKind getKind() { /** * Get the result property: Operation result upon success. - * + * * @return the result value. */ @Generated @@ -76,11 +76,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("status", getStatus() == null ? null : getStatus().toString()); jsonWriter.writeStringField("createdDateTime", - getCreatedDateTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedDateTime())); + getCreatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedOn())); jsonWriter.writeStringField("lastUpdatedDateTime", - getLastUpdatedDateTime() == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedDateTime())); + getLastUpdatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedOn())); jsonWriter.writeStringField("resourceLocation", getResourceLocation()); jsonWriter.writeNumberField("percentCompleted", getPercentCompleted()); jsonWriter.writeStringField("apiVersion", getApiVersion()); @@ -93,7 +91,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentClassifierCopyToOperationDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentClassifierCopyToOperationDetails if the JsonReader was pointing to an instance of * it, or null if it was pointing to JSON null. @@ -104,29 +102,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { public static DocumentClassifierCopyToOperationDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String operationId = null; - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; String resourceLocation = null; Integer percentCompleted = null; String apiVersion = null; Map tags = null; - Error error = null; + DocumentIntelligenceError error = null; OperationKind kind = OperationKind.DOCUMENT_CLASSIFIER_COPY_TO; DocumentClassifierDetails result = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("operationId".equals(fieldName)) { operationId = reader.getString(); } else if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("resourceLocation".equals(fieldName)) { resourceLocation = reader.getString(); @@ -137,7 +134,7 @@ public static DocumentClassifierCopyToOperationDetails fromJson(JsonReader jsonR } else if ("tags".equals(fieldName)) { tags = reader.readMap(reader1 -> reader1.getString()); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else if ("kind".equals(fieldName)) { kind = OperationKind.fromString(reader.getString()); } else if ("result".equals(fieldName)) { @@ -147,8 +144,7 @@ public static DocumentClassifierCopyToOperationDetails fromJson(JsonReader jsonR } } DocumentClassifierCopyToOperationDetails deserializedDocumentClassifierCopyToOperationDetails - = new DocumentClassifierCopyToOperationDetails(status, createdDateTime, lastUpdatedDateTime, - resourceLocation); + = new DocumentClassifierCopyToOperationDetails(status, createdOn, lastUpdatedOn, resourceLocation); deserializedDocumentClassifierCopyToOperationDetails.setOperationId(operationId); deserializedDocumentClassifierCopyToOperationDetails.setPercentCompleted(percentCompleted); deserializedDocumentClassifierCopyToOperationDetails.setApiVersion(apiVersion); @@ -156,7 +152,6 @@ public static DocumentClassifierCopyToOperationDetails fromJson(JsonReader jsonR deserializedDocumentClassifierCopyToOperationDetails.setError(error); deserializedDocumentClassifierCopyToOperationDetails.kind = kind; deserializedDocumentClassifierCopyToOperationDetails.result = result; - return deserializedDocumentClassifierCopyToOperationDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierDetails.java index 0cb372bbf965..7398a04ec0f8 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentClassifierDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -22,6 +21,7 @@ */ @Immutable public final class DocumentClassifierDetails implements JsonSerializable { + /* * Unique document classifier name. */ @@ -38,13 +38,19 @@ public final class DocumentClassifierDetails implements JsonSerializable docTypes; + private final Map documentTypes; /* * List of warnings encountered while building the classifier. */ @Generated - private List warnings; + private List warnings; /** * Creates an instance of DocumentClassifierDetails class. - * - * @param createdDateTime the createdDateTime value to set. + * + * @param createdOn the createdOn value to set. * @param apiVersion the apiVersion value to set. - * @param docTypes the docTypes value to set. + * @param documentTypes the documentTypes value to set. */ @Generated - private DocumentClassifierDetails(OffsetDateTime createdDateTime, String apiVersion, - Map docTypes) { - this.createdDateTime = createdDateTime; + private DocumentClassifierDetails(OffsetDateTime createdOn, String apiVersion, + Map documentTypes) { + this.createdOn = createdOn; this.apiVersion = apiVersion; - this.docTypes = docTypes; + this.documentTypes = documentTypes; } /** * Get the classifierId property: Unique document classifier name. - * + * * @return the classifierId value. */ @Generated @@ -97,7 +103,7 @@ public String getClassifierId() { /** * Get the description property: Document classifier description. - * + * * @return the description value. */ @Generated @@ -106,28 +112,38 @@ public String getDescription() { } /** - * Get the createdDateTime property: Date and time (UTC) when the document classifier was created. - * - * @return the createdDateTime value. + * Get the createdOn property: Date and time (UTC) when the document classifier was created. + * + * @return the createdOn value. + */ + @Generated + public OffsetDateTime getCreatedOn() { + return this.createdOn; + } + + /** + * Get the expiresOn property: Date and time (UTC) when the document classifier will expire. + * + * @return the expiresOn value. */ @Generated - public OffsetDateTime getCreatedDateTime() { - return this.createdDateTime; + public OffsetDateTime getExpiresOn() { + return this.expiresOn; } /** - * Get the expirationDateTime property: Date and time (UTC) when the document classifier will expire. - * - * @return the expirationDateTime value. + * Get the modifiedOn property: Date and time (UTC) when the document model was last modified. + * + * @return the modifiedOn value. */ @Generated - public OffsetDateTime getExpirationDateTime() { - return this.expirationDateTime; + public OffsetDateTime getModifiedOn() { + return this.modifiedOn; } /** * Get the apiVersion property: API version used to create this document classifier. - * + * * @return the apiVersion value. */ @Generated @@ -137,7 +153,7 @@ public String getApiVersion() { /** * Get the baseClassifierId property: Base classifierId on top of which the classifier was trained. - * + * * @return the baseClassifierId value. */ @Generated @@ -146,22 +162,22 @@ public String getBaseClassifierId() { } /** - * Get the docTypes property: List of document types to classify against. - * - * @return the docTypes value. + * Get the documentTypes property: List of document types to classify against. + * + * @return the documentTypes value. */ @Generated - public Map getDocTypes() { - return this.docTypes; + public Map getDocumentTypes() { + return this.documentTypes; } /** * Get the warnings property: List of warnings encountered while building the classifier. - * + * * @return the warnings value. */ @Generated - public List getWarnings() { + public List getWarnings() { return this.warnings; } @@ -173,14 +189,12 @@ public List getWarnings() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("createdDateTime", - this.createdDateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdDateTime)); + this.createdOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdOn)); jsonWriter.writeStringField("apiVersion", this.apiVersion); - jsonWriter.writeMapField("docTypes", this.docTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("docTypes", this.documentTypes, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("description", this.description); jsonWriter.writeStringField("expirationDateTime", - this.expirationDateTime == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expirationDateTime)); + this.expiresOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiresOn)); jsonWriter.writeStringField("baseClassifierId", this.baseClassifierId); jsonWriter.writeArrayField("warnings", this.warnings, (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); @@ -188,7 +202,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentClassifierDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentClassifierDetails if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. @@ -199,47 +213,50 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { public static DocumentClassifierDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String classifierId = null; - OffsetDateTime createdDateTime = null; + OffsetDateTime createdOn = null; String apiVersion = null; - Map docTypes = null; + Map documentTypes = null; String description = null; - OffsetDateTime expirationDateTime = null; + OffsetDateTime expiresOn = null; + OffsetDateTime modifiedOn = null; String baseClassifierId = null; - List warnings = null; + List warnings = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("classifierId".equals(fieldName)) { classifierId = reader.getString(); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("apiVersion".equals(fieldName)) { apiVersion = reader.getString(); } else if ("docTypes".equals(fieldName)) { - docTypes = reader.readMap(reader1 -> ClassifierDocumentTypeDetails.fromJson(reader1)); + documentTypes = reader.readMap(reader1 -> ClassifierDocumentTypeDetails.fromJson(reader1)); } else if ("description".equals(fieldName)) { description = reader.getString(); } else if ("expirationDateTime".equals(fieldName)) { - expirationDateTime = reader + expiresOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("modifiedDateTime".equals(fieldName)) { + modifiedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("baseClassifierId".equals(fieldName)) { baseClassifierId = reader.getString(); } else if ("warnings".equals(fieldName)) { - warnings = reader.readArray(reader1 -> Warning.fromJson(reader1)); + warnings = reader.readArray(reader1 -> DocumentIntelligenceWarning.fromJson(reader1)); } else { reader.skipChildren(); } } DocumentClassifierDetails deserializedDocumentClassifierDetails - = new DocumentClassifierDetails(createdDateTime, apiVersion, docTypes); + = new DocumentClassifierDetails(createdOn, apiVersion, documentTypes); deserializedDocumentClassifierDetails.classifierId = classifierId; deserializedDocumentClassifierDetails.description = description; - deserializedDocumentClassifierDetails.expirationDateTime = expirationDateTime; + deserializedDocumentClassifierDetails.expiresOn = expiresOn; + deserializedDocumentClassifierDetails.modifiedOn = modifiedOn; deserializedDocumentClassifierDetails.baseClassifierId = baseClassifierId; deserializedDocumentClassifierDetails.warnings = warnings; - return deserializedDocumentClassifierDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ContentFormat.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentContentFormat.java similarity index 50% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ContentFormat.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentContentFormat.java index c51762293778..72ae17aa3efe 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ContentFormat.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentContentFormat.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -11,48 +10,49 @@ /** * Format of the content in analyzed result. */ -public final class ContentFormat extends ExpandableStringEnum { +public final class DocumentContentFormat extends ExpandableStringEnum { + /** * Plain text representation of the document content without any formatting. */ @Generated - public static final ContentFormat TEXT = fromString("text"); + public static final DocumentContentFormat TEXT = fromString("text"); /** * Markdown representation of the document content with section headings, tables, * etc. */ @Generated - public static final ContentFormat MARKDOWN = fromString("markdown"); + public static final DocumentContentFormat MARKDOWN = fromString("markdown"); /** - * Creates a new instance of ContentFormat value. - * + * Creates a new instance of DocumentContentFormat value. + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @Deprecated - public ContentFormat() { + public DocumentContentFormat() { } /** - * Creates or finds a ContentFormat from its string representation. - * + * Creates or finds a DocumentContentFormat from its string representation. + * * @param name a name to look for. - * @return the corresponding ContentFormat. + * @return the corresponding DocumentContentFormat. */ @Generated - public static ContentFormat fromString(String name) { - return fromString(name, ContentFormat.class); + public static DocumentContentFormat fromString(String name) { + return fromString(name, DocumentContentFormat.class); } /** - * Gets known ContentFormat values. - * - * @return known ContentFormat values. + * Gets known DocumentContentFormat values. + * + * @return known DocumentContentFormat values. */ @Generated - public static Collection values() { - return values(ContentFormat.class); + public static Collection values() { + return values(DocumentContentFormat.class); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentField.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentField.java index 95fba0fa2b6b..ce22f134be52 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentField.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentField.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -21,6 +20,7 @@ */ @Immutable public final class DocumentField implements JsonSerializable { + /* * Data type of the field value. */ @@ -143,7 +143,7 @@ public final class DocumentField implements JsonSerializable { /** * Creates an instance of DocumentField class. - * + * * @param type the type value to set. */ @Generated @@ -153,7 +153,7 @@ private DocumentField(DocumentFieldType type) { /** * Get the type property: Data type of the field value. - * + * * @return the type value. */ @Generated @@ -163,7 +163,7 @@ public DocumentFieldType getType() { /** * Get the valueString property: String value. - * + * * @return the valueString value. */ @Generated @@ -173,7 +173,7 @@ public String getValueString() { /** * Get the valueDate property: Date value in YYYY-MM-DD format (ISO 8601). - * + * * @return the valueDate value. */ @Generated @@ -183,7 +183,7 @@ public LocalDate getValueDate() { /** * Get the valueTime property: Time value in hh:mm:ss format (ISO 8601). - * + * * @return the valueTime value. */ @Generated @@ -193,7 +193,7 @@ public String getValueTime() { /** * Get the valuePhoneNumber property: Phone number value in E.164 format (ex. +19876543210). - * + * * @return the valuePhoneNumber value. */ @Generated @@ -203,7 +203,7 @@ public String getValuePhoneNumber() { /** * Get the valueNumber property: Floating point value. - * + * * @return the valueNumber value. */ @Generated @@ -213,7 +213,7 @@ public Double getValueNumber() { /** * Get the valueInteger property: Integer value. - * + * * @return the valueInteger value. */ @Generated @@ -223,7 +223,7 @@ public Long getValueInteger() { /** * Get the valueSelectionMark property: Selection mark value. - * + * * @return the valueSelectionMark value. */ @Generated @@ -233,7 +233,7 @@ public DocumentSelectionMarkState getValueSelectionMark() { /** * Get the valueSignature property: Presence of signature. - * + * * @return the valueSignature value. */ @Generated @@ -243,7 +243,7 @@ public DocumentSignatureType getValueSignature() { /** * Get the valueCountryRegion property: 3-letter country code value (ISO 3166-1 alpha-3). - * + * * @return the valueCountryRegion value. */ @Generated @@ -253,7 +253,7 @@ public String getValueCountryRegion() { /** * Get the valueArray property: Array of field values. - * + * * @return the valueArray value. */ @Generated @@ -263,7 +263,7 @@ public List getValueArray() { /** * Get the valueObject property: Dictionary of named field values. - * + * * @return the valueObject value. */ @Generated @@ -273,7 +273,7 @@ public Map getValueObject() { /** * Get the valueCurrency property: Currency value. - * + * * @return the valueCurrency value. */ @Generated @@ -283,7 +283,7 @@ public CurrencyValue getValueCurrency() { /** * Get the valueAddress property: Address value. - * + * * @return the valueAddress value. */ @Generated @@ -293,7 +293,7 @@ public AddressValue getValueAddress() { /** * Get the valueBoolean property: Boolean value. - * + * * @return the valueBoolean value. */ @Generated @@ -303,7 +303,7 @@ public Boolean isValueBoolean() { /** * Get the valueSelectionGroup property: Selection group value. - * + * * @return the valueSelectionGroup value. */ @Generated @@ -313,7 +313,7 @@ public List getValueSelectionGroup() { /** * Get the content property: Field content. - * + * * @return the content value. */ @Generated @@ -323,7 +323,7 @@ public String getContent() { /** * Get the boundingRegions property: Bounding regions covering the field. - * + * * @return the boundingRegions value. */ @Generated @@ -333,7 +333,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the field in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -343,7 +343,7 @@ public List getSpans() { /** * Get the confidence property: Confidence of correctly extracting the field. - * + * * @return the confidence value. */ @Generated @@ -387,7 +387,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentField from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentField if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -420,7 +420,6 @@ public static DocumentField fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("type".equals(fieldName)) { type = DocumentFieldType.fromString(reader.getString()); } else if ("valueString".equals(fieldName)) { @@ -485,7 +484,6 @@ public static DocumentField fromJson(JsonReader jsonReader) throws IOException { deserializedDocumentField.boundingRegions = boundingRegions; deserializedDocumentField.spans = spans; deserializedDocumentField.confidence = confidence; - return deserializedDocumentField; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldSchema.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldSchema.java index 4d48d9dffcf9..4e86113af7a3 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldSchema.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldSchema.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Fluent; @@ -18,6 +17,7 @@ */ @Fluent public final class DocumentFieldSchema implements JsonSerializable { + /* * Semantic data type of the field value. */ @@ -50,7 +50,7 @@ public final class DocumentFieldSchema implements JsonSerializable getProperties() { /** * Set the properties property: Named sub-fields of the object field. - * + * * @param properties the properties value to set. * @return the DocumentFieldSchema object itself. */ @@ -173,7 +173,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentFieldSchema from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentFieldSchema if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -191,7 +191,6 @@ public static DocumentFieldSchema fromJson(JsonReader jsonReader) throws IOExcep while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("type".equals(fieldName)) { type = DocumentFieldType.fromString(reader.getString()); } else if ("description".equals(fieldName)) { @@ -211,7 +210,6 @@ public static DocumentFieldSchema fromJson(JsonReader jsonReader) throws IOExcep deserializedDocumentFieldSchema.example = example; deserializedDocumentFieldSchema.items = items; deserializedDocumentFieldSchema.properties = properties; - return deserializedDocumentFieldSchema; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldType.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldType.java index 7a44e88d902f..6d837ee314d3 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldType.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFieldType.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Semantic data type of the field value. */ public final class DocumentFieldType extends ExpandableStringEnum { + /** * Plain text. */ @@ -104,7 +104,7 @@ public final class DocumentFieldType extends ExpandableStringEnum { + /* * Bounding regions covering the figure. */ @@ -56,7 +56,7 @@ public final class DocumentFigure implements JsonSerializable { /** * Creates an instance of DocumentFigure class. - * + * * @param spans the spans value to set. */ @Generated @@ -66,7 +66,7 @@ private DocumentFigure(List spans) { /** * Get the boundingRegions property: Bounding regions covering the figure. - * + * * @return the boundingRegions value. */ @Generated @@ -76,7 +76,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the figure in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -86,7 +86,7 @@ public List getSpans() { /** * Get the elements property: Child elements of the figure, excluding any caption or footnotes. - * + * * @return the elements value. */ @Generated @@ -96,7 +96,7 @@ public List getElements() { /** * Get the caption property: Caption associated with the figure. - * + * * @return the caption value. */ @Generated @@ -106,7 +106,7 @@ public DocumentCaption getCaption() { /** * Get the footnotes property: List of footnotes associated with the figure. - * + * * @return the footnotes value. */ @Generated @@ -116,7 +116,7 @@ public List getFootnotes() { /** * Get the id property: Figure ID. - * + * * @return the id value. */ @Generated @@ -143,7 +143,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentFigure from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentFigure if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -162,7 +162,6 @@ public static DocumentFigure fromJson(JsonReader jsonReader) throws IOException while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("spans".equals(fieldName)) { spans = reader.readArray(reader1 -> DocumentSpan.fromJson(reader1)); } else if ("boundingRegions".equals(fieldName)) { @@ -185,7 +184,6 @@ public static DocumentFigure fromJson(JsonReader jsonReader) throws IOException deserializedDocumentFigure.caption = caption; deserializedDocumentFigure.footnotes = footnotes; deserializedDocumentFigure.id = id; - return deserializedDocumentFigure; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFontStyle.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFontStyle.java new file mode 100644 index 000000000000..2546ea16dfe8 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFontStyle.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.documentintelligence.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Font style. + */ +public final class DocumentFontStyle extends ExpandableStringEnum { + + /** + * Characters are represented normally. + */ + @Generated + public static final DocumentFontStyle NORMAL = fromString("normal"); + + /** + * Characters are visually slanted to the right. + */ + @Generated + public static final DocumentFontStyle ITALIC = fromString("italic"); + + /** + * Creates a new instance of DocumentFontStyle value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentFontStyle() { + } + + /** + * Creates or finds a DocumentFontStyle from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentFontStyle. + */ + @Generated + public static DocumentFontStyle fromString(String name) { + return fromString(name, DocumentFontStyle.class); + } + + /** + * Gets known DocumentFontStyle values. + * + * @return known DocumentFontStyle values. + */ + @Generated + public static Collection values() { + return values(DocumentFontStyle.class); + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFontWeight.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFontWeight.java new file mode 100644 index 000000000000..27f60abe1cbc --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFontWeight.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.documentintelligence.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Font weight. + */ +public final class DocumentFontWeight extends ExpandableStringEnum { + + /** + * Characters are represented normally. + */ + @Generated + public static final DocumentFontWeight NORMAL = fromString("normal"); + + /** + * Characters are represented with thicker strokes. + */ + @Generated + public static final DocumentFontWeight BOLD = fromString("bold"); + + /** + * Creates a new instance of DocumentFontWeight value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentFontWeight() { + } + + /** + * Creates or finds a DocumentFontWeight from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentFontWeight. + */ + @Generated + public static DocumentFontWeight fromString(String name) { + return fromString(name, DocumentFontWeight.class); + } + + /** + * Gets known DocumentFontWeight values. + * + * @return known DocumentFontWeight values. + */ + @Generated + public static Collection values() { + return values(DocumentFontWeight.class); + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFootnote.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFootnote.java index 082bf426e096..de842185498e 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFootnote.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFootnote.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentFootnote implements JsonSerializable { + /* * Content of the footnote. */ @@ -44,7 +44,7 @@ public final class DocumentFootnote implements JsonSerializable spans) { /** * Get the content property: Content of the footnote. - * + * * @return the content value. */ @Generated @@ -66,7 +66,7 @@ public String getContent() { /** * Get the boundingRegions property: Bounding regions covering the footnote. - * + * * @return the boundingRegions value. */ @Generated @@ -76,7 +76,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the footnote in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -86,7 +86,7 @@ public List getSpans() { /** * Get the elements property: Child elements of the footnote. - * + * * @return the elements value. */ @Generated @@ -111,7 +111,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentFootnote from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentFootnote if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -128,7 +128,6 @@ public static DocumentFootnote fromJson(JsonReader jsonReader) throws IOExceptio while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("content".equals(fieldName)) { content = reader.getString(); } else if ("spans".equals(fieldName)) { @@ -144,7 +143,6 @@ public static DocumentFootnote fromJson(JsonReader jsonReader) throws IOExceptio DocumentFootnote deserializedDocumentFootnote = new DocumentFootnote(content, spans); deserializedDocumentFootnote.boundingRegions = boundingRegions; deserializedDocumentFootnote.elements = elements; - return deserializedDocumentFootnote; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormula.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormula.java index 1b633f7db316..dc74b431b77c 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormula.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormula.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentFormula implements JsonSerializable { + /* * Formula kind. */ @@ -53,7 +53,7 @@ public final class DocumentFormula implements JsonSerializable /** * Creates an instance of DocumentFormula class. - * + * * @param kind the kind value to set. * @param value the value value to set. * @param span the span value to set. @@ -69,7 +69,7 @@ private DocumentFormula(DocumentFormulaKind kind, String value, DocumentSpan spa /** * Get the kind property: Formula kind. - * + * * @return the kind value. */ @Generated @@ -79,7 +79,7 @@ public DocumentFormulaKind getKind() { /** * Get the value property: LaTex expression describing the formula. - * + * * @return the value value. */ @Generated @@ -92,7 +92,7 @@ public String getValue() { * top-left of the page. The numbers represent the x, y values of the polygon * vertices, clockwise from the left (-180 degrees inclusive) relative to the * element orientation. - * + * * @return the polygon value. */ @Generated @@ -102,7 +102,7 @@ public List getPolygon() { /** * Get the span property: Location of the formula in the reading order concatenated content. - * + * * @return the span value. */ @Generated @@ -112,7 +112,7 @@ public DocumentSpan getSpan() { /** * Get the confidence property: Confidence of correctly extracting the formula. - * + * * @return the confidence value. */ @Generated @@ -137,7 +137,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentFormula from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentFormula if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -155,7 +155,6 @@ public static DocumentFormula fromJson(JsonReader jsonReader) throws IOException while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("kind".equals(fieldName)) { kind = DocumentFormulaKind.fromString(reader.getString()); } else if ("value".equals(fieldName)) { @@ -172,7 +171,6 @@ public static DocumentFormula fromJson(JsonReader jsonReader) throws IOException } DocumentFormula deserializedDocumentFormula = new DocumentFormula(kind, value, span, confidence); deserializedDocumentFormula.polygon = polygon; - return deserializedDocumentFormula; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormulaKind.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormulaKind.java index c7207ca50048..5a5c7c35a71d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormulaKind.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentFormulaKind.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Formula kind. */ public final class DocumentFormulaKind extends ExpandableStringEnum { + /** * A formula embedded within the content of a paragraph. */ @@ -26,7 +26,7 @@ public final class DocumentFormulaKind extends ExpandableStringEnum { +public final class DocumentIntelligenceError implements JsonSerializable { + /* * One of a server-defined set of error codes. */ @@ -40,29 +40,29 @@ public final class Error implements JsonSerializable { * An array of details about specific errors that led to this reported error. */ @Generated - private List details; + private List details; /* * An object containing more specific information than the current object about the error. */ @Generated - private InnerError innererror; + private DocumentIntelligenceInnerError innererror; /** - * Creates an instance of Error class. - * + * Creates an instance of DocumentIntelligenceError class. + * * @param code the code value to set. * @param message the message value to set. */ @Generated - private Error(String code, String message) { + private DocumentIntelligenceError(String code, String message) { this.code = code; this.message = message; } /** * Get the code property: One of a server-defined set of error codes. - * + * * @return the code value. */ @Generated @@ -72,7 +72,7 @@ public String getCode() { /** * Get the message property: A human-readable representation of the error. - * + * * @return the message value. */ @Generated @@ -82,7 +82,7 @@ public String getMessage() { /** * Get the target property: The target of the error. - * + * * @return the target value. */ @Generated @@ -92,22 +92,22 @@ public String getTarget() { /** * Get the details property: An array of details about specific errors that led to this reported error. - * + * * @return the details value. */ @Generated - public List getDetails() { + public List getDetails() { return this.details; } /** * Get the innererror property: An object containing more specific information than the current object about the * error. - * + * * @return the innererror value. */ @Generated - public InnerError getInnererror() { + public DocumentIntelligenceInnerError getInnererror() { return this.innererror; } @@ -127,26 +127,25 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of Error from the JsonReader. - * + * Reads an instance of DocumentIntelligenceError from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of Error if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. + * @return An instance of DocumentIntelligenceError 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 Error. + * @throws IOException If an error occurs while reading the DocumentIntelligenceError. */ @Generated - public static Error fromJson(JsonReader jsonReader) throws IOException { + public static DocumentIntelligenceError fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String code = null; String message = null; String target = null; - List details = null; - InnerError innererror = null; + List details = null; + DocumentIntelligenceInnerError innererror = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("code".equals(fieldName)) { code = reader.getString(); } else if ("message".equals(fieldName)) { @@ -154,19 +153,19 @@ public static Error fromJson(JsonReader jsonReader) throws IOException { } else if ("target".equals(fieldName)) { target = reader.getString(); } else if ("details".equals(fieldName)) { - details = reader.readArray(reader1 -> Error.fromJson(reader1)); + details = reader.readArray(reader1 -> DocumentIntelligenceError.fromJson(reader1)); } else if ("innererror".equals(fieldName)) { - innererror = InnerError.fromJson(reader); + innererror = DocumentIntelligenceInnerError.fromJson(reader); } else { reader.skipChildren(); } } - Error deserializedError = new Error(code, message); - deserializedError.target = target; - deserializedError.details = details; - deserializedError.innererror = innererror; - - return deserializedError; + DocumentIntelligenceError deserializedDocumentIntelligenceError + = new DocumentIntelligenceError(code, message); + deserializedDocumentIntelligenceError.target = target; + deserializedDocumentIntelligenceError.details = details; + deserializedDocumentIntelligenceError.innererror = innererror; + return deserializedDocumentIntelligenceError; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/InnerError.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceInnerError.java similarity index 65% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/InnerError.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceInnerError.java index 0aadb6f6869c..f3318d56c425 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/InnerError.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceInnerError.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -16,7 +15,8 @@ * An object containing more specific information about the error. */ @Immutable -public final class InnerError implements JsonSerializable { +public final class DocumentIntelligenceInnerError implements JsonSerializable { + /* * One of a server-defined set of error codes. */ @@ -33,18 +33,18 @@ public final class InnerError implements JsonSerializable { * Inner error. */ @Generated - private InnerError innererror; + private DocumentIntelligenceInnerError innererror; /** - * Creates an instance of InnerError class. + * Creates an instance of DocumentIntelligenceInnerError class. */ @Generated - private InnerError() { + private DocumentIntelligenceInnerError() { } /** * Get the code property: One of a server-defined set of error codes. - * + * * @return the code value. */ @Generated @@ -54,7 +54,7 @@ public String getCode() { /** * Get the message property: A human-readable representation of the error. - * + * * @return the message value. */ @Generated @@ -64,11 +64,11 @@ public String getMessage() { /** * Get the innererror property: Inner error. - * + * * @return the innererror value. */ @Generated - public InnerError getInnererror() { + public DocumentIntelligenceInnerError getInnererror() { return this.innererror; } @@ -86,33 +86,33 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of InnerError from the JsonReader. - * + * Reads an instance of DocumentIntelligenceInnerError from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of InnerError if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the InnerError. + * @return An instance of DocumentIntelligenceInnerError if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DocumentIntelligenceInnerError. */ @Generated - public static InnerError fromJson(JsonReader jsonReader) throws IOException { + public static DocumentIntelligenceInnerError fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - InnerError deserializedInnerError = new InnerError(); + DocumentIntelligenceInnerError deserializedDocumentIntelligenceInnerError + = new DocumentIntelligenceInnerError(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("code".equals(fieldName)) { - deserializedInnerError.code = reader.getString(); + deserializedDocumentIntelligenceInnerError.code = reader.getString(); } else if ("message".equals(fieldName)) { - deserializedInnerError.message = reader.getString(); + deserializedDocumentIntelligenceInnerError.message = reader.getString(); } else if ("innererror".equals(fieldName)) { - deserializedInnerError.innererror = InnerError.fromJson(reader); + deserializedDocumentIntelligenceInnerError.innererror + = DocumentIntelligenceInnerError.fromJson(reader); } else { reader.skipChildren(); } } - - return deserializedInnerError; + return deserializedDocumentIntelligenceInnerError; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceOperationDetails.java similarity index 68% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationDetails.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceOperationDetails.java index 6f134d006f4b..119fba3e4547 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceOperationDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -20,12 +19,13 @@ * Operation info. */ @Immutable -public class OperationDetails implements JsonSerializable { +public class DocumentIntelligenceOperationDetails implements JsonSerializable { + /* * Type of operation. */ @Generated - private OperationKind kind = OperationKind.fromString("OperationDetails"); + private OperationKind kind = OperationKind.fromString("DocumentIntelligenceOperationDetails"); /* * Operation ID @@ -37,7 +37,7 @@ public class OperationDetails implements JsonSerializable { * Operation status. notStarted, running, completed, or failed */ @Generated - private final OperationStatus status; + private final DocumentIntelligenceOperationStatus status; /* * Operation progress (0-100). @@ -49,13 +49,13 @@ public class OperationDetails implements JsonSerializable { * Date and time (UTC) when the operation was created. */ @Generated - private final OffsetDateTime createdDateTime; + private final OffsetDateTime createdOn; /* * Date and time (UTC) when the status was last updated. */ @Generated - private final OffsetDateTime lastUpdatedDateTime; + private final OffsetDateTime lastUpdatedOn; /* * URL of the resource targeted by this operation. @@ -79,28 +79,28 @@ public class OperationDetails implements JsonSerializable { * Encountered error. */ @Generated - private Error error; + private DocumentIntelligenceError error; /** - * Creates an instance of OperationDetails class. - * + * Creates an instance of DocumentIntelligenceOperationDetails class. + * * @param status the status value to set. - * @param createdDateTime the createdDateTime value to set. - * @param lastUpdatedDateTime the lastUpdatedDateTime value to set. + * @param createdOn the createdOn value to set. + * @param lastUpdatedOn the lastUpdatedOn value to set. * @param resourceLocation the resourceLocation value to set. */ @Generated - protected OperationDetails(OperationStatus status, OffsetDateTime createdDateTime, - OffsetDateTime lastUpdatedDateTime, String resourceLocation) { + protected DocumentIntelligenceOperationDetails(DocumentIntelligenceOperationStatus status, OffsetDateTime createdOn, + OffsetDateTime lastUpdatedOn, String resourceLocation) { this.status = status; - this.createdDateTime = createdDateTime; - this.lastUpdatedDateTime = lastUpdatedDateTime; + this.createdOn = createdOn; + this.lastUpdatedOn = lastUpdatedOn; this.resourceLocation = resourceLocation; } /** * Get the kind property: Type of operation. - * + * * @return the kind value. */ @Generated @@ -110,7 +110,7 @@ public OperationKind getKind() { /** * Get the operationId property: Operation ID. - * + * * @return the operationId value. */ @Generated @@ -120,29 +120,29 @@ public String getOperationId() { /** * Set the operationId property: Operation ID. - * + * * @param operationId the operationId value to set. - * @return the OperationDetails object itself. + * @return the DocumentIntelligenceOperationDetails object itself. */ @Generated - OperationDetails setOperationId(String operationId) { + DocumentIntelligenceOperationDetails setOperationId(String operationId) { this.operationId = operationId; return this; } /** * Get the status property: Operation status. notStarted, running, completed, or failed. - * + * * @return the status value. */ @Generated - public OperationStatus getStatus() { + public DocumentIntelligenceOperationStatus getStatus() { return this.status; } /** * Get the percentCompleted property: Operation progress (0-100). - * + * * @return the percentCompleted value. */ @Generated @@ -152,39 +152,39 @@ public Integer getPercentCompleted() { /** * Set the percentCompleted property: Operation progress (0-100). - * + * * @param percentCompleted the percentCompleted value to set. - * @return the OperationDetails object itself. + * @return the DocumentIntelligenceOperationDetails object itself. */ @Generated - OperationDetails setPercentCompleted(Integer percentCompleted) { + DocumentIntelligenceOperationDetails setPercentCompleted(Integer percentCompleted) { this.percentCompleted = percentCompleted; return this; } /** - * Get the createdDateTime property: Date and time (UTC) when the operation was created. - * - * @return the createdDateTime value. + * Get the createdOn property: Date and time (UTC) when the operation was created. + * + * @return the createdOn value. */ @Generated - public OffsetDateTime getCreatedDateTime() { - return this.createdDateTime; + public OffsetDateTime getCreatedOn() { + return this.createdOn; } /** - * Get the lastUpdatedDateTime property: Date and time (UTC) when the status was last updated. - * - * @return the lastUpdatedDateTime value. + * Get the lastUpdatedOn property: Date and time (UTC) when the status was last updated. + * + * @return the lastUpdatedOn value. */ @Generated - public OffsetDateTime getLastUpdatedDateTime() { - return this.lastUpdatedDateTime; + public OffsetDateTime getLastUpdatedOn() { + return this.lastUpdatedOn; } /** * Get the resourceLocation property: URL of the resource targeted by this operation. - * + * * @return the resourceLocation value. */ @Generated @@ -194,7 +194,7 @@ public String getResourceLocation() { /** * Get the apiVersion property: API version used to create this operation. - * + * * @return the apiVersion value. */ @Generated @@ -204,19 +204,19 @@ public String getApiVersion() { /** * Set the apiVersion property: API version used to create this operation. - * + * * @param apiVersion the apiVersion value to set. - * @return the OperationDetails object itself. + * @return the DocumentIntelligenceOperationDetails object itself. */ @Generated - OperationDetails setApiVersion(String apiVersion) { + DocumentIntelligenceOperationDetails setApiVersion(String apiVersion) { this.apiVersion = apiVersion; return this; } /** * Get the tags property: List of key-value tag attributes associated with the document model. - * + * * @return the tags value. */ @Generated @@ -226,34 +226,34 @@ public Map getTags() { /** * Set the tags property: List of key-value tag attributes associated with the document model. - * + * * @param tags the tags value to set. - * @return the OperationDetails object itself. + * @return the DocumentIntelligenceOperationDetails object itself. */ @Generated - OperationDetails setTags(Map tags) { + DocumentIntelligenceOperationDetails setTags(Map tags) { this.tags = tags; return this; } /** * Get the error property: Encountered error. - * + * * @return the error value. */ @Generated - public Error getError() { + public DocumentIntelligenceError getError() { return this.error; } /** * Set the error property: Encountered error. - * + * * @param error the error value to set. - * @return the OperationDetails object itself. + * @return the DocumentIntelligenceOperationDetails object itself. */ @Generated - OperationDetails setError(Error error) { + DocumentIntelligenceOperationDetails setError(DocumentIntelligenceError error) { this.error = error; return this; } @@ -267,11 +267,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); jsonWriter.writeStringField("createdDateTime", - this.createdDateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdDateTime)); + this.createdOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdOn)); jsonWriter.writeStringField("lastUpdatedDateTime", - this.lastUpdatedDateTime == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedDateTime)); + this.lastUpdatedOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedOn)); jsonWriter.writeStringField("resourceLocation", this.resourceLocation); jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); jsonWriter.writeNumberField("percentCompleted", this.percentCompleted); @@ -282,20 +280,21 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of OperationDetails from the JsonReader. - * + * Reads an instance of DocumentIntelligenceOperationDetails from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of OperationDetails if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. + * @return An instance of DocumentIntelligenceOperationDetails 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 OperationDetails. + * @throws IOException If an error occurs while reading the DocumentIntelligenceOperationDetails. */ @Generated - public static OperationDetails fromJson(JsonReader jsonReader) throws IOException { + public static DocumentIntelligenceOperationDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String discriminatorValue = null; try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading + // Prepare for reading + readerToUse.nextToken(); while (readerToUse.nextToken() != JsonToken.END_OBJECT) { String fieldName = readerToUse.getFieldName(); readerToUse.nextToken(); @@ -325,31 +324,30 @@ public static OperationDetails fromJson(JsonReader jsonReader) throws IOExceptio } @Generated - static OperationDetails fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + static DocumentIntelligenceOperationDetails fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String operationId = null; - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; String resourceLocation = null; OperationKind kind = null; Integer percentCompleted = null; String apiVersion = null; Map tags = null; - Error error = null; + DocumentIntelligenceError error = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("operationId".equals(fieldName)) { operationId = reader.getString(); } else if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("resourceLocation".equals(fieldName)) { resourceLocation = reader.getString(); @@ -362,21 +360,20 @@ static OperationDetails fromJsonKnownDiscriminator(JsonReader jsonReader) throws } else if ("tags".equals(fieldName)) { tags = reader.readMap(reader1 -> reader1.getString()); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else { reader.skipChildren(); } } - OperationDetails deserializedOperationDetails - = new OperationDetails(status, createdDateTime, lastUpdatedDateTime, resourceLocation); - deserializedOperationDetails.operationId = operationId; - deserializedOperationDetails.kind = kind; - deserializedOperationDetails.percentCompleted = percentCompleted; - deserializedOperationDetails.apiVersion = apiVersion; - deserializedOperationDetails.tags = tags; - deserializedOperationDetails.error = error; - - return deserializedOperationDetails; + DocumentIntelligenceOperationDetails deserializedDocumentIntelligenceOperationDetails + = new DocumentIntelligenceOperationDetails(status, createdOn, lastUpdatedOn, resourceLocation); + deserializedDocumentIntelligenceOperationDetails.operationId = operationId; + deserializedDocumentIntelligenceOperationDetails.kind = kind; + deserializedDocumentIntelligenceOperationDetails.percentCompleted = percentCompleted; + deserializedDocumentIntelligenceOperationDetails.apiVersion = apiVersion; + deserializedDocumentIntelligenceOperationDetails.tags = tags; + deserializedDocumentIntelligenceOperationDetails.error = error; + return deserializedDocumentIntelligenceOperationDetails; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceOperationStatus.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceOperationStatus.java new file mode 100644 index 000000000000..b84dbb8d4beb --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceOperationStatus.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.ai.documentintelligence.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Operation status. + */ +public final class DocumentIntelligenceOperationStatus + extends ExpandableStringEnum { + + /** + * The operation has not started yet. + */ + @Generated + public static final DocumentIntelligenceOperationStatus NOT_STARTED = fromString("notStarted"); + + /** + * The operation is in progress. + */ + @Generated + public static final DocumentIntelligenceOperationStatus RUNNING = fromString("running"); + + /** + * The operation has failed. + */ + @Generated + public static final DocumentIntelligenceOperationStatus FAILED = fromString("failed"); + + /** + * The operation has succeeded. + */ + @Generated + public static final DocumentIntelligenceOperationStatus SUCCEEDED = fromString("succeeded"); + + /** + * The operation has been canceled. + */ + @Generated + public static final DocumentIntelligenceOperationStatus CANCELED = fromString("canceled"); + + /** + * The operation has been skipped. + */ + @Generated + public static final DocumentIntelligenceOperationStatus SKIPPED = fromString("skipped"); + + /** + * Creates a new instance of DocumentIntelligenceOperationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DocumentIntelligenceOperationStatus() { + } + + /** + * Creates or finds a DocumentIntelligenceOperationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentIntelligenceOperationStatus. + */ + @Generated + public static DocumentIntelligenceOperationStatus fromString(String name) { + return fromString(name, DocumentIntelligenceOperationStatus.class); + } + + /** + * Gets known DocumentIntelligenceOperationStatus values. + * + * @return known DocumentIntelligenceOperationStatus values. + */ + @Generated + public static Collection values() { + return values(DocumentIntelligenceOperationStatus.class); + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ResourceDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceResourceDetails.java similarity index 73% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ResourceDetails.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceResourceDetails.java index bf23bec56968..130d91cae1ce 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ResourceDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceResourceDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -16,7 +15,9 @@ * General information regarding the current resource. */ @Immutable -public final class ResourceDetails implements JsonSerializable { +public final class DocumentIntelligenceResourceDetails + implements JsonSerializable { + /* * Details regarding custom document models. */ @@ -24,18 +25,18 @@ public final class ResourceDetails implements JsonSerializable private final CustomDocumentModelsDetails customDocumentModels; /** - * Creates an instance of ResourceDetails class. - * + * Creates an instance of DocumentIntelligenceResourceDetails class. + * * @param customDocumentModels the customDocumentModels value to set. */ @Generated - private ResourceDetails(CustomDocumentModelsDetails customDocumentModels) { + private DocumentIntelligenceResourceDetails(CustomDocumentModelsDetails customDocumentModels) { this.customDocumentModels = customDocumentModels; } /** * Get the customDocumentModels property: Details regarding custom document models. - * + * * @return the customDocumentModels value. */ @Generated @@ -55,29 +56,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of ResourceDetails from the JsonReader. - * + * Reads an instance of DocumentIntelligenceResourceDetails from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of ResourceDetails if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. + * @return An instance of DocumentIntelligenceResourceDetails 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 ResourceDetails. + * @throws IOException If an error occurs while reading the DocumentIntelligenceResourceDetails. */ @Generated - public static ResourceDetails fromJson(JsonReader jsonReader) throws IOException { + public static DocumentIntelligenceResourceDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CustomDocumentModelsDetails customDocumentModels = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("customDocumentModels".equals(fieldName)) { customDocumentModels = CustomDocumentModelsDetails.fromJson(reader); } else { reader.skipChildren(); } } - return new ResourceDetails(customDocumentModels); + return new DocumentIntelligenceResourceDetails(customDocumentModels); }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/Warning.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceWarning.java similarity index 76% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/Warning.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceWarning.java index c755fba0a7b5..bda353246a15 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/Warning.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentIntelligenceWarning.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -16,7 +15,8 @@ * The error object. */ @Immutable -public final class Warning implements JsonSerializable { +public final class DocumentIntelligenceWarning implements JsonSerializable { + /* * One of a server-defined set of warning codes. */ @@ -36,20 +36,20 @@ public final class Warning implements JsonSerializable { private String target; /** - * Creates an instance of Warning class. - * + * Creates an instance of DocumentIntelligenceWarning class. + * * @param code the code value to set. * @param message the message value to set. */ @Generated - private Warning(String code, String message) { + private DocumentIntelligenceWarning(String code, String message) { this.code = code; this.message = message; } /** * Get the code property: One of a server-defined set of warning codes. - * + * * @return the code value. */ @Generated @@ -59,7 +59,7 @@ public String getCode() { /** * Get the message property: A human-readable representation of the warning. - * + * * @return the message value. */ @Generated @@ -69,7 +69,7 @@ public String getMessage() { /** * Get the target property: The target of the error. - * + * * @return the target value. */ @Generated @@ -91,16 +91,16 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of Warning from the JsonReader. - * + * Reads an instance of DocumentIntelligenceWarning from the JsonReader. + * * @param jsonReader The JsonReader being read. - * @return An instance of Warning if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. + * @return An instance of DocumentIntelligenceWarning 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 Warning. + * @throws IOException If an error occurs while reading the DocumentIntelligenceWarning. */ @Generated - public static Warning fromJson(JsonReader jsonReader) throws IOException { + public static DocumentIntelligenceWarning fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String code = null; String message = null; @@ -108,7 +108,6 @@ public static Warning fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("code".equals(fieldName)) { code = reader.getString(); } else if ("message".equals(fieldName)) { @@ -119,10 +118,10 @@ public static Warning fromJson(JsonReader jsonReader) throws IOException { reader.skipChildren(); } } - Warning deserializedWarning = new Warning(code, message); - deserializedWarning.target = target; - - return deserializedWarning; + DocumentIntelligenceWarning deserializedDocumentIntelligenceWarning + = new DocumentIntelligenceWarning(code, message); + deserializedDocumentIntelligenceWarning.target = target; + return deserializedDocumentIntelligenceWarning; }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValueElement.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValueElement.java index 89dc408ce8df..c88b25a9c744 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValueElement.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValueElement.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentKeyValueElement implements JsonSerializable { + /* * Concatenated content of the key-value element in reading order. */ @@ -38,7 +38,7 @@ public final class DocumentKeyValueElement implements JsonSerializable spans) { /** * Get the content property: Concatenated content of the key-value element in reading order. - * + * * @return the content value. */ @Generated @@ -60,7 +60,7 @@ public String getContent() { /** * Get the boundingRegions property: Bounding regions covering the key-value element. - * + * * @return the boundingRegions value. */ @Generated @@ -70,7 +70,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the key-value element in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -94,7 +94,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentKeyValueElement from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentKeyValueElement if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. @@ -110,7 +110,6 @@ public static DocumentKeyValueElement fromJson(JsonReader jsonReader) throws IOE while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("content".equals(fieldName)) { content = reader.getString(); } else if ("spans".equals(fieldName)) { @@ -123,7 +122,6 @@ public static DocumentKeyValueElement fromJson(JsonReader jsonReader) throws IOE } DocumentKeyValueElement deserializedDocumentKeyValueElement = new DocumentKeyValueElement(content, spans); deserializedDocumentKeyValueElement.boundingRegions = boundingRegions; - return deserializedDocumentKeyValueElement; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValuePair.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValuePair.java index 08723ee2968e..c2d9be1352cf 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValuePair.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentKeyValuePair.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentKeyValuePair implements JsonSerializable { + /* * Field label of the key-value pair. */ @@ -38,7 +38,7 @@ public final class DocumentKeyValuePair implements JsonSerializable { + /* * Detected language. Value may an ISO 639-1 language code (ex. "en", "fr") * or BCP 47 language tag (ex. "zh-Hans"). @@ -40,7 +40,7 @@ public final class DocumentLanguage implements JsonSerializable spans, double confide /** * Get the locale property: Detected language. Value may an ISO 639-1 language code (ex. "en", "fr") * or BCP 47 language tag (ex. "zh-Hans"). - * + * * @return the locale value. */ @Generated @@ -66,7 +66,7 @@ public String getLocale() { /** * Get the spans property: Location of the text elements in the concatenated content the language applies * to. - * + * * @return the spans value. */ @Generated @@ -76,7 +76,7 @@ public List getSpans() { /** * Get the confidence property: Confidence of correctly identifying the language. - * + * * @return the confidence value. */ @Generated @@ -99,7 +99,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentLanguage from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentLanguage if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -115,7 +115,6 @@ public static DocumentLanguage fromJson(JsonReader jsonReader) throws IOExceptio while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("locale".equals(fieldName)) { locale = reader.getString(); } else if ("spans".equals(fieldName)) { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentLine.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentLine.java index 907d565c3f01..4698cc97e959 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentLine.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentLine.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,6 +18,7 @@ */ @Immutable public final class DocumentLine implements JsonSerializable { + /* * Concatenated content of the contained elements in reading order. */ @@ -42,7 +42,7 @@ public final class DocumentLine implements JsonSerializable { /** * Creates an instance of DocumentLine class. - * + * * @param content the content value to set. * @param spans the spans value to set. */ @@ -54,7 +54,7 @@ private DocumentLine(String content, List spans) { /** * Get the content property: Concatenated content of the contained elements in reading order. - * + * * @return the content value. */ @Generated @@ -67,7 +67,7 @@ public String getContent() { * top-left of the page. The numbers represent the x, y values of the polygon * vertices, clockwise from the left (-180 degrees inclusive) relative to the * element orientation. - * + * * @return the polygon value. */ @Generated @@ -77,7 +77,7 @@ public List getPolygon() { /** * Get the spans property: Location of the line in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -100,7 +100,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentLine from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentLine if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -116,7 +116,6 @@ public static DocumentLine fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("content".equals(fieldName)) { content = reader.getString(); } else if ("spans".equals(fieldName)) { @@ -129,7 +128,6 @@ public static DocumentLine fromJson(JsonReader jsonReader) throws IOException { } DocumentLine deserializedDocumentLine = new DocumentLine(content, spans); deserializedDocumentLine.polygon = polygon; - return deserializedDocumentLine; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentList.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentList.java deleted file mode 100644 index 3a8aec53ade6..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentList.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.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; - -/** - * An object representing a list in the document. - */ -@Immutable -public final class DocumentList implements JsonSerializable { - /* - * Location of the list in the reading order concatenated content. - */ - @Generated - private final List spans; - - /* - * Items in the list. - */ - @Generated - private final List items; - - /** - * Creates an instance of DocumentList class. - * - * @param spans the spans value to set. - * @param items the items value to set. - */ - @Generated - private DocumentList(List spans, List items) { - this.spans = spans; - this.items = items; - } - - /** - * Get the spans property: Location of the list in the reading order concatenated content. - * - * @return the spans value. - */ - @Generated - public List getSpans() { - return this.spans; - } - - /** - * Get the items property: Items in the list. - * - * @return the items value. - */ - @Generated - public List getItems() { - return this.items; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("spans", this.spans, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeArrayField("items", this.items, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DocumentList from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DocumentList 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 DocumentList. - */ - @Generated - public static DocumentList fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List spans = null; - List items = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("spans".equals(fieldName)) { - spans = reader.readArray(reader1 -> DocumentSpan.fromJson(reader1)); - } else if ("items".equals(fieldName)) { - items = reader.readArray(reader1 -> DocumentListItem.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - return new DocumentList(spans, items); - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentListItem.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentListItem.java deleted file mode 100644 index 2002d73dcc9e..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentListItem.java +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.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; - -/** - * An object representing a list item in the document. - */ -@Immutable -public final class DocumentListItem implements JsonSerializable { - /* - * Level of the list item (1-indexed). - */ - @Generated - private final int level; - - /* - * Content of the list item. - */ - @Generated - private final String content; - - /* - * Bounding regions covering the list item. - */ - @Generated - private List boundingRegions; - - /* - * Location of the list item in the reading order concatenated content. - */ - @Generated - private final List spans; - - /* - * Child elements of the list item. - */ - @Generated - private List elements; - - /** - * Creates an instance of DocumentListItem class. - * - * @param level the level value to set. - * @param content the content value to set. - * @param spans the spans value to set. - */ - @Generated - private DocumentListItem(int level, String content, List spans) { - this.level = level; - this.content = content; - this.spans = spans; - } - - /** - * Get the level property: Level of the list item (1-indexed). - * - * @return the level value. - */ - @Generated - public int getLevel() { - return this.level; - } - - /** - * Get the content property: Content of the list item. - * - * @return the content value. - */ - @Generated - public String getContent() { - return this.content; - } - - /** - * Get the boundingRegions property: Bounding regions covering the list item. - * - * @return the boundingRegions value. - */ - @Generated - public List getBoundingRegions() { - return this.boundingRegions; - } - - /** - * Get the spans property: Location of the list item in the reading order concatenated content. - * - * @return the spans value. - */ - @Generated - public List getSpans() { - return this.spans; - } - - /** - * Get the elements property: Child elements of the list item. - * - * @return the elements value. - */ - @Generated - public List getElements() { - return this.elements; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("level", this.level); - jsonWriter.writeStringField("content", this.content); - jsonWriter.writeArrayField("spans", this.spans, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeArrayField("boundingRegions", this.boundingRegions, - (writer, element) -> writer.writeJson(element)); - jsonWriter.writeArrayField("elements", this.elements, (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DocumentListItem from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DocumentListItem 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 DocumentListItem. - */ - @Generated - public static DocumentListItem fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int level = 0; - String content = null; - List spans = null; - List boundingRegions = null; - List elements = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("level".equals(fieldName)) { - level = reader.getInt(); - } else if ("content".equals(fieldName)) { - content = reader.getString(); - } else if ("spans".equals(fieldName)) { - spans = reader.readArray(reader1 -> DocumentSpan.fromJson(reader1)); - } else if ("boundingRegions".equals(fieldName)) { - boundingRegions = reader.readArray(reader1 -> BoundingRegion.fromJson(reader1)); - } else if ("elements".equals(fieldName)) { - elements = reader.readArray(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - DocumentListItem deserializedDocumentListItem = new DocumentListItem(level, content, spans); - deserializedDocumentListItem.boundingRegions = boundingRegions; - deserializedDocumentListItem.elements = elements; - - return deserializedDocumentListItem; - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelBuildOperationDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelBuildOperationDetails.java index 81a1592d8fa8..770fff77dd50 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelBuildOperationDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelBuildOperationDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,7 +18,8 @@ * Get Operation response object. */ @Immutable -public final class DocumentModelBuildOperationDetails extends OperationDetails { +public final class DocumentModelBuildOperationDetails extends DocumentIntelligenceOperationDetails { + /* * Type of operation. */ @@ -34,21 +34,21 @@ public final class DocumentModelBuildOperationDetails extends OperationDetails { /** * Creates an instance of DocumentModelBuildOperationDetails class. - * + * * @param status the status value to set. - * @param createdDateTime the createdDateTime value to set. - * @param lastUpdatedDateTime the lastUpdatedDateTime value to set. + * @param createdOn the createdOn value to set. + * @param lastUpdatedOn the lastUpdatedOn value to set. * @param resourceLocation the resourceLocation value to set. */ @Generated - private DocumentModelBuildOperationDetails(OperationStatus status, OffsetDateTime createdDateTime, - OffsetDateTime lastUpdatedDateTime, String resourceLocation) { - super(status, createdDateTime, lastUpdatedDateTime, resourceLocation); + private DocumentModelBuildOperationDetails(DocumentIntelligenceOperationStatus status, OffsetDateTime createdOn, + OffsetDateTime lastUpdatedOn, String resourceLocation) { + super(status, createdOn, lastUpdatedOn, resourceLocation); } /** * Get the kind property: Type of operation. - * + * * @return the kind value. */ @Generated @@ -59,7 +59,7 @@ public OperationKind getKind() { /** * Get the result property: Operation result upon success. - * + * * @return the result value. */ @Generated @@ -76,11 +76,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("status", getStatus() == null ? null : getStatus().toString()); jsonWriter.writeStringField("createdDateTime", - getCreatedDateTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedDateTime())); + getCreatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedOn())); jsonWriter.writeStringField("lastUpdatedDateTime", - getLastUpdatedDateTime() == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedDateTime())); + getLastUpdatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedOn())); jsonWriter.writeStringField("resourceLocation", getResourceLocation()); jsonWriter.writeNumberField("percentCompleted", getPercentCompleted()); jsonWriter.writeStringField("apiVersion", getApiVersion()); @@ -93,7 +91,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentModelBuildOperationDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentModelBuildOperationDetails if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. @@ -104,29 +102,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { public static DocumentModelBuildOperationDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String operationId = null; - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; String resourceLocation = null; Integer percentCompleted = null; String apiVersion = null; Map tags = null; - Error error = null; + DocumentIntelligenceError error = null; OperationKind kind = OperationKind.DOCUMENT_MODEL_BUILD; DocumentModelDetails result = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("operationId".equals(fieldName)) { operationId = reader.getString(); } else if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("resourceLocation".equals(fieldName)) { resourceLocation = reader.getString(); @@ -137,7 +134,7 @@ public static DocumentModelBuildOperationDetails fromJson(JsonReader jsonReader) } else if ("tags".equals(fieldName)) { tags = reader.readMap(reader1 -> reader1.getString()); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else if ("kind".equals(fieldName)) { kind = OperationKind.fromString(reader.getString()); } else if ("result".equals(fieldName)) { @@ -147,8 +144,7 @@ public static DocumentModelBuildOperationDetails fromJson(JsonReader jsonReader) } } DocumentModelBuildOperationDetails deserializedDocumentModelBuildOperationDetails - = new DocumentModelBuildOperationDetails(status, createdDateTime, lastUpdatedDateTime, - resourceLocation); + = new DocumentModelBuildOperationDetails(status, createdOn, lastUpdatedOn, resourceLocation); deserializedDocumentModelBuildOperationDetails.setOperationId(operationId); deserializedDocumentModelBuildOperationDetails.setPercentCompleted(percentCompleted); deserializedDocumentModelBuildOperationDetails.setApiVersion(apiVersion); @@ -156,7 +152,6 @@ public static DocumentModelBuildOperationDetails fromJson(JsonReader jsonReader) deserializedDocumentModelBuildOperationDetails.setError(error); deserializedDocumentModelBuildOperationDetails.kind = kind; deserializedDocumentModelBuildOperationDetails.result = result; - return deserializedDocumentModelBuildOperationDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelComposeOperationDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelComposeOperationDetails.java index e717046a0b0c..5c680500eb70 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelComposeOperationDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelComposeOperationDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,7 +18,8 @@ * Get Operation response object. */ @Immutable -public final class DocumentModelComposeOperationDetails extends OperationDetails { +public final class DocumentModelComposeOperationDetails extends DocumentIntelligenceOperationDetails { + /* * Type of operation. */ @@ -34,21 +34,21 @@ public final class DocumentModelComposeOperationDetails extends OperationDetails /** * Creates an instance of DocumentModelComposeOperationDetails class. - * + * * @param status the status value to set. - * @param createdDateTime the createdDateTime value to set. - * @param lastUpdatedDateTime the lastUpdatedDateTime value to set. + * @param createdOn the createdOn value to set. + * @param lastUpdatedOn the lastUpdatedOn value to set. * @param resourceLocation the resourceLocation value to set. */ @Generated - private DocumentModelComposeOperationDetails(OperationStatus status, OffsetDateTime createdDateTime, - OffsetDateTime lastUpdatedDateTime, String resourceLocation) { - super(status, createdDateTime, lastUpdatedDateTime, resourceLocation); + private DocumentModelComposeOperationDetails(DocumentIntelligenceOperationStatus status, OffsetDateTime createdOn, + OffsetDateTime lastUpdatedOn, String resourceLocation) { + super(status, createdOn, lastUpdatedOn, resourceLocation); } /** * Get the kind property: Type of operation. - * + * * @return the kind value. */ @Generated @@ -59,7 +59,7 @@ public OperationKind getKind() { /** * Get the result property: Operation result upon success. - * + * * @return the result value. */ @Generated @@ -76,11 +76,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("status", getStatus() == null ? null : getStatus().toString()); jsonWriter.writeStringField("createdDateTime", - getCreatedDateTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedDateTime())); + getCreatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedOn())); jsonWriter.writeStringField("lastUpdatedDateTime", - getLastUpdatedDateTime() == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedDateTime())); + getLastUpdatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedOn())); jsonWriter.writeStringField("resourceLocation", getResourceLocation()); jsonWriter.writeNumberField("percentCompleted", getPercentCompleted()); jsonWriter.writeStringField("apiVersion", getApiVersion()); @@ -93,7 +91,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentModelComposeOperationDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentModelComposeOperationDetails if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. @@ -104,29 +102,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { public static DocumentModelComposeOperationDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String operationId = null; - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; String resourceLocation = null; Integer percentCompleted = null; String apiVersion = null; Map tags = null; - Error error = null; + DocumentIntelligenceError error = null; OperationKind kind = OperationKind.DOCUMENT_MODEL_COMPOSE; DocumentModelDetails result = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("operationId".equals(fieldName)) { operationId = reader.getString(); } else if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("resourceLocation".equals(fieldName)) { resourceLocation = reader.getString(); @@ -137,7 +134,7 @@ public static DocumentModelComposeOperationDetails fromJson(JsonReader jsonReade } else if ("tags".equals(fieldName)) { tags = reader.readMap(reader1 -> reader1.getString()); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else if ("kind".equals(fieldName)) { kind = OperationKind.fromString(reader.getString()); } else if ("result".equals(fieldName)) { @@ -147,8 +144,7 @@ public static DocumentModelComposeOperationDetails fromJson(JsonReader jsonReade } } DocumentModelComposeOperationDetails deserializedDocumentModelComposeOperationDetails - = new DocumentModelComposeOperationDetails(status, createdDateTime, lastUpdatedDateTime, - resourceLocation); + = new DocumentModelComposeOperationDetails(status, createdOn, lastUpdatedOn, resourceLocation); deserializedDocumentModelComposeOperationDetails.setOperationId(operationId); deserializedDocumentModelComposeOperationDetails.setPercentCompleted(percentCompleted); deserializedDocumentModelComposeOperationDetails.setApiVersion(apiVersion); @@ -156,7 +152,6 @@ public static DocumentModelComposeOperationDetails fromJson(JsonReader jsonReade deserializedDocumentModelComposeOperationDetails.setError(error); deserializedDocumentModelComposeOperationDetails.kind = kind; deserializedDocumentModelComposeOperationDetails.result = result; - return deserializedDocumentModelComposeOperationDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelCopyToOperationDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelCopyToOperationDetails.java index 79eb1cb5d239..60178faa97fa 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelCopyToOperationDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelCopyToOperationDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,7 +18,8 @@ * Get Operation response object. */ @Immutable -public final class DocumentModelCopyToOperationDetails extends OperationDetails { +public final class DocumentModelCopyToOperationDetails extends DocumentIntelligenceOperationDetails { + /* * Type of operation. */ @@ -34,21 +34,21 @@ public final class DocumentModelCopyToOperationDetails extends OperationDetails /** * Creates an instance of DocumentModelCopyToOperationDetails class. - * + * * @param status the status value to set. - * @param createdDateTime the createdDateTime value to set. - * @param lastUpdatedDateTime the lastUpdatedDateTime value to set. + * @param createdOn the createdOn value to set. + * @param lastUpdatedOn the lastUpdatedOn value to set. * @param resourceLocation the resourceLocation value to set. */ @Generated - private DocumentModelCopyToOperationDetails(OperationStatus status, OffsetDateTime createdDateTime, - OffsetDateTime lastUpdatedDateTime, String resourceLocation) { - super(status, createdDateTime, lastUpdatedDateTime, resourceLocation); + private DocumentModelCopyToOperationDetails(DocumentIntelligenceOperationStatus status, OffsetDateTime createdOn, + OffsetDateTime lastUpdatedOn, String resourceLocation) { + super(status, createdOn, lastUpdatedOn, resourceLocation); } /** * Get the kind property: Type of operation. - * + * * @return the kind value. */ @Generated @@ -59,7 +59,7 @@ public OperationKind getKind() { /** * Get the result property: Operation result upon success. - * + * * @return the result value. */ @Generated @@ -76,11 +76,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("status", getStatus() == null ? null : getStatus().toString()); jsonWriter.writeStringField("createdDateTime", - getCreatedDateTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedDateTime())); + getCreatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getCreatedOn())); jsonWriter.writeStringField("lastUpdatedDateTime", - getLastUpdatedDateTime() == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedDateTime())); + getLastUpdatedOn() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getLastUpdatedOn())); jsonWriter.writeStringField("resourceLocation", getResourceLocation()); jsonWriter.writeNumberField("percentCompleted", getPercentCompleted()); jsonWriter.writeStringField("apiVersion", getApiVersion()); @@ -93,7 +91,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentModelCopyToOperationDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentModelCopyToOperationDetails if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. @@ -104,29 +102,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { public static DocumentModelCopyToOperationDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String operationId = null; - OperationStatus status = null; - OffsetDateTime createdDateTime = null; - OffsetDateTime lastUpdatedDateTime = null; + DocumentIntelligenceOperationStatus status = null; + OffsetDateTime createdOn = null; + OffsetDateTime lastUpdatedOn = null; String resourceLocation = null; Integer percentCompleted = null; String apiVersion = null; Map tags = null; - Error error = null; + DocumentIntelligenceError error = null; OperationKind kind = OperationKind.DOCUMENT_MODEL_COPY_TO; DocumentModelDetails result = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("operationId".equals(fieldName)) { operationId = reader.getString(); } else if ("status".equals(fieldName)) { - status = OperationStatus.fromString(reader.getString()); + status = DocumentIntelligenceOperationStatus.fromString(reader.getString()); } else if ("createdDateTime".equals(fieldName)) { - createdDateTime = reader + createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdatedDateTime".equals(fieldName)) { - lastUpdatedDateTime = reader + lastUpdatedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("resourceLocation".equals(fieldName)) { resourceLocation = reader.getString(); @@ -137,7 +134,7 @@ public static DocumentModelCopyToOperationDetails fromJson(JsonReader jsonReader } else if ("tags".equals(fieldName)) { tags = reader.readMap(reader1 -> reader1.getString()); } else if ("error".equals(fieldName)) { - error = Error.fromJson(reader); + error = DocumentIntelligenceError.fromJson(reader); } else if ("kind".equals(fieldName)) { kind = OperationKind.fromString(reader.getString()); } else if ("result".equals(fieldName)) { @@ -147,8 +144,7 @@ public static DocumentModelCopyToOperationDetails fromJson(JsonReader jsonReader } } DocumentModelCopyToOperationDetails deserializedDocumentModelCopyToOperationDetails - = new DocumentModelCopyToOperationDetails(status, createdDateTime, lastUpdatedDateTime, - resourceLocation); + = new DocumentModelCopyToOperationDetails(status, createdOn, lastUpdatedOn, resourceLocation); deserializedDocumentModelCopyToOperationDetails.setOperationId(operationId); deserializedDocumentModelCopyToOperationDetails.setPercentCompleted(percentCompleted); deserializedDocumentModelCopyToOperationDetails.setApiVersion(apiVersion); @@ -156,7 +152,6 @@ public static DocumentModelCopyToOperationDetails fromJson(JsonReader jsonReader deserializedDocumentModelCopyToOperationDetails.setError(error); deserializedDocumentModelCopyToOperationDetails.kind = kind; deserializedDocumentModelCopyToOperationDetails.result = result; - return deserializedDocumentModelCopyToOperationDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelDetails.java index 2b798bc5db40..8b7a1f099819 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelDetails.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentModelDetails.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -21,6 +20,7 @@ */ @Immutable public final class DocumentModelDetails implements JsonSerializable { + /* * Unique document model name. */ @@ -37,13 +37,19 @@ public final class DocumentModelDetails implements JsonSerializable docTypes; + private Map documentTypes; /* * List of warnings encountered while building the model. */ @Generated - private List warnings; + private List warnings; /* * Number of V100-equivalent GPU hours consumed for model training. @@ -116,7 +122,7 @@ private DocumentModelDetails() { /** * Get the modelId property: Unique document model name. - * + * * @return the modelId value. */ @Generated @@ -126,7 +132,7 @@ public String getModelId() { /** * Get the description property: Document model description. - * + * * @return the description value. */ @Generated @@ -135,28 +141,38 @@ public String getDescription() { } /** - * Get the createdDateTime property: Date and time (UTC) when the document model was created. - * - * @return the createdDateTime value. + * Get the createdOn property: Date and time (UTC) when the document model was created. + * + * @return the createdOn value. + */ + @Generated + public OffsetDateTime getCreatedOn() { + return this.createdOn; + } + + /** + * Get the expiresOn property: Date and time (UTC) when the document model will expire. + * + * @return the expiresOn value. */ @Generated - public OffsetDateTime getCreatedDateTime() { - return this.createdDateTime; + public OffsetDateTime getExpiresOn() { + return this.expiresOn; } /** - * Get the expirationDateTime property: Date and time (UTC) when the document model will expire. - * - * @return the expirationDateTime value. + * Get the modifiedOn property: Date and time (UTC) when the document model was last modified. + * + * @return the modifiedOn value. */ @Generated - public OffsetDateTime getExpirationDateTime() { - return this.expirationDateTime; + public OffsetDateTime getModifiedOn() { + return this.modifiedOn; } /** * Get the apiVersion property: API version used to create this document model. - * + * * @return the apiVersion value. */ @Generated @@ -166,7 +182,7 @@ public String getApiVersion() { /** * Get the tags property: List of key-value tag attributes associated with the document model. - * + * * @return the tags value. */ @Generated @@ -176,7 +192,7 @@ public Map getTags() { /** * Get the buildMode property: Custom document model build mode. - * + * * @return the buildMode value. */ @Generated @@ -187,7 +203,7 @@ public DocumentBuildMode getBuildMode() { /** * Get the azureBlobSource property: Azure Blob Storage location containing the training data. Either * azureBlobSource or azureBlobFileListSource must be specified. - * + * * @return the azureBlobSource value. */ @Generated @@ -198,7 +214,7 @@ public AzureBlobContentSource getAzureBlobSource() { /** * Get the azureBlobFileListSource property: Azure Blob Storage file list specifying the training data. Either * azureBlobSource or azureBlobFileListSource must be specified. - * + * * @return the azureBlobFileListSource value. */ @Generated @@ -208,7 +224,7 @@ public AzureBlobFileListContentSource getAzureBlobFileListSource() { /** * Get the classifierId property: For composed models, the custom classifier to split and classify the input file. - * + * * @return the classifierId value. */ @Generated @@ -218,7 +234,7 @@ public String getClassifierId() { /** * Get the split property: For composed models, the file splitting behavior. - * + * * @return the split value. */ @Generated @@ -227,28 +243,28 @@ public SplitMode getSplit() { } /** - * Get the docTypes property: Supported document types. - * - * @return the docTypes value. + * Get the documentTypes property: Supported document types. + * + * @return the documentTypes value. */ @Generated - public Map getDocTypes() { - return this.docTypes; + public Map getDocumentTypes() { + return this.documentTypes; } /** * Get the warnings property: List of warnings encountered while building the model. - * + * * @return the warnings value. */ @Generated - public List getWarnings() { + public List getWarnings() { return this.warnings; } /** * Get the trainingHours property: Number of V100-equivalent GPU hours consumed for model training. - * + * * @return the trainingHours value. */ @Generated @@ -272,7 +288,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentModelDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentModelDetails if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. @@ -286,16 +302,18 @@ public static DocumentModelDetails fromJson(JsonReader jsonReader) throws IOExce while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("modelId".equals(fieldName)) { deserializedDocumentModelDetails.modelId = reader.getString(); } else if ("createdDateTime".equals(fieldName)) { - deserializedDocumentModelDetails.createdDateTime = reader + deserializedDocumentModelDetails.createdOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("description".equals(fieldName)) { deserializedDocumentModelDetails.description = reader.getString(); } else if ("expirationDateTime".equals(fieldName)) { - deserializedDocumentModelDetails.expirationDateTime = reader + deserializedDocumentModelDetails.expiresOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("modifiedDateTime".equals(fieldName)) { + deserializedDocumentModelDetails.modifiedOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("apiVersion".equals(fieldName)) { deserializedDocumentModelDetails.apiVersion = reader.getString(); @@ -314,11 +332,12 @@ public static DocumentModelDetails fromJson(JsonReader jsonReader) throws IOExce } else if ("split".equals(fieldName)) { deserializedDocumentModelDetails.split = SplitMode.fromString(reader.getString()); } else if ("docTypes".equals(fieldName)) { - Map docTypes + Map documentTypes = reader.readMap(reader1 -> DocumentTypeDetails.fromJson(reader1)); - deserializedDocumentModelDetails.docTypes = docTypes; + deserializedDocumentModelDetails.documentTypes = documentTypes; } else if ("warnings".equals(fieldName)) { - List warnings = reader.readArray(reader1 -> Warning.fromJson(reader1)); + List warnings + = reader.readArray(reader1 -> DocumentIntelligenceWarning.fromJson(reader1)); deserializedDocumentModelDetails.warnings = warnings; } else if ("trainingHours".equals(fieldName)) { deserializedDocumentModelDetails.trainingHours = reader.getNullable(JsonReader::getDouble); @@ -326,7 +345,6 @@ public static DocumentModelDetails fromJson(JsonReader jsonReader) throws IOExce reader.skipChildren(); } } - return deserializedDocumentModelDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentPage.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentPage.java index b7449a25d811..d5ab827b61d2 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentPage.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentPage.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentPage implements JsonSerializable { + /* * 1-based page number in the input document. */ @@ -89,7 +89,7 @@ public final class DocumentPage implements JsonSerializable { /** * Creates an instance of DocumentPage class. - * + * * @param pageNumber the pageNumber value to set. * @param spans the spans value to set. */ @@ -101,7 +101,7 @@ private DocumentPage(int pageNumber, List spans) { /** * Get the pageNumber property: 1-based page number in the input document. - * + * * @return the pageNumber value. */ @Generated @@ -112,7 +112,7 @@ public int getPageNumber() { /** * Get the angle property: The general orientation of the content in clockwise direction, measured in * degrees between (-180, 180]. - * + * * @return the angle value. */ @Generated @@ -122,7 +122,7 @@ public Double getAngle() { /** * Get the width property: The width of the image/PDF in pixels/inches, respectively. - * + * * @return the width value. */ @Generated @@ -132,7 +132,7 @@ public Double getWidth() { /** * Get the height property: The height of the image/PDF in pixels/inches, respectively. - * + * * @return the height value. */ @Generated @@ -143,7 +143,7 @@ public Double getHeight() { /** * Get the unit property: The unit used by the width, height, and polygon properties. For images, the * unit is "pixel". For PDF, the unit is "inch". - * + * * @return the unit value. */ @Generated @@ -153,7 +153,7 @@ public LengthUnit getUnit() { /** * Get the spans property: Location of the page in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -163,7 +163,7 @@ public List getSpans() { /** * Get the words property: Extracted words from the page. - * + * * @return the words value. */ @Generated @@ -173,7 +173,7 @@ public List getWords() { /** * Get the selectionMarks property: Extracted selection marks from the page. - * + * * @return the selectionMarks value. */ @Generated @@ -184,7 +184,7 @@ public List getSelectionMarks() { /** * Get the lines property: Extracted lines from the page, potentially containing both textual and visual * elements. - * + * * @return the lines value. */ @Generated @@ -194,7 +194,7 @@ public List getLines() { /** * Get the barcodes property: Extracted barcodes from the page. - * + * * @return the barcodes value. */ @Generated @@ -204,7 +204,7 @@ public List getBarcodes() { /** * Get the formulas property: Extracted formulas from the page. - * + * * @return the formulas value. */ @Generated @@ -236,7 +236,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentPage from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentPage if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -260,7 +260,6 @@ public static DocumentPage fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("pageNumber".equals(fieldName)) { pageNumber = reader.getInt(); } else if ("spans".equals(fieldName)) { @@ -297,7 +296,6 @@ public static DocumentPage fromJson(JsonReader jsonReader) throws IOException { deserializedDocumentPage.lines = lines; deserializedDocumentPage.barcodes = barcodes; deserializedDocumentPage.formulas = formulas; - return deserializedDocumentPage; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentParagraph.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentParagraph.java index c51cf67133c0..c7b5b3733835 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentParagraph.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentParagraph.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,6 +18,7 @@ */ @Immutable public final class DocumentParagraph implements JsonSerializable { + /* * Semantic role of the paragraph. */ @@ -45,7 +45,7 @@ public final class DocumentParagraph implements JsonSerializable spans) { /** * Get the role property: Semantic role of the paragraph. - * + * * @return the role value. */ @Generated @@ -67,7 +67,7 @@ public ParagraphRole getRole() { /** * Get the content property: Concatenated content of the paragraph in reading order. - * + * * @return the content value. */ @Generated @@ -77,7 +77,7 @@ public String getContent() { /** * Get the boundingRegions property: Bounding regions covering the paragraph. - * + * * @return the boundingRegions value. */ @Generated @@ -87,7 +87,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the paragraph in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -112,7 +112,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentParagraph from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentParagraph if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -129,7 +129,6 @@ public static DocumentParagraph fromJson(JsonReader jsonReader) throws IOExcepti while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("content".equals(fieldName)) { content = reader.getString(); } else if ("spans".equals(fieldName)) { @@ -145,7 +144,6 @@ public static DocumentParagraph fromJson(JsonReader jsonReader) throws IOExcepti DocumentParagraph deserializedDocumentParagraph = new DocumentParagraph(content, spans); deserializedDocumentParagraph.role = role; deserializedDocumentParagraph.boundingRegions = boundingRegions; - return deserializedDocumentParagraph; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSection.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSection.java index 957c0888ad0a..5dbd82ab6300 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSection.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSection.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentSection implements JsonSerializable { + /* * Location of the section in the reading order concatenated content. */ @@ -32,7 +32,7 @@ public final class DocumentSection implements JsonSerializable /** * Creates an instance of DocumentSection class. - * + * * @param spans the spans value to set. */ @Generated @@ -42,7 +42,7 @@ private DocumentSection(List spans) { /** * Get the spans property: Location of the section in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -52,7 +52,7 @@ public List getSpans() { /** * Get the elements property: Child elements of the section. - * + * * @return the elements value. */ @Generated @@ -74,7 +74,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentSection from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentSection if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -89,7 +89,6 @@ public static DocumentSection fromJson(JsonReader jsonReader) throws IOException while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("spans".equals(fieldName)) { spans = reader.readArray(reader1 -> DocumentSpan.fromJson(reader1)); } else if ("elements".equals(fieldName)) { @@ -100,7 +99,6 @@ public static DocumentSection fromJson(JsonReader jsonReader) throws IOException } DocumentSection deserializedDocumentSection = new DocumentSection(spans); deserializedDocumentSection.elements = elements; - return deserializedDocumentSection; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMark.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMark.java index 44f66831497f..6741aa6305de 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMark.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMark.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -19,6 +18,7 @@ */ @Immutable public final class DocumentSelectionMark implements JsonSerializable { + /* * State of the selection mark. */ @@ -48,7 +48,7 @@ public final class DocumentSelectionMark implements JsonSerializable getPolygon() { /** * Get the span property: Location of the selection mark in the reading order concatenated content. - * + * * @return the span value. */ @Generated @@ -95,7 +95,7 @@ public DocumentSpan getSpan() { /** * Get the confidence property: Confidence of correctly extracting the selection mark. - * + * * @return the confidence value. */ @Generated @@ -119,7 +119,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentSelectionMark from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentSelectionMark if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. @@ -136,7 +136,6 @@ public static DocumentSelectionMark fromJson(JsonReader jsonReader) throws IOExc while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("state".equals(fieldName)) { state = DocumentSelectionMarkState.fromString(reader.getString()); } else if ("span".equals(fieldName)) { @@ -152,7 +151,6 @@ public static DocumentSelectionMark fromJson(JsonReader jsonReader) throws IOExc DocumentSelectionMark deserializedDocumentSelectionMark = new DocumentSelectionMark(state, span, confidence); deserializedDocumentSelectionMark.polygon = polygon; - return deserializedDocumentSelectionMark; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMarkState.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMarkState.java index 9785af8119ac..2c5e53fa36fe 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMarkState.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentSelectionMarkState.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * State of the selection mark. */ public final class DocumentSelectionMarkState extends ExpandableStringEnum { + /** * The selection mark is selected, often indicated by a check ✓ or cross X inside * the selection mark. @@ -27,7 +27,7 @@ public final class DocumentSelectionMarkState extends ExpandableStringEnum { + /** * A signature is detected. */ @@ -26,7 +26,7 @@ public final class DocumentSignatureType extends ExpandableStringEnum { + /* * Zero-based index of the content represented by the span. */ @@ -32,7 +32,7 @@ public final class DocumentSpan implements JsonSerializable { /** * Creates an instance of DocumentSpan class. - * + * * @param offset the offset value to set. * @param length the length value to set. */ @@ -44,7 +44,7 @@ private DocumentSpan(int offset, int length) { /** * Get the offset property: Zero-based index of the content represented by the span. - * + * * @return the offset value. */ @Generated @@ -54,7 +54,7 @@ public int getOffset() { /** * Get the length property: Number of characters in the content represented by the span. - * + * * @return the length value. */ @Generated @@ -76,7 +76,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentSpan from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentSpan if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -91,7 +91,6 @@ public static DocumentSpan fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("offset".equals(fieldName)) { offset = reader.getInt(); } else if ("length".equals(fieldName)) { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentStyle.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentStyle.java index d5e8449a5208..5520fd44976d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentStyle.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentStyle.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentStyle implements JsonSerializable { + /* * Is content handwritten? */ @@ -35,13 +35,13 @@ public final class DocumentStyle implements JsonSerializable { * Font style. */ @Generated - private FontStyle fontStyle; + private DocumentFontStyle fontStyle; /* * Font weight. */ @Generated - private FontWeight fontWeight; + private DocumentFontWeight fontWeight; /* * Foreground color in #rrggbb hexadecimal format. @@ -69,7 +69,7 @@ public final class DocumentStyle implements JsonSerializable { /** * Creates an instance of DocumentStyle class. - * + * * @param spans the spans value to set. * @param confidence the confidence value to set. */ @@ -81,7 +81,7 @@ private DocumentStyle(List spans, double confidence) { /** * Get the isHandwritten property: Is content handwritten?. - * + * * @return the isHandwritten value. */ @Generated @@ -93,7 +93,7 @@ public Boolean isHandwritten() { * Get the similarFontFamily property: Visually most similar font from among the set of supported font families, * with * fallback fonts following CSS convention (ex. 'Arial, sans-serif'). - * + * * @return the similarFontFamily value. */ @Generated @@ -103,27 +103,27 @@ public String getSimilarFontFamily() { /** * Get the fontStyle property: Font style. - * + * * @return the fontStyle value. */ @Generated - public FontStyle getFontStyle() { + public DocumentFontStyle getFontStyle() { return this.fontStyle; } /** * Get the fontWeight property: Font weight. - * + * * @return the fontWeight value. */ @Generated - public FontWeight getFontWeight() { + public DocumentFontWeight getFontWeight() { return this.fontWeight; } /** * Get the color property: Foreground color in #rrggbb hexadecimal format. - * + * * @return the color value. */ @Generated @@ -133,7 +133,7 @@ public String getColor() { /** * Get the backgroundColor property: Background color in #rrggbb hexadecimal format.. - * + * * @return the backgroundColor value. */ @Generated @@ -143,7 +143,7 @@ public String getBackgroundColor() { /** * Get the spans property: Location of the text elements in the concatenated content the style applies to. - * + * * @return the spans value. */ @Generated @@ -153,7 +153,7 @@ public List getSpans() { /** * Get the confidence property: Confidence of correctly identifying the style. - * + * * @return the confidence value. */ @Generated @@ -181,7 +181,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentStyle from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentStyle if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -195,14 +195,13 @@ public static DocumentStyle fromJson(JsonReader jsonReader) throws IOException { double confidence = 0.0; Boolean isHandwritten = null; String similarFontFamily = null; - FontStyle fontStyle = null; - FontWeight fontWeight = null; + DocumentFontStyle fontStyle = null; + DocumentFontWeight fontWeight = null; String color = null; String backgroundColor = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("spans".equals(fieldName)) { spans = reader.readArray(reader1 -> DocumentSpan.fromJson(reader1)); } else if ("confidence".equals(fieldName)) { @@ -212,9 +211,9 @@ public static DocumentStyle fromJson(JsonReader jsonReader) throws IOException { } else if ("similarFontFamily".equals(fieldName)) { similarFontFamily = reader.getString(); } else if ("fontStyle".equals(fieldName)) { - fontStyle = FontStyle.fromString(reader.getString()); + fontStyle = DocumentFontStyle.fromString(reader.getString()); } else if ("fontWeight".equals(fieldName)) { - fontWeight = FontWeight.fromString(reader.getString()); + fontWeight = DocumentFontWeight.fromString(reader.getString()); } else if ("color".equals(fieldName)) { color = reader.getString(); } else if ("backgroundColor".equals(fieldName)) { @@ -230,7 +229,6 @@ public static DocumentStyle fromJson(JsonReader jsonReader) throws IOException { deserializedDocumentStyle.fontWeight = fontWeight; deserializedDocumentStyle.color = color; deserializedDocumentStyle.backgroundColor = backgroundColor; - return deserializedDocumentStyle; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTable.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTable.java index 983119c0b8be..52ceea4ccd98 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTable.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTable.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentTable implements JsonSerializable { + /* * Number of rows in the table. */ @@ -62,7 +62,7 @@ public final class DocumentTable implements JsonSerializable { /** * Creates an instance of DocumentTable class. - * + * * @param rowCount the rowCount value to set. * @param columnCount the columnCount value to set. * @param cells the cells value to set. @@ -78,7 +78,7 @@ private DocumentTable(int rowCount, int columnCount, List cel /** * Get the rowCount property: Number of rows in the table. - * + * * @return the rowCount value. */ @Generated @@ -88,7 +88,7 @@ public int getRowCount() { /** * Get the columnCount property: Number of columns in the table. - * + * * @return the columnCount value. */ @Generated @@ -98,7 +98,7 @@ public int getColumnCount() { /** * Get the cells property: Cells contained within the table. - * + * * @return the cells value. */ @Generated @@ -108,7 +108,7 @@ public List getCells() { /** * Get the boundingRegions property: Bounding regions covering the table. - * + * * @return the boundingRegions value. */ @Generated @@ -118,7 +118,7 @@ public List getBoundingRegions() { /** * Get the spans property: Location of the table in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -128,7 +128,7 @@ public List getSpans() { /** * Get the caption property: Caption associated with the table. - * + * * @return the caption value. */ @Generated @@ -138,7 +138,7 @@ public DocumentCaption getCaption() { /** * Get the footnotes property: List of footnotes associated with the table. - * + * * @return the footnotes value. */ @Generated @@ -166,7 +166,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentTable from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentTable if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -186,7 +186,6 @@ public static DocumentTable fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("rowCount".equals(fieldName)) { rowCount = reader.getInt(); } else if ("columnCount".equals(fieldName)) { @@ -209,7 +208,6 @@ public static DocumentTable fromJson(JsonReader jsonReader) throws IOException { deserializedDocumentTable.boundingRegions = boundingRegions; deserializedDocumentTable.caption = caption; deserializedDocumentTable.footnotes = footnotes; - return deserializedDocumentTable; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCell.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCell.java index 63e424baf5e9..92508f11a121 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCell.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCell.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -18,6 +17,7 @@ */ @Immutable public final class DocumentTableCell implements JsonSerializable { + /* * Table cell kind. */ @@ -74,7 +74,7 @@ public final class DocumentTableCell implements JsonSerializable getBoundingRegions() { /** * Get the spans property: Location of the table cell in the reading order concatenated content. - * + * * @return the spans value. */ @Generated @@ -170,7 +170,7 @@ public List getSpans() { /** * Get the elements property: Child elements of the table cell. - * + * * @return the elements value. */ @Generated @@ -200,7 +200,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentTableCell from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentTableCell if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -222,7 +222,6 @@ public static DocumentTableCell fromJson(JsonReader jsonReader) throws IOExcepti while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("rowIndex".equals(fieldName)) { rowIndex = reader.getInt(); } else if ("columnIndex".equals(fieldName)) { @@ -252,7 +251,6 @@ public static DocumentTableCell fromJson(JsonReader jsonReader) throws IOExcepti deserializedDocumentTableCell.columnSpan = columnSpan; deserializedDocumentTableCell.boundingRegions = boundingRegions; deserializedDocumentTableCell.elements = elements; - return deserializedDocumentTableCell; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCellKind.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCellKind.java index 2657e27bcbb4..4deeed3b5294 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCellKind.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentTableCellKind.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Table cell kind. */ public final class DocumentTableCellKind extends ExpandableStringEnum { + /** * Contains the main content/data. */ @@ -44,7 +44,7 @@ public final class DocumentTableCellKind extends ExpandableStringEnum { + /* * Document model description. */ @@ -82,7 +82,7 @@ public DocumentTypeDetails() { /** * Get the description property: Document model description. - * + * * @return the description value. */ @Generated @@ -92,7 +92,7 @@ public String getDescription() { /** * Set the description property: Document model description. - * + * * @param description the description value to set. * @return the DocumentTypeDetails object itself. */ @@ -104,7 +104,7 @@ public DocumentTypeDetails setDescription(String description) { /** * Get the buildMode property: Custom document model build mode. - * + * * @return the buildMode value. */ @Generated @@ -114,7 +114,7 @@ public DocumentBuildMode getBuildMode() { /** * Set the buildMode property: Custom document model build mode. - * + * * @param buildMode the buildMode value to set. * @return the DocumentTypeDetails object itself. */ @@ -126,7 +126,7 @@ public DocumentTypeDetails setBuildMode(DocumentBuildMode buildMode) { /** * Get the fieldSchema property: Description of the document semantic schema using a JSON Schema style syntax. - * + * * @return the fieldSchema value. */ @Generated @@ -136,7 +136,7 @@ public Map getFieldSchema() { /** * Set the fieldSchema property: Description of the document semantic schema using a JSON Schema style syntax. - * + * * @param fieldSchema the fieldSchema value to set. * @return the DocumentTypeDetails object itself. */ @@ -148,7 +148,7 @@ public DocumentTypeDetails setFieldSchema(Map field /** * Get the fieldConfidence property: Estimated confidence for each field. - * + * * @return the fieldConfidence value. */ @Generated @@ -158,7 +158,7 @@ public Map getFieldConfidence() { /** * Set the fieldConfidence property: Estimated confidence for each field. - * + * * @param fieldConfidence the fieldConfidence value to set. * @return the DocumentTypeDetails object itself. */ @@ -170,7 +170,7 @@ public DocumentTypeDetails setFieldConfidence(Map fieldConfidenc /** * Get the modelId property: Document model to use for analyzing documents with specified type. - * + * * @return the modelId value. */ @Generated @@ -180,7 +180,7 @@ public String getModelId() { /** * Set the modelId property: Document model to use for analyzing documents with specified type. - * + * * @param modelId the modelId value to set. * @return the DocumentTypeDetails object itself. */ @@ -192,7 +192,7 @@ public DocumentTypeDetails setModelId(String modelId) { /** * Get the confidenceThreshold property: Only perform analysis if docType confidence is above threshold. - * + * * @return the confidenceThreshold value. */ @Generated @@ -202,7 +202,7 @@ public Double getConfidenceThreshold() { /** * Set the confidenceThreshold property: Only perform analysis if docType confidence is above threshold. - * + * * @param confidenceThreshold the confidenceThreshold value to set. * @return the DocumentTypeDetails object itself. */ @@ -214,7 +214,7 @@ public DocumentTypeDetails setConfidenceThreshold(Double confidenceThreshold) { /** * Get the features property: List of optional analysis features. - * + * * @return the features value. */ @Generated @@ -224,7 +224,7 @@ public List getFeatures() { /** * Set the features property: List of optional analysis features. - * + * * @param features the features value to set. * @return the DocumentTypeDetails object itself. */ @@ -236,7 +236,7 @@ public DocumentTypeDetails setFeatures(List features) { /** * Get the queryFields property: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". - * + * * @return the queryFields value. */ @Generated @@ -246,7 +246,7 @@ public List getQueryFields() { /** * Set the queryFields property: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". - * + * * @param queryFields the queryFields value to set. * @return the DocumentTypeDetails object itself. */ @@ -258,7 +258,7 @@ public DocumentTypeDetails setQueryFields(List queryFields) { /** * Get the maxDocumentsToAnalyze property: Maximum number of documents of specified type to analyze. Default=all. - * + * * @return the maxDocumentsToAnalyze value. */ @Generated @@ -268,7 +268,7 @@ public Integer getMaxDocumentsToAnalyze() { /** * Set the maxDocumentsToAnalyze property: Maximum number of documents of specified type to analyze. Default=all. - * + * * @param maxDocumentsToAnalyze the maxDocumentsToAnalyze value to set. * @return the DocumentTypeDetails object itself. */ @@ -301,7 +301,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentTypeDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentTypeDetails if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -314,7 +314,6 @@ public static DocumentTypeDetails fromJson(JsonReader jsonReader) throws IOExcep while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("description".equals(fieldName)) { deserializedDocumentTypeDetails.description = reader.getString(); } else if ("buildMode".equals(fieldName)) { @@ -343,7 +342,6 @@ public static DocumentTypeDetails fromJson(JsonReader jsonReader) throws IOExcep reader.skipChildren(); } } - return deserializedDocumentTypeDetails; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentWord.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentWord.java index 9c0b6afaada4..dc8a79727000 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentWord.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/DocumentWord.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -20,6 +19,7 @@ */ @Immutable public final class DocumentWord implements JsonSerializable { + /* * Text content of the word. */ @@ -49,7 +49,7 @@ public final class DocumentWord implements JsonSerializable { /** * Creates an instance of DocumentWord class. - * + * * @param content the content value to set. * @param span the span value to set. * @param confidence the confidence value to set. @@ -63,7 +63,7 @@ private DocumentWord(String content, DocumentSpan span, double confidence) { /** * Get the content property: Text content of the word. - * + * * @return the content value. */ @Generated @@ -76,7 +76,7 @@ public String getContent() { * top-left of the page. The numbers represent the x, y values of the polygon * vertices, clockwise from the left (-180 degrees inclusive) relative to the * element orientation. - * + * * @return the polygon value. */ @Generated @@ -86,7 +86,7 @@ public List getPolygon() { /** * Get the span property: Location of the word in the reading order concatenated content. - * + * * @return the span value. */ @Generated @@ -96,7 +96,7 @@ public DocumentSpan getSpan() { /** * Get the confidence property: Confidence of correctly extracting the word. - * + * * @return the confidence value. */ @Generated @@ -120,7 +120,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DocumentWord from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DocumentWord if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -137,7 +137,6 @@ public static DocumentWord fromJson(JsonReader jsonReader) throws IOException { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("content".equals(fieldName)) { content = reader.getString(); } else if ("span".equals(fieldName)) { @@ -152,7 +151,6 @@ public static DocumentWord fromJson(JsonReader jsonReader) throws IOException { } DocumentWord deserializedDocumentWord = new DocumentWord(content, span, confidence); deserializedDocumentWord.polygon = polygon; - return deserializedDocumentWord; }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/FontStyle.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/FontStyle.java deleted file mode 100644 index e31d82c6f234..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/FontStyle.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Font style. - */ -public final class FontStyle extends ExpandableStringEnum { - /** - * Characters are represented normally. - */ - @Generated - public static final FontStyle NORMAL = fromString("normal"); - - /** - * Characters are visually slanted to the right. - */ - @Generated - public static final FontStyle ITALIC = fromString("italic"); - - /** - * Creates a new instance of FontStyle value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public FontStyle() { - } - - /** - * Creates or finds a FontStyle from its string representation. - * - * @param name a name to look for. - * @return the corresponding FontStyle. - */ - @Generated - public static FontStyle fromString(String name) { - return fromString(name, FontStyle.class); - } - - /** - * Gets known FontStyle values. - * - * @return known FontStyle values. - */ - @Generated - public static Collection values() { - return values(FontStyle.class); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/FontWeight.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/FontWeight.java deleted file mode 100644 index 39b2f1e1c86a..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/FontWeight.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Font weight. - */ -public final class FontWeight extends ExpandableStringEnum { - /** - * Characters are represented normally. - */ - @Generated - public static final FontWeight NORMAL = fromString("normal"); - - /** - * Characters are represented with thicker strokes. - */ - @Generated - public static final FontWeight BOLD = fromString("bold"); - - /** - * Creates a new instance of FontWeight value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public FontWeight() { - } - - /** - * Creates or finds a FontWeight from its string representation. - * - * @param name a name to look for. - * @return the corresponding FontWeight. - */ - @Generated - public static FontWeight fromString(String name) { - return fromString(name, FontWeight.class); - } - - /** - * Gets known FontWeight values. - * - * @return known FontWeight values. - */ - @Generated - public static Collection values() { - return values(FontWeight.class); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/LengthUnit.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/LengthUnit.java index 28b1164f02a2..f86548bc7b27 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/LengthUnit.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/LengthUnit.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -13,6 +12,7 @@ * "inch". */ public final class LengthUnit extends ExpandableStringEnum { + /** * Length unit for image files. */ @@ -27,7 +27,7 @@ public final class LengthUnit extends ExpandableStringEnum { /** * Creates a new instance of LengthUnit value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @@ -37,7 +37,7 @@ public LengthUnit() { /** * Creates or finds a LengthUnit from its string representation. - * + * * @param name a name to look for. * @return the corresponding LengthUnit. */ @@ -48,7 +48,7 @@ public static LengthUnit fromString(String name) { /** * Gets known LengthUnit values. - * + * * @return known LengthUnit values. */ @Generated diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/CopyAuthorization.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ModelCopyAuthorization.java similarity index 79% rename from sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/CopyAuthorization.java rename to sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ModelCopyAuthorization.java index 420339fceb28..fbc9530a09e2 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/CopyAuthorization.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ModelCopyAuthorization.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -20,7 +19,8 @@ * modelId. */ @Immutable -public final class CopyAuthorization implements JsonSerializable { +public final class ModelCopyAuthorization implements JsonSerializable { + /* * ID of the target Azure resource where the document model should be copied to. */ @@ -56,32 +56,32 @@ public final class CopyAuthorization implements JsonSerializable { String targetResourceId = null; String targetResourceRegion = null; String targetModelId = null; String targetModelLocation = null; String accessToken = null; - OffsetDateTime expirationDateTime = null; + OffsetDateTime expiresOn = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("targetResourceId".equals(fieldName)) { targetResourceId = reader.getString(); } else if ("targetResourceRegion".equals(fieldName)) { @@ -193,14 +190,14 @@ public static CopyAuthorization fromJson(JsonReader jsonReader) throws IOExcepti } else if ("accessToken".equals(fieldName)) { accessToken = reader.getString(); } else if ("expirationDateTime".equals(fieldName)) { - expirationDateTime = reader + expiresOn = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else { reader.skipChildren(); } } - return new CopyAuthorization(targetResourceId, targetResourceRegion, targetModelId, targetModelLocation, - accessToken, expirationDateTime); + return new ModelCopyAuthorization(targetResourceId, targetResourceRegion, targetModelId, + targetModelLocation, accessToken, expiresOn); }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationKind.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationKind.java index 7da18755bdae..74ade4391790 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationKind.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationKind.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Type of operation. */ public final class OperationKind extends ExpandableStringEnum { + /** * Build a new custom document model. */ @@ -46,7 +46,7 @@ public final class OperationKind extends ExpandableStringEnum { /** * Creates a new instance of OperationKind value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @@ -56,7 +56,7 @@ public OperationKind() { /** * Creates or finds a OperationKind from its string representation. - * + * * @param name a name to look for. * @return the corresponding OperationKind. */ @@ -67,7 +67,7 @@ public static OperationKind fromString(String name) { /** * Gets known OperationKind values. - * + * * @return known OperationKind values. */ @Generated diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationStatus.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationStatus.java deleted file mode 100644 index a1a150f54d73..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/OperationStatus.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Operation status. - */ -public final class OperationStatus extends ExpandableStringEnum { - /** - * The operation has not started yet. - */ - @Generated - public static final OperationStatus NOT_STARTED = fromString("notStarted"); - - /** - * The operation is in progress. - */ - @Generated - public static final OperationStatus RUNNING = fromString("running"); - - /** - * The operation has failed. - */ - @Generated - public static final OperationStatus FAILED = fromString("failed"); - - /** - * The operation has succeeded. - */ - @Generated - public static final OperationStatus SUCCEEDED = fromString("succeeded"); - - /** - * The operation has completed. - */ - @Generated - public static final OperationStatus COMPLETED = fromString("completed"); - - /** - * The operation has been canceled. - */ - @Generated - public static final OperationStatus CANCELED = fromString("canceled"); - - /** - * Creates a new instance of OperationStatus value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public OperationStatus() { - } - - /** - * Creates or finds a OperationStatus from its string representation. - * - * @param name a name to look for. - * @return the corresponding OperationStatus. - */ - @Generated - public static OperationStatus fromString(String name) { - return fromString(name, OperationStatus.class); - } - - /** - * Gets known OperationStatus values. - * - * @return known OperationStatus values. - */ - @Generated - public static Collection values() { - return values(OperationStatus.class); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ParagraphRole.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ParagraphRole.java index e996d59dd685..71263e23b10f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ParagraphRole.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/ParagraphRole.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Semantic role of the paragraph. */ public final class ParagraphRole extends ExpandableStringEnum { + /** * Text near the top edge of the page. */ @@ -56,7 +56,7 @@ public final class ParagraphRole extends ExpandableStringEnum { /** * Creates a new instance of ParagraphRole value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @@ -66,7 +66,7 @@ public ParagraphRole() { /** * Creates or finds a ParagraphRole from its string representation. - * + * * @param name a name to look for. * @return the corresponding ParagraphRole. */ @@ -77,7 +77,7 @@ public static ParagraphRole fromString(String name) { /** * Gets known ParagraphRole values. - * + * * @return known ParagraphRole values. */ @Generated diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/QuotaDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/QuotaDetails.java deleted file mode 100644 index 79fc9c613d15..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/QuotaDetails.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.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; - -/** - * Quota used, limit, and next reset date/time. - */ -@Immutable -public final class QuotaDetails implements JsonSerializable { - /* - * Amount of the resource quota used. - */ - @Generated - private final int used; - - /* - * Resource quota limit. - */ - @Generated - private final int quota; - - /* - * Date/time when the resource quota usage will be reset. - */ - @Generated - private final OffsetDateTime quotaResetDateTime; - - /** - * Creates an instance of QuotaDetails class. - * - * @param used the used value to set. - * @param quota the quota value to set. - * @param quotaResetDateTime the quotaResetDateTime value to set. - */ - @Generated - private QuotaDetails(int used, int quota, OffsetDateTime quotaResetDateTime) { - this.used = used; - this.quota = quota; - this.quotaResetDateTime = quotaResetDateTime; - } - - /** - * Get the used property: Amount of the resource quota used. - * - * @return the used value. - */ - @Generated - public int getUsed() { - return this.used; - } - - /** - * Get the quota property: Resource quota limit. - * - * @return the quota value. - */ - @Generated - public int getQuota() { - return this.quota; - } - - /** - * Get the quotaResetDateTime property: Date/time when the resource quota usage will be reset. - * - * @return the quotaResetDateTime value. - */ - @Generated - public OffsetDateTime getQuotaResetDateTime() { - return this.quotaResetDateTime; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("used", this.used); - jsonWriter.writeIntField("quota", this.quota); - jsonWriter.writeStringField("quotaResetDateTime", - this.quotaResetDateTime == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.quotaResetDateTime)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of QuotaDetails from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of QuotaDetails 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 QuotaDetails. - */ - @Generated - public static QuotaDetails fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int used = 0; - int quota = 0; - OffsetDateTime quotaResetDateTime = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("used".equals(fieldName)) { - used = reader.getInt(); - } else if ("quota".equals(fieldName)) { - quota = reader.getInt(); - } else if ("quotaResetDateTime".equals(fieldName)) { - quotaResetDateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new QuotaDetails(used, quota, quotaResetDateTime); - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/SplitMode.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/SplitMode.java index 4bd39e703fcf..d470717f91c5 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/SplitMode.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/SplitMode.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Document splitting mode. */ public final class SplitMode extends ExpandableStringEnum { + /** * Automatically split file into documents. */ @@ -32,7 +32,7 @@ public final class SplitMode extends ExpandableStringEnum { /** * Creates a new instance of SplitMode value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @@ -42,7 +42,7 @@ public SplitMode() { /** * Creates or finds a SplitMode from its string representation. - * + * * @param name a name to look for. * @return the corresponding SplitMode. */ @@ -53,7 +53,7 @@ public static SplitMode fromString(String name) { /** * Gets known SplitMode values. - * + * * @return known SplitMode values. */ @Generated diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/StringIndexType.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/StringIndexType.java index 1babb038cbde..6a2774fa9621 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/StringIndexType.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/StringIndexType.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - package com.azure.ai.documentintelligence.models; import com.azure.core.annotation.Generated; @@ -12,6 +11,7 @@ * Method used to compute string offset and length. */ public final class StringIndexType extends ExpandableStringEnum { + /** * User-perceived display character, or grapheme cluster, as defined by Unicode * 8.0.0. @@ -30,11 +30,11 @@ public final class StringIndexType extends ExpandableStringEnum * Java, and .NET. */ @Generated - public static final StringIndexType UTF16CODE_UNIT = fromString("utf16CodeUnit"); + public static final StringIndexType UTF16_CODE_UNIT = fromString("utf16CodeUnit"); /** * Creates a new instance of StringIndexType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @@ -44,7 +44,7 @@ public StringIndexType() { /** * Creates or finds a StringIndexType from its string representation. - * + * * @param name a name to look for. * @return the corresponding StringIndexType. */ @@ -55,7 +55,7 @@ public static StringIndexType fromString(String name) { /** * Gets known StringIndexType values. - * + * * @return known StringIndexType values. */ @Generated diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/package-info.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/package-info.java index 5aa2a7658d47..0307893321c2 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/package-info.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/models/package-info.java @@ -1,7 +1,6 @@ // 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 DocumentIntelligence. * Extracts content, layout, and structured data from documents. diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/package-info.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/package-info.java index ca47a74a42fb..a90abd29715a 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/package-info.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/java/com/azure/ai/documentintelligence/package-info.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - /** * Package containing the classes for DocumentIntelligence. * Extracts content, layout, and structured data from documents. diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/azure-ai-documentintelligence_apiview_properties.json b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/azure-ai-documentintelligence_apiview_properties.json index c6e56a5006f6..daca38633456 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/azure-ai-documentintelligence_apiview_properties.json +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/azure-ai-documentintelligence_apiview_properties.json @@ -26,8 +26,8 @@ "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.getModelWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getModel", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.getOperation": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getOperation", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.getOperationWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getOperation", - "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.getResourceInfo": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceInfo", - "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.getResourceInfoWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceInfo", + "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.getResourceDetails": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceDetails", + "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.getResourceDetailsWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceDetails", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.listClassifiers": "ClientCustomizations.DocumentIntelligenceAdministrationClient.listClassifiers", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.listModels": "ClientCustomizations.DocumentIntelligenceAdministrationClient.listModels", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient.listOperations": "ClientCustomizations.DocumentIntelligenceAdministrationClient.listOperations", @@ -56,8 +56,8 @@ "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.getModelWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getModel", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.getOperation": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getOperation", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.getOperationWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getOperation", - "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.getResourceInfo": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceInfo", - "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.getResourceInfoWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceInfo", + "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.getResourceDetails": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceDetails", + "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.getResourceDetailsWithResponse": "ClientCustomizations.DocumentIntelligenceAdministrationClient.getResourceDetails", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.listClassifiers": "ClientCustomizations.DocumentIntelligenceAdministrationClient.listClassifiers", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.listModels": "ClientCustomizations.DocumentIntelligenceAdministrationClient.listModels", "com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient.listOperations": "ClientCustomizations.DocumentIntelligenceAdministrationClient.listOperations", @@ -69,10 +69,17 @@ "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.beginAnalyzeDocumentWithModel": "ClientCustomizations.DocumentIntelligenceClient.analyzeDocument", "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.beginClassifyDocument": "ClientCustomizations.DocumentIntelligenceClient.classifyDocument", "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.beginClassifyDocumentWithModel": "ClientCustomizations.DocumentIntelligenceClient.classifyDocument", + "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.deleteAnalyzeBatchResult": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeBatchResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.deleteAnalyzeBatchResultWithResponse": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeBatchResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.deleteAnalyzeResult": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.deleteAnalyzeResultWithResponse": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.getAnalyzeBatchResult": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeBatchResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.getAnalyzeBatchResultWithResponse": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeBatchResult", "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.getAnalyzeResultFigure": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultFigure", "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.getAnalyzeResultFigureWithResponse": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultFigure", "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.getAnalyzeResultPdf": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultPdf", "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.getAnalyzeResultPdfWithResponse": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultPdf", + "com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient.listAnalyzeBatchResults": "ClientCustomizations.DocumentIntelligenceClient.listAnalyzeBatchResults", "com.azure.ai.documentintelligence.DocumentIntelligenceClient": "ClientCustomizations.DocumentIntelligenceClient", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.beginAnalyzeBatchDocuments": "ClientCustomizations.DocumentIntelligenceClient.analyzeBatchDocuments", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.beginAnalyzeBatchDocumentsWithModel": "ClientCustomizations.DocumentIntelligenceClient.analyzeBatchDocuments", @@ -80,37 +87,42 @@ "com.azure.ai.documentintelligence.DocumentIntelligenceClient.beginAnalyzeDocumentWithModel": "ClientCustomizations.DocumentIntelligenceClient.analyzeDocument", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.beginClassifyDocument": "ClientCustomizations.DocumentIntelligenceClient.classifyDocument", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.beginClassifyDocumentWithModel": "ClientCustomizations.DocumentIntelligenceClient.classifyDocument", + "com.azure.ai.documentintelligence.DocumentIntelligenceClient.deleteAnalyzeBatchResult": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeBatchResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceClient.deleteAnalyzeBatchResultWithResponse": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeBatchResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceClient.deleteAnalyzeResult": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceClient.deleteAnalyzeResultWithResponse": "ClientCustomizations.DocumentIntelligenceClient.deleteAnalyzeResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceClient.getAnalyzeBatchResult": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeBatchResult", + "com.azure.ai.documentintelligence.DocumentIntelligenceClient.getAnalyzeBatchResultWithResponse": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeBatchResult", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.getAnalyzeResultFigure": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultFigure", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.getAnalyzeResultFigureWithResponse": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultFigure", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.getAnalyzeResultPdf": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultPdf", "com.azure.ai.documentintelligence.DocumentIntelligenceClient.getAnalyzeResultPdfWithResponse": "ClientCustomizations.DocumentIntelligenceClient.getAnalyzeResultPdf", + "com.azure.ai.documentintelligence.DocumentIntelligenceClient.listAnalyzeBatchResults": "ClientCustomizations.DocumentIntelligenceClient.listAnalyzeBatchResults", "com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder": "ClientCustomizations.DocumentIntelligenceClient", "com.azure.ai.documentintelligence.models.AddressValue": "DocumentIntelligence.AddressValue", - "com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest": "DocumentIntelligence.AnalyzeBatchDocumentsRequest", + "com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsOptions": "DocumentIntelligence.AnalyzeBatchDocumentsRequest", + "com.azure.ai.documentintelligence.models.AnalyzeBatchOperation": "DocumentIntelligence.AnalyzeBatchOperation", "com.azure.ai.documentintelligence.models.AnalyzeBatchOperationDetail": "DocumentIntelligence.AnalyzeBatchOperationDetail", "com.azure.ai.documentintelligence.models.AnalyzeBatchResult": "DocumentIntelligence.AnalyzeBatchResult", - "com.azure.ai.documentintelligence.models.AnalyzeBatchResultOperation": "DocumentIntelligence.AnalyzeBatchResultOperation", - "com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest": "DocumentIntelligence.AnalyzeDocumentRequest", - "com.azure.ai.documentintelligence.models.AnalyzeOutputOption": "DocumentIntelligence.AnalyzeOutputOption", + "com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions": "DocumentIntelligence.AnalyzeDocumentRequest", + "com.azure.ai.documentintelligence.models.AnalyzeOperation": "DocumentIntelligence.AnalyzeOperation", + "com.azure.ai.documentintelligence.models.AnalyzeOutputFormat": "DocumentIntelligence.AnalyzeOutputOption", "com.azure.ai.documentintelligence.models.AnalyzeResult": "DocumentIntelligence.AnalyzeResult", - "com.azure.ai.documentintelligence.models.AnalyzeResultOperation": "DocumentIntelligence.AnalyzeResultOperation", - "com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest": "DocumentIntelligence.AuthorizeClassifierCopyRequest", - "com.azure.ai.documentintelligence.models.AuthorizeCopyRequest": "DocumentIntelligence.AuthorizeCopyRequest", + "com.azure.ai.documentintelligence.models.AnalyzedDocument": "DocumentIntelligence.AnalyzedDocument", + "com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyOptions": "DocumentIntelligence.AuthorizeClassifierCopyRequest", + "com.azure.ai.documentintelligence.models.AuthorizeModelCopyOptions": "DocumentIntelligence.AuthorizeCopyRequest", "com.azure.ai.documentintelligence.models.AzureBlobContentSource": "DocumentIntelligence.AzureBlobContentSource", "com.azure.ai.documentintelligence.models.AzureBlobFileListContentSource": "DocumentIntelligence.AzureBlobFileListContentSource", "com.azure.ai.documentintelligence.models.BoundingRegion": "DocumentIntelligence.BoundingRegion", - "com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest": "DocumentIntelligence.BuildDocumentClassifierRequest", - "com.azure.ai.documentintelligence.models.BuildDocumentModelRequest": "DocumentIntelligence.BuildDocumentModelRequest", + "com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions": "DocumentIntelligence.BuildDocumentClassifierRequest", + "com.azure.ai.documentintelligence.models.BuildDocumentModelOptions": "DocumentIntelligence.BuildDocumentModelRequest", "com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization": "DocumentIntelligence.ClassifierCopyAuthorization", "com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails": "DocumentIntelligence.ClassifierDocumentTypeDetails", - "com.azure.ai.documentintelligence.models.ClassifyDocumentRequest": "DocumentIntelligence.ClassifyDocumentRequest", + "com.azure.ai.documentintelligence.models.ClassifyDocumentOptions": "DocumentIntelligence.ClassifyDocumentRequest", "com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest": "DocumentIntelligence.ComposeDocumentModelRequest", - "com.azure.ai.documentintelligence.models.ContentFormat": "DocumentIntelligence.ContentFormat", "com.azure.ai.documentintelligence.models.ContentSourceKind": "DocumentIntelligence.ContentSourceKind", - "com.azure.ai.documentintelligence.models.CopyAuthorization": "DocumentIntelligence.CopyAuthorization", "com.azure.ai.documentintelligence.models.CurrencyValue": "DocumentIntelligence.CurrencyValue", "com.azure.ai.documentintelligence.models.CustomDocumentModelsDetails": "DocumentIntelligence.CustomDocumentModelsDetails", - "com.azure.ai.documentintelligence.models.Document": "DocumentIntelligence.Document", "com.azure.ai.documentintelligence.models.DocumentAnalysisFeature": "DocumentIntelligence.DocumentAnalysisFeature", "com.azure.ai.documentintelligence.models.DocumentBarcode": "DocumentIntelligence.DocumentBarcode", "com.azure.ai.documentintelligence.models.DocumentBarcodeKind": "DocumentIntelligence.DocumentBarcodeKind", @@ -119,13 +131,22 @@ "com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails": "DocumentIntelligence.DocumentClassifierBuildOperationDetails", "com.azure.ai.documentintelligence.models.DocumentClassifierCopyToOperationDetails": "DocumentIntelligence.DocumentClassifierCopyToOperationDetails", "com.azure.ai.documentintelligence.models.DocumentClassifierDetails": "DocumentIntelligence.DocumentClassifierDetails", + "com.azure.ai.documentintelligence.models.DocumentContentFormat": "DocumentIntelligence.DocumentContentFormat", "com.azure.ai.documentintelligence.models.DocumentField": "DocumentIntelligence.DocumentField", "com.azure.ai.documentintelligence.models.DocumentFieldSchema": "DocumentIntelligence.DocumentFieldSchema", "com.azure.ai.documentintelligence.models.DocumentFieldType": "DocumentIntelligence.DocumentFieldType", "com.azure.ai.documentintelligence.models.DocumentFigure": "DocumentIntelligence.DocumentFigure", + "com.azure.ai.documentintelligence.models.DocumentFontStyle": "DocumentIntelligence.DocumentFontStyle", + "com.azure.ai.documentintelligence.models.DocumentFontWeight": "DocumentIntelligence.DocumentFontWeight", "com.azure.ai.documentintelligence.models.DocumentFootnote": "DocumentIntelligence.DocumentFootnote", "com.azure.ai.documentintelligence.models.DocumentFormula": "DocumentIntelligence.DocumentFormula", "com.azure.ai.documentintelligence.models.DocumentFormulaKind": "DocumentIntelligence.DocumentFormulaKind", + "com.azure.ai.documentintelligence.models.DocumentIntelligenceError": "DocumentIntelligence.DocumentIntelligenceError", + "com.azure.ai.documentintelligence.models.DocumentIntelligenceInnerError": "DocumentIntelligence.DocumentIntelligenceInnerError", + "com.azure.ai.documentintelligence.models.DocumentIntelligenceOperationDetails": "DocumentIntelligence.DocumentIntelligenceOperationDetails", + "com.azure.ai.documentintelligence.models.DocumentIntelligenceOperationStatus": "DocumentIntelligence.DocumentIntelligenceOperationStatus", + "com.azure.ai.documentintelligence.models.DocumentIntelligenceResourceDetails": "DocumentIntelligence.DocumentIntelligenceResourceDetails", + "com.azure.ai.documentintelligence.models.DocumentIntelligenceWarning": "DocumentIntelligence.DocumentIntelligenceWarning", "com.azure.ai.documentintelligence.models.DocumentKeyValueElement": "DocumentIntelligence.DocumentKeyValueElement", "com.azure.ai.documentintelligence.models.DocumentKeyValuePair": "DocumentIntelligence.DocumentKeyValuePair", "com.azure.ai.documentintelligence.models.DocumentLanguage": "DocumentIntelligence.DocumentLanguage", @@ -147,18 +168,11 @@ "com.azure.ai.documentintelligence.models.DocumentTableCellKind": "DocumentIntelligence.DocumentTableCellKind", "com.azure.ai.documentintelligence.models.DocumentTypeDetails": "DocumentIntelligence.DocumentTypeDetails", "com.azure.ai.documentintelligence.models.DocumentWord": "DocumentIntelligence.DocumentWord", - "com.azure.ai.documentintelligence.models.Error": "DocumentIntelligence.Error", - "com.azure.ai.documentintelligence.models.FontStyle": "DocumentIntelligence.FontStyle", - "com.azure.ai.documentintelligence.models.FontWeight": "DocumentIntelligence.FontWeight", - "com.azure.ai.documentintelligence.models.InnerError": "DocumentIntelligence.InnerError", "com.azure.ai.documentintelligence.models.LengthUnit": "DocumentIntelligence.LengthUnit", - "com.azure.ai.documentintelligence.models.OperationDetails": "DocumentIntelligence.OperationDetails", + "com.azure.ai.documentintelligence.models.ModelCopyAuthorization": "DocumentIntelligence.ModelCopyAuthorization", "com.azure.ai.documentintelligence.models.OperationKind": "DocumentIntelligence.OperationKind", - "com.azure.ai.documentintelligence.models.OperationStatus": "DocumentIntelligence.OperationStatus", "com.azure.ai.documentintelligence.models.ParagraphRole": "DocumentIntelligence.ParagraphRole", - "com.azure.ai.documentintelligence.models.ResourceDetails": "DocumentIntelligence.ResourceDetails", "com.azure.ai.documentintelligence.models.SplitMode": "DocumentIntelligence.SplitMode", - "com.azure.ai.documentintelligence.models.StringIndexType": "DocumentIntelligence.StringIndexType", - "com.azure.ai.documentintelligence.models.Warning": "DocumentIntelligence.Warning" + "com.azure.ai.documentintelligence.models.StringIndexType": "DocumentIntelligence.StringIndexType" } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/native-image/com.azure/azure-ai-documentintelligence/reflect-config.json b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/native-image/com.azure/azure-ai-documentintelligence/reflect-config.json index 18a3548f23d7..6cbfd5f4b87d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/native-image/com.azure/azure-ai-documentintelligence/reflect-config.json +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/main/resources/META-INF/native-image/com.azure/azure-ai-documentintelligence/reflect-config.json @@ -60,7 +60,7 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest", + "name": "com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -72,13 +72,13 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.AnalyzeResultOperation", + "name": "com.azure.ai.documentintelligence.models.AnalyzeOperation", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.AuthorizeCopyRequest", + "name": "com.azure.ai.documentintelligence.models.AuthorizeModelCopyOptions", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -102,13 +102,13 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest", + "name": "com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.BuildDocumentModelRequest", + "name": "com.azure.ai.documentintelligence.models.BuildDocumentModelOptions", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -120,7 +120,7 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.ClassifyDocumentRequest", + "name": "com.azure.ai.documentintelligence.models.ClassifyDocumentOptions", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -138,7 +138,7 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.ContentFormat", + "name": "com.azure.ai.documentintelligence.models.DocumentContentFormat", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -150,7 +150,7 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.CopyAuthorization", + "name": "com.azure.ai.documentintelligence.models.ModelCopyAuthorization", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -168,7 +168,7 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.Document", + "name": "com.azure.ai.documentintelligence.models.AnalyzedDocument", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -396,19 +396,19 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.Error", + "name": "com.azure.ai.documentintelligence.models.DocumentIntelligenceError", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.FontStyle", + "name": "com.azure.ai.documentintelligence.models.DocumentFontStyle", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.FontWeight", + "name": "com.azure.ai.documentintelligence.models.DocumentFontWeight", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -426,7 +426,7 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.OperationDetails", + "name": "com.azure.ai.documentintelligence.models.DocumentIntelligenceOperationDetails", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true @@ -450,7 +450,7 @@ "allDeclaredMethods": true }, { - "name": "com.azure.ai.documentintelligence.models.ResourceDetails", + "name": "com.azure.ai.documentintelligence.models.DocumentIntelligenceResourceDetails", "allDeclaredConstructors": true, "allDeclaredFields": true, "allDeclaredMethods": true diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodes.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodes.java index 2ca8c46ebdcf..65d3c55ae0b3 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodes.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodes.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentBarcode; import com.azure.ai.documentintelligence.models.DocumentPage; @@ -15,7 +15,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -40,15 +40,10 @@ public static void main(final String[] args) throws IOException { File barcodesDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/barcodes.jpg"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.BARCODES), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(barcodesDocument.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(barcodesDocument.toPath())) + .setDocumentAnalysisFeatures(Collections.singletonList(DocumentAnalysisFeature.BARCODES))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodesAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodesAsync.java index 99e82bd3f8c5..2195f9e279a7 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodesAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnBarcodesAsync.java @@ -3,10 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentBarcode; import com.azure.ai.documentintelligence.models.DocumentPage; import com.azure.core.credential.AzureKeyCredential; @@ -17,7 +16,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; @@ -43,16 +41,9 @@ public static void main(final String[] args) throws IOException { File barcodesDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/barcodes.jpg"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.BARCODES), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(barcodesDocument.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(barcodesDocument.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFonts.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFonts.java index 1ff0df53129c..c691cc3d1787 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFonts.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFonts.java @@ -3,13 +3,13 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.DocumentFontStyle; +import com.azure.ai.documentintelligence.models.DocumentFontWeight; import com.azure.ai.documentintelligence.models.DocumentStyle; -import com.azure.ai.documentintelligence.models.FontStyle; -import com.azure.ai.documentintelligence.models.FontWeight; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.CoreUtils; import com.azure.core.util.polling.SyncPoller; @@ -18,7 +18,7 @@ import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -45,22 +45,17 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/fonts_and_languages.png"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.STYLE_FONT), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath())) + .setDocumentAnalysisFeatures(Collections.singletonList(DocumentAnalysisFeature.STYLE_FONT))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); // DocumentStyle has the following font related attributes: Map> similarFontFamilies = new HashMap<>(); // e.g., 'Arial, sans-serif - Map> fontStyles = new HashMap<>(); // e.g, 'italic' - Map> fontWeights = new HashMap<>(); // e.g., 'bold' + Map> fontStyles = new HashMap<>(); // e.g, 'italic' + Map> fontWeights = new HashMap<>(); // e.g., 'bold' Map> fontColors = new HashMap<>(); // in '#rrggbb' hexadecimal format Map> fontBackgroundColors = new HashMap<>(); // in '#rrggbb' hexadecimal format @@ -75,9 +70,9 @@ public static void main(final String[] args) throws IOException { }); if (isDocumentContainsHandwritten) { - System.out.println("Document contains handwritten content"); + System.out.println("AnalyzedDocument contains handwritten content"); } else { - System.out.println("Document does not contains handwritten content"); + System.out.println("AnalyzedDocument does not contains handwritten content"); } System.out.println("----Fonts styles detected in the document----"); @@ -92,7 +87,7 @@ public static void main(final String[] args) throws IOException { similarFontFamilies.get(similarFontFamily).add(documentStyle); } - FontStyle fontStyle = documentStyle.getFontStyle(); + DocumentFontStyle fontStyle = documentStyle.getFontStyle(); if (fontStyle != null) { if (!fontStyles.containsKey(fontStyle)) { fontStyles.put(fontStyle, new ArrayList<>()); @@ -100,7 +95,7 @@ public static void main(final String[] args) throws IOException { fontStyles.get(fontStyle).add(documentStyle); } - FontWeight fontWeight = documentStyle.getFontWeight(); + DocumentFontWeight fontWeight = documentStyle.getFontWeight(); if (fontWeight != null) { if (!fontWeights.containsKey(fontWeight)) { fontWeights.put(fontWeight, new ArrayList<>()); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFontsAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFontsAsync.java index b02cca77608d..101a318fe369 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFontsAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFontsAsync.java @@ -3,13 +3,12 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentStyle; -import com.azure.ai.documentintelligence.models.FontStyle; -import com.azure.ai.documentintelligence.models.FontWeight; +import com.azure.ai.documentintelligence.models.DocumentFontStyle; +import com.azure.ai.documentintelligence.models.DocumentFontWeight; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.CoreUtils; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -20,7 +19,6 @@ import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -50,16 +48,9 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/fonts_and_languages.png"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.STYLE_FONT), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller @@ -78,8 +69,8 @@ public static void main(final String[] args) throws IOException { analyzeLayoutResultMono.subscribe(analyzeLayoutResult -> { // DocumentStyle has the following font related attributes: Map> similarFontFamilies = new HashMap<>(); // e.g., 'Arial, sans-serif - Map> fontStyles = new HashMap<>(); // e.g, 'italic' - Map> fontWeights = new HashMap<>(); // e.g., 'bold' + Map> fontStyles = new HashMap<>(); // e.g, 'italic' + Map> fontWeights = new HashMap<>(); // e.g., 'bold' Map> fontColors = new HashMap<>(); // in '#rrggbb' hexadecimal format Map> fontBackgroundColors = new HashMap<>(); // in '#rrggbb' hexadecimal format @@ -95,9 +86,9 @@ public static void main(final String[] args) throws IOException { }); if (isDocumentContainsHandwritten) { - System.out.println("Document contains handwritten content"); + System.out.println("AnalyzedDocument contains handwritten content"); } else { - System.out.println("Document does not contains handwritten content"); + System.out.println("AnalyzedDocument does not contains handwritten content"); } System.out.println("----Fonts styles detected in the document----"); @@ -112,7 +103,7 @@ public static void main(final String[] args) throws IOException { similarFontFamilies.get(similarFontFamily).add(documentStyle); } - FontStyle fontStyle = documentStyle.getFontStyle(); + DocumentFontStyle fontStyle = documentStyle.getFontStyle(); if (fontStyle != null) { if (!fontStyles.containsKey(fontStyle)) { fontStyles.put(fontStyle, new ArrayList<>()); @@ -120,7 +111,7 @@ public static void main(final String[] args) throws IOException { fontStyles.get(fontStyle).add(documentStyle); } - FontWeight fontWeight = documentStyle.getFontWeight(); + DocumentFontWeight fontWeight = documentStyle.getFontWeight(); if (fontWeight != null) { if (!fontWeights.containsKey(fontWeight)) { fontWeights.put(fontWeight, new ArrayList<>()); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulas.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulas.java index 626ceb33b5df..42d031dc61f4 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulas.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulas.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentFormula; import com.azure.ai.documentintelligence.models.DocumentFormulaKind; @@ -41,15 +41,9 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/formulas.pdf"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.FORMULAS), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath())).setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.FORMULAS))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulasAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulasAsync.java index 21913cd7e514..75cdab95e5f1 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulasAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnFormulasAsync.java @@ -3,10 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentFormula; import com.azure.ai.documentintelligence.models.DocumentFormulaKind; import com.azure.ai.documentintelligence.models.DocumentPage; @@ -18,7 +17,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; @@ -44,16 +42,9 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/formulas.pdf"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.FORMULAS), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighRes.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighRes.java index e01f17e8ec47..6a897a63fbd4 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighRes.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighRes.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentStyle; import com.azure.ai.documentintelligence.models.DocumentTable; @@ -40,15 +40,9 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/highres.png"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.OCR_HIGH_RESOLUTION), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath())).setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.OCR_HIGH_RESOLUTION))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); @@ -61,9 +55,9 @@ public static void main(final String[] args) throws IOException { }); if (isDocumentContainsHandwritten) { - System.out.println("Document contains handwritten content"); + System.out.println("AnalyzedDocument contains handwritten content"); } else { - System.out.println("Document does not contains handwritten content"); + System.out.println("AnalyzedDocument does not contains handwritten content"); } // pages diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighResAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighResAsync.java index 18b5ce10e044..34e644a23d88 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighResAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnHighResAsync.java @@ -3,10 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentStyle; import com.azure.ai.documentintelligence.models.DocumentTable; import com.azure.core.credential.AzureKeyCredential; @@ -17,7 +16,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; @@ -43,16 +41,9 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/highres.png"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.OCR_HIGH_RESOLUTION), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller @@ -78,9 +69,9 @@ public static void main(final String[] args) throws IOException { }); if (isDocumentContainsHandwritten) { - System.out.println("Document contains handwritten content"); + System.out.println("AnalyzedDocument contains handwritten content"); } else { - System.out.println("Document does not contains handwritten content"); + System.out.println("AnalyzedDocument does not contains handwritten content"); } // pages diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePair.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePair.java index 0b15ba7bcdd6..e4eabb662699 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePair.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePair.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.BoundingRegion; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentKeyValueElement; @@ -40,15 +40,9 @@ public static void main(final String[] args) throws IOException { File invoiceDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/invoices/Invoice_1.pdf"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.KEY_VALUE_PAIRS), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoiceDocument.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(invoiceDocument.toPath())).setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.KEY_VALUE_PAIRS))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePairAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePairAsync.java index 821f35ee0ec5..9ce4f6c69772 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePairAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnKeyValuePairAsync.java @@ -3,11 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.BoundingRegion; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentKeyValueElement; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -17,7 +16,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; @@ -43,16 +41,9 @@ public static void main(final String[] args) throws IOException { File invoiceDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/invoices/Invoice_1.pdf"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.KEY_VALUE_PAIRS), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoiceDocument.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(invoiceDocument.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguages.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguages.java index 2265c941385f..d94dcd91951c 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguages.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguages.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentLanguage; import com.azure.core.credential.AzureKeyCredential; @@ -39,15 +39,9 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/fonts_and_languages.png"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.LANGUAGES), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath())).setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.LANGUAGES))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguagesAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguagesAsync.java index 2e1bcf86e90f..d3d2b702cef6 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguagesAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnLanguagesAsync.java @@ -3,10 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentLanguage; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -16,7 +15,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; @@ -42,16 +40,9 @@ public static void main(final String[] args) throws IOException { File document = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/addOns/fonts_and_languages.png"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.LANGUAGES), - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(document.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFields.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFields.java index 3dda5729d3d1..13d15bd14424 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFields.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFields.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.SyncPoller; @@ -37,15 +37,11 @@ public static void main(final String[] args) throws IOException { File invoiceDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/invoices/Invoice_1.pdf"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.QUERY_FIELDS), - Arrays.asList("Address", "InvoiceNumber"), - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoiceDocument.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(invoiceDocument.toPath())) + .setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.QUERY_FIELDS)) + .setQueryFields(Arrays.asList("Address", "InvoiceNumber"))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFieldsAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFieldsAsync.java index 608c539d3591..b76c314c0f4d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFieldsAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeAddOnQueryFieldsAsync.java @@ -3,10 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; @@ -15,7 +14,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; import java.util.concurrent.TimeUnit; /** @@ -40,16 +38,9 @@ public static void main(final String[] args) throws IOException { File invoiceDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/invoices/Invoice_1.pdf"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - Arrays.asList(DocumentAnalysisFeature.QUERY_FIELDS), - Arrays.asList("Address", "InvoiceNumber"), - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoiceDocument.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(invoiceDocument.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentAsync.java index 170e2cb48314..eb1e372ec07f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentAsync.java @@ -3,14 +3,11 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.ContentFormat; -import com.azure.ai.documentintelligence.models.Document; -import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentTable; -import com.azure.ai.documentintelligence.models.StringIndexType; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.PollerFlux; import reactor.core.publisher.Mono; @@ -18,7 +15,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; @@ -46,14 +42,9 @@ public static void main(String[] args) throws IOException { + "sample-forms/forms/Invoice_6.pdf"); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); String modelId = "{modelId}"; - PollerFlux analyzeDocumentPoller + PollerFlux analyzeDocumentPoller = client.beginAnalyzeDocument(modelId, - "1", - "en-US", - StringIndexType.TEXT_ELEMENTS, - Arrays.asList(DocumentAnalysisFeature.LANGUAGES), - null, - ContentFormat.TEXT, null, new AnalyzeDocumentRequest().setBase64Source(fileContent)); + new AnalyzeDocumentOptions(fileContent)); Mono analyzeDocumentResult = analyzeDocumentPoller @@ -69,10 +60,10 @@ public static void main(String[] args) throws IOException { analyzeDocumentResult.subscribe(analyzeResult -> { for (int i = 0; i < analyzeResult.getDocuments().size(); i++) { - Document analyzedDocument = analyzeResult.getDocuments().get(i); + AnalyzedDocument analyzedDocument = analyzeResult.getDocuments().get(i); System.out.printf("----------- Analyzing custom document %d -----------%n", i); System.out.printf("Analyzed document has doc type %s with confidence : %.2f%n", - analyzedDocument.getDocType(), analyzedDocument.getConfidence()); + analyzedDocument.getDocumentType(), analyzedDocument.getConfidence()); } analyzeResult.getPages().forEach(documentPage -> { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentFromUrl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentFromUrl.java index 1411abf45774..bbca8714a098 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentFromUrl.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeCustomDocumentFromUrl.java @@ -3,11 +3,11 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.ContentFormat; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.DocumentContentFormat; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentTable; import com.azure.ai.documentintelligence.models.StringIndexType; @@ -37,23 +37,18 @@ public static void main(String[] args) { String documentUrl = "{document-url}"; String modelId = "{custom-built-model-ID}"; - SyncPoller analyzeDocumentPoller = client.beginAnalyzeDocument(modelId, - "1", - "en-US", - StringIndexType.TEXT_ELEMENTS, - Arrays.asList(DocumentAnalysisFeature.LANGUAGES), - null, - ContentFormat.TEXT, - null, - new AnalyzeDocumentRequest().setUrlSource(documentUrl)); + SyncPoller analyzeDocumentPoller = client.beginAnalyzeDocument(modelId, + new AnalyzeDocumentOptions(documentUrl).setPages(Arrays.asList("1")) + .setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.LANGUAGES)).setLocale("en-US") + .setStringIndexType(StringIndexType.TEXT_ELEMENTS).setOutputContentFormat(DocumentContentFormat.TEXT)); AnalyzeResult analyzeResult = analyzeDocumentPoller.getFinalResult(); for (int i = 0; i < analyzeResult.getDocuments().size(); i++) { - final Document analyzedDocument = analyzeResult.getDocuments().get(i); + final AnalyzedDocument analyzedDocument = analyzeResult.getDocuments().get(i); System.out.printf("----------- Analyzing custom document %d -----------%n", i); System.out.printf("Analyzed document has doc type %s with confidence : %.2f%n", - analyzedDocument.getDocType(), analyzedDocument.getConfidence()); + analyzedDocument.getDocumentType(), analyzedDocument.getConfidence()); } analyzeResult.getPages().forEach(documentPage -> { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocuments.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocuments.java index dc214031e9cd..ecd5f6060dd9 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocuments.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocuments.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -41,21 +41,14 @@ public static void main(final String[] args) throws IOException { File licenseDocumentFile = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/identityDocuments/license.png"); - SyncPoller analyzeIdentityDocumentPoller = + SyncPoller analyzeIdentityDocumentPoller = client.beginAnalyzeDocument("prebuilt-idDocument", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(licenseDocumentFile.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(licenseDocumentFile.toPath()))); AnalyzeResult identityDocumentResults = analyzeIdentityDocumentPoller.getFinalResult(); for (int i = 0; i < identityDocumentResults.getDocuments().size(); i++) { - Document analyzedIDDocument = identityDocumentResults.getDocuments().get(i); + AnalyzedDocument analyzedIDDocument = identityDocumentResults.getDocuments().get(i); Map licenseFields = analyzedIDDocument.getFields(); System.out.printf("----------- Analyzed license info for page %d -----------%n", i); DocumentField addressField = licenseFields.get("Address"); @@ -89,7 +82,7 @@ public static void main(final String[] args) throws IOException { if (dateOfExpirationField != null) { if (DocumentFieldType.DATE == dateOfExpirationField.getType()) { LocalDate expirationDate = dateOfExpirationField.getValueDate(); - System.out.printf("Document date of expiration: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument date of expiration: %s, confidence: %.2f%n", expirationDate, dateOfExpirationField.getConfidence()); } } @@ -98,7 +91,7 @@ public static void main(final String[] args) throws IOException { if (documentNumberField != null) { if (DocumentFieldType.STRING == documentNumberField.getType()) { String documentNumber = documentNumberField.getValueString(); - System.out.printf("Document number: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument number: %s, confidence: %.2f%n", documentNumber, documentNumberField.getConfidence()); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsAsync.java index 332f66bd510a..51b0321a3074 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsAsync.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -43,15 +43,9 @@ public static void main(final String[] args) throws IOException { + "sample-forms/identityDocuments/license.png"); byte[] fileContent = Files.readAllBytes(licenseDocumentFile.toPath()); - PollerFlux analyzeIdentityDocumentPoller + PollerFlux analyzeIdentityDocumentPoller = client.beginAnalyzeDocument("prebuilt-idDocument", - null, - null, - null, - null, - null, - null, - null, new AnalyzeDocumentRequest().setBase64Source(fileContent)); + new AnalyzeDocumentOptions(fileContent)); Mono identityDocumentPollerResult = analyzeIdentityDocumentPoller .last() @@ -66,7 +60,7 @@ public static void main(final String[] args) throws IOException { identityDocumentPollerResult.subscribe(idDocumentResults -> { for (int i = 0; i < idDocumentResults.getDocuments().size(); i++) { - Document analyzedIDDocument = idDocumentResults.getDocuments().get(i); + AnalyzedDocument analyzedIDDocument = idDocumentResults.getDocuments().get(i); Map licenseFields = analyzedIDDocument.getFields(); System.out.printf("----------- Analyzed license info for page %d -----------%n", i); DocumentField addressField = licenseFields.get("Address"); @@ -100,7 +94,7 @@ public static void main(final String[] args) throws IOException { if (dateOfExpirationField != null) { if (DocumentFieldType.DATE == dateOfExpirationField.getType()) { LocalDate expirationDate = dateOfExpirationField.getValueDate(); - System.out.printf("Document date of expiration: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument date of expiration: %s, confidence: %.2f%n", expirationDate, dateOfExpirationField.getConfidence()); } } @@ -109,7 +103,7 @@ public static void main(final String[] args) throws IOException { if (documentNumberField != null) { if (DocumentFieldType.STRING == documentNumberField.getType()) { String documentNumber = documentNumberField.getValueString(); - System.out.printf("Document number: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument number: %s, confidence: %.2f%n", documentNumber, documentNumberField.getConfidence()); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrl.java index 6e3347fefdbe..b05088939b2a 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrl.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrl.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -38,20 +38,13 @@ public static void main(final String[] args) throws IOException { String licenseDocumentUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence/" + "azure-ai-documentintelligence/src/samples/resources/sample-forms/IdentityDocuments/license.png"; - SyncPoller analyzeIdentityDocumentPoller - = client.beginAnalyzeDocument("prebuilt-idDocument", - null, - null, - null, - null, - null, - null, - null, new AnalyzeDocumentRequest().setUrlSource(licenseDocumentUrl)); + SyncPoller analyzeIdentityDocumentPoller + = client.beginAnalyzeDocument("prebuilt-idDocument", new AnalyzeDocumentOptions(licenseDocumentUrl)); AnalyzeResult identityDocumentResults = analyzeIdentityDocumentPoller.getFinalResult(); for (int i = 0; i < identityDocumentResults.getDocuments().size(); i++) { - Document analyzedIDDocument = identityDocumentResults.getDocuments().get(i); + AnalyzedDocument analyzedIDDocument = identityDocumentResults.getDocuments().get(i); Map licenseFields = analyzedIDDocument.getFields(); System.out.printf("----------- Analyzed license info for page %d -----------%n", i); DocumentField addressField = licenseFields.get("Address"); @@ -85,7 +78,7 @@ public static void main(final String[] args) throws IOException { if (dateOfExpirationField != null) { if (DocumentFieldType.DATE == dateOfExpirationField.getType()) { LocalDate expirationDate = dateOfExpirationField.getValueDate(); - System.out.printf("Document date of expiration: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument date of expiration: %s, confidence: %.2f%n", expirationDate, dateOfExpirationField.getConfidence()); } } @@ -94,7 +87,7 @@ public static void main(final String[] args) throws IOException { if (documentNumberField != null) { if (DocumentFieldType.STRING == documentNumberField.getType()) { String documentNumber = documentNumberField.getValueString(); - System.out.printf("Document number: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument number: %s, confidence: %.2f%n", documentNumber, documentNumberField.getConfidence()); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrlAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrlAsync.java index 6514355cdf29..38683c626bef 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrlAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrlAsync.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -38,16 +38,9 @@ public static void main(final String[] args) { String licenseDocumentUrl = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence/" + "azure-ai-documentintelligence/src/samples/resources/sample-forms/IdentityDocuments/license.png"; - PollerFlux analyzeIdentityDocumentPoller = + PollerFlux analyzeIdentityDocumentPoller = client.beginAnalyzeDocument("prebuilt-idDocument", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource(licenseDocumentUrl)); + new AnalyzeDocumentOptions(licenseDocumentUrl)); Mono identityDocumentPollerResult = analyzeIdentityDocumentPoller .last() @@ -62,7 +55,7 @@ public static void main(final String[] args) { identityDocumentPollerResult.subscribe(identityDocumentResults -> { for (int i = 0; i < identityDocumentResults.getDocuments().size(); i++) { - Document analyzedIDDocument = identityDocumentResults.getDocuments().get(i); + AnalyzedDocument analyzedIDDocument = identityDocumentResults.getDocuments().get(i); Map licenseFields = analyzedIDDocument.getFields(); System.out.printf("----------- Analyzed license info for page %d -----------%n", i); DocumentField addressField = licenseFields.get("Address"); @@ -96,7 +89,7 @@ public static void main(final String[] args) { if (dateOfExpirationField != null) { if (DocumentFieldType.DATE == dateOfExpirationField.getType()) { LocalDate expirationDate = dateOfExpirationField.getValueDate(); - System.out.printf("Document date of expiration: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument date of expiration: %s, confidence: %.2f%n", expirationDate, dateOfExpirationField.getConfidence()); } } @@ -105,7 +98,7 @@ public static void main(final String[] args) { if (documentNumberField != null) { if (DocumentFieldType.STRING == documentNumberField.getType()) { String documentNumber = documentNumberField.getValueString(); - System.out.printf("Document number: %s, confidence: %.2f%n", + System.out.printf("AnalyzedDocument number: %s, confidence: %.2f%n", documentNumber, documentNumberField.getConfidence()); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoices.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoices.java index 231e694946c9..74c062050849 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoices.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoices.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -40,21 +40,13 @@ public static void main(final String[] args) throws IOException { File invoice = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/invoices/sample_invoice.jpg"); - SyncPoller analyzeInvoicesPoller = - client.beginAnalyzeDocument("prebuilt-invoice", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoice.toPath()))); + SyncPoller analyzeInvoicesPoller = + client.beginAnalyzeDocument("prebuilt-invoice", new AnalyzeDocumentOptions(Files.readAllBytes(invoice.toPath()))); AnalyzeResult analyzeInvoiceResult = analyzeInvoicesPoller.getFinalResult(); for (int i = 0; i < analyzeInvoiceResult.getDocuments().size(); i++) { - Document analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); + AnalyzedDocument analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); Map invoiceFields = analyzedInvoice.getFields(); System.out.printf("----------- Analyzing invoice %d -----------%n", i); DocumentField vendorNameField = invoiceFields.get("VendorName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesAsync.java index d83b35208fe8..6d5412e30b12 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesAsync.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -42,16 +42,9 @@ public static void main(final String[] args) throws IOException { File invoice = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/invoices/sample_invoice.jpg"); - PollerFlux analyzeInvoicePoller = + PollerFlux analyzeInvoicePoller = client.beginAnalyzeDocument("prebuilt-invoice", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoice.toPath())) + new AnalyzeDocumentOptions(Files.readAllBytes(invoice.toPath())) ); @@ -69,7 +62,7 @@ public static void main(final String[] args) throws IOException { analyzeInvoiceResultMono.subscribe(analyzeInvoiceResult -> { for (int i = 0; i < analyzeInvoiceResult.getDocuments().size(); i++) { - Document analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); + AnalyzedDocument analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); Map invoiceFields = analyzedInvoice.getFields(); System.out.printf("----------- Analyzing invoice %d -----------%n", i); DocumentField vendorNameField = invoiceFields.get("VendorName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrl.java index f1dcf6692b71..161d37326d04 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrl.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrl.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -40,20 +40,13 @@ public static void main(final String[] args) throws IOException { "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/documentintelligence/" + "azure-ai-documentintelligence/samples/sample_forms/forms/sample_invoice.jpg"; - SyncPoller analyzeInvoicesPoller - = client.beginAnalyzeDocument("prebuilt-invoice", - null, - null, - null, - null, - null, - null, - null, new AnalyzeDocumentRequest().setUrlSource(invoiceUrl)); + SyncPoller analyzeInvoicesPoller + = client.beginAnalyzeDocument("prebuilt-invoice", new AnalyzeDocumentOptions(invoiceUrl)); AnalyzeResult analyzeInvoiceResult = analyzeInvoicesPoller.getFinalResult(); for (int i = 0; i < analyzeInvoiceResult.getDocuments().size(); i++) { - Document analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); + AnalyzedDocument analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); Map invoiceFields = analyzedInvoice.getFields(); System.out.printf("----------- Analyzing invoice %d -----------%n", i); DocumentField vendorNameField = invoiceFields.get("VendorName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrlAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrlAsync.java index 4269e085bf7e..616e1c7527ca 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrlAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrlAsync.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -41,15 +41,9 @@ public static void main(final String[] args) throws IOException { "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/documentintelligence/" + "azure-ai-documentintelligence/samples/sample_forms/forms/sample_invoice.jpg"; - PollerFlux analyzeInvoicePoller = + PollerFlux analyzeInvoicePoller = client.beginAnalyzeDocument("prebuilt-invoice", - null, - null, - null, - null, - null, - null, - null, new AnalyzeDocumentRequest().setUrlSource(invoiceUrl)); + new AnalyzeDocumentOptions(invoiceUrl)); Mono analyzeInvoiceResultMono = analyzeInvoicePoller .last() @@ -65,7 +59,7 @@ public static void main(final String[] args) throws IOException { analyzeInvoiceResultMono.subscribe(analyzeInvoiceResult -> { for (int i = 0; i < analyzeInvoiceResult.getDocuments().size(); i++) { - Document analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); + AnalyzedDocument analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i); Map invoiceFields = analyzedInvoice.getFields(); System.out.printf("----------- Analyzing invoice %d -----------%n", i); DocumentField vendorNameField = invoiceFields.get("VendorName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayout.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayout.java index 5c12cba564eb..0d8206317d97 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayout.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayout.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentTable; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.SyncPoller; @@ -36,15 +36,9 @@ public static void main(final String[] args) throws IOException { File selectionMarkDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/forms/selectionMarkForm.pdf"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(selectionMarkDocument.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(selectionMarkDocument.toPath()))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); @@ -90,6 +84,6 @@ public static void main(final String[] args) throws IOException { // styles analyzeLayoutResult.getStyles().forEach(documentStyle - -> System.out.printf("Document is handwritten %s%n.", documentStyle.isHandwritten())); + -> System.out.printf("AnalyzedDocument is handwritten %s%n.", documentStyle.isHandwritten())); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutAsync.java index 31183e27b97b..6ec8614be5b6 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutAsync.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentTable; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -42,16 +42,9 @@ public static void main(final String[] args) throws IOException { byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(sourceFile.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(sourceFile.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller @@ -111,7 +104,7 @@ public static void main(final String[] args) throws IOException { // styles analyzeLayoutResult.getStyles().forEach(documentStyle - -> System.out.printf("Document is handwritten %s.%n", documentStyle.isHandwritten())); + -> System.out.printf("AnalyzedDocument is handwritten %s.%n", documentStyle.isHandwritten())); }); // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrl.java index 1ebab54fc3b6..fb60b2e9caba 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrl.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrl.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentTable; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.SyncPoller; @@ -28,16 +28,9 @@ public static void main(final String[] args) { .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); - SyncPoller analyzeLayoutPoller = + SyncPoller analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource("https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence/" + new AnalyzeDocumentOptions("https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence/" + "azure-ai-documentintelligence/src/samples/resources/sample-forms/forms/selectionMarkForm.pdf")); AnalyzeResult analyzeLayoutResult = analyzeLayoutPoller.getFinalResult(); @@ -84,6 +77,6 @@ public static void main(final String[] args) { // styles analyzeLayoutResult.getStyles().forEach(documentStyle - -> System.out.printf("Document is handwritten %s.%n", documentStyle.isHandwritten())); + -> System.out.printf("AnalyzedDocument is handwritten %s.%n", documentStyle.isHandwritten())); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrlAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrlAsync.java index d0c2b1c7604a..26f5bb3aeec0 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrlAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutFromUrlAsync.java @@ -3,9 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.DocumentTable; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -32,16 +32,9 @@ public static void main(final String[] args) { .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildAsyncClient(); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource("https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence/" + new AnalyzeDocumentOptions("https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence/" + "azure-ai-documentintelligence/src/samples/resources/sample-forms/forms/selectionMarkForm.pdf")); Mono analyzeLayoutResultMono = @@ -102,7 +95,7 @@ public static void main(final String[] args) { // styles analyzeLayoutResult.getStyles().forEach(documentStyle - -> System.out.printf("Document is handwritten %s.%n", documentStyle.isHandwritten())); + -> System.out.printf("AnalyzedDocument is handwritten %s.%n", documentStyle.isHandwritten())); }); // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutput.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutput.java index d8fe9101cf31..b5eb2dea5688 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutput.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutput.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.ContentFormat; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.DocumentContentFormat; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.SyncPoller; @@ -33,15 +33,9 @@ public static void main(final String[] args) throws IOException { File invoiceDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/sample-forms/forms/Invoice_6.pdf"); - SyncPoller analyzeLayoutResultPoller = - client.beginAnalyzeDocument("prebuilt-layout", null, - null, - null, - null, - null, - ContentFormat.MARKDOWN, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoiceDocument.toPath()))); + SyncPoller analyzeLayoutResultPoller = + client.beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(Files.readAllBytes(invoiceDocument.toPath())).setOutputContentFormat(DocumentContentFormat.MARKDOWN)); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); System.out.println("Markdown output"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutputAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutputAsync.java index 497ecb221a68..c2ea23f3e117 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutputAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeLayoutMarkdownOutputAsync.java @@ -3,10 +3,9 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.ContentFormat; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; @@ -36,16 +35,9 @@ public static void main(final String[] args) throws IOException { File invoiceDocument = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/sample-forms/forms/Invoice_6.pdf"); - PollerFlux analyzeLayoutPoller = + PollerFlux analyzeLayoutPoller = client.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - null, - null, - ContentFormat.MARKDOWN, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoiceDocument.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(invoiceDocument.toPath()))); Mono analyzeLayoutResultMono = analyzeLayoutPoller diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceipts.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceipts.java index 10314fbdd183..4744b0a4482a 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceipts.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceipts.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -41,21 +41,14 @@ public static void main(final String[] args) throws IOException { File sourceFile = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/receipts/contoso-allinone.jpg"); - SyncPoller analyzeReceiptPoller = + SyncPoller analyzeReceiptPoller = client.beginAnalyzeDocument("prebuilt-receipt", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(sourceFile.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(sourceFile.toPath()))); AnalyzeResult receiptResults = analyzeReceiptPoller.getFinalResult(); for (int i = 0; i < receiptResults.getDocuments().size(); i++) { - Document analyzedReceipt = receiptResults.getDocuments().get(i); + AnalyzedDocument analyzedReceipt = receiptResults.getDocuments().get(i); Map receiptFields = analyzedReceipt.getFields(); System.out.printf("----------- Analyzing receipt info %d -----------%n", i); DocumentField merchantNameField = receiptFields.get("MerchantName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsAsync.java index e53433507185..a7652dbe83ec 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsAsync.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -43,16 +43,9 @@ public static void main(final String[] args) throws IOException { File sourceFile = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/receipts/contoso-allinone.jpg"); - PollerFlux analyzeReceiptPoller; + PollerFlux analyzeReceiptPoller; analyzeReceiptPoller = client.beginAnalyzeDocument("prebuilt-receipt", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(sourceFile.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(sourceFile.toPath()))); Mono receiptResultsMono = analyzeReceiptPoller @@ -69,7 +62,7 @@ public static void main(final String[] args) throws IOException { receiptResultsMono.subscribe(receiptResults -> { for (int i = 0; i < receiptResults.getDocuments().size(); i++) { - Document analyzedReceipt = receiptResults.getDocuments().get(i); + AnalyzedDocument analyzedReceipt = receiptResults.getDocuments().get(i); Map receiptFields = analyzedReceipt.getFields(); System.out.printf("----------- Analyzing receipt info %d -----------%n", i); DocumentField merchantNameField = receiptFields.get("MerchantName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrl.java index a8bbabbd6b69..84204c0d7239 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrl.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrl.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -39,21 +39,14 @@ public static void main(final String[] args) { "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence" + "/azure-ai-documentintelligence/src/samples/resources/sample-forms/receipts/contoso-allinone.jpg"; - SyncPoller analyzeReceiptPoller = + SyncPoller analyzeReceiptPoller = client.beginAnalyzeDocument("prebuilt-receipt", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource(receiptUrl)); + new AnalyzeDocumentOptions(receiptUrl)); AnalyzeResult receiptResults = analyzeReceiptPoller.getFinalResult(); for (int i = 0; i < receiptResults.getDocuments().size(); i++) { - Document analyzedReceipt = receiptResults.getDocuments().get(i); + AnalyzedDocument analyzedReceipt = receiptResults.getDocuments().get(i); Map receiptFields = analyzedReceipt.getFields(); System.out.printf("----------- Analyzing receipt info %d -----------%n", i); DocumentField merchantNameField = receiptFields.get("MerchantName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrlAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrlAsync.java index edda539290f9..3d009b35bf6e 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrlAsync.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrlAsync.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -40,15 +40,9 @@ public static void main(final String[] args) { "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence" + "/azure-ai-documentintelligence/src/samples/resources/sample-forms/receipts/contoso-allinone.jpg"; - PollerFlux analyzeReceiptPoller = - client.beginAnalyzeDocument("prebuilt-receipt", null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource(receiptUrl)); + PollerFlux analyzeReceiptPoller = + client.beginAnalyzeDocument("prebuilt-receipt", + new AnalyzeDocumentOptions(receiptUrl)); Mono receiptResultsMono = analyzeReceiptPoller .last() @@ -64,7 +58,7 @@ public static void main(final String[] args) { receiptResultsMono.subscribe(receiptResults -> { for (int i = 0; i < receiptResults.getDocuments().size(); i++) { - Document analyzedReceipt = receiptResults.getDocuments().get(i); + AnalyzedDocument analyzedReceipt = receiptResults.getDocuments().get(i); Map receiptFields = analyzedReceipt.getFields(); System.out.printf("----------- Analyzing receipt info %d -----------%n", i); DocumentField merchantNameField = receiptFields.get("MerchantName"); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2.java index 56e967b4ba12..3aa348c35524 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -38,22 +38,16 @@ public static void main(final String[] args) throws IOException { File invoice = new File("./documentintelligence/azure-ai-documentintelligence/src/samples/resources/Sample-W2.jpg"); - SyncPoller analyzeW2Poller = - client.beginAnalyzeDocument("prebuilt-tax.us.w2", null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(invoice.toPath()))); + SyncPoller analyzeW2Poller = + client.beginAnalyzeDocument("prebuilt-tax.us.w2", + new AnalyzeDocumentOptions(Files.readAllBytes(invoice.toPath()))); AnalyzeResult analyzeTaxResult = analyzeW2Poller.getFinalResult(); for (int i = 0; i < analyzeTaxResult.getDocuments().size(); i++) { - Document analyzedTaxDocument = analyzeTaxResult.getDocuments().get(i); + AnalyzedDocument analyzedTaxDocument = analyzeTaxResult.getDocuments().get(i); Map taxFields = analyzedTaxDocument.getFields(); - System.out.printf("----------- Analyzing Document %d -----------%n", i); + System.out.printf("----------- Analyzing AnalyzedDocument %d -----------%n", i); DocumentField w2FormVariantField = taxFields.get("W2FormVariant"); if (w2FormVariantField != null) { if (DocumentFieldType.STRING == w2FormVariantField.getType()) { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2Async.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2Async.java index 80511ff81d6c..44d65fd0c411 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2Async.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeTaxW2Async.java @@ -3,10 +3,10 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentField; import com.azure.ai.documentintelligence.models.DocumentFieldType; import com.azure.core.credential.AzureKeyCredential; @@ -38,15 +38,9 @@ public static void main(final String[] args) throws IOException { String w2Url = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/resources/sample-forms/w2/Sample-W2.jpg"; - PollerFlux analyzeW2Poller = - client.beginAnalyzeDocument("prebuilt-tax.us.w2", null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource(w2Url)); + PollerFlux analyzeW2Poller = + client.beginAnalyzeDocument("prebuilt-tax.us.w2", + new AnalyzeDocumentOptions(w2Url)); Mono w2Mono = analyzeW2Poller .last() @@ -63,9 +57,9 @@ public static void main(final String[] args) throws IOException { w2Mono.subscribe(analyzeTaxResult -> { for (int i = 0; i < analyzeTaxResult.getDocuments().size(); i++) { - Document analyzedTaxDocument = analyzeTaxResult.getDocuments().get(i); + AnalyzedDocument analyzedTaxDocument = analyzeTaxResult.getDocuments().get(i); Map taxFields = analyzedTaxDocument.getFields(); - System.out.printf("----------- Analyzing Document %d -----------%n", i); + System.out.printf("----------- Analyzing AnalyzedDocument %d -----------%n", i); DocumentField w2FormVariantField = taxFields.get("W2FormVariant"); if (w2FormVariantField != null) { if (DocumentFieldType.STRING == w2FormVariantField.getType()) { diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisAsyncClientJavaDocCodeSnippets.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisAsyncClientJavaDocCodeSnippets.java index 3bc43af9bb85..bec963e8f8d2 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisAsyncClientJavaDocCodeSnippets.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisAsyncClientJavaDocCodeSnippets.java @@ -3,11 +3,8 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; -import com.azure.ai.documentintelligence.models.ClassifyDocumentRequest; -import com.azure.ai.documentintelligence.models.ContentFormat; -import com.azure.ai.documentintelligence.models.SplitMode; -import com.azure.ai.documentintelligence.models.StringIndexType; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.ClassifyDocumentOptions; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -18,7 +15,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.List; /** * Code snippet for {@link DocumentIntelligenceAsyncClient} @@ -57,21 +53,14 @@ public void createDocumentAnalysisAsyncClientWithPipeline() { } /** - * Code snippet for {@link DocumentIntelligenceAsyncClient#beginAnalyzeDocument(String, String, String, StringIndexType, List, List, ContentFormat, AnalyzeDocumentRequest)} + * Code snippet for {@link DocumentIntelligenceAsyncClient#beginAnalyzeDocument(String, AnalyzeDocumentOptions)} */ public void beginAnalyzeDocumentFromUrl() { - // BEGIN: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginAnalyzeDocumentFromUrl#String-String-String-StringIndexType-List-List-ContentFormat-AnalyzeDocumentRequest + // BEGIN: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginAnalyzeDocumentFromUrl#String-AnalyzeDocumentOptions String documentUrl = "{document_url}"; String modelId = "{model_id}"; documentIntelligenceAsyncClient.beginAnalyzeDocument(modelId, - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource(documentUrl)) + new AnalyzeDocumentOptions(documentUrl)) // if polling operation completed, retrieve the final result. .flatMap(AsyncPollResponse::getFinalResult) .subscribe(analyzeResult -> @@ -83,32 +72,32 @@ public void beginAnalyzeDocumentFromUrl() { System.out.printf("Field value data content: %s%n", documentField.getContent()); System.out.printf("Confidence score: %.2f%n", documentField.getConfidence()); }))); - // END: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginAnalyzeDocumentFromUrl#String-String-String-StringIndexType-List-List-ContentFormat-AnalyzeDocumentRequest + // END: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginAnalyzeDocumentFromUrl#String-AnalyzeDocumentOptions } /** * Code snippet for - * {@link DocumentIntelligenceAsyncClient#beginClassifyDocument(String, ClassifyDocumentRequest, StringIndexType, SplitMode)} + * {@link DocumentIntelligenceAsyncClient#beginClassifyDocument(String, ClassifyDocumentOptions)} * with options * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ public void beginClassifyDocument() throws IOException { - // BEGIN: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginClassifyDocument#String-ClassifyDocumentRequest-StringIndexType-SplitMode + // BEGIN: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginClassifyDocument#String-ClassifyDocumentOptions File document = new File("{local/file_path/fileName.jpg}"); String classifierId = "{model_id}"; // Utility method to convert input stream to Binary Data BinaryData buffer = BinaryData.fromStream(new ByteArrayInputStream(Files.readAllBytes(document.toPath()))); - documentIntelligenceAsyncClient.beginClassifyDocument(classifierId, new ClassifyDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))) + documentIntelligenceAsyncClient.beginClassifyDocument(classifierId, new ClassifyDocumentOptions(Files.readAllBytes(document.toPath()))) // if polling operation completed, retrieve the final result. .flatMap(AsyncPollResponse::getFinalResult) .subscribe(analyzeResult -> { System.out.println(analyzeResult.getModelId()); analyzeResult.getDocuments() - .forEach(analyzedDocument -> System.out.printf("Doc Type: %s%n", analyzedDocument.getDocType())); + .forEach(analyzedDocument -> System.out.printf("Doc Type: %s%n", analyzedDocument.getDocumentType())); }); - // END: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginClassifyDocument#String-ClassifyDocumentRequest-StringIndexType-SplitMode + // END: com.azure.ai.documentintelligence.DocumentAnalysisAsyncClient.beginClassifyDocument#String-ClassifyDocumentOptions } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisClientJavaDocCodeSnippets.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisClientJavaDocCodeSnippets.java index bd1139ae3108..dd3526d1a938 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisClientJavaDocCodeSnippets.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/DocumentAnalysisClientJavaDocCodeSnippets.java @@ -3,16 +3,16 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; -import com.azure.ai.documentintelligence.models.ClassifyDocumentRequest; -import com.azure.ai.documentintelligence.models.ContentFormat; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; +import com.azure.ai.documentintelligence.models.ClassifyDocumentOptions; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentBuildMode; +import com.azure.ai.documentintelligence.models.DocumentContentFormat; import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelDetails; import com.azure.ai.documentintelligence.models.DocumentTable; @@ -27,6 +27,7 @@ import java.io.IOException; import java.nio.file.Files; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -79,36 +80,32 @@ public void createDocumentAnalysisClientWithPipeline() { // Analyze Custom Form /** - * Code snippet for {@link DocumentIntelligenceClient#beginAnalyzeDocument(String, String, String, StringIndexType, List, List, ContentFormat, AnalyzeDocumentRequest)} + * Code snippet for {@link DocumentIntelligenceClient#beginAnalyzeDocument(String, AnalyzeDocumentOptions)} */ public void beginAnalyzeDocumentFromUrl() { - // BEGIN: com.azure.ai.documentintelligence.DocumentAnalysisClient.beginAnalyzeDocumentFromUrl#String-String-String-StringIndexType-List-List-ContentFormat-AnalyzeDocumentRequest + // BEGIN: com.azure.ai.documentintelligence.DocumentAnalysisClient.beginAnalyzeDocumentFromUrl#String-AnalyzeDocumentOptions String documentUrl = "{document_url}"; String modelId = "{custom_trained_model_id}"; documentIntelligenceClient.beginAnalyzeDocument(modelId, - "1", - "en-US", - StringIndexType.TEXT_ELEMENTS, - Arrays.asList(DocumentAnalysisFeature.LANGUAGES), - null, - ContentFormat.TEXT, - null, - new AnalyzeDocumentRequest().setUrlSource(documentUrl)).getFinalResult() + new AnalyzeDocumentOptions(documentUrl).setPages(Arrays.asList("1")) + .setLocale("en-US").setStringIndexType(StringIndexType.TEXT_ELEMENTS) + .setDocumentAnalysisFeatures(Collections.singletonList(DocumentAnalysisFeature.LANGUAGES)) + .setOutputContentFormat(DocumentContentFormat.TEXT)).getFinalResult() .getDocuments().stream() - .map(Document::getFields) + .map(AnalyzedDocument::getFields) .forEach(documentFieldMap -> documentFieldMap.forEach((key, documentField) -> { System.out.printf("Field text: %s%n", key); System.out.printf("Field value data content: %s%n", documentField.getContent()); System.out.printf("Confidence score: %.2f%n", documentField.getConfidence()); })); - // END: com.azure.ai.documentintelligence.DocumentAnalysisClient.beginAnalyzeDocumentFromUrl#String-String-String-StringIndexType-List-List-ContentFormat-AnalyzeDocumentRequest + // END: com.azure.ai.documentintelligence.DocumentAnalysisClient.beginAnalyzeDocumentFromUrl#String-AnalyzeDocumentOptions } /** * Code snippet for - * {@link DocumentIntelligenceClient#beginClassifyDocument(String, ClassifyDocumentRequest)} + * {@link DocumentIntelligenceClient#beginClassifyDocument(String, ClassifyDocumentOptions)} * * @throws IOException Exception thrown when there is an error in reading all the bytes from the File. */ @@ -117,10 +114,10 @@ public void beginClassifyDocumentContext() throws IOException { File document = new File("{local/file_path/fileName.jpg}"); String classifierId = "{custom_trained_classifier_id}"; - documentIntelligenceClient.beginClassifyDocument(classifierId, new ClassifyDocumentRequest().setBase64Source(Files.readAllBytes(document.toPath()))) + documentIntelligenceClient.beginClassifyDocument(classifierId, new ClassifyDocumentOptions(Files.readAllBytes(document.toPath()))) .getFinalResult() .getDocuments() - .forEach(analyzedDocument -> System.out.printf("Doc Type: %s%n", analyzedDocument.getDocType())); + .forEach(analyzedDocument -> System.out.printf("Doc Type: %s%n", analyzedDocument.getDocumentType())); // END: com.azure.ai.documentintelligence.DocumentAnalysisClient.beginClassifyDocument#string-BinaryData-Context } @@ -132,7 +129,7 @@ private void buildAndAnalyzeCustomDocument() { // Build custom document analysis model SyncPoller buildOperationPoller = documentModelAdminClient.beginBuildDocumentModel( - new BuildDocumentModelRequest("modelId", DocumentBuildMode.TEMPLATE) + new BuildDocumentModelOptions("modelId", DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl))); DocumentModelDetails customBuildModel = buildOperationPoller.getFinalResult(); @@ -140,29 +137,22 @@ private void buildAndAnalyzeCustomDocument() { // analyze using custom-built model String modelId = customBuildModel.getModelId(); String documentUrl = "documentUrl"; - SyncPoller analyzeDocumentPoller = + SyncPoller analyzeDocumentPoller = documentIntelligenceClient.beginAnalyzeDocument(modelId, - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setUrlSource(documentUrl)); + new AnalyzeDocumentOptions(documentUrl)); AnalyzeResult analyzeResult = analyzeDocumentPoller.getFinalResult(); for (int i = 0; i < analyzeResult.getDocuments().size(); i++) { - final Document analyzedDocument = analyzeResult.getDocuments().get(i); + final AnalyzedDocument analyzedDocument = analyzeResult.getDocuments().get(i); System.out.printf("----------- Analyzing custom document %d -----------%n", i); System.out.printf("Analyzed document has doc type %s with confidence : %.2f%n", - analyzedDocument.getDocType(), analyzedDocument.getConfidence()); + analyzedDocument.getDocumentType(), analyzedDocument.getConfidence()); analyzedDocument.getFields().forEach((key, documentField) -> { - System.out.printf("Document Field content: %s%n", documentField.getContent()); - System.out.printf("Document Field confidence: %.2f%n", documentField.getConfidence()); - System.out.printf("Document Field Type: %s%n", documentField.getType()); - System.out.printf("Document Field found within bounding region: %s%n", + System.out.printf("AnalyzedDocument Field content: %s%n", documentField.getContent()); + System.out.printf("AnalyzedDocument Field confidence: %.2f%n", documentField.getConfidence()); + System.out.printf("AnalyzedDocument Field Type: %s%n", documentField.getType()); + System.out.printf("AnalyzedDocument Field found within bounding region: %s%n", documentField.getBoundingRegions().toString()); }); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/ReadmeSamples.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/ReadmeSamples.java index 9f4954e48755..e5080b47e1f6 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/ReadmeSamples.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/ReadmeSamples.java @@ -4,13 +4,13 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; -import com.azure.ai.documentintelligence.models.ContentFormat; -import com.azure.ai.documentintelligence.models.Document; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; +import com.azure.ai.documentintelligence.models.DocumentContentFormat; +import com.azure.ai.documentintelligence.models.AnalyzedDocument; import com.azure.ai.documentintelligence.models.DocumentAnalysisFeature; import com.azure.ai.documentintelligence.models.DocumentBuildMode; import com.azure.ai.documentintelligence.models.DocumentField; @@ -18,7 +18,7 @@ import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelDetails; import com.azure.ai.documentintelligence.models.DocumentTable; -import com.azure.ai.documentintelligence.models.ResourceDetails; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceResourceDetails; import com.azure.ai.documentintelligence.models.StringIndexType; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.rest.PagedIterable; @@ -32,6 +32,7 @@ import java.nio.file.Path; import java.time.LocalDate; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -60,22 +61,27 @@ public void createDocumentAnalysisClientWithAAD() { // END: com.azure.ai.documentanalysis.readme.DocumentAnalysisAsyncClient.withAAD } + /** + * Code snippet for creating a {@link DocumentIntelligenceAdministrationClient} + */ + public void createDocumentIntelligenceAdministrationClient() { + // BEGIN: com.azure.ai.documentanalysis.readme.DocumentIntelligenceAdministrationClient + DocumentIntelligenceAdministrationClient documentIntelligenceAsyncClient = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new AzureKeyCredential("{key}")) + .endpoint("{endpoint}") + .buildClient(); + // END: com.azure.ai.documentanalysis.readme.DocumentIntelligenceAdministrationClient + } + public void analyzeLayout() throws IOException { // BEGIN: com.azure.ai.documentintelligence.readme.analyzeLayout File layoutDocument = new File("local/file_path/filename.png"); Path filePath = layoutDocument.toPath(); BinaryData layoutDocumentData = BinaryData.fromFile(filePath, (int) layoutDocument.length()); - SyncPoller analyzeLayoutResultPoller = + SyncPoller analyzeLayoutResultPoller = documentIntelligenceClient.beginAnalyzeDocument("prebuilt-layout", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(layoutDocument.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(layoutDocument.toPath()))); AnalyzeResult analyzeLayoutResult = analyzeLayoutResultPoller.getFinalResult(); @@ -120,21 +126,14 @@ public void analyzeReceipts() throws IOException { File sourceFile = new File("../documentintelligence/azure-ai-documentintelligence/src/samples/resources/" + "sample-forms/receipts/contoso-allinone.jpg"); - SyncPoller analyzeReceiptPoller = + SyncPoller analyzeReceiptPoller = documentIntelligenceClient.beginAnalyzeDocument("prebuilt-receipt", - null, - null, - null, - null, - null, - null, - null, - new AnalyzeDocumentRequest().setBase64Source(Files.readAllBytes(sourceFile.toPath()))); + new AnalyzeDocumentOptions(Files.readAllBytes(sourceFile.toPath()))); AnalyzeResult receiptResults = analyzeReceiptPoller.getFinalResult(); for (int i = 0; i < receiptResults.getDocuments().size(); i++) { - Document analyzedReceipt = receiptResults.getDocuments().get(i); + AnalyzedDocument analyzedReceipt = receiptResults.getDocuments().get(i); Map receiptFields = analyzedReceipt.getFields(); System.out.printf("----------- Analyzing receipt info %d -----------%n", i); DocumentField merchantNameField = receiptFields.get("MerchantName"); @@ -183,7 +182,7 @@ public void buildModel() throws IOException { String blobContainerUrl = "{SAS_URL_of_your_container_in_blob_storage}"; // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. SyncPoller buildOperationPoller = - administrationClient.beginBuildDocumentModel(new BuildDocumentModelRequest("modelID", DocumentBuildMode.TEMPLATE) + administrationClient.beginBuildDocumentModel(new BuildDocumentModelOptions("modelID", DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl))); DocumentModelDetails documentModelDetails = buildOperationPoller.getFinalResult(); @@ -191,10 +190,10 @@ public void buildModel() throws IOException { // Model Info System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); System.out.printf("Model Description: %s%n", documentModelDetails.getDescription()); - System.out.printf("Model created on: %s%n%n", documentModelDetails.getCreatedDateTime()); + System.out.printf("Model created on: %s%n%n", documentModelDetails.getCreatedOn()); - System.out.println("Document Fields:"); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { + System.out.println("AnalyzedDocument Fields:"); + documentModelDetails.getDocumentTypes().forEach((key, documentTypeDetails) -> { documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { System.out.printf("Field: %s", field); System.out.printf("Field type: %s", documentFieldSchema.getType()); @@ -209,23 +208,18 @@ public void analyzeCustomModel() { // BEGIN: com.azure.ai.documentintelligence.readme.analyzeCustomModel String documentUrl = "{document-url}"; String modelId = "{custom-built-model-ID}"; - SyncPoller analyzeDocumentPoller = documentIntelligenceClient.beginAnalyzeDocument(modelId, - "1", - "en-US", - StringIndexType.TEXT_ELEMENTS, - Arrays.asList(DocumentAnalysisFeature.LANGUAGES), - null, - ContentFormat.TEXT, - null, - new AnalyzeDocumentRequest().setUrlSource(documentUrl)); + SyncPoller analyzeDocumentPoller = documentIntelligenceClient.beginAnalyzeDocument(modelId, + new AnalyzeDocumentOptions(documentUrl).setPages(Collections.singletonList("1")).setLocale("en-US") + .setStringIndexType(StringIndexType.TEXT_ELEMENTS).setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.LANGUAGES)) + .setOutputContentFormat(DocumentContentFormat.TEXT)); AnalyzeResult analyzeResult = analyzeDocumentPoller.getFinalResult(); for (int i = 0; i < analyzeResult.getDocuments().size(); i++) { - final Document analyzedDocument = analyzeResult.getDocuments().get(i); + final AnalyzedDocument analyzedDocument = analyzeResult.getDocuments().get(i); System.out.printf("----------- Analyzing custom document %d -----------%n", i); System.out.printf("Analyzed document has doc type %s with confidence : %.2f%n", - analyzedDocument.getDocType(), analyzedDocument.getConfidence()); + analyzedDocument.getDocumentType(), analyzedDocument.getConfidence()); } analyzeResult.getPages().forEach(documentPage -> { @@ -267,7 +261,7 @@ public void analyzeCustomModel() { public void manageModels() { // BEGIN: com.azure.ai.documentintelligence.readme.manageModels - ResourceDetails resourceDetails = administrationClient.getResourceInfo(); + DocumentIntelligenceResourceDetails resourceDetails = administrationClient.getResourceDetails(); System.out.printf("The resource has %s models, and we can have at most %s models.%n", resourceDetails.getCustomDocumentModels().getCount(), resourceDetails.getCustomDocumentModels().getLimit()); @@ -280,9 +274,9 @@ public void manageModels() { DocumentModelDetails documentModel = administrationClient.getModel(documentModelInfo.getModelId()); System.out.printf("Model ID: %s%n", documentModel.getModelId()); System.out.printf("Model Description: %s%n", documentModel.getDescription()); - System.out.printf("Model created on: %s%n", documentModel.getCreatedDateTime()); - if (documentModel.getDocTypes() != null) { - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { + System.out.printf("Model created on: %s%n", documentModel.getCreatedOn()); + if (documentModel.getDocumentTypes() != null) { + documentModel.getDocumentTypes().forEach((key, documentTypeDetails) -> { documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { System.out.printf("Field: %s, ", field); System.out.printf("Field type: %s, ", documentFieldSchema.getType()); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentClassifier.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentClassifier.java deleted file mode 100644 index 6f3632eb7ec0..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentClassifier.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; -import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; -import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.util.polling.SyncPoller; - -import java.util.HashMap; - -/** - * Sample to build a classifier model with training data. - * For instructions on setting up documents for training in an Azure Storage Blob Container, see - * here. - *

- * For this sample, you can use the training documents found in - * here - * to create your own custom document analysis models. - * For instructions to create a label file for your training forms, please see: - * here. - *

- * Further, see AnalyzeDocumentWithClassifier.java to analyze a document with your custom classifier built model. - */ -public class BuildDocumentClassifier { - - /** - * Main method to invoke this demo. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - // Build custom classifier document model - String blobContainerUrl1040D = "{SAS_URL_of_your_container_in_blob_storage}"; - String blobContainerUrl1040A = "{SAS_URL_of_your_container_in_blob_storage}"; - - HashMap docTypes = new HashMap<>(); - docTypes.put("1040-A", new ClassifierDocumentTypeDetails().setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040A) - )); - docTypes.put("1040-D", new ClassifierDocumentTypeDetails().setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040D) - )); - - SyncPoller buildOperationPoller - = client.beginBuildClassifier(new BuildDocumentClassifierRequest("classifierId", docTypes)); - DocumentClassifierDetails documentClassifierDetails = buildOperationPoller.getFinalResult(); - - System.out.printf("Classifier ID: %s%n", documentClassifierDetails.getClassifierId()); - System.out.printf("Classifier description: %s%n", documentClassifierDetails.getDescription()); - System.out.printf("Classifier created on: %s%n", documentClassifierDetails.getCreatedDateTime()); - System.out.printf("Classifier expires on: %s%n", documentClassifierDetails.getExpirationDateTime()); - documentClassifierDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s", documentTypeDetails - .getAzureBlobSource().getContainerUrl()); - } - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentClassifierAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentClassifierAsync.java deleted file mode 100644 index 3a865a0c847e..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentClassifierAsync.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; -import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; -import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.util.polling.SyncPoller; - -import java.util.HashMap; - -/** - * Sample to build a classifier model with training data. - * For instructions on setting up documents for training in an Azure Storage Blob Container, see - * here. - *

- * For this sample, you can use the training documents found in - * here - * to create your own custom document analysis models. - * For instructions to create a label file for your training forms, please see: - * here. - *

- * Further, see AnalyzeDocumentWithClassifier.java to analyze a document with your custom classifer built model. - */ -public class BuildDocumentClassifierAsync { - - /** - * Main method to invoke this demo. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - String blobContainerUrl1040D = "{SAS_URL_of_your_container_in_blob_storage}"; - String blobContainerUrl1040A = "{SAS_URL_of_your_container_in_blob_storage}"; - HashMap docTypes = new HashMap<>(); - docTypes.put("1040-D", new ClassifierDocumentTypeDetails().setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040D) - )); - docTypes.put("1040-A", new ClassifierDocumentTypeDetails().setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040A) - )); - - SyncPoller classifierPoller = - client.beginBuildClassifier(new BuildDocumentClassifierRequest("classifierID", docTypes)); - - DocumentClassifierDetails documentClassifierDetails = classifierPoller.getFinalResult(); - - // Classifier model Info - System.out.printf("Classifier ID: %s%n", documentClassifierDetails.getClassifierId()); - System.out.printf("Classifier description: %s%n", documentClassifierDetails.getDescription()); - System.out.printf("Classifier created on: %s%n", documentClassifierDetails.getCreatedDateTime()); - System.out.printf("Classifier expires on: %s%n", documentClassifierDetails.getExpirationDateTime()); - documentClassifierDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s", (documentTypeDetails - .getAzureBlobSource()).getContainerUrl()); - } - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentModel.java deleted file mode 100644 index 8a59fed06dca..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentModel.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; -import com.azure.ai.documentintelligence.models.DocumentBuildMode; -import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; -import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.util.polling.SyncPoller; - -/** - * Sample to build a model with training data. - * For instructions on setting up documents for training in an Azure Storage Blob Container, see - * here. - *

- * For this sample, you can use the training documents found in - * here - * to create your own custom document analysis models. - * For instructions to create a label file for your training forms, please see: - * here. - *

- * Further, see AnalyzeCustomDocumentFromUrl.java to analyze a custom document with your built model. - */ -public class BuildDocumentModel { - - /** - * Main method to invoke this demo. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - // Build custom document analysis model - String blobContainerUrl = "{SAS_URL_of_your_container_in_blob_storage}"; - // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. - SyncPoller buildOperationPoller = - client.beginBuildDocumentModel(new BuildDocumentModelRequest("modelID", DocumentBuildMode.TEMPLATE) - .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl))); - - DocumentModelDetails documentModelDetails = buildOperationPoller.getFinalResult(); - - // Model Info - System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); - System.out.printf("Model Description: %s%n", documentModelDetails.getDescription()); - System.out.printf("Model created on: %s%n%n", documentModelDetails.getCreatedDateTime()); - - System.out.println("Document Fields:"); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentModelAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentModelAsync.java deleted file mode 100644 index 43cb8a2d4026..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/BuildDocumentModelAsync.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; -import com.azure.ai.documentintelligence.models.DocumentBuildMode; -import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; -import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.util.polling.PollerFlux; -import reactor.core.publisher.Mono; - -import java.util.concurrent.TimeUnit; - -/** - * Async sample to build a model with training data. - * For instructions on setting up documents for training in an Azure Storage Blob Container, see - * here. - *

- * For this sample, you can use the training documents found in - * here - * to create your own custom document analysis models. - * For instructions to create a label file for your training forms, please see: - * here. - *

- * Further, see AnalyzeCustomDocumentAsync.java to analyze a custom document with your built model. - */ -public class BuildDocumentModelAsync { - - /** - * Main method to invoke this demo. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationAsyncClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildAsyncClient(); - - String blobContainerUrl = "{SAS_URL_of_your_container_in_blob_storage}"; - // The shared access signature (SAS) Url of your Azure Blob Storage container with your forms. - String prefix = "{blob_name_prefix}"; - PollerFlux buildModelPoller = - client.beginBuildDocumentModel(new BuildDocumentModelRequest("modelID", DocumentBuildMode.TEMPLATE) - .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl))); - - Mono customFormModelResult = buildModelPoller - .last() - .flatMap(pollResponse -> { - if (pollResponse.getStatus().isComplete()) { - // building model completed successfully, retrieving final result. - return pollResponse.getFinalResult(); - } else { - return Mono.error(new RuntimeException("Polling completed unsuccessfully with status:" - + pollResponse.getStatus())); - } - }); - - customFormModelResult.subscribe(documentModel -> { - System.out.printf("Model Description: %s%n", documentModel.getDescription()); - System.out.printf("Model created on: %s%n%n", documentModel.getCreatedDateTime()); - - System.out.println("Document Fields:"); - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - }); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.MINUTES.sleep(1); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ComposeDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ComposeDocumentModel.java deleted file mode 100644 index f8d40b11cd09..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ComposeDocumentModel.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; -import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.core.credential.AzureKeyCredential; - -import java.time.Duration; - -/** - * Sample for creating a custom document analysis composed model. - *

- * This is useful when you have build different analysis models and want to aggregate a group of - * them into a single model that you (or a user) could use to analyze a custom document. When doing - * so, you can let the service decide which model more accurately represents the document to - * analyze, instead of manually trying each built model against the form and selecting - * the most accurate one. - *

- */ -public class ComposeDocumentModel { - - /** - * Main method to invoke this demo. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - String composedModelId = "my-composed-model"; - final DocumentModelDetails documentModelDetails = - client.beginComposeModel( - new ComposeDocumentModelRequest(composedModelId, "classifierId", null) - .setDescription("my composed model description")) - .setPollInterval(Duration.ofSeconds(5)) - .getFinalResult(); - - System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); - System.out.printf("Model description: %s%n", documentModelDetails.getDescription()); - System.out.printf("Composed model created on: %s%n", documentModelDetails.getCreatedDateTime()); - - System.out.println("Document Fields:"); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - } -} - diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ComposeDocumentModelAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ComposeDocumentModelAsync.java deleted file mode 100644 index 0e53286410e3..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ComposeDocumentModelAsync.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; -import com.azure.core.credential.AzureKeyCredential; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -/** - * Sample for creating a custom document analysis composed model. - *

- * This is useful when you have build different analysis models and want to aggregate a group of - * them into a single model that you (or a user) could use to analyze a custom document. When doing - * so, you can let the service decide which model more accurately represents the document to - * analyze, instead of manually trying each built model against the form and selecting - * the most accurate one. - *

- */ -public class ComposeDocumentModelAsync { - - /** - * Main method to invoke this demo. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationAsyncClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildAsyncClient(); - - client.beginComposeModel( - new ComposeDocumentModelRequest("composedModelId", "classifierId", null) - .setDescription("my composed model description")) - .setPollInterval(Duration.ofSeconds(5)) - .flatMap(asyncPollResponse -> asyncPollResponse.getFinalResult()) - .subscribe(documentModel -> { - - System.out.printf("Model ID: %s%n", documentModel.getModelId()); - System.out.printf("Model Description: %s%n", documentModel.getDescription()); - System.out.printf("Composed model created on: %s%n", documentModel.getCreatedDateTime()); - - System.out.println("Document Fields:"); - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - }); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.MINUTES.sleep(1); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -} - diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/CopyDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/CopyDocumentModel.java deleted file mode 100644 index 5a8f151ff0c6..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/CopyDocumentModel.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; -import com.azure.ai.documentintelligence.models.CopyAuthorization; -import com.azure.ai.documentintelligence.models.DocumentModelCopyToOperationDetails; -import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.util.polling.SyncPoller; - -/** - * Sample for copying a custom document analysis model from a source Form Recognizer resource to a target Form Recognizer resource. - */ -public class CopyDocumentModel { - - /** - * Main method to invoke this demo. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a source client which has the model that we want to copy. - DocumentIntelligenceAdministrationClient sourceClient = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - // Instantiate the target client where we want to copy the custom document analysis model to. - DocumentIntelligenceAdministrationClient targetClient = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - String copiedModelId = "my-copied-model"; - - // Get authorization to copy the model to target resource - CopyAuthorization modelDocumentModelCopyAuthorization - = targetClient.authorizeModelCopy(new AuthorizeCopyRequest(copiedModelId)); - - // The ID of the model that needs to be copied to the target resource - String copyModelId = "copy-model-ID"; - // Start copy operation from the source client - SyncPoller copyPoller = sourceClient.beginCopyModelTo(copyModelId, - modelDocumentModelCopyAuthorization); - copyPoller.waitForCompletion(); - - // Get the copied model - DocumentModelDetails copiedModel = targetClient.getModel(modelDocumentModelCopyAuthorization.getTargetModelId()); - - System.out.printf("Copied model has model ID: %s, was created on: %s.%n", - copiedModel.getModelId(), - copiedModel.getCreatedDateTime()); - } -} - diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/CopyDocumentModelAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/CopyDocumentModelAsync.java deleted file mode 100644 index fab2e5b88348..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/CopyDocumentModelAsync.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; -import com.azure.core.credential.AzureKeyCredential; - -import java.util.concurrent.TimeUnit; - -/** - * Async sample for copying a custom document analysis model from a source Form Recognizer resource to a target Form Recognizer resource. - */ -public class CopyDocumentModelAsync { - - /** - * Main method to invoke this demo. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a source client which has the model that we want to copy. - DocumentIntelligenceAdministrationAsyncClient sourceClient = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildAsyncClient(); - - // Instantiate the target client where we want to copy the custom document analysis model to. - DocumentIntelligenceAdministrationAsyncClient targetClient = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildAsyncClient(); - - String copiedModelId = "my-copied-model"; - // The ID of the model that needs to be copied to the target resource - String copyModelId = "copy-model-ID"; - - // Get authorization to copy the model to target resource - targetClient.authorizeModelCopy(new AuthorizeCopyRequest(copyModelId)) - // Start copy operation from the source client - // The ID of the model that needs to be copied to the target resource - .subscribe(copyAuthorization -> sourceClient.beginCopyModelTo(copyModelId, copyAuthorization) - .filter(pollResponse -> pollResponse.getStatus().isComplete()) - .flatMap(asyncPollResponse -> asyncPollResponse.getFinalResult()) - .subscribe(documentModelInfo -> { - System.out.printf("Original model has model ID: %s and was created on: %s.%n", - documentModelInfo.getModelId(), - documentModelInfo.getCreatedDateTime()); - - // Get the copied model from the target resource - targetClient.getModel(copyAuthorization.getTargetModelId()).subscribe(documentModel -> - System.out.printf("Copied model has model ID: %s was created on: %s.%n", - documentModel.getModelId(), - documentModel.getCreatedDateTime())); - })); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(30); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/DocumentModelAdminAsyncClientJavaDocCodeSnippets.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/DocumentModelAdminAsyncClientJavaDocCodeSnippets.java deleted file mode 100644 index 9f05f09a8163..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/DocumentModelAdminAsyncClientJavaDocCodeSnippets.java +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; -import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; -import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; -import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; -import com.azure.ai.documentintelligence.models.CopyAuthorization; -import com.azure.ai.documentintelligence.models.DocumentBuildMode; -import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; -import com.azure.ai.documentintelligence.models.OperationStatus; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.identity.DefaultAzureCredentialBuilder; - -import java.util.HashMap; - -/** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient} - */ -public class DocumentModelAdminAsyncClientJavaDocCodeSnippets { - private final DocumentIntelligenceAdministrationAsyncClient documentIntelligenceAdministrationAsyncClient = - new DocumentIntelligenceAdministrationClientBuilder().buildAsyncClient(); - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient} initialization - */ - public void documentModelAdministrationAsyncClientInitialization() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.initialization - DocumentIntelligenceAdministrationAsyncClient client = new DocumentIntelligenceAdministrationClientBuilder() - .endpoint("{endpoint}") - .credential(new DefaultAzureCredentialBuilder().build()) - .buildAsyncClient(); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.initialization - } - - public void documentModelAdministrationAsyncClientKeyCred() { - // BEGIN: readme-sample-createDocumentModelAdministrationAsyncClient - DocumentIntelligenceAdministrationAsyncClient documentIntelligenceAdministrationAsyncClient = - new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildAsyncClient(); - // END: readme-sample-createDocumentModelAdministrationAsyncClient - } - - /** - * Code snippet for creating a {@link DocumentIntelligenceAdministrationAsyncClient} with pipeline - */ - public void createDocumentModelAdministrationAsyncClientWithPipeline() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.pipeline.instantiation - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(/* add policies */) - .build(); - - DocumentIntelligenceAdministrationAsyncClient documentIntelligenceAdministrationAsyncClient = - new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .pipeline(pipeline) - .buildAsyncClient(); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.pipeline.instantiation - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#beginBuildDocumentModel(BuildDocumentModelRequest)} - */ - public void beginBuildModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginBuildDocumentModel#BuildDocumentModelRequest - String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}"; - documentIntelligenceAdministrationAsyncClient.beginBuildDocumentModel( - new BuildDocumentModelRequest("modelID", DocumentBuildMode.TEMPLATE) - .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl))) - // if polling operation completed, retrieve the final result. - .flatMap(asyncPollResponse -> asyncPollResponse.getFinalResult()) - .subscribe(documentModel -> { - System.out.printf("Model ID: %s%n", documentModel.getModelId()); - System.out.printf("Model Created on: %s%n", documentModel.getCreatedDateTime()); - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginBuildDocumentModel#BuildDocumentModelRequest - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#beginBuildClassifier(BinaryData, RequestOptions)} - */ - public void beginBuildClassifier() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginBuildClassifier#BuildDocumentClassifierRequest - String blobContainerUrl1040D = "{SAS_URL_of_your_container_in_blob_storage}"; - String blobContainerUrl1040A = "{SAS_URL_of_your_container_in_blob_storage}"; - HashMap documentTypesDetailsMap = new HashMap<>(); - documentTypesDetailsMap.put("1040-D", new ClassifierDocumentTypeDetails().setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040D) - )); - documentTypesDetailsMap.put("1040-A", new ClassifierDocumentTypeDetails().setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040A) - )); - - documentIntelligenceAdministrationAsyncClient.beginBuildClassifier(new BuildDocumentClassifierRequest("classifierID", documentTypesDetailsMap)) - // if polling operation completed, retrieve the final result. - .flatMap(asyncPollResponse -> asyncPollResponse.getFinalResult()) - .subscribe(classifierDetails -> { - System.out.printf("Classifier ID: %s%n", classifierDetails.getClassifierId()); - System.out.printf("Classifier description: %s%n", classifierDetails.getDescription()); - System.out.printf("Classifier created on: %s%n", classifierDetails.getCreatedDateTime()); - System.out.printf("Classifier expires on: %s%n", classifierDetails.getExpirationDateTime()); - classifierDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s", (documentTypeDetails - .getAzureBlobSource()).getContainerUrl()); - } - }); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginBuildClassifier#BuildDocumentClassifierRequest - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#deleteModel(String)} - */ - public void deleteModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteModel#string - String modelId = "{model_id}"; - documentIntelligenceAdministrationAsyncClient.deleteModel(modelId) - .subscribe(ignored -> System.out.printf("Model ID: %s is deleted%n", modelId)); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteModel#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#deleteModelWithResponse(String, RequestOptions)} - */ - public void deleteModelWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteModelWithResponse#string-RequestOptions - String modelId = "{model_id}"; - documentIntelligenceAdministrationAsyncClient.deleteModelWithResponse(modelId, null) - .subscribe(response -> { - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - System.out.printf("Model ID: %s is deleted.%n", modelId); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteModelWithResponse#string-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#authorizeModelCopy(AuthorizeCopyRequest)} - */ - public void authorizeModelCopy() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.authorizeModelCopy - String modelId = "my-copied-model"; - documentIntelligenceAdministrationAsyncClient.authorizeModelCopy(new AuthorizeCopyRequest(modelId)) - .subscribe(copyAuthorization -> - System.out.printf("Copy Authorization for model id: %s, access token: %s, expiration time: %s, " - + "target resource ID; %s, target resource region: %s%n", - copyAuthorization.getTargetModelId(), - copyAuthorization.getAccessToken(), - copyAuthorization.getExpirationDateTime(), - copyAuthorization.getTargetResourceId(), - copyAuthorization.getTargetResourceRegion() - )); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.authorizeModelCopy - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#authorizeModelCopyWithResponse(BinaryData, RequestOptions)} - */ - public void authorizeModelCopyWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.authorizeModelCopyWithResponse#Options - /* - String modelId = "my-copied-model"; - Map attrs = new HashMap(); - attrs.put("createdBy", "sample"); - - documentModelAdministrationAsyncClient.authorizeModelCopyWithResponse( - new AuthorizeCopyRequest(modelId) - .setDescription("model desc") - .setTags(attrs), null) - .subscribe(copyAuthorization -> - System.out.printf("Copy Authorization response status: %s, for model id: %s, access token: %s, " - + "expiration time: %s, target resource ID; %s, target resource region: %s%n", - copyAuthorization.getStatusCode(), - copyAuthorization.getValue().getTargetModelId(), - copyAuthorization.getValue().getAccessToken(), - copyAuthorization.getValue().getExpirationDateTime(), - copyAuthorization.getValue().getTargetResourceId(), - copyAuthorization.getValue().getTargetResourceRegion() - )); - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.authorizeModelCopyWithResponse#Options - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getResourceInfo()} - */ - public void getResourceInfo() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getResourceInfo - documentIntelligenceAdministrationAsyncClient.getResourceInfo() - .subscribe(resourceInfo -> { - System.out.printf("Max number of models that can be build for this account: %d%n", - resourceInfo.getCustomDocumentModels().getLimit()); - System.out.printf("Current count of built document analysis models: %d%n", - resourceInfo.getCustomDocumentModels().getCount()); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getResourceInfo - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getResourceInfoWithResponse(RequestOptions)} - */ - public void getResourceInfoWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getResourceInfoWithResponse - /*documentModelAdministrationAsyncClient.getResourceInfoWithResponse(new RequestOptions()) - .subscribe(response -> { - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - ResourceDetails resourceDetails = response.getValue(); - System.out.printf("Max number of models that can be build for this account: %d%n", - resourceDetails.getCustomDocumentModelLimit()); - System.out.printf("Current count of built document analysis models: %d%n", - resourceDetails.getCustomDocumentModelCount()); - }); - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getResourceInfoWithResponse - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#beginComposeModel(BinaryData, RequestOptions)} - */ - public void beginCreateComposedModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginComposeDocumentModel#ComposeDocumentModelRequest - documentIntelligenceAdministrationAsyncClient.beginComposeModel( - new ComposeDocumentModelRequest("composedModelID", "classifierId", null) - .setDescription("my composed model description")) - // if polling operation completed, retrieve the final result. - .flatMap(asyncPollResponse -> asyncPollResponse.getFinalResult()) - .subscribe(documentModel -> { - System.out.printf("Model ID: %s%n", documentModel.getModelId()); - System.out.printf("Model Created on: %s%n", documentModel.getCreatedDateTime()); - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginComposeDocumentModel#ComposeDocumentModelRequest - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#beginCopyModelTo(String, CopyAuthorization)} - */ - public void beginCopy() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginCopyDocumentModelTo#AuthorizeCopyRequest - String copyModelId = "copy-model"; - // Get authorization to copy the model to target resource - documentIntelligenceAdministrationAsyncClient.authorizeModelCopy(new AuthorizeCopyRequest(copyModelId)) - // Start copy operation from the source client - // The ID of the model that needs to be copied to the target resource - .subscribe(copyAuthorization -> documentIntelligenceAdministrationAsyncClient.beginCopyModelTo(copyModelId, - copyAuthorization) - .filter(pollResponse -> pollResponse.getStatus().isComplete()) - .flatMap(asyncPollResponse -> asyncPollResponse.getFinalResult()) - .subscribe(documentModel -> - System.out.printf("Copied model has model ID: %s, was created on: %s.%n,", - documentModel.getModelId(), - documentModel.getCreatedDateTime()))); - - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.beginCopyDocumentModelTo#AuthorizeCopyRequest - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#listModels()} - */ - public void listModels() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.listModels - documentIntelligenceAdministrationAsyncClient.listModels() - .subscribe(documentModelInfo -> - System.out.printf("Model ID: %s, Model description: %s, Created on: %s.%n", - documentModelInfo.getModelId(), - documentModelInfo.getDescription(), - documentModelInfo.getCreatedDateTime())); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.listModels - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getModel(String)} - */ - public void getModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getModel#string - String modelId = "{model_id}"; - documentIntelligenceAdministrationAsyncClient.getModel(modelId).subscribe(documentModel -> { - System.out.printf("Model ID: %s%n", documentModel.getModelId()); - System.out.printf("Model Description: %s%n", documentModel.getDescription()); - System.out.printf("Model Created on: %s%n", documentModel.getCreatedDateTime()); - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getModel#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getModelWithResponse(String, RequestOptions)} - */ - public void getModelWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getModelWithResponse#string-RequestOptions - /*String modelId = "{model_id}"; - documentModelAdministrationAsyncClient.getModelWithResponse(modelId, null) - .subscribe(response -> { - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - DocumentModelDetails documentModelDetails = response.getValue(); - System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); - System.out.printf("Model Description: %s%n", documentModelDetails.getDescription()); - System.out.printf("Model Created on: %s%n", documentModelDetails.getCreatedDateTime()); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - }); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getModelWithResponse#string-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getModel(String)} - */ - public void getOperation() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getOperation#string - String operationId = "{operation_Id}"; - documentIntelligenceAdministrationAsyncClient.getOperation(operationId).subscribe(operationDetails -> { - System.out.printf("Operation ID: %s%n", operationDetails.getOperationId()); - System.out.printf("Operation Status: %s%n", operationDetails.getStatus()); - System.out.printf("Model ID created with this operation: %s%n", - ((DocumentModelBuildOperationDetails) operationDetails).getResult().getModelId()); - if (OperationStatus.FAILED.equals(operationDetails.getStatus())) { - System.out.printf("Operation fail error: %s%n", operationDetails.getError().getMessage()); - } - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getOperation#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getOperationWithResponse(String, RequestOptions)} - */ - public void getOperationWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getOperationWithResponse#string-RequestOptions - /*String operationId = "{operation_Id}"; - documentModelAdministrationAsyncClient.getOperationWithResponse(operationId, null) - .subscribe(response -> { - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - OperationDetails operationDetails = response.getValue(); - System.out.printf("Operation ID: %s%n", operationDetails.getOperationId()); - System.out.printf("Operation Status: %s%n", operationDetails.getStatus()); - System.out.printf("Model ID created with this operation: %s%n", - ((DocumentModelBuildOperationDetails) operationDetails).getResult().getModelId()); - if (OperationStatus.FAILED.equals(operationDetails.getStatus())) { - System.out.printf("Operation fail error: %s%n", operationDetails.getError().getMessage()); - } - }); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getOperationWithResponse#string-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#listOperations()} - */ - public void listOperations() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.listOperations - documentIntelligenceAdministrationAsyncClient.listOperations() - .subscribe(modelOperationSummary -> { - System.out.printf("Operation ID: %s%n", modelOperationSummary.getOperationId()); - System.out.printf("Operation Status: %s%n", modelOperationSummary.getStatus()); - System.out.printf("Operation Created on: %s%n", modelOperationSummary.getCreatedDateTime()); - System.out.printf("Operation Percent completed: %d%n", modelOperationSummary.getPercentCompleted()); - System.out.printf("Operation Last updated on: %s%n", modelOperationSummary.getLastUpdatedDateTime()); - System.out.printf("Operation resource location: %s%n", modelOperationSummary.getResourceLocation()); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.listOperations - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#deleteClassifier(String)} - */ - public void deleteClassifier() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteDocumentClassifier#string - String classifierId = "{classifierId}"; - documentIntelligenceAdministrationAsyncClient.deleteClassifier(classifierId) - .subscribe(ignored -> System.out.printf("Classifier ID: %s is deleted%n", classifierId)); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteDocumentClassifier#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#deleteClassifierWithResponse(String, RequestOptions)} - */ - public void deleteClassifierWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteDocumentClassifierWithResponse#string-RequestOptions - String classifierId = "{classifierId}"; - documentIntelligenceAdministrationAsyncClient.deleteClassifierWithResponse(classifierId, new RequestOptions()) - .subscribe(response -> { - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - System.out.printf("Classifier ID: %s is deleted.%n", classifierId); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.deleteDocumentClassifierWithResponse#string-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#listClassifiers()} - */ - public void listClassifiers() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.listDocumentClassifiers - documentIntelligenceAdministrationAsyncClient.listClassifiers() - .subscribe(documentModelInfo -> - System.out.printf("Classifier ID: %s, Classifier description: %s, Created on: %s.%n", - documentModelInfo.getClassifierId(), - documentModelInfo.getDescription(), - documentModelInfo.getCreatedDateTime())); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.listDocumentClassifiers - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getClassifier(String)} - */ - public void getDocumentClassifier() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getDocumentClassifier#string - String modelId = "{model_id}"; - documentIntelligenceAdministrationAsyncClient.getClassifier(modelId).subscribe(documentClassifier -> { - System.out.printf("Classifier ID: %s%n", documentClassifier.getClassifierId()); - System.out.printf("Classifier Description: %s%n", documentClassifier.getDescription()); - System.out.printf("Classifier Created on: %s%n", documentClassifier.getCreatedDateTime()); - documentClassifier.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s", (documentTypeDetails - .getAzureBlobSource()).getContainerUrl()); - } - if (documentTypeDetails.getAzureBlobFileListSource() != null) { - System.out.printf("Blob File List Source container Url: %s", - (documentTypeDetails - .getAzureBlobFileListSource()).getContainerUrl()); - } - }); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getDocumentClassifier#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationAsyncClient#getClassifierWithResponse(String, RequestOptions)} - */ - public void getClassifierWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getDocumentClassifierWithResponse#string-RequestOptions - /*String modelId = "{model_id}"; - documentModelAdministrationAsyncClient.getClassifierWithResponse(modelId, new RequestOptions()) - .subscribe(response -> { - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - DocumentClassifierDetails documentClassifierDetails = response.getValue(); - System.out.printf("Classifier ID: %s%n", documentClassifierDetails.getClassifierId()); - System.out.printf("Classifier Description: %s%n", documentClassifierDetails.getDescription()); - System.out.printf("Classifier Created on: %s%n", documentClassifierDetails.getCreatedDateTime()); - documentClassifierDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getContentSource() instanceof AzureBlobContentSource) { - System.out.printf("Blob Source container Url: %s", ((AzureBlobContentSource) documentTypeDetails - .getContentSource()).getContainerUrl()); - } - if (documentTypeDetails.getContentSource() instanceof BlobFileListContentSource) { - System.out.printf("Blob File List Source container Url: %s", - ((BlobFileListContentSource) documentTypeDetails - .getContentSource()).getContainerUrl()); - } - }); - }); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminAsyncClient.getDocumentClassifierWithResponse#string-RequestOptions - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/DocumentModelAdminClientJavaDocCodeSnippets.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/DocumentModelAdminClientJavaDocCodeSnippets.java deleted file mode 100644 index 147037112129..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/DocumentModelAdminClientJavaDocCodeSnippets.java +++ /dev/null @@ -1,516 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; -import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; -import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; -import com.azure.ai.documentintelligence.models.CopyAuthorization; -import com.azure.ai.documentintelligence.models.DocumentBuildMode; -import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; -import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; -import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.ai.documentintelligence.models.OperationDetails; -import com.azure.ai.documentintelligence.models.OperationStatus; -import com.azure.ai.documentintelligence.models.ResourceDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.identity.DefaultAzureCredentialBuilder; - -import java.util.HashMap; - -/** - * Code snippet for {@link DocumentIntelligenceAdministrationClient} - */ -public class DocumentModelAdminClientJavaDocCodeSnippets { - private final DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient = - new DocumentIntelligenceAdministrationClientBuilder().buildClient(); - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient} initialization - */ - public void documentModelAdministrationClientInInitialization() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.initialization - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .endpoint("{endpoint}") - .credential(new DefaultAzureCredentialBuilder().build()) - .buildClient(); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.initialization - } - - /** - * Code snippet for getting sync DocumentModelAdministration client using the AzureKeyCredential authentication. - */ - public void documentModelAdministrationClientKeyCred() { - // BEGIN: readme-sample-createDocumentModelAdministrationClient - DocumentIntelligenceAdministrationClient client = - new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("{endpoint}") - .buildClient(); - // END: readme-sample-createDocumentModelAdministrationClient - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#beginBuildDocumentModel(BinaryData, RequestOptions)} - */ - public void beginBuildModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginBuildDocumentModel#BuildDocumentModelRequest - String blobContainerUrl = "{SAS-URL-of-your-container-in-blob-storage}"; - DocumentModelDetails documentModelDetails - = documentIntelligenceAdministrationClient.beginBuildDocumentModel( - new BuildDocumentModelRequest("modelID", DocumentBuildMode.TEMPLATE) - .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl))) - .getFinalResult(); - - System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); - System.out.printf("Model Created on: %s%n", documentModelDetails.getCreatedDateTime()); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginBuildDocumentModel#BuildDocumentModelRequest - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getResourceInfo()} - */ - public void getResourceInfo() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getResourceInfo - ResourceDetails resourceDetails = documentIntelligenceAdministrationClient.getResourceInfo(); - System.out.printf("Max number of models that can be build for this account: %d%n", - resourceDetails.getCustomDocumentModels().getLimit()); - System.out.printf("Current count of built document analysis models: %d%n", - resourceDetails.getCustomDocumentModels().getCount()); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getResourceInfo - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getResourceInfoWithResponse(RequestOptions)} - */ - public void getResourceInfoWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getResourceInfoWithResponse#RequestOptions - /*Response response = - documentModelAdministrationClient.getResourceInfoWithResponse(new RequestOptions()); - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - ResourceDetails resourceDetails = response.getValue(); - System.out.printf("Max number of models that can be build for this account: %d%n", - resourceDetails.getCustomDocumentModels().getLimit()); - System.out.printf("Current count of built document analysis models: %d%n", - resourceDetails.getCustomDocumentModels().getCount()); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getResourceInfoWithResponse#RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#deleteModel(String)} - */ - public void deleteModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentModel#string - String modelId = "{custom-model-id}"; - documentIntelligenceAdministrationClient.deleteModel(modelId); - System.out.printf("Model ID: %s is deleted.%n", modelId); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentModel#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#deleteModelWithResponse(String, RequestOptions)} - */ - public void deleteModelWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentModelWithResponse#string-RequestOptions - String modelId = "{custom-model-id}"; - Response response - = documentIntelligenceAdministrationClient.deleteModelWithResponse(modelId, new RequestOptions()); - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - System.out.printf("Model ID: %s is deleted.%n", modelId); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentModelWithResponse#string-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#authorizeModelCopy(AuthorizeCopyRequest)} - */ - public void getCopyAuthorization() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getCopyAuthorization#AuthorizeCopyRequest - CopyAuthorization documentModelCopyAuthorization - = documentIntelligenceAdministrationClient.authorizeModelCopy(new AuthorizeCopyRequest("copyModelID")); - System.out.printf("Copy Authorization for model id: %s, access token: %s, expiration time: %s, " - + "target resource ID; %s, target resource region: %s%n", - documentModelCopyAuthorization.getTargetModelId(), - documentModelCopyAuthorization.getAccessToken(), - documentModelCopyAuthorization.getExpirationDateTime(), - documentModelCopyAuthorization.getTargetResourceId(), - documentModelCopyAuthorization.getTargetResourceRegion() - ); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getCopyAuthorization#AuthorizeCopyRequest - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#authorizeModelCopyWithResponse(BinaryData, RequestOptions)} - */ - public void getCopyAuthorizationWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getCopyAuthorizationWithResponse#AuthorizeCopyRequest-RequestOptions - /*String modelId = "my-copied-model"; - Map attrs = new HashMap(); - attrs.put("createdBy", "sample"); - - Response copyAuthorizationResponse = - documentModelAdministrationClient.authorizeModelCopyWithResponse( - new AuthorizeCopyRequest(modelId) - .setDescription("model-desc") - .setTags(attrs), new RequestOptions()); - - System.out.printf("Copy Authorization operation returned with status: %s", - copyAuthorizationResponse.getStatusCode()); - DocumentModelCopyAuthorization documentModelCopyAuthorization = copyAuthorizationResponse.getValue(); - System.out.printf("Copy Authorization for model id: %s, access token: %s, " - + "expiration time: %s, target resource ID; %s, target resource region: %s%n", - documentModelCopyAuthorization.getTargetModelId(), - documentModelCopyAuthorization.getAccessToken(), - documentModelCopyAuthorization.getExpirationDateTime(), - documentModelCopyAuthorization.getTargetResourceId(), - documentModelCopyAuthorization.getTargetResourceRegion() - ); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getCopyAuthorizationWithResponse#AuthorizeCopyRequest-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#beginComposeModel(BinaryData, RequestOptions)} - */ - public void beginCreateComposedModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginComposeDocumentModel#list-RequestOptions - /*String modelId1 = "{custom-model-id_1}"; - String modelId2 = "{custom-model-id_2}"; - final DocumentModelDetails documentModelDetails - = documentModelAdministrationClient.beginComposeModel(new ComposeDocumentModelRequest("composedModelID", Arrays.asList(new ComponentDocumentModelDetails(modelId1), new ComponentDocumentModelDetails(modelId2))), new RequestOptions()) - .getFinalResult(); - - System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); - System.out.printf("Model Description: %s%n", documentModelDetails.getDescription()); - System.out.printf("Model Created on: %s%n", documentModelDetails.getCreatedDateTime()); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginComposeDocumentModel#list-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#beginCopyModelTo(String, CopyAuthorization)} - */ - public void beginCopy() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginCopyDocumentModelTo#string-copyAuthorization - String copyModelId = "copy-model"; - // Get authorization to copy the model to target resource - CopyAuthorization documentModelCopyAuthorization - = documentIntelligenceAdministrationClient.authorizeModelCopy(new AuthorizeCopyRequest(copyModelId)); - // Start copy operation from the source client - DocumentModelDetails documentModelDetails - = documentIntelligenceAdministrationClient.beginCopyModelTo(copyModelId, documentModelCopyAuthorization) - .getFinalResult(); - System.out.printf("Copied model has model ID: %s, was created on: %s.%n,", - documentModelDetails.getModelId(), - documentModelDetails.getCreatedDateTime()); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginCopyDocumentModelTo#string-copyAuthorization - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#listModels()} - */ - public void listModels() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.listModels - documentIntelligenceAdministrationClient.listModels() - .forEach(documentModel -> - System.out.printf("Model ID: %s, Model description: %s, Created on: %s.%n", - documentModel.getModelId(), - documentModel.getDescription(), - documentModel.getCreatedDateTime()) - ); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.listModels - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#listModels(RequestOptions)} - */ - public void listModelsWithContext() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.listModels#RequestOptions - /*documentModelAdministrationClient.listModels(new RequestOptions()) - .forEach(documentModel -> - System.out.printf("Model ID: %s, Model description: %s, Created on: %s.%n", - documentModel.getModelId(), - documentModel.getDescription(), - documentModel.getCreatedDateTime()) - ); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.listModels#RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getModel(String)} - */ - public void getModel() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getModel#string - String modelId = "{custom-model-id}"; - DocumentModelDetails documentModelDetails = documentIntelligenceAdministrationClient.getModel(modelId); - System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); - System.out.printf("Model Description: %s%n", documentModelDetails.getDescription()); - System.out.printf("Model Created on: %s%n", documentModelDetails.getCreatedDateTime()); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getModel#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getModelWithResponse(String, RequestOptions)} - */ - public void getModelWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getModelWithResponse#string-RequestOptions - String modelId = "{custom-model-id}"; - /*Response response - = documentModelAdministrationClient.getModelWithResponse(modelId, new RequestOptions()); - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - DocumentModelDetails documentModelDetails = response.getValue(); - System.out.printf("Model ID: %s%n", documentModelDetails.getModelId()); - System.out.printf("Model Description: %s%n", documentModelDetails.getDescription()); - System.out.printf("Model Created on: %s%n", documentModelDetails.getCreatedDateTime()); - documentModelDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s", field); - System.out.printf("Field type: %s", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getModelWithResponse#string-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getOperation(String)} - */ - public void getOperation() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getOperation#string - String operationId = "{operation-id}"; - OperationDetails operationDetails - = documentIntelligenceAdministrationClient.getOperation(operationId); - System.out.printf("Operation ID: %s%n", operationDetails.getOperationId()); - System.out.printf("Operation Status: %s%n", operationDetails.getStatus()); - System.out.printf("Model ID created with this operation: %s%n", - ((DocumentModelBuildOperationDetails) operationDetails).getResult().getModelId()); - if (OperationStatus.FAILED.equals(operationDetails.getStatus())) { - System.out.printf("Operation fail error: %s%n", operationDetails.getError().getMessage()); - } - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getOperation#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getOperationWithResponse(String, RequestOptions)} - */ - public void getOperationWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getOperationWithResponse#string-RequestOptions - /*String operationId = "{operation-id}"; - Response response = - documentModelAdministrationClient.getOperationWithResponse(operationId, new RequestOptions()); - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - OperationDetails operationDetails = response.getValue(); - System.out.printf("Operation ID: %s%n", operationDetails.getOperationId()); - System.out.printf("Operation Status: %s%n", operationDetails.getStatus()); - System.out.printf("Model ID created with this operation: %s%n", - ((DocumentModelBuildOperationDetails) operationDetails).getResult().getModelId()); - if (OperationStatus.FAILED.equals(operationDetails.getStatus())) { - System.out.printf("Operation fail error: %s%n", operationDetails.getError().getMessage()); - } - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getOperationWithResponse#string-RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#listOperations()} - */ - public void listOperations() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.listOperations - PagedIterable - modelOperationInfo = documentIntelligenceAdministrationClient.listOperations(); - modelOperationInfo.forEach(modelOperationSummary -> { - System.out.printf("Operation ID: %s%n", modelOperationSummary.getOperationId()); - System.out.printf("Operation Status: %s%n", modelOperationSummary.getStatus()); - System.out.printf("Operation Created on: %s%n", modelOperationSummary.getCreatedDateTime()); - System.out.printf("Operation Percent completed: %d%n", modelOperationSummary.getPercentCompleted()); - System.out.printf("Operation Last updated on: %s%n", modelOperationSummary.getLastUpdatedDateTime()); - System.out.printf("Operation resource location: %s%n", modelOperationSummary.getResourceLocation()); - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.listOperations - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#listOperations(RequestOptions)} - */ - public void listOperationsWithContext() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.listOperations#RequestOptions - /*PagedIterable - modelOperationInfo = documentModelAdministrationClient.listOperations(new RequestOptions()); - modelOperationInfo.forEach(modelOperationSummary -> { - System.out.printf("Operation ID: %s%n", modelOperationSummary.getOperationId()); - System.out.printf("Operation Status: %s%n", modelOperationSummary.getStatus()); - System.out.printf("Operation Created on: %s%n", modelOperationSummary.getCreatedDateTime()); - System.out.printf("Operation Percent completed: %d%n", modelOperationSummary.getPercentCompleted()); - System.out.printf("Operation Last updated on: %s%n", modelOperationSummary.getLastUpdatedDateTime()); - System.out.printf("Operation resource location: %s%n", modelOperationSummary.getResourceLocation()); - }); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.listOperations#RequestOptions - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#beginBuildClassifier(BuildDocumentClassifierRequest)} - */ - public void beginBuildClassifier() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginBuildClassifier#BuildDocumentClassifierRequest - String blobContainerUrl1040D = "{SAS_URL_of_your_container_in_blob_storage}"; - String blobContainerUrl1040A = "{SAS_URL_of_your_container_in_blob_storage}"; - HashMap documentTypes = new HashMap<>(); - documentTypes.put("1040-D", new ClassifierDocumentTypeDetails() - .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040D) - )); - documentTypes.put("1040-A", new ClassifierDocumentTypeDetails() - .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl1040A) - )); - - DocumentClassifierDetails classifierDetails - = documentIntelligenceAdministrationClient.beginBuildClassifier( - new BuildDocumentClassifierRequest("classifierID", documentTypes)) - .getFinalResult(); - - System.out.printf("Classifier ID: %s%n", classifierDetails.getClassifierId()); - System.out.printf("Classifier description: %s%n", classifierDetails.getDescription()); - System.out.printf("Classifier created on: %s%n", classifierDetails.getCreatedDateTime()); - System.out.printf("Classifier expires on: %s%n", classifierDetails.getExpirationDateTime()); - classifierDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s", (documentTypeDetails - .getAzureBlobSource()).getContainerUrl()); - } - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.beginBuildClassifier#BuildDocumentClassifierRequest - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#deleteClassifier(String)} - */ - public void deleteDocumentClassifier() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentClassifier#string - String classifierId = "{classifierId}"; - documentIntelligenceAdministrationClient.deleteClassifier(classifierId); - System.out.printf("Classifier ID: %s is deleted.%n", classifierId); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentClassifier#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#deleteClassifierWithResponse(String, RequestOptions)} - */ - public void deleteDocumentClassifierWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentClassifierWithResponse#string-Context - String classifierId = "{classifierId}"; - Response response - = documentIntelligenceAdministrationClient.deleteClassifierWithResponse(classifierId, new RequestOptions()); - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - System.out.printf("Classifier ID: %s is deleted.%n", classifierId); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.deleteDocumentClassifierWithResponse#string-Context - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#listClassifiers()} - */ - public void listDocumentClassifiers() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.listDocumentClassifiers - documentIntelligenceAdministrationClient.listClassifiers() - .forEach(documentModel -> - System.out.printf("Classifier ID: %s, Classifier description: %s, Created on: %s.%n", - documentModel.getClassifierId(), - documentModel.getDescription(), - documentModel.getCreatedDateTime()) - ); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.listDocumentClassifiers - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getClassifier(String)} - */ - public void getDocumentClassifier() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getDocumentClassifier#string - String classifierId = "{classifierId}"; - DocumentClassifierDetails documentClassifierDetails - = documentIntelligenceAdministrationClient.getClassifier(classifierId); - System.out.printf("Classifier ID: %s%n", documentClassifierDetails.getClassifierId()); - System.out.printf("Classifier Description: %s%n", documentClassifierDetails.getDescription()); - System.out.printf("Classifier Created on: %s%n", documentClassifierDetails.getCreatedDateTime()); - documentClassifierDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s", (documentTypeDetails - .getAzureBlobSource()).getContainerUrl()); - } - if (documentTypeDetails.getAzureBlobFileListSource() != null) { - System.out.printf("Blob File List Source container Url: %s", - (documentTypeDetails - .getAzureBlobFileListSource()).getContainerUrl()); - } - }); - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getDocumentClassifier#string - } - - /** - * Code snippet for {@link DocumentIntelligenceAdministrationClient#getClassifierWithResponse(String, RequestOptions)} - */ - public void getDocumentClassifierWithResponse() { - // BEGIN: com.azure.ai.documentintelligence.DocumentModelAdminClient.getDocumentClassifierWithResponse#string-RequestOptions - /*String modelId = "{custom-model-id}"; - Response response - = documentModelAdministrationClient.getClassifierWithResponse(modelId, new RequestOptions()); - System.out.printf("Response Status Code: %d.", response.getStatusCode()); - DocumentClassifierDetails documentClassifierDetails = response.getValue(); - System.out.printf("Classifier ID: %s%n", documentClassifierDetails.getClassifierId()); - System.out.printf("Classifier Description: %s%n", documentClassifierDetails.getDescription()); - System.out.printf("Classifier Created on: %s%n", documentClassifierDetails.getCreatedDateTime()); - documentClassifierDetails.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getContentSource() instanceof AzureBlobContentSource) { - System.out.printf("Blob Source container Url: %s", ((AzureBlobContentSource) documentTypeDetails - .getContentSource()).getContainerUrl()); - } - if (documentTypeDetails.getContentSource() instanceof BlobFileListContentSource) { - System.out.printf("Blob File List Source container Url: %s", - ((BlobFileListContentSource) documentTypeDetails - .getContentSource()).getContainerUrl()); - } - }); - - */ - // END: com.azure.ai.documentintelligence.DocumentModelAdminClient.getDocumentClassifierWithResponse#string-RequestOptions - } - -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/GetOperationSummary.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/GetOperationSummary.java deleted file mode 100644 index 371d4d813d3e..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/GetOperationSummary.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; -import com.azure.ai.documentintelligence.models.OperationDetails; -import com.azure.ai.documentintelligence.models.OperationStatus; -import com.azure.core.credential.AzureKeyCredential; - -/** - * Sample to get/list all document model operations associated with the Form Recognizer resource. - * Kinds of operations returned are "documentModelBuild", "documentModelCompose", and "documentModelCopyTo". - * Note that operation information only persists for 24 hours. - * If the operation was successful, the document model can be accessed using getDocumentModel() or listDocumentModels() APIs - */ -public class GetOperationSummary { - - /** - * Main method to invoke this demo. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - client.listOperations().forEach(modelOperationSummary -> { - System.out.printf("Operation ID: %s%n", modelOperationSummary.getOperationId()); - System.out.printf("Operation Status: %s%n", modelOperationSummary.getStatus()); - System.out.printf("Operation resource location %s%n", modelOperationSummary.getResourceLocation()); - System.out.printf("Operation percent completion status: %d%n", modelOperationSummary.getPercentCompleted()); - - // get the specific operation info - OperationDetails modelOperationDetails = - client.getOperation(modelOperationSummary.getOperationId()); - if (OperationStatus.FAILED.equals(modelOperationSummary.getStatus())) { - System.out.printf("Operation fail error: %s%n", modelOperationDetails.getError().getMessage()); - } else { - System.out.printf("Model ID created with this operation: %s%n", - ((DocumentModelBuildOperationDetails) modelOperationDetails).getResult().getModelId()); - } - }); - - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/GetOperationSummaryAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/GetOperationSummaryAsync.java deleted file mode 100644 index e3bceb230e76..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/GetOperationSummaryAsync.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; -import com.azure.ai.documentintelligence.models.OperationStatus; -import com.azure.core.credential.AzureKeyCredential; - -/** - * Async sample to get/list all document model operations associated with the Form Recognizer resource. - * Kinds of operations returned are "documentModelBuild", "documentModelCompose", and "documentModelCopyTo". - * Note that operation information only persists for 24 hours. - * If the operation was successful, the document model can be accessed using get_model or list_models APIs - */ -public class GetOperationSummaryAsync { - - /** - * Main method to invoke this demo. - * - * @param args Unused arguments to the program. - */ - public static void main(String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationAsyncClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildAsyncClient(); - - client.listOperations().subscribe(modelOperationSummary -> { - System.out.printf("Operation ID: %s%n", modelOperationSummary.getOperationId()); - System.out.printf("Operation Status: %s%n", modelOperationSummary.getStatus()); - System.out.printf("Operation resource location %s%n", modelOperationSummary.getResourceLocation()); - System.out.printf("Operation percent completion status: %d%n", modelOperationSummary.getPercentCompleted()); - - // get the specific operation info - client.getOperation(modelOperationSummary.getOperationId()).subscribe(modelOperationDetails -> { - if (OperationStatus.FAILED.equals(modelOperationSummary.getStatus())) { - System.out.printf("Operation fail error: %s%n", modelOperationDetails.getError().getMessage()); - } else { - System.out.printf("Model ID created with this operation: %s%n", - ((DocumentModelBuildOperationDetails) modelOperationDetails).getResult().getModelId()); - } - }); - - }); - - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageCustomModels.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageCustomModels.java deleted file mode 100644 index e0da62b4cd42..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageCustomModels.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.ai.documentintelligence.models.ResourceDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; - -import java.util.concurrent.atomic.AtomicReference; - -/** - * Sample for demonstrating common custom document analysis model management operations. - * To learn how to build your own models, look at BuildDocumentModel.java and BuildDocumentModelAsync.java. - */ -public class ManageCustomModels { - - /** - * Main program to invoke the demo for performing operations of a custom document analysis model. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - AtomicReference modelId = new AtomicReference<>(); - - // First, we see how many models we have, and what our limit is - ResourceDetails resourceDetails = client.getResourceInfo(); - System.out.printf("The resource has %s models, and we can have at most %s models.%n", - resourceDetails.getCustomDocumentModels().getCount(), resourceDetails.getCustomDocumentModels().getLimit()); - - // Next, we get a paged list of all of our models - PagedIterable customDocumentModels = client.listModels(); - System.out.println("We have following models in the account:"); - customDocumentModels.forEach(documentModelInfo -> { - System.out.println(); - // get custom document analysis model info - modelId.set(documentModelInfo.getModelId()); - DocumentModelDetails documentModel = client.getModel(modelId.get()); - System.out.printf("Model ID: %s%n", documentModel.getModelId()); - System.out.printf("Model Description: %s%n", documentModel.getDescription()); - System.out.printf("Model created on: %s%n", documentModel.getCreatedDateTime()); - if (documentModel.getDocTypes() != null) { - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s, ", field); - System.out.printf("Field type: %s, ", documentFieldSchema.getType()); - if (documentTypeDetails.getFieldConfidence() != null) { - System.out.printf("Field confidence: %.2f%n", documentTypeDetails.getFieldConfidence().get(field)); - } - }); - }); - } - }); - - // Delete Custom Model - System.out.printf("Deleted model with model ID: %s, operation completed with status: %s%n", modelId.get(), - client.deleteModelWithResponse(modelId.get(), new RequestOptions()).getStatusCode()); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageCustomModelsAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageCustomModelsAsync.java deleted file mode 100644 index e1bff207a877..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageCustomModelsAsync.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.core.credential.AzureKeyCredential; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - - -/** - * Async sample for demonstrating to perform common custom document analysis model management operations on your Form - * Recognizer resource. - * To learn how to build your own models, look at BuildDocumentModelAsync.java and BuildDocumentModel.java. - */ -public class ManageCustomModelsAsync { - - /** - * Main program to invoke the demo. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationAsyncClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildAsyncClient(); - - AtomicReference modelId = new AtomicReference<>(); - - // First, we see how many models we have, and what our limit is - client.getResourceInfo().subscribe(resourceInfo -> - System.out.printf("The resource has %s models, and we can have at most %s models.%n", - resourceInfo.getCustomDocumentModels().getCount(), resourceInfo.getCustomDocumentModels().getLimit())); - // Next, we get a paged list of all of our models - System.out.println("We have following models in the account:"); - client.listModels().subscribe(documentModelInfo -> { - String createdModelId = documentModelInfo.getModelId(); - System.out.println(); - // get custom document analysis model info - modelId.set(createdModelId); - client.getModel(documentModelInfo.getModelId()).subscribe(documentModel -> { - System.out.printf("Model ID: %s%n", documentModel.getModelId()); - System.out.printf("Model Description: %s%n", documentModel.getDescription()); - System.out.printf("Model created on: %s%n", documentModel.getCreatedDateTime()); - documentModel.getDocTypes().forEach((key, documentTypeDetails) -> { - documentTypeDetails.getFieldSchema().forEach((field, documentFieldSchema) -> { - System.out.printf("Field: %s, ", field); - System.out.printf("Field type: %s, ", documentFieldSchema.getType()); - System.out.printf("Field confidence: %.2f%n", documentTypeDetails.getFieldConfidence().get(field)); - }); - }); - }); - }); - - // Delete Custom Model - client.deleteModel(modelId.get()); - System.out.printf("Deleted model with model ID: %s%n", modelId.get()); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(15); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageDocumentClassifiers.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageDocumentClassifiers.java deleted file mode 100644 index ff4424303a0f..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageDocumentClassifiers.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; -import com.azure.core.credential.AzureKeyCredential; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; - -import java.util.concurrent.atomic.AtomicReference; - -/** - * Sample for demonstrating commonly performed document classifier management operations. - * To learn how to build your own classifiers, look at BuildDocumentClassifier.java and BuildDocumentClassifierAsync.java. - */ -public class ManageDocumentClassifiers { - - /** - * Main program to invoke the demo. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildClient(); - - AtomicReference classifierId = new AtomicReference<>(); - - // Next, we get a paged list of all document classifiers - PagedIterable documentClassifierDetailList = client.listClassifiers(); - System.out.println("We have following classifiers in the account:"); - documentClassifierDetailList.forEach(documentClassifierDetails -> { - System.out.println(); - // get Classifier info - classifierId.set(documentClassifierDetails.getClassifierId()); - DocumentClassifierDetails documentClassifier = client.getClassifier(documentClassifierDetails.getClassifierId()); - System.out.printf("Classifier ID: %s%n", documentClassifier.getClassifierId()); - System.out.printf("Classifier Description: %s%n", documentClassifier.getDescription()); - System.out.printf("Classifier created on: %s%n", documentClassifier.getCreatedDateTime()); - documentClassifier.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s%n", (documentTypeDetails - .getAzureBlobSource()).getContainerUrl()); - } - }); - }); - - // Delete classifier - System.out.printf("Deleted Classifier with Classifier ID: %s, operation completed with status: %s%n", classifierId.get(), - client.deleteClassifierWithResponse(classifierId.get(), new RequestOptions()).getStatusCode()); - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageDocumentClassifiersAsync.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageDocumentClassifiersAsync.java deleted file mode 100644 index 7df49cbfe870..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/ManageDocumentClassifiersAsync.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.documentintelligence.administration; - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.core.credential.AzureKeyCredential; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - - -/** - * Async sample demonstrating common document classifier management operations on your Form - * Recognizer resource. - * To learn how to build your own classifiers, look at BuildDocumentClassifierAsync.java and BuildDocumentClassifier.java. - */ -public class ManageDocumentClassifiersAsync { - - /** - * Main program to invoke the demo. - * - * @param args Unused. Arguments to the program. - */ - public static void main(final String[] args) { - // Instantiate a client that will be used to call the service. - DocumentIntelligenceAdministrationAsyncClient client = new DocumentIntelligenceAdministrationClientBuilder() - .credential(new AzureKeyCredential("{key}")) - .endpoint("https://{endpoint}.cognitiveservices.azure.com/") - .buildAsyncClient(); - - AtomicReference classifierId = new AtomicReference<>(); - - // Next, we get a paged list of all document classifiers - System.out.println("We have following classifiers in the account:"); - client.listClassifiers().subscribe(documentClassifierDetails -> { - System.out.println(); - // get Classifier info - classifierId.set(documentClassifierDetails.getClassifierId()); - client.getClassifier(documentClassifierDetails.getClassifierId()).subscribe(documentClassifier -> { - System.out.printf("Classifier ID: %s%n", documentClassifier.getClassifierId()); - System.out.printf("Classifier Description: %s%n", documentClassifier.getDescription()); - System.out.printf("Classifier created on: %s%n", documentClassifier.getCreatedDateTime()); - documentClassifier.getDocTypes().forEach((key, documentTypeDetails) -> { - if (documentTypeDetails.getAzureBlobSource() != null) { - System.out.printf("Blob Source container Url: %s%n", (documentTypeDetails - .getAzureBlobSource()).getContainerUrl()); - } - }); - }); - }); - - - // Delete classifier - client.deleteClassifier(classifierId.get()); - System.out.printf("Deleted Classifier with Classifier ID: %s", classifierId.get()); - - // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep - // the thread so the program does not end before the send operation is complete. Using .block() instead of - // .subscribe() will turn this into a synchronous call. - try { - TimeUnit.SECONDS.sleep(15); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/package-info.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/package-info.java deleted file mode 100644 index 6f21048304d9..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/administration/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * Package containing sample classes for interacting with {@link com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationAsyncClient} to - * perform operations on Azure Form Recognizer - */ -package com.azure.ai.documentintelligence.administration; diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeBatchDocuments.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeBatchDocuments.java new file mode 100644 index 000000000000..cdaf41d6d43c --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeBatchDocuments.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsOptions; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; +import com.azure.ai.documentintelligence.models.AnalyzeBatchResult; +import com.azure.ai.documentintelligence.models.AzureBlobContentSource; +import com.azure.ai.documentintelligence.models.StringIndexType; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; + +import java.util.Collections; + +public class AnalyzeBatchDocuments { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.analyzebatchdocuments.analyzebatchdocuments + SyncPoller response + = documentIntelligenceClient.beginAnalyzeBatchDocuments("customModel", + new AnalyzeBatchDocumentsOptions(new AzureBlobContentSource( + "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken").setPrefix("trainingDocs/"), + "https://myStorageAccount.blob.core.windows.net/myOutputContainer?mySasToken") + .setResultPrefix("trainingDocsResult/") + .setOverwriteExisting(true) + .setPages(Collections.singletonList("1-5")) + .setLocale("en-US") + .setStringIndexType(StringIndexType.TEXT_ELEMENTS)); + // END:com.azure.ai.documentintelligence.generated.analyzebatchdocuments.analyzebatchdocuments + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromBytes.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromBytes.java new file mode 100644 index 000000000000..20f636743b76 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromBytes.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzeResult; +import com.azure.ai.documentintelligence.models.StringIndexType; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; + +import java.util.Collections; + +public class AnalyzeDocumentFromBytes { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.analyzedocument.analyzedocumentfrombytes + SyncPoller response = documentIntelligenceClient.beginAnalyzeDocument( + "prebuilt-layout", + new AnalyzeDocumentOptions("e2Jhc2U2NEVuY29kZWRQZGZ9".getBytes()).setPages(Collections.singletonList("1-2,4")) + .setLocale("en-US") + .setStringIndexType(StringIndexType.TEXT_ELEMENTS)); + // END:com.azure.ai.documentintelligence.generated.analyzedocument.analyzedocumentfrombytes + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromUrl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromUrl.java new file mode 100644 index 000000000000..7dd45bd685ef --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AnalyzeDocumentFromUrl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzeResult; +import com.azure.ai.documentintelligence.models.StringIndexType; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; + +import java.util.Collections; + +public class AnalyzeDocumentFromUrl { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.analyzedocument.analyzedocumentfromurl + SyncPoller response = documentIntelligenceClient.beginAnalyzeDocument( + "customModel", + new AnalyzeDocumentOptions("http://host.com/doc.pdf").setPages(Collections.singletonList("1-2,4")) + .setLocale("en-US") + .setStringIndexType(StringIndexType.TEXT_ELEMENTS)); + // END:com.azure.ai.documentintelligence.generated.analyzedocument.analyzedocumentfromurl + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AuthorizeCopyOfDocumentClassifier.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AuthorizeCopyOfDocumentClassifier.java new file mode 100644 index 000000000000..219269a45e6a --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AuthorizeCopyOfDocumentClassifier.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyOptions; +import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AuthorizeCopyOfDocumentClassifier { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.authorizeclassifiercopy.authorizecopyofdocumentclassifier + ClassifierCopyAuthorization response = documentIntelligenceAdministrationClient.authorizeClassifierCopy( + new AuthorizeClassifierCopyOptions("targetClassifier").setDescription("Target classifier description")); + // END:com.azure.ai.documentintelligence.generated.authorizeclassifiercopy.authorizecopyofdocumentclassifier + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AuthorizeCopyOfDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AuthorizeCopyOfDocumentModel.java new file mode 100644 index 000000000000..15123f17e87e --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/AuthorizeCopyOfDocumentModel.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.AuthorizeModelCopyOptions; +import com.azure.ai.documentintelligence.models.ModelCopyAuthorization; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AuthorizeCopyOfDocumentModel { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.authorizemodelcopy.authorizecopyofdocumentmodel + ModelCopyAuthorization response = documentIntelligenceAdministrationClient.authorizeModelCopy( + new AuthorizeModelCopyOptions("targetModel").setDescription("Target model description")); + // END:com.azure.ai.documentintelligence.generated.authorizemodelcopy.authorizecopyofdocumentmodel + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/BuildDocumentClassifier.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/BuildDocumentClassifier.java new file mode 100644 index 000000000000..754ad8c9b114 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/BuildDocumentClassifier.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.AzureBlobContentSource; +import com.azure.ai.documentintelligence.models.AzureBlobFileListContentSource; +import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions; +import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; +import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; +import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class BuildDocumentClassifier { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.buildclassifier.builddocumentclassifier + SyncPoller response + = documentIntelligenceAdministrationClient.beginBuildClassifier(new BuildDocumentClassifierOptions( + "myClassifier", + mapOf("formA", new ClassifierDocumentTypeDetails().setAzureBlobSource( + new AzureBlobContentSource("https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken") + .setPrefix("formADocs/")), + "formB", + new ClassifierDocumentTypeDetails().setAzureBlobFileListSource(new AzureBlobFileListContentSource( + "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken", "formB.jsonl")))) + .setDescription("Classifier description")); + // END:com.azure.ai.documentintelligence.generated.buildclassifier.builddocumentclassifier + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/BuildDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/BuildDocumentModel.java new file mode 100644 index 000000000000..a070d6c49e6d --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/BuildDocumentModel.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.AzureBlobContentSource; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; +import com.azure.ai.documentintelligence.models.DocumentBuildMode; +import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; +import com.azure.ai.documentintelligence.models.DocumentModelDetails; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class BuildDocumentModel { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.builddocumentmodel.builddocumentmodel + SyncPoller response + = documentIntelligenceAdministrationClient + .beginBuildDocumentModel(new BuildDocumentModelOptions("myCustomModel", DocumentBuildMode.TEMPLATE) + .setDescription("Custom model description") + .setAzureBlobSource(new AzureBlobContentSource( + "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken") + .setPrefix("trainingDocs/")) + .setTags(mapOf("createdBy", "myUserId"))); + // END:com.azure.ai.documentintelligence.generated.builddocumentmodel.builddocumentmodel + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ClassifyDocumentFromUrl.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ClassifyDocumentFromUrl.java new file mode 100644 index 000000000000..fbd864b80662 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ClassifyDocumentFromUrl.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzeResult; +import com.azure.ai.documentintelligence.models.ClassifyDocumentOptions; +import com.azure.ai.documentintelligence.models.StringIndexType; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class ClassifyDocumentFromUrl { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.classifydocument.classifydocumentfromurl + SyncPoller response = documentIntelligenceClient.beginClassifyDocument( + "classifierId", new ClassifyDocumentOptions("http://host.com/doc.pdf") + .setStringIndexType(StringIndexType.TEXT_ELEMENTS)); + // END:com.azure.ai.documentintelligence.generated.classifydocument.classifydocumentfromurl + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ComposeDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ComposeDocumentModel.java new file mode 100644 index 000000000000..d24f52833f17 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ComposeDocumentModel.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; +import com.azure.ai.documentintelligence.models.DocumentModelComposeOperationDetails; +import com.azure.ai.documentintelligence.models.DocumentModelDetails; +import com.azure.ai.documentintelligence.models.DocumentTypeDetails; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.HashMap; +import java.util.Map; + +public class ComposeDocumentModel { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.composemodel.composedocumentmodel + SyncPoller response + = documentIntelligenceAdministrationClient + .beginComposeModel( + new ComposeDocumentModelRequest("composedModel", "customClassifier", + mapOf("formA", new DocumentTypeDetails().setModelId("model1"), "formB", + new DocumentTypeDetails().setModelId("model2"))) + .setDescription("Composed model description")); + // END:com.azure.ai.documentintelligence.generated.composemodel.composedocumentmodel + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/CopyDocumentClassifierTo.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/CopyDocumentClassifierTo.java new file mode 100644 index 000000000000..8a75c3b55da4 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/CopyDocumentClassifierTo.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization; +import com.azure.ai.documentintelligence.models.DocumentClassifierCopyToOperationDetails; +import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; + +public class CopyDocumentClassifierTo { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.copyclassifierto.copydocumentclassifierto + SyncPoller response + = documentIntelligenceAdministrationClient.beginCopyClassifierTo("sourceClassifier", + new ClassifierCopyAuthorization( + "/subscriptions/targetSub/resourceGroups/targetRG/providers/Microsoft.CognitiveServices/accounts/targetService", + "targetResourceRegion", "targetClassifier", + "https://targetEndpoint.cognitiveservices.azure.com/documentintelligence/documentClassifiers/targetClassifier", + "fakeTokenPlaceholder", OffsetDateTime.parse("2021-09-23T09:12:54.552Z"))); + // END:com.azure.ai.documentintelligence.generated.copyclassifierto.copydocumentclassifierto + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/CopyDocumentModelTo.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/CopyDocumentModelTo.java new file mode 100644 index 000000000000..b28c1959cd32 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/CopyDocumentModelTo.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentModelCopyToOperationDetails; +import com.azure.ai.documentintelligence.models.DocumentModelDetails; +import com.azure.ai.documentintelligence.models.ModelCopyAuthorization; +import com.azure.core.util.polling.SyncPoller; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; + +public class CopyDocumentModelTo { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.copymodelto.copydocumentmodelto + SyncPoller response + = documentIntelligenceAdministrationClient.beginCopyModelTo("sourceModel", new ModelCopyAuthorization( + "/subscriptions/targetSub/resourceGroups/targetRG/providers/Microsoft.CognitiveServices/accounts/targetService", + "targetResourceRegion", "targetModel", + "https://targetEndpoint.cognitiveservices.azure.com/documentintelligence/documentModels/targetModel", + "fakeTokenPlaceholder", OffsetDateTime.parse("2021-09-23T09:12:54.552Z"))); + // END:com.azure.ai.documentintelligence.generated.copymodelto.copydocumentmodelto + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteAnalyzeBatchDocumentsResult.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteAnalyzeBatchDocumentsResult.java new file mode 100644 index 000000000000..3a061c9da284 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteAnalyzeBatchDocumentsResult.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteAnalyzeBatchDocumentsResult { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.deleteanalyzebatchresult.deleteanalyzebatchdocumentsresult + documentIntelligenceClient.deleteAnalyzeBatchResult("prebuilt-invoice", "3b31320d-8bab-4f88-b19c-2322a7f11034"); + // END:com.azure.ai.documentintelligence.generated.deleteanalyzebatchresult.deleteanalyzebatchdocumentsresult + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteAnalyzeResult.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteAnalyzeResult.java new file mode 100644 index 000000000000..40c730ba60c5 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteAnalyzeResult.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteAnalyzeResult { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.deleteanalyzeresult.deleteanalyzeresult + documentIntelligenceClient.deleteAnalyzeResult("myCustomModel", "3b31320d-8bab-4f88-b19c-2322a7f11034"); + // END:com.azure.ai.documentintelligence.generated.deleteanalyzeresult.deleteanalyzeresult + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteDocumentClassifier.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteDocumentClassifier.java new file mode 100644 index 000000000000..c7b0d16350d2 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteDocumentClassifier.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteDocumentClassifier { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.deleteclassifier.deletedocumentclassifier + documentIntelligenceAdministrationClient.deleteClassifier("myClassifier"); + // END:com.azure.ai.documentintelligence.generated.deleteclassifier.deletedocumentclassifier + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteDocumentModel.java new file mode 100644 index 000000000000..375b76a5c01e --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/DeleteDocumentModel.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteDocumentModel { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.deletemodel.deletedocumentmodel + documentIntelligenceAdministrationClient.deleteModel("myCustomModel"); + // END:com.azure.ai.documentintelligence.generated.deletemodel.deletedocumentmodel + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeBatchDocumentsResult.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeBatchDocumentsResult.java new file mode 100644 index 000000000000..f0506691c99b --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeBatchDocumentsResult.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAnalyzeBatchDocumentsResult { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getanalyzebatchresult.getanalyzebatchdocumentsresult + AnalyzeBatchOperation response = documentIntelligenceClient.getAnalyzeBatchResult("prebuilt-invoice", + "3b31320d-8bab-4f88-b19c-2322a7f11034"); + // END:com.azure.ai.documentintelligence.generated.getanalyzebatchresult.getanalyzebatchdocumentsresult + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeDocumentResultFigure.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeDocumentResultFigure.java new file mode 100644 index 000000000000..d13f25b61426 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeDocumentResultFigure.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAnalyzeDocumentResultFigure { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getanalyzeresultfigure.getanalyzedocumentresultfigure + BinaryData response = documentIntelligenceClient.getAnalyzeResultFigure("prebuilt-invoice", + "3b31320d-8bab-4f88-b19c-2322a7f11034", "1.0"); + // END:com.azure.ai.documentintelligence.generated.getanalyzeresultfigure.getanalyzedocumentresultfigure + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeDocumentResultPDF.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeDocumentResultPDF.java new file mode 100644 index 000000000000..286eaa908d90 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetAnalyzeDocumentResultPDF.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAnalyzeDocumentResultPDF { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getanalyzeresultpdf.getanalyzedocumentresultpdf + BinaryData response = documentIntelligenceClient.getAnalyzeResultPdf("prebuilt-invoice", + "3b31320d-8bab-4f88-b19c-2322a7f11034"); + // END:com.azure.ai.documentintelligence.generated.getanalyzeresultpdf.getanalyzedocumentresultpdf + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetCustomDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetCustomDocumentModel.java new file mode 100644 index 000000000000..3ecacf988fcf --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetCustomDocumentModel.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentModelDetails; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetCustomDocumentModel { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getmodel.getcustomdocumentmodel + DocumentModelDetails response = documentIntelligenceAdministrationClient.getModel("myCustomModel"); + // END:com.azure.ai.documentintelligence.generated.getmodel.getcustomdocumentmodel + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentClassifier.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentClassifier.java new file mode 100644 index 000000000000..ab9180d20afa --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentClassifier.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetDocumentClassifier { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getclassifier.getdocumentclassifier + DocumentClassifierDetails response = documentIntelligenceAdministrationClient.getClassifier("myClassifier"); + // END:com.azure.ai.documentintelligence.generated.getclassifier.getdocumentclassifier + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentClassifiers.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentClassifiers.java new file mode 100644 index 000000000000..387b59581f8a --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentClassifiers.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; +import com.azure.core.http.rest.PagedIterable; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetDocumentClassifiers { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.listclassifiers.getdocumentclassifiers + PagedIterable response = documentIntelligenceAdministrationClient.listClassifiers(); + // END:com.azure.ai.documentintelligence.generated.listclassifiers.getdocumentclassifiers + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentModels.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentModels.java new file mode 100644 index 000000000000..fb58af534831 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetDocumentModels.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentModelDetails; +import com.azure.core.http.rest.PagedIterable; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetDocumentModels { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.listmodels.getdocumentmodels + PagedIterable response = documentIntelligenceAdministrationClient.listModels(); + // END:com.azure.ai.documentintelligence.generated.listmodels.getdocumentmodels + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetOperation.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetOperation.java new file mode 100644 index 000000000000..6b50004989b0 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetOperation.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceOperationDetails; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetOperation { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getoperation.getoperation + DocumentIntelligenceOperationDetails response + = documentIntelligenceAdministrationClient.getOperation("b704bb00-d130-4f3f-a1d8-ca96de3eabb4"); + // END:com.azure.ai.documentintelligence.generated.getoperation.getoperation + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetOperations.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetOperations.java new file mode 100644 index 000000000000..0355699b2d10 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetOperations.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceOperationDetails; +import com.azure.core.http.rest.PagedIterable; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetOperations { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.listoperations.getoperations + PagedIterable response + = documentIntelligenceAdministrationClient.listOperations(); + // END:com.azure.ai.documentintelligence.generated.listoperations.getoperations + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetPrebuiltDocumentModel.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetPrebuiltDocumentModel.java new file mode 100644 index 000000000000..aebcc8da96f0 --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetPrebuiltDocumentModel.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentModelDetails; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetPrebuiltDocumentModel { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getmodel.getprebuiltdocumentmodel + DocumentModelDetails response = documentIntelligenceAdministrationClient.getModel("prebuilt-invoice"); + // END:com.azure.ai.documentintelligence.generated.getmodel.getprebuiltdocumentmodel + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetResourceDetails.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetResourceDetails.java new file mode 100644 index 000000000000..c80ce9b4981f --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/GetResourceDetails.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceResourceDetails; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetResourceDetails { + public static void main(String[] args) { + DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient + = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.getresourcedetails.getresourcedetails + DocumentIntelligenceResourceDetails response = documentIntelligenceAdministrationClient.getResourceDetails(); + // END:com.azure.ai.documentintelligence.generated.getresourcedetails.getresourcedetails + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ListAnalyzeBatchDocumentsResults.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ListAnalyzeBatchDocumentsResults.java new file mode 100644 index 000000000000..056bc4148fdf --- /dev/null +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/generated/ListAnalyzeBatchDocumentsResults.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.documentintelligence.generated; + +import com.azure.ai.documentintelligence.DocumentIntelligenceClient; +import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; +import com.azure.core.http.rest.PagedIterable; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class ListAnalyzeBatchDocumentsResults { + public static void main(String[] args) { + DocumentIntelligenceClient documentIntelligenceClient + = new DocumentIntelligenceClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myendpoint.cognitiveservices.azure.com") + .buildClient(); + // BEGIN:com.azure.ai.documentintelligence.generated.listanalyzebatchresults.listanalyzebatchdocumentsresults + PagedIterable response + = documentIntelligenceClient.listAnalyzeBatchResults("prebuilt-invoice"); + // END:com.azure.ai.documentintelligence.generated.listanalyzebatchresults.listanalyzebatchdocumentsresults + } +} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentAdministrationClientTestBase.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentAdministrationClientTestBase.java index 269e01c43c4b..4f979a4aef87 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentAdministrationClientTestBase.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentAdministrationClientTestBase.java @@ -9,10 +9,10 @@ // See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization; -import com.azure.ai.documentintelligence.models.CopyAuthorization; +import com.azure.ai.documentintelligence.models.ModelCopyAuthorization; import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; +import com.azure.ai.documentintelligence.models.DocumentIntelligenceResourceDetails; import com.azure.ai.documentintelligence.models.DocumentModelDetails; -import com.azure.ai.documentintelligence.models.ResourceDetails; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; @@ -74,9 +74,9 @@ private void setMatchers() { interceptorManager.addMatchers(Collections.singletonList(new BodilessMatcher())); } - static void validateCopyAuthorizationResult(CopyAuthorization actualResult) { + static void validateCopyAuthorizationResult(ModelCopyAuthorization actualResult) { assertNotNull(actualResult.getTargetModelId()); - assertNotNull(actualResult.getExpirationDateTime()); + assertNotNull(actualResult.getExpiresOn()); assertNotNull(actualResult.getTargetResourceRegion()); assertNotNull(actualResult.getTargetResourceId()); assertNotNull(actualResult.getTargetResourceId()); @@ -84,26 +84,26 @@ static void validateCopyAuthorizationResult(CopyAuthorization actualResult) { static void validateClassifierCopyAuthorizationResult(ClassifierCopyAuthorization actualResult) { assertNotNull(actualResult.getTargetClassifierId()); - assertNotNull(actualResult.getExpirationDateTime()); + assertNotNull(actualResult.getExpiresOn()); assertNotNull(actualResult.getTargetResourceRegion()); assertNotNull(actualResult.getTargetResourceId()); assertNotNull(actualResult.getTargetResourceId()); } - static void validateResourceInfo(ResourceDetails actualResourceDetails) { + static void validateResourceInfo(DocumentIntelligenceResourceDetails actualResourceDetails) { assertNotNull(actualResourceDetails.getCustomDocumentModels().getLimit()); assertNotNull(actualResourceDetails.getCustomDocumentModels().getCount()); } void validateDocumentModelData(DocumentModelDetails actualCustomModel) { - assertNotNull(actualCustomModel.getCreatedDateTime()); + assertNotNull(actualCustomModel.getCreatedOn()); assertNotNull(actualCustomModel.getModelId()); - actualCustomModel.getDocTypes().forEach((s, docTypeInfo) -> assertNotNull(docTypeInfo.getFieldSchema())); + actualCustomModel.getDocumentTypes().forEach((s, docTypeInfo) -> assertNotNull(docTypeInfo.getFieldSchema())); } void validateClassifierModelData(DocumentClassifierDetails documentClassifierDetails) { - assertNotNull(documentClassifierDetails.getCreatedDateTime()); + assertNotNull(documentClassifierDetails.getCreatedOn()); assertNotNull(documentClassifierDetails.getClassifierId()); } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClientTest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClientTest.java index bc9339ca0467..930e8e753571 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClientTest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceAsyncClientTest.java @@ -3,41 +3,35 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest; +import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsOptions; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; import com.azure.ai.documentintelligence.models.AnalyzeBatchResult; -import com.azure.ai.documentintelligence.models.AnalyzeBatchResultOperation; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; -import com.azure.ai.documentintelligence.models.AnalyzeOutputOption; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; +import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions; import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; -import com.azure.ai.documentintelligence.models.ClassifyDocumentRequest; -import com.azure.ai.documentintelligence.models.DocumentBuildMode; +import com.azure.ai.documentintelligence.models.ClassifyDocumentOptions; import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; -import com.azure.ai.documentintelligence.models.DocumentModelBuildOperationDetails; -import com.azure.ai.documentintelligence.models.DocumentModelDetails; import com.azure.core.http.HttpClient; import com.azure.core.test.annotation.RecordWithoutRequestBody; import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; -import static com.azure.ai.documentintelligence.TestUtils.BATCH_SAMPLE_PDF; import static com.azure.ai.documentintelligence.TestUtils.CONTENT_FORM_JPG; import static com.azure.ai.documentintelligence.TestUtils.CONTENT_GERMAN_PDF; import static com.azure.ai.documentintelligence.TestUtils.DEFAULT_TIMEOUT; @@ -50,7 +44,10 @@ import static com.azure.ai.documentintelligence.TestUtils.RECEIPT_CONTOSO_JPG; import static com.azure.ai.documentintelligence.TestUtils.W2_JPG; import static com.azure.ai.documentintelligence.TestUtils.urlRunner; -import static com.azure.ai.documentintelligence.models.AnalyzeOutputOption.PDF; +import static com.azure.ai.documentintelligence.models.AnalyzeOutputFormat.FIGURES; +import static com.azure.ai.documentintelligence.models.AnalyzeOutputFormat.PDF; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class DocumentIntelligenceAsyncClientTest extends DocumentIntelligenceClientTestBase { @@ -90,11 +87,10 @@ private DocumentIntelligenceAdministrationAsyncClient getDocumentAdminAsyncClien public void analyzeReceiptData(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-receipt", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-receipt", new AnalyzeDocumentOptions(data)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateJpegReceiptData(syncPoller.getFinalResult()); }, RECEIPT_CONTOSO_JPG); @@ -109,12 +105,11 @@ public void analyzeReceiptData(HttpClient httpClient, DocumentIntelligenceServic @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeReceiptSourceUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); - urlRunner(sourceUrl -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-receipt", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + urlRunner(urlSource -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-receipt", new AnalyzeDocumentOptions(urlSource)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateJpegReceiptData(syncPoller.getFinalResult()); }, RECEIPT_CONTOSO_JPG); @@ -132,11 +127,10 @@ public void analyzeReceiptSourceUrl(HttpClient httpClient, DocumentIntelligenceS public void analyzeLayout(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-layout", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-layout", new AnalyzeDocumentOptions(data)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateContentData(syncPoller.getFinalResult()); }, CONTENT_FORM_JPG); @@ -147,9 +141,9 @@ public void analyzeLayout(HttpClient httpClient, DocumentIntelligenceServiceVers public void analyzeLayoutWithPages(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-layout", "1, 2", null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller = client + .beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(data).setPages(Arrays.asList("1, 2"))) .setPollInterval(durationTestMode) .getSyncPoller(); syncPoller.waitForCompletion(); @@ -167,12 +161,11 @@ public void analyzeLayoutWithPages(HttpClient httpClient, DocumentIntelligenceSe @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeContentFromUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); - urlRunner(sourceUrl -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-layout", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + urlRunner(urlSource -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-layout", new AnalyzeDocumentOptions(urlSource)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateContentData(syncPoller.getFinalResult()); }, CONTENT_FORM_JPG); @@ -183,11 +176,10 @@ public void analyzeContentFromUrl(HttpClient httpClient, DocumentIntelligenceSer public void analyzeGermanContentFromUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-layout", null, "de", null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-layout", new AnalyzeDocumentOptions(data).setLocale("de")) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateGermanContentData(syncPoller.getFinalResult()); }, CONTENT_GERMAN_PDF); @@ -201,11 +193,10 @@ public void analyzeGermanContentFromUrl(HttpClient httpClient, DocumentIntellige public void analyzeInvoiceData(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-invoice", null, "de", null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-invoice", new AnalyzeDocumentOptions(data).setLocale("de")) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateInvoiceData(syncPoller.getFinalResult()); @@ -221,12 +212,11 @@ public void analyzeInvoiceData(HttpClient httpClient, DocumentIntelligenceServic @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeInvoiceSourceUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); - urlRunner((sourceUrl) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-invoice", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + urlRunner((urlSource) -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-invoice", new AnalyzeDocumentOptions(urlSource)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateInvoiceData(syncPoller.getFinalResult()); }, INVOICE_PDF); @@ -242,11 +232,10 @@ public void analyzeInvoiceSourceUrl(HttpClient httpClient, DocumentIntelligenceS public void analyzeLicenseCardData(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-idDocument", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-idDocument", new AnalyzeDocumentOptions(data)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateIdentityData(syncPoller.getFinalResult()); @@ -262,12 +251,11 @@ public void analyzeLicenseCardData(HttpClient httpClient, DocumentIntelligenceSe @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeLicenseSourceUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); - urlRunner(sourceUrl -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-idDocument", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + urlRunner(urlSource -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-idDocument", new AnalyzeDocumentOptions(urlSource)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateIdentityData(syncPoller.getFinalResult()); }, LICENSE_PNG); @@ -278,11 +266,10 @@ public void analyzeLicenseSourceUrl(HttpClient httpClient, DocumentIntelligenceS public void analyzeW2Data(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-tax.us.w2", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode) - .getSyncPoller(); + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-tax.us.w2", new AnalyzeDocumentOptions(data)) + .setPollInterval(durationTestMode) + .getSyncPoller(); syncPoller.waitForCompletion(); validateW2Data(syncPoller.getFinalResult()); }, W2_JPG); @@ -313,7 +300,7 @@ public void testClassifyAnalyzeFromUrl(HttpClient httpClient, DocumentIntelligen .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl).setPrefix("IRS-1040-E/train"))); SyncPoller buildModelPoller = adminClient - .beginBuildClassifier(new BuildDocumentClassifierRequest(classifierId1, documentTypeDetailsMap)) + .beginBuildClassifier(new BuildDocumentClassifierOptions(classifierId1, documentTypeDetailsMap)) .setPollInterval(durationTestMode) .getSyncPoller(); buildModelPoller.waitForCompletion(); @@ -324,13 +311,13 @@ public void testClassifyAnalyzeFromUrl(HttpClient httpClient, DocumentIntelligen if (documentClassifierDetails.get() != null) { String classifierId = documentClassifierDetails.get().getClassifierId(); dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client.beginClassifyDocument(classifierId, new ClassifyDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginClassifyDocument(classifierId, new ClassifyDocumentOptions(data)) .setPollInterval(durationTestMode) .getSyncPoller(); AnalyzeResult analyzeResult = syncPoller.getFinalResult(); - Assertions.assertNotNull(analyzeResult); - // TODO: (service bug) Document count should be 3 + assertNotNull(analyzeResult); + // TODO: (service bug) AnalyzedDocument count should be 3 Assertions.assertEquals(1, analyzeResult.getDocuments().size()); Assertions.assertEquals(analyzeResult.getModelId(), classifierId); }, IRS_1040); @@ -344,12 +331,10 @@ public void getAnalyzePdf(HttpClient httpClient, DocumentIntelligenceServiceVers client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); String modelID = "prebuilt-read"; dataRunner((data, dataLength) -> { - PollerFlux resultPollerFlux - = client - .beginAnalyzeDocument(modelID, null, null, null, null, null, null, - Collections.singletonList(AnalyzeOutputOption.PDF), - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode); + PollerFlux resultPollerFlux = client + .beginAnalyzeDocument(modelID, + new AnalyzeDocumentOptions(data).setOutput(Collections.singletonList(PDF))) + .setPollInterval(durationTestMode); StepVerifier .create(resultPollerFlux.last() @@ -373,12 +358,10 @@ public void getAnalyzeFigures(HttpClient httpClient, DocumentIntelligenceService client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); String modelID = "prebuilt-layout"; dataRunner((data, dataLength) -> { - PollerFlux resultPollerFlux - = client - .beginAnalyzeDocument(modelID, null, null, null, null, null, null, - Collections.singletonList(AnalyzeOutputOption.FIGURES), - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode); + PollerFlux resultPollerFlux = client + .beginAnalyzeDocument(modelID, + new AnalyzeDocumentOptions(data).setOutput(Collections.singletonList(FIGURES))) + .setPollInterval(durationTestMode); StepVerifier.create(resultPollerFlux.last() .flatMap(response -> client.getAnalyzeResultFigure(modelID, response.getValue().getOperationId(), @@ -399,30 +382,19 @@ public void getAnalyzeFigures(HttpClient httpClient, DocumentIntelligenceService @RecordWithoutRequestBody @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") - @Disabled("com.azure.core.exception.AzureException: Long running operation failed.\n") public void analyzeBatchDocuments(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisAsyncClient(httpClient, serviceVersion); - DocumentIntelligenceAdministrationAsyncClient adminClient - = getDocumentAdminAsyncClient(httpClient, serviceVersion); buildBatchModelRunner((trainingFilesUrl, trainingFilesResultUrl) -> { - SyncPoller buildModelPoller = adminClient - .beginBuildDocumentModel( - new BuildDocumentModelRequest("modelID" + UUID.randomUUID(), DocumentBuildMode.TEMPLATE) - .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) + + SyncPoller syncPoller = client + .beginAnalyzeBatchDocuments("prebuilt-layout", + new AnalyzeBatchDocumentsOptions(new AzureBlobContentSource(trainingFilesUrl), + trainingFilesResultUrl).setResultPrefix("result/").setOverwriteExisting(true)) .setPollInterval(durationTestMode) .getSyncPoller(); - - String modelId = buildModelPoller.getFinalResult().getModelId(); - - urlRunner((sourceUrl) -> { - SyncPoller syncPoller = client - .beginAnalyzeBatchDocuments(modelId, null, null, null, null, null, null, - Collections.singletonList(PDF), - new AnalyzeBatchDocumentsRequest(trainingFilesUrl).setResultPrefix("trainingDocsResult/") - .setAzureBlobSource(new AzureBlobContentSource(sourceUrl))) - .setPollInterval(durationTestMode) - .getSyncPoller(); - }, BATCH_SAMPLE_PDF); + AnalyzeBatchResult analyzeResult = syncPoller.getFinalResult(); + assertNotNull(analyzeResult); + assertEquals(6, analyzeResult.getSucceededCount()); }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTest.java index 784bc602e07e..09acd07909f0 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTest.java @@ -3,18 +3,18 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest; +import com.azure.ai.documentintelligence.models.AnalyzeBatchDocumentsOptions; +import com.azure.ai.documentintelligence.models.AnalyzeBatchOperation; import com.azure.ai.documentintelligence.models.AnalyzeBatchResult; -import com.azure.ai.documentintelligence.models.AnalyzeBatchResultOperation; -import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest; -import com.azure.ai.documentintelligence.models.AnalyzeOutputOption; +import com.azure.ai.documentintelligence.models.AnalyzeDocumentOptions; +import com.azure.ai.documentintelligence.models.AnalyzeOperation; +import com.azure.ai.documentintelligence.models.AnalyzeOutputFormat; import com.azure.ai.documentintelligence.models.AnalyzeResult; -import com.azure.ai.documentintelligence.models.AnalyzeResultOperation; import com.azure.ai.documentintelligence.models.AzureBlobContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; +import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; -import com.azure.ai.documentintelligence.models.ClassifyDocumentRequest; +import com.azure.ai.documentintelligence.models.ClassifyDocumentOptions; import com.azure.ai.documentintelligence.models.DocumentBuildMode; import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; @@ -26,10 +26,10 @@ import com.azure.core.util.BinaryData; import com.azure.core.util.polling.SyncPoller; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -46,8 +46,9 @@ import static com.azure.ai.documentintelligence.TestUtils.MULTIPAGE_INVOICE_PDF; import static com.azure.ai.documentintelligence.TestUtils.RECEIPT_CONTOSO_JPG; import static com.azure.ai.documentintelligence.TestUtils.urlRunner; -import static com.azure.ai.documentintelligence.models.AnalyzeOutputOption.PDF; +import static com.azure.ai.documentintelligence.models.AnalyzeOutputFormat.PDF; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class DocumentIntelligenceClientTest extends DocumentIntelligenceClientTestBase { private DocumentIntelligenceClient client; @@ -85,10 +86,8 @@ private DocumentIntelligenceAdministrationClient getDocumentModelAdminClient(Htt public void analyzeReceiptData(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-receipt", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-receipt", new AnalyzeDocumentOptions(data)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateJpegReceiptData(syncPoller.getFinalResult()); @@ -106,11 +105,9 @@ public void analyzeReceiptData(HttpClient httpClient, DocumentIntelligenceServic @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeReceiptSourceUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); - urlRunner((sourceUrl) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-receipt", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) + urlRunner((urlSource) -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-receipt", new AnalyzeDocumentOptions(urlSource)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateJpegReceiptData(syncPoller.getFinalResult()); @@ -129,10 +126,8 @@ public void analyzeReceiptSourceUrl(HttpClient httpClient, DocumentIntelligenceS public void analyzeLayout(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-layout", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-layout", new AnalyzeDocumentOptions(data)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateContentData(syncPoller.getFinalResult()); @@ -144,10 +139,10 @@ public void analyzeLayout(HttpClient httpClient, DocumentIntelligenceServiceVers public void analyzeLayoutWithPages(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller + SyncPoller syncPoller = client - .beginAnalyzeDocument("prebuilt-layout", "1, 2", null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + .beginAnalyzeDocument("prebuilt-layout", + new AnalyzeDocumentOptions(data).setPages(Arrays.asList("1, 2"))) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); AnalyzeResult analyzeResult = syncPoller.getFinalResult(); @@ -161,11 +156,9 @@ public void analyzeLayoutWithPages(HttpClient httpClient, DocumentIntelligenceSe @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeLayoutFromUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); - urlRunner(sourceUrl -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-layout", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) + urlRunner(urlSource -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-layout", new AnalyzeDocumentOptions(urlSource)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateContentData(syncPoller.getFinalResult()); @@ -177,17 +170,15 @@ public void analyzeLayoutFromUrl(HttpClient httpClient, DocumentIntelligenceServ public void analyzeGermanContentFromUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-layout", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-layout", new AnalyzeDocumentOptions(data)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateGermanContentData(syncPoller.getFinalResult()); }, CONTENT_GERMAN_PDF); } - // Custom Document recognition + // Custom AnalyzedDocument recognition /** * Verifies custom form data for a document using source as input stream data and valid model Id. @@ -200,17 +191,15 @@ public void analyzeCustomDocument(HttpClient httpClient, DocumentIntelligenceSer dataRunner((data, dataLength) -> buildModelRunner((trainingFilesUrl) -> { SyncPoller buildModelPoller = adminClient .beginBuildDocumentModel( - new BuildDocumentModelRequest("modelID" + UUID.randomUUID(), DocumentBuildMode.TEMPLATE) + new BuildDocumentModelOptions("modelID" + UUID.randomUUID(), DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); String modelId = buildModelPoller.getFinalResult().getModelId(); - SyncPoller syncPoller - = client - .beginAnalyzeDocument(modelId, null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginAnalyzeDocument(modelId, new AnalyzeDocumentOptions(data)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); @@ -219,7 +208,7 @@ public void analyzeCustomDocument(HttpClient httpClient, DocumentIntelligenceSer }), CONTENT_FORM_JPG); } - // Custom Document - URL + // Custom AnalyzedDocument - URL /** * Verifies custom form data for an URL document data without labeled data @@ -230,17 +219,15 @@ public void analyzeCustomDocumentUrl(HttpClient httpClient, DocumentIntelligence client = getDocumentAnalysisClient(httpClient, serviceVersion); String modelId1 = interceptorManager.isPlaybackMode() ? "REDACTED" : "modelId" + UUID.randomUUID(); DocumentIntelligenceAdministrationClient adminClient = getDocumentModelAdminClient(httpClient, serviceVersion); - urlRunner((sourceUrl) -> buildModelRunner((trainingFilesUrl) -> { + urlRunner((urlSource) -> buildModelRunner((trainingFilesUrl) -> { SyncPoller buildModelPoller = adminClient - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId1, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId1, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); String modelId = buildModelPoller.getFinalResult().getModelId(); - SyncPoller syncPoller - = client - .beginAnalyzeDocument(modelId, null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) + SyncPoller syncPoller + = client.beginAnalyzeDocument(modelId, new AnalyzeDocumentOptions(urlSource)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); adminClient.deleteModel(modelId); @@ -261,10 +248,8 @@ public void analyzeCustomDocumentUrl(HttpClient httpClient, DocumentIntelligence public void analyzeInvoiceData(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-invoice", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-invoice", new AnalyzeDocumentOptions(data)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateInvoiceData(syncPoller.getFinalResult()); @@ -280,11 +265,9 @@ public void analyzeInvoiceData(HttpClient httpClient, DocumentIntelligenceServic @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeInvoiceSourceUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); - urlRunner((sourceUrl) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-invoice", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) + urlRunner((urlSource) -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-invoice", new AnalyzeDocumentOptions(urlSource)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateInvoiceData(syncPoller.getFinalResult()); @@ -299,16 +282,14 @@ public void analyzeInvoiceSourceUrl(HttpClient httpClient, DocumentIntelligenceS public void invoiceValidLocale(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-invoice", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-invoice", new AnalyzeDocumentOptions(data)) .setPollInterval(durationTestMode); validateInvoiceData(syncPoller.getFinalResult()); }, INVOICE_PDF); } - // Identity Document Recognition + // Identity AnalyzedDocument Recognition /** * Verifies license card data from a document using file data as source. @@ -318,17 +299,15 @@ public void invoiceValidLocale(HttpClient httpClient, DocumentIntelligenceServic public void analyzeLicenseCardData(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-idDocument", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setBase64Source(data)) + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-idDocument", new AnalyzeDocumentOptions(data)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateIdentityData(syncPoller.getFinalResult()); }, LICENSE_PNG); } - // Identity Document - URL + // Identity AnalyzedDocument - URL /** * Verifies business card data for a document using source as file url. @@ -337,11 +316,9 @@ public void analyzeLicenseCardData(HttpClient httpClient, DocumentIntelligenceSe @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void analyzeLicenseSourceUrl(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); - urlRunner(sourceUrl -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument("prebuilt-idDocument", null, null, null, null, null, null, null, - new AnalyzeDocumentRequest().setUrlSource(sourceUrl)) + urlRunner(urlSource -> { + SyncPoller syncPoller + = client.beginAnalyzeDocument("prebuilt-idDocument", new AnalyzeDocumentOptions(urlSource)) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); validateIdentityData(syncPoller.getFinalResult()); @@ -370,7 +347,7 @@ public void testClassifyAnalyzeFromUrl(HttpClient httpClient, DocumentIntelligen .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl).setPrefix("IRS-1040-E/train"))); SyncPoller buildModelPoller = adminClient - .beginBuildClassifier(new BuildDocumentClassifierRequest(classifierId1, documentTypeDetailsMap)) + .beginBuildClassifier(new BuildDocumentClassifierOptions(classifierId1, documentTypeDetailsMap)) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); documentClassifierDetails.set(buildModelPoller.getFinalResult()); @@ -380,14 +357,14 @@ public void testClassifyAnalyzeFromUrl(HttpClient httpClient, DocumentIntelligen if (documentClassifierDetails.get() != null) { String classifierId = documentClassifierDetails.get().getClassifierId(); dataRunner((data, dataLength) -> { - SyncPoller syncPoller + SyncPoller syncPoller = client .beginClassifyDocument(documentClassifierDetails.get().getClassifierId(), - new ClassifyDocumentRequest().setBase64Source(data)) + new ClassifyDocumentOptions(data)) .setPollInterval(durationTestMode); AnalyzeResult analyzeResult = syncPoller.getFinalResult(); Assertions.assertNotNull(analyzeResult); - // TODO: (service bug) Document count should be 3 + // TODO: (service bug) AnalyzedDocument count should be 3 assertEquals(1, analyzeResult.getDocuments().size()); assertEquals(analyzeResult.getModelId(), classifierId); }, IRS_1040); @@ -416,7 +393,7 @@ public void testClassifyAnalyze(HttpClient httpClient, DocumentIntelligenceServi SyncPoller buildModelPoller = adminClient .beginBuildClassifier( - new BuildDocumentClassifierRequest("classifierId" + UUID.randomUUID(), documentTypeDetailsMap)) + new BuildDocumentClassifierOptions("classifierId" + UUID.randomUUID(), documentTypeDetailsMap)) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); documentClassifierDetails.set(buildModelPoller.getFinalResult()); @@ -426,14 +403,14 @@ public void testClassifyAnalyze(HttpClient httpClient, DocumentIntelligenceServi if (documentClassifierDetails.get() != null) { String classifierId = documentClassifierDetails.get().getClassifierId(); dataRunner((data, dataLength) -> { - SyncPoller syncPoller + SyncPoller syncPoller = client .beginClassifyDocument(documentClassifierDetails.get().getClassifierId(), - new ClassifyDocumentRequest().setBase64Source(data)) + new ClassifyDocumentOptions(data)) .setPollInterval(durationTestMode); AnalyzeResult analyzeResult = syncPoller.getFinalResult(); Assertions.assertNotNull(analyzeResult); - // TODO: (service bug) Document count should be 3 + // TODO: (service bug) AnalyzedDocument count should be 3 assertEquals(1, analyzeResult.getDocuments().size()); assertEquals(analyzeResult.getModelId(), classifierId); }, IRS_1040); @@ -447,11 +424,10 @@ public void getAnalyzePdf(HttpClient httpClient, DocumentIntelligenceServiceVers client = getDocumentAnalysisClient(httpClient, serviceVersion); String modelID = "prebuilt-read"; dataRunner((data, dataLength) -> { - SyncPoller syncPoller - = client - .beginAnalyzeDocument(modelID, null, null, null, null, null, null, Collections.singletonList(PDF), - new AnalyzeDocumentRequest().setBase64Source(data)) - .setPollInterval(durationTestMode); + SyncPoller syncPoller = client + .beginAnalyzeDocument(modelID, + new AnalyzeDocumentOptions(data).setOutput(Collections.singletonList(PDF))) + .setPollInterval(durationTestMode); String resultId = syncPoller.poll().getValue().getOperationId(); syncPoller.waitForCompletion(); @@ -471,11 +447,11 @@ public void getAnalyzeFigures(HttpClient httpClient, DocumentIntelligenceService client = getDocumentAnalysisClient(httpClient, serviceVersion); String modelID = "prebuilt-layout"; dataRunner((data, dataLength) -> { - SyncPoller syncPoller + SyncPoller syncPoller = client - .beginAnalyzeDocument(modelID, null, null, null, null, null, null, - Collections.singletonList(AnalyzeOutputOption.FIGURES), - new AnalyzeDocumentRequest().setBase64Source(data)) + .beginAnalyzeDocument(modelID, + new AnalyzeDocumentOptions(data) + .setOutput(Collections.singletonList(AnalyzeOutputFormat.FIGURES))) .setPollInterval(durationTestMode); String resultId = syncPoller.poll().getValue().getOperationId(); syncPoller.waitForCompletion(); @@ -497,29 +473,18 @@ public void getAnalyzeFigures(HttpClient httpClient, DocumentIntelligenceService @RecordWithoutRequestBody @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") - @Disabled("com.azure.core.exception.AzureException: Long running operation failed.\n") public void analyzeBatchDocuments(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getDocumentAnalysisClient(httpClient, serviceVersion); - DocumentIntelligenceAdministrationClient adminClient = getDocumentModelAdminClient(httpClient, serviceVersion); buildBatchModelRunner((trainingFilesUrl, trainingFilesResultUrl) -> { - SyncPoller buildModelPoller = adminClient - .beginBuildDocumentModel( - new BuildDocumentModelRequest("modelID" + UUID.randomUUID(), DocumentBuildMode.GENERATIVE) - .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) - .setPollInterval(durationTestMode); - buildModelPoller.waitForCompletion(); - String modelId = buildModelPoller.getFinalResult().getModelId(); - - SyncPoller syncPoller = client - .beginAnalyzeBatchDocuments(modelId, null, null, null, null, null, null, null, - new AnalyzeBatchDocumentsRequest(trainingFilesResultUrl) - .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl).setPrefix("result"))) + SyncPoller syncPoller = client + .beginAnalyzeBatchDocuments("prebuilt-layout", + new AnalyzeBatchDocumentsOptions(new AzureBlobContentSource(trainingFilesUrl), + trainingFilesResultUrl).setResultPrefix("result/").setOverwriteExisting(true)) .setPollInterval(durationTestMode); - syncPoller.waitForCompletion(); AnalyzeBatchResult analyzeBatchResult = syncPoller.getFinalResult(); - assertEquals(trainingFilesResultUrl, analyzeBatchResult.getDetails().get(0).getResultUrl()); + assertNotNull(analyzeBatchResult.getDetails().get(0).getResultUrl()); }); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java index 248da5f2b605..e4b06e28b364 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java @@ -137,7 +137,7 @@ void validateJpegReceiptData(AnalyzeResult actualAnalyzeResult) { // documents Assertions.assertEquals(1, actualAnalyzeResult.getDocuments().size()); actualAnalyzeResult.getDocuments().forEach(actualDocument -> { - Assertions.assertEquals("receipt.retailMeal", actualDocument.getDocType()); + Assertions.assertEquals("receipt.retailMeal", actualDocument.getDocumentType()); // document fields validateJpegReceiptFields(actualDocument.getFields()); }); @@ -224,7 +224,7 @@ void validateIdentityData(AnalyzeResult analyzeResult) { assertEquals(1, licensePage1.getPageNumber()); assertNotNull(analyzeResult.getDocuments()); - assertEquals("idDocument.driverLicense", analyzeResult.getDocuments().get(0).getDocType()); + assertEquals("idDocument.driverLicense", analyzeResult.getDocuments().get(0).getDocumentType()); Map licensePageFields = analyzeResult.getDocuments().get(0).getFields(); assertEquals("Main Street", licensePageFields.get("Address").getValueAddress().getStreetAddress()); assertNotNull(licensePageFields.get("Address").getConfidence()); @@ -333,7 +333,7 @@ void validateJpegCustomDocument(AnalyzeResult actualAnalyzeResult) { } actualAnalyzeResult.getDocuments().forEach(actualDocument -> { - // Assertions.assertEquals(modelId, actualDocument.getDocType()); + // Assertions.assertEquals(modelId, actualDocument.getDocumentType()); actualDocument.getFields().forEach((key, documentField) -> { // document fields assertNotNull(documentField.getConfidence()); @@ -397,7 +397,7 @@ void validateW2Data(AnalyzeResult analyzeResult) { assertEquals(1, licensePage1.getPageNumber()); assertNotNull(analyzeResult.getDocuments()); - assertEquals("tax.us.w2", analyzeResult.getDocuments().get(0).getDocType()); + assertEquals("tax.us.w2", analyzeResult.getDocuments().get(0).getDocumentType()); Map w2Fields = analyzeResult.getDocuments().get(0).getFields(); Map employeeFields = w2Fields.get("Employee").getValueObject(); @@ -494,9 +494,8 @@ private void validateJpegReceiptFields(Map actualFields) Assertions.assertEquals("+19876543210", documentField.getValuePhoneNumber()); assertNotNull(documentField.getConfidence()); } else if ("ReceiptType".equals(key)) { - Assertions.assertEquals("Itemized", documentField.getValueString()); - // TODO: (service bug) confidence is returned as null - // assertNotNull(documentField.getConfidence()); + Assertions.assertEquals("Meal", documentField.getValueString()); + assertNotNull(documentField.getConfidence()); } else if ("Subtotal".equals(key)) { Assertions.assertEquals("$ 11.70", documentField.getContent()); assertNotNull(documentField.getConfidence()); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationAsyncClientTest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationAsyncClientTest.java index e3e267965a2e..044d6997f02d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationAsyncClientTest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationAsyncClientTest.java @@ -3,16 +3,15 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; +import com.azure.ai.documentintelligence.models.AuthorizeClassifierCopyOptions; +import com.azure.ai.documentintelligence.models.AuthorizeModelCopyOptions; import com.azure.ai.documentintelligence.models.AzureBlobContentSource; import com.azure.ai.documentintelligence.models.AzureBlobFileListContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; +import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; import com.azure.ai.documentintelligence.models.ClassifierCopyAuthorization; import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; -import com.azure.ai.documentintelligence.models.CopyAuthorization; import com.azure.ai.documentintelligence.models.DocumentBuildMode; import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierCopyToOperationDetails; @@ -22,6 +21,7 @@ import com.azure.ai.documentintelligence.models.DocumentModelCopyToOperationDetails; import com.azure.ai.documentintelligence.models.DocumentModelDetails; import com.azure.ai.documentintelligence.models.DocumentTypeDetails; +import com.azure.ai.documentintelligence.models.ModelCopyAuthorization; import com.azure.core.http.HttpClient; import com.azure.core.test.annotation.RecordWithoutRequestBody; import com.azure.core.test.http.AssertingHttpClientBuilder; @@ -46,7 +46,6 @@ import static com.azure.ai.documentintelligence.TestUtils.DEFAULT_TIMEOUT; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; public class DocumentModelAdministrationAsyncClientTest extends DocumentAdministrationClientTestBase { @@ -73,7 +72,7 @@ private DocumentIntelligenceAdministrationAsyncClient getModelAdminAsyncClient(H @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void validGetResourceInfo(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getModelAdminAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.getResourceInfo()) + StepVerifier.create(client.getResourceDetails()) .assertNext(DocumentAdministrationClientTestBase::validateResourceInfo) .expectComplete() .verify(DEFAULT_TIMEOUT); @@ -87,7 +86,7 @@ public void validGetResourceInfo(HttpClient httpClient, DocumentIntelligenceServ public void validgetResourceInfoWithResponse(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getModelAdminAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.getResourceInfo()) + StepVerifier.create(client.getResourceDetails()) .assertNext(DocumentAdministrationClientTestBase::validateResourceInfo) .expectComplete() .verify(DEFAULT_TIMEOUT); @@ -102,7 +101,7 @@ public void deleteModelValidModelIdWithResponse(HttpClient httpClient, buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = client .beginBuildDocumentModel( - new BuildDocumentModelRequest("modelId" + UUID.randomUUID(), DocumentBuildMode.TEMPLATE) + new BuildDocumentModelOptions("modelId" + UUID.randomUUID(), DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -127,7 +126,7 @@ public void copyAuthorization(HttpClient httpClient, DocumentIntelligenceService try { buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -137,9 +136,9 @@ public void copyAuthorization(HttpClient httpClient, DocumentIntelligenceService StepVerifier .create(client.authorizeModelCopyWithResponse( - BinaryData.fromObject(new AuthorizeCopyRequest("copy_model_id" + UUID.randomUUID())), null)) - .assertNext( - response -> validateCopyAuthorizationResult(response.getValue().toObject(CopyAuthorization.class))) + BinaryData.fromObject(new AuthorizeModelCopyOptions("copy_model_id" + UUID.randomUUID())), null)) + .assertNext(response -> validateCopyAuthorizationResult( + response.getValue().toObject(ModelCopyAuthorization.class))) .expectComplete() .verify(DEFAULT_TIMEOUT); } finally { @@ -163,7 +162,7 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentIntelligence try { buildModelRunner((trainingDataSasUrl) -> { SyncPoller syncPoller1 = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId1, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId1, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -177,7 +176,7 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentIntelligence assertNotNull(documentModelDetails1); SyncPoller syncPoller2 = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId2, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId2, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -206,7 +205,7 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentIntelligence SyncPoller syncPoller = client .beginBuildClassifier( - new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsClassifierMap)) + new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsClassifierMap)) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -239,7 +238,7 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentIntelligence DocumentModelDetails composedModel = composePoller.getFinalResult(); assertNotNull(composedModel.getModelId()); assertEquals("test desc", composedModel.getDescription()); - assertEquals(2, composedModel.getDocTypes().size()); + assertEquals(2, composedModel.getDocumentTypes().size()); validateDocumentModelData(composedModel); } finally { StepVerifier.create(client.deleteModel(modelId1)).expectComplete().verify(DEFAULT_TIMEOUT); @@ -260,7 +259,7 @@ public void beginBuildModel(HttpClient httpClient, DocumentIntelligenceServiceVe String modelId = interceptorManager.isPlaybackMode() ? "REDACTED" : "modelId" + UUID.randomUUID(); buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -282,16 +281,16 @@ public void beginCopy(HttpClient httpClient, DocumentIntelligenceServiceVersion String modelId = interceptorManager.isPlaybackMode() ? "REDACTED" : "modelId" + UUID.randomUUID(); buildModelRunner((trainingFilesUrl) -> { SyncPoller syncPoller1 = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl))) .setPollInterval(durationTestMode) .getSyncPoller(); syncPoller1.waitForCompletion(); DocumentModelDetails actualModel = syncPoller1.getFinalResult(); - Mono targetMono - = client.authorizeModelCopy(new AuthorizeCopyRequest("copyModelId" + UUID.randomUUID())); - CopyAuthorization target = targetMono.block(); + Mono targetMono + = client.authorizeModelCopy(new AuthorizeModelCopyOptions("copyModelId" + UUID.randomUUID())); + ModelCopyAuthorization target = targetMono.block(); if (actualModel == null) { fail(); return; @@ -317,7 +316,7 @@ public void listModels(HttpClient httpClient, DocumentIntelligenceServiceVersion StepVerifier.create(client.listModels().byPage().take(4)).thenConsumeWhile(documentModelInfoPagedResponse -> { documentModelInfoPagedResponse.getValue().forEach(documentModelInfo -> { assertNotNull(documentModelInfo.getModelId()); - assertNotNull(documentModelInfo.getCreatedDateTime()); + assertNotNull(documentModelInfo.getCreatedOn()); }); return true; }).expectComplete().verify(DEFAULT_TIMEOUT); @@ -336,13 +335,11 @@ public void listOperations(HttpClient httpClient, DocumentIntelligenceServiceVer .thenConsumeWhile(modelOperationInfoPagedResponse -> { modelOperationInfoPagedResponse.getValue().forEach(modelOperationInfo -> { operationIdList.add(modelOperationInfo.getOperationId()); - assertTrue(modelOperationInfo.getOperationId() != null - && modelOperationInfo.getKind() != null - && modelOperationInfo.getStatus() != null - && modelOperationInfo.getCreatedDateTime() != null - && modelOperationInfo.getLastUpdatedDateTime() != null - && modelOperationInfo.getResourceLocation() != null - && modelOperationInfo.getPercentCompleted() != null); + assertNotNull(modelOperationInfo.getOperationId()); + assertNotNull(modelOperationInfo.getKind()); + assertNotNull(modelOperationInfo.getStatus()); + assertNotNull(modelOperationInfo.getCreatedOn()); + assertNotNull(modelOperationInfo.getResourceLocation()); }); return true; }) @@ -353,7 +350,7 @@ public void listOperations(HttpClient httpClient, DocumentIntelligenceServiceVer operationIdList.forEach( operationId -> StepVerifier.create(client.getOperation(operationId)).assertNext(operationDetails -> { assertNotNull(operationDetails.getOperationId()); - assertNotNull(operationDetails.getCreatedDateTime()); + assertNotNull(operationDetails.getCreatedOn()); }).expectComplete().verify(DEFAULT_TIMEOUT)); } } @@ -377,14 +374,14 @@ public void beginBuildClassifier(HttpClient httpClient, DocumentIntelligenceServ documentTypeDetailsMap.put("IRS-1040-E", new ClassifierDocumentTypeDetails() .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl).setPrefix("IRS-1040-E/train"))); SyncPoller buildModelPoller - = client.beginBuildClassifier(new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsMap)) + = client.beginBuildClassifier(new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsMap)) .setPollInterval(durationTestMode) .getSyncPoller(); DocumentClassifierDetails documentClassifierDetails = buildModelPoller.getFinalResult(); validateClassifierModelData(buildModelPoller.getFinalResult()); - assertNotNull(documentClassifierDetails.getDocTypes()); - documentClassifierDetails.getDocTypes() + assertNotNull(documentClassifierDetails.getDocumentTypes()); + documentClassifierDetails.getDocumentTypes() .forEach((s, classifierDocumentTypeDetails) -> assertNotNull( (classifierDocumentTypeDetails.getAzureBlobSource()).getContainerUrl())); }); @@ -413,12 +410,12 @@ public void beginBuildClassifierWithJsonL(HttpClient httpClient, documentTypeDetailsMap.put("IRS-1040-E", new ClassifierDocumentTypeDetails() .setAzureBlobFileListSource(new AzureBlobFileListContentSource(trainingFilesUrl, "IRS-1040-E.jsonl"))); SyncPoller buildModelPoller - = client.beginBuildClassifier(new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsMap)) + = client.beginBuildClassifier(new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsMap)) .setPollInterval(durationTestMode) .getSyncPoller(); DocumentClassifierDetails documentClassifierDetails = buildModelPoller.getFinalResult(); - assertNotNull(documentClassifierDetails.getDocTypes()); - documentClassifierDetails.getDocTypes() + assertNotNull(documentClassifierDetails.getDocumentTypes()); + documentClassifierDetails.getDocumentTypes() .forEach((s, classifierDocumentTypeDetails) -> assertNotNull( (classifierDocumentTypeDetails.getAzureBlobFileListSource()).getContainerUrl())); @@ -452,7 +449,7 @@ public void copyAuthorizationClassifier(HttpClient httpClient, DocumentIntellige SyncPoller syncPoller = client .beginBuildClassifier( - new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsClassifierMap)) + new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsClassifierMap)) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -466,7 +463,7 @@ public void copyAuthorizationClassifier(HttpClient httpClient, DocumentIntellige StepVerifier .create(client.authorizeClassifierCopyWithResponse( - BinaryData.fromObject(new AuthorizeClassifierCopyRequest("copy_classifier" + UUID.randomUUID()) + BinaryData.fromObject(new AuthorizeClassifierCopyOptions("copy_classifier" + UUID.randomUUID()) .setDescription("test description")), null)) .assertNext(response -> validateClassifierCopyAuthorizationResult( @@ -505,7 +502,7 @@ public void beginCopyClassifier(HttpClient httpClient, DocumentIntelligenceServi SyncPoller syncPoller = client .beginBuildClassifier( - new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsClassifierMap)) + new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsClassifierMap)) .setPollInterval(durationTestMode) .getSyncPoller(); @@ -519,7 +516,7 @@ public void beginCopyClassifier(HttpClient httpClient, DocumentIntelligenceServi final ClassifierCopyAuthorization[] copyAuthorization = new ClassifierCopyAuthorization[1]; Mono targetMono = client - .authorizeClassifierCopy(new AuthorizeClassifierCopyRequest("copyClassifierId" + UUID.randomUUID())); + .authorizeClassifierCopy(new AuthorizeClassifierCopyOptions("copyClassifierId" + UUID.randomUUID())); StepVerifier.create(targetMono).assertNext(target -> { assertNotNull(target); copyAuthorization[0] = target; diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationClientTest.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationClientTest.java index 15a31de7bfc3..24557cb835cc 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationClientTest.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentModelAdministrationClientTest.java @@ -3,14 +3,14 @@ package com.azure.ai.documentintelligence; -import com.azure.ai.documentintelligence.models.AuthorizeCopyRequest; +import com.azure.ai.documentintelligence.models.AuthorizeModelCopyOptions; import com.azure.ai.documentintelligence.models.AzureBlobContentSource; import com.azure.ai.documentintelligence.models.AzureBlobFileListContentSource; -import com.azure.ai.documentintelligence.models.BuildDocumentClassifierRequest; -import com.azure.ai.documentintelligence.models.BuildDocumentModelRequest; +import com.azure.ai.documentintelligence.models.BuildDocumentClassifierOptions; +import com.azure.ai.documentintelligence.models.BuildDocumentModelOptions; import com.azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails; import com.azure.ai.documentintelligence.models.ComposeDocumentModelRequest; -import com.azure.ai.documentintelligence.models.CopyAuthorization; +import com.azure.ai.documentintelligence.models.ModelCopyAuthorization; import com.azure.ai.documentintelligence.models.DocumentBuildMode; import com.azure.ai.documentintelligence.models.DocumentClassifierBuildOperationDetails; import com.azure.ai.documentintelligence.models.DocumentClassifierDetails; @@ -59,7 +59,7 @@ public void getModelWithResponse(HttpClient httpClient, DocumentIntelligenceServ String modelId = interceptorManager.isPlaybackMode() ? "REDACTED" : "modelId" + UUID.randomUUID(); buildModelRunner((trainingDataSasUrl) -> { DocumentModelDetails documentModelDetails = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode) .getFinalResult(); @@ -78,7 +78,7 @@ public void getModelWithResponse(HttpClient httpClient, DocumentIntelligenceServ @MethodSource("com.azure.ai.documentintelligence.TestUtils#getTestParameters") public void validGetResourceDetails(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getModelAdministrationClient(httpClient, serviceVersion); - validateResourceInfo(client.getResourceInfo()); + validateResourceInfo(client.getResourceDetails()); } /** @@ -89,7 +89,7 @@ public void validGetResourceDetails(HttpClient httpClient, DocumentIntelligenceS public void validGetResourceDetailsWithResponse(HttpClient httpClient, DocumentIntelligenceServiceVersion serviceVersion) { client = getModelAdministrationClient(httpClient, serviceVersion); - Response resourceDetailsResponse = client.getResourceInfoWithResponse(null); + Response resourceDetailsResponse = client.getResourceDetailsWithResponse(null); assertEquals(resourceDetailsResponse.getStatusCode(), HttpResponseStatus.OK.code()); } @@ -101,7 +101,7 @@ public void deleteModelValidModelIDWithResponse(HttpClient httpClient, client = getModelAdministrationClient(httpClient, serviceVersion); buildModelRunner((trainingDataSasUrl) -> { SyncPoller syncPoller = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); @@ -127,7 +127,7 @@ public void listModels(HttpClient httpClient, DocumentIntelligenceServiceVersion List modelInfoList = documentModelDetailsPagedResponse.getValue(); modelInfoList.forEach(DocumentModelDetails -> { assertNotNull(DocumentModelDetails.getModelId()); - assertNotNull(DocumentModelDetails.getCreatedDateTime()); + assertNotNull(DocumentModelDetails.getCreatedOn()); }); pageCount++; if (pageCount > 4) { @@ -149,7 +149,7 @@ public void listModelsWithContext(HttpClient httpClient, DocumentIntelligenceSer List modelInfoList = documentModelDetailsPagedResponse.getValue(); modelInfoList.forEach(modelInfo -> { assertNotNull(modelInfo.toObject(DocumentModelDetails.class).getModelId()); - assertNotNull(modelInfo.toObject(DocumentModelDetails.class).getCreatedDateTime()); + assertNotNull(modelInfo.toObject(DocumentModelDetails.class).getCreatedOn()); }); pageCount++; if (pageCount > 4) { @@ -169,14 +169,14 @@ public void beginCopy(HttpClient httpClient, DocumentIntelligenceServiceVersion String modelId = interceptorManager.isPlaybackMode() ? "REDACTED" : "modelId" + UUID.randomUUID(); buildModelRunner((trainingDataSasUrl) -> { SyncPoller syncPoller = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode); syncPoller.waitForCompletion(); DocumentModelDetails actualModel = syncPoller.getFinalResult(); - CopyAuthorization target = client.authorizeModelCopy( - new AuthorizeCopyRequest("copyModelId" + UUID.randomUUID()).setTags(actualModel.getTags()) + ModelCopyAuthorization target = client.authorizeModelCopy( + new AuthorizeModelCopyOptions("copyModelId" + UUID.randomUUID()).setTags(actualModel.getTags()) .setDescription(actualModel.getDescription())); SyncPoller copyPoller @@ -200,7 +200,7 @@ public void beginBuildModelWithJPGTrainingSet(HttpClient httpClient, String modelId = interceptorManager.isPlaybackMode() ? "REDACTED" : "modelId" + UUID.randomUUID(); buildModelRunner((trainingDataSasUrl) -> { SyncPoller buildModelPoller = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); @@ -220,7 +220,7 @@ public void beginBuildModelWithMultiPagePDFTrainingSet(HttpClient httpClient, client = getModelAdministrationClient(httpClient, serviceVersion); multipageTrainingRunner(trainingDataSasUrl -> { SyncPoller buildModelPoller = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); @@ -240,7 +240,7 @@ public void beginBuildModelWithJsonLTrainingSet(HttpClient httpClient, String modelId = interceptorManager.isPlaybackMode() ? "REDACTED" : "modelId" + UUID.randomUUID(); selectionMarkTrainingRunner(trainingFilesUrl -> { SyncPoller buildModelPoller = client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId, DocumentBuildMode.TEMPLATE) .setAzureBlobFileListSource(new AzureBlobFileListContentSource(trainingFilesUrl, "filelist.jsonl"))) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); @@ -263,13 +263,13 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentIntelligence try { buildModelRunner((trainingDataSasUrl) -> { client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId1, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId1, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode) .getFinalResult(); client - .beginBuildDocumentModel(new BuildDocumentModelRequest(modelId2, DocumentBuildMode.TEMPLATE) + .beginBuildDocumentModel(new BuildDocumentModelOptions(modelId2, DocumentBuildMode.TEMPLATE) .setAzureBlobSource(new AzureBlobContentSource(trainingDataSasUrl))) .setPollInterval(durationTestMode) .getFinalResult(); @@ -290,7 +290,7 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentIntelligence .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl).setPrefix("IRS-1040-E/train"))); SyncPoller buildClassifier = client .beginBuildClassifier( - new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsClassifierMap)) + new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsClassifierMap)) .setPollInterval(durationTestMode); buildClassifier.getFinalResult(); }); @@ -310,7 +310,7 @@ public void beginCreateComposedModel(HttpClient httpClient, DocumentIntelligence assertNotNull(composedModel.getModelId()); assertEquals("test desc", composedModel.getDescription()); - assertEquals(2, composedModel.getDocTypes().size()); + assertEquals(2, composedModel.getDocumentTypes().size()); validateDocumentModelData(composedModel); client.deleteModel(composedModel.getModelId()); @@ -342,12 +342,12 @@ public void beginBuildClassifier(HttpClient httpClient, DocumentIntelligenceServ documentTypeDetailsMap.put("IRS-1040-E", new ClassifierDocumentTypeDetails() .setAzureBlobSource(new AzureBlobContentSource(trainingFilesUrl).setPrefix("IRS-1040-E/train"))); SyncPoller buildModelPoller - = client.beginBuildClassifier(new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsMap)) + = client.beginBuildClassifier(new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsMap)) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); DocumentClassifierDetails documentClassifierDetails = buildModelPoller.getFinalResult(); validateClassifierModelData(documentClassifierDetails); - documentClassifierDetails.getDocTypes() + documentClassifierDetails.getDocumentTypes() .forEach((s, classifierDocumentTypeDetails) -> assertNotNull( classifierDocumentTypeDetails.getAzureBlobSource().getContainerUrl())); }); @@ -377,12 +377,12 @@ public void beginBuildClassifierWithJsonL(HttpClient httpClient, documentTypeDetailsMap.put("IRS-1040-E", new ClassifierDocumentTypeDetails() .setAzureBlobFileListSource(new AzureBlobFileListContentSource(trainingFilesUrl, "IRS-1040-E.jsonl"))); SyncPoller buildModelPoller - = client.beginBuildClassifier(new BuildDocumentClassifierRequest(classifierId, documentTypeDetailsMap)) + = client.beginBuildClassifier(new BuildDocumentClassifierOptions(classifierId, documentTypeDetailsMap)) .setPollInterval(durationTestMode); buildModelPoller.waitForCompletion(); DocumentClassifierDetails documentClassifierDetails = buildModelPoller.getFinalResult(); - documentClassifierDetails.getDocTypes() + documentClassifierDetails.getDocumentTypes() .forEach((s, classifierDocumentTypeDetails) -> assertNotNull( classifierDocumentTypeDetails.getAzureBlobFileListSource().getContainerUrl())); diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/TestUtils.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/TestUtils.java index 72f048ca7981..de48a2d7a77a 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/TestUtils.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/TestUtils.java @@ -242,6 +242,8 @@ public static List getTestProxySanitizers() { new TestProxySanitizer("$..urlSource", null, REDACTED_VALUE, TestProxySanitizerType.BODY_KEY), new TestProxySanitizer("$..source", null, REDACTED_VALUE, TestProxySanitizerType.BODY_KEY), new TestProxySanitizer("$..resourceLocation", null, REDACTED_VALUE, TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("Location", URL_REGEX, REDACTED_VALUE, TestProxySanitizerType.BODY_KEY)); + new TestProxySanitizer("Location", URL_REGEX, REDACTED_VALUE, TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("$..urlSource", null, REDACTED_VALUE, TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("$..resultUrl", null, REDACTED_VALUE, TestProxySanitizerType.BODY_KEY)); } } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/generated/DocumentIntelligenceClientTestBase.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/generated/DocumentIntelligenceClientTestBase.java deleted file mode 100644 index c7c2d147c6f6..000000000000 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/generated/DocumentIntelligenceClientTestBase.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.ai.documentintelligence.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder; -import com.azure.ai.documentintelligence.DocumentIntelligenceClient; -import com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder; -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.test.utils.MockTokenCredential; -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; - -class DocumentIntelligenceClientTestBase extends TestProxyTestBase { - protected DocumentIntelligenceClient documentIntelligenceClient; - - protected DocumentIntelligenceAdministrationClient documentIntelligenceAdministrationClient; - - @Override - protected void beforeTest() { - DocumentIntelligenceClientBuilder documentIntelligenceClientbuilder = new DocumentIntelligenceClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(HttpClient.createDefault()) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.PLAYBACK) { - documentIntelligenceClientbuilder.httpClient(interceptorManager.getPlaybackClient()) - .credential(new MockTokenCredential()); - } else if (getTestMode() == TestMode.RECORD) { - documentIntelligenceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) - .credential(new DefaultAzureCredentialBuilder().build()); - } else if (getTestMode() == TestMode.LIVE) { - documentIntelligenceClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); - } - documentIntelligenceClient = documentIntelligenceClientbuilder.buildClient(); - - DocumentIntelligenceAdministrationClientBuilder documentIntelligenceAdministrationClientbuilder - = new DocumentIntelligenceAdministrationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(HttpClient.createDefault()) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.PLAYBACK) { - documentIntelligenceAdministrationClientbuilder.httpClient(interceptorManager.getPlaybackClient()) - .credential(new MockTokenCredential()); - } else if (getTestMode() == TestMode.RECORD) { - documentIntelligenceAdministrationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) - .credential(new DefaultAzureCredentialBuilder().build()); - } else if (getTestMode() == TestMode.LIVE) { - documentIntelligenceAdministrationClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); - } - documentIntelligenceAdministrationClient = documentIntelligenceAdministrationClientbuilder.buildClient(); - - } -} diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml b/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml index a04b82899d79..829b33c5146e 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/ai/DocumentIntelligence -commit: b1e5e8e9679ac5abd112acee4a17d2d036ec61da +commit: a716d1baa7139cb4f21995c9fa23521189e1de40 repo: Azure/azure-rest-api-specs diff --git a/sdk/documentintelligence/test-resources.json b/sdk/documentintelligence/test-resources.json index bdb59ee84f35..61fd90bec052 100644 --- a/sdk/documentintelligence/test-resources.json +++ b/sdk/documentintelligence/test-resources.json @@ -11,7 +11,7 @@ }, "location": { "type": "string", - "defaultValue": "eastus", + "defaultValue": "eu2euap", "metadata": { "description": "The location of the resource. By default, this is the same as the resource group." }