Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Release History

## 1.0.0-beta.1 (Unreleased)

- Azure DocumentIntelligence client library for Java. This package contains Microsoft Azure DocumentIntelligence client library.

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
483 changes: 483 additions & 0 deletions sdk/documentintelligence/azure-ai-documentintelligence/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo" : "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath" : "java",
"TagPrefix" : "java/documentintelligence/azure-ai-documentintelligence",
"Tag" : ""
}
100 changes: 100 additions & 0 deletions sdk/documentintelligence/azure-ai-documentintelligence/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!--
~ Copyright (c) Microsoft Corporation. All rights reserved.
~ Licensed under the MIT License.
~ Code generated by Microsoft (R) TypeSpec Code Generator.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.azure</groupId>
<artifactId>azure-client-sdk-parent</artifactId>
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
</parent>

<groupId>com.azure</groupId>
<artifactId>azure-ai-documentintelligence</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-ai-documentintelligence;current} -->
<packaging>jar</packaging>

<name>Microsoft Azure SDK for DocumentIntelligence</name>
<description>This package contains Microsoft Azure DocumentIntelligence client library.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/Azure/azure-sdk-for-java</url>
<connection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</connection>
<developerConnection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>microsoft</id>
<name>Microsoft</name>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.45.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.13.10</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.11.0</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.22.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.10.4</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-experimental</artifactId>
<version>1.0.0-beta.46</version> <!-- {x-version-update;com.azure:azure-core-experimental;dependency} -->
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
// 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.DocumentAnalysisClientImpl;
import com.azure.ai.documentintelligence.models.AnalyzeDocumentRequest;
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.DocumentAnalysisFeature;
import com.azure.ai.documentintelligence.models.SplitMode;
import com.azure.ai.documentintelligence.models.StringIndexType;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.ClientAuthenticationException;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.util.BinaryData;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.serializer.CollectionFormat;
import com.azure.core.util.serializer.JacksonAdapter;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/** Initializes a new instance of the asynchronous DocumentAnalysisClient type. */
@ServiceClient(builder = DocumentAnalysisClientBuilder.class, isAsync = true)
public final class DocumentAnalysisAsyncClient {
@Generated private final DocumentAnalysisClientImpl serviceClient;

/**
* Initializes an instance of DocumentAnalysisAsyncClient class.
*
* @param serviceClient the service client implementation.
*/
@Generated
DocumentAnalysisAsyncClient(DocumentAnalysisClientImpl serviceClient) {
this.serviceClient = serviceClient;
}

/**
* Analyzes document with document model.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>pages</td><td>String</td><td>No</td><td>List of 1-based page numbers to analyze. Ex. "1-3,5,7-9"</td></tr>
* <tr><td>locale</td><td>String</td><td>No</td><td>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").</td></tr>
* <tr><td>stringIndexType</td><td>String</td><td>No</td><td>Method used to compute string offset and length. Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".</td></tr>
* <tr><td>features</td><td>List&lt;String&gt;</td><td>No</td><td>List of optional analysis features. In the form of "," separated string.</td></tr>
* <tr><td>queryFields</td><td>List&lt;String&gt;</td><td>No</td><td>List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". In the form of "," separated string.</td></tr>
* <tr><td>outputContentFormat</td><td>String</td><td>No</td><td>Format of the analyze result top-level content. Allowed values: "text", "markdown".</td></tr>
* </table>
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
*
* <p><strong>Request Body Schema</strong>
*
* <pre>{@code
* {
* urlSource: String (Optional)
* base64Source: byte[] (Optional)
* }
* }</pre>
*
* @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 the {@link PollerFlux} for polling of long-running operation.
*/
@Generated
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux<BinaryData, BinaryData> beginAnalyzeDocument(String modelId, RequestOptions requestOptions) {
return this.serviceClient.beginAnalyzeDocumentAsync(modelId, requestOptions);
}

/**
* Classifies document with document classifier.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>stringIndexType</td><td>String</td><td>No</td><td>Method used to compute string offset and length. Allowed values: "textElements", "unicodeCodePoint", "utf16CodeUnit".</td></tr>
* <tr><td>split</td><td>String</td><td>No</td><td>Document splitting mode. Allowed values: "auto", "none", "perPage".</td></tr>
* </table>
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
*
* <p><strong>Request Body Schema</strong>
*
* <pre>{@code
* {
* urlSource: String (Optional)
* base64Source: byte[] (Optional)
* }
* }</pre>
*
* @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.
* @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<BinaryData, BinaryData> beginClassifyDocument(
String classifierId, BinaryData classifyRequest, RequestOptions requestOptions) {
return this.serviceClient.beginClassifyDocumentAsync(classifierId, classifyRequest, 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 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.
* @param features List of optional analysis features.
* @param queryFields List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber".
* @param outputContentFormat Format of the analyze result top-level content.
* @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.
* @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<AnalyzeResultOperation, AnalyzeResult> beginAnalyzeDocument(
String modelId,
String pages,
String locale,
StringIndexType stringIndexType,
List<DocumentAnalysisFeature> features,
List<String> queryFields,
ContentFormat outputContentFormat,
AnalyzeDocumentRequest analyzeRequest) {
// Generated convenience method for beginAnalyzeDocumentWithModel
RequestOptions requestOptions = new RequestOptions();
if (pages != null) {
requestOptions.addQueryParam("pages", pages, false);
}
if (locale != null) {
requestOptions.addQueryParam("locale", locale, false);
}
if (stringIndexType != null) {
requestOptions.addQueryParam("stringIndexType", stringIndexType.toString(), false);
}
if (features != null) {
requestOptions.addQueryParam(
"features",
JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(features, CollectionFormat.CSV),
false);
}
if (queryFields != null) {
requestOptions.addQueryParam(
"queryFields",
queryFields.stream()
.map(paramItemValue -> Objects.toString(paramItemValue, ""))
.collect(Collectors.joining(",")),
false);
}
if (outputContentFormat != null) {
requestOptions.addQueryParam("outputContentFormat", outputContentFormat.toString(), 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<AnalyzeResultOperation, AnalyzeResult> beginAnalyzeDocument(String modelId) {
// Generated convenience method for beginAnalyzeDocumentWithModel
RequestOptions requestOptions = new RequestOptions();
return serviceClient.beginAnalyzeDocumentWithModelAsync(modelId, 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.
* @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<AnalyzeResultOperation, AnalyzeResult> beginClassifyDocument(
String classifierId,
ClassifyDocumentRequest classifyRequest,
StringIndexType stringIndexType,
SplitMode split) {
// 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);
}
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<AnalyzeResultOperation, AnalyzeResult> beginClassifyDocument(
String classifierId, ClassifyDocumentRequest classifyRequest) {
// Generated convenience method for beginClassifyDocumentWithModel
RequestOptions requestOptions = new RequestOptions();
return serviceClient.beginClassifyDocumentWithModelAsync(
classifierId, BinaryData.fromObject(classifyRequest), requestOptions);
}
}
Loading