Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

docs: generate sample code in the Java microgenerator #338

Merged
merged 1 commit into from Feb 9, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -39,6 +39,15 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* List<ProcessDocumentRequest> requests = new ArrayList<>();
* BatchProcessDocumentsResponse response =
* documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
* }
* }</pre>
*
* <p>Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up
* resources such as threads. In the example above, try-with-resources is used, which automatically
* calls close().
Expand Down Expand Up @@ -161,6 +170,17 @@ public final OperationsClient getOperationsClient() {
/**
* LRO endpoint to batch process many documents.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* List<ProcessDocumentRequest> requests = new ArrayList<>();
* BatchProcessDocumentsResponse response =
* documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
* }
* }</pre>
*
* @param requests Required. Individual requests for each document.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -175,6 +195,21 @@ public final OperationsClient getOperationsClient() {
/**
* LRO endpoint to batch process many documents.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* BatchProcessDocumentsRequest request =
* BatchProcessDocumentsRequest.newBuilder()
* .addAllRequests(new ArrayList<ProcessDocumentRequest>())
* .setParent("parent-995424086")
* .build();
* BatchProcessDocumentsResponse response =
* documentUnderstandingServiceClient.batchProcessDocumentsAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -188,6 +223,23 @@ public final OperationsClient getOperationsClient() {
* LRO endpoint to batch process many documents.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* BatchProcessDocumentsRequest request =
* BatchProcessDocumentsRequest.newBuilder()
* .addAllRequests(new ArrayList<ProcessDocumentRequest>())
* .setParent("parent-995424086")
* .build();
* OperationFuture<BatchProcessDocumentsResponse, OperationMetadata> future =
* documentUnderstandingServiceClient
* .batchProcessDocumentsOperationCallable()
* .futureCall(request);
* // Do something.
* BatchProcessDocumentsResponse response = future.get();
* }
* }</pre>
*/
public final OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
Expand All @@ -200,6 +252,21 @@ public final OperationsClient getOperationsClient() {
* LRO endpoint to batch process many documents.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* BatchProcessDocumentsRequest request =
* BatchProcessDocumentsRequest.newBuilder()
* .addAllRequests(new ArrayList<ProcessDocumentRequest>())
* .setParent("parent-995424086")
* .build();
* ApiFuture<Operation> future =
* documentUnderstandingServiceClient.batchProcessDocumentsCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<BatchProcessDocumentsRequest, Operation>
batchProcessDocumentsCallable() {
Expand Down
Expand Up @@ -24,6 +24,15 @@
* vision, and translation.
*
* <p>Sample for DocumentUnderstandingServiceClient:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* List<ProcessDocumentRequest> requests = new ArrayList<>();
* BatchProcessDocumentsResponse response =
* documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.documentai.v1beta1;
Expand Down
Expand Up @@ -39,6 +39,25 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* ProcessDocumentRequest request =
* ProcessDocumentRequest.newBuilder()
* .setParent("parent-995424086")
* .setInputConfig(InputConfig.newBuilder().build())
* .setOutputConfig(OutputConfig.newBuilder().build())
* .setDocumentType("documentType-1473196299")
* .setTableExtractionParams(TableExtractionParams.newBuilder().build())
* .setFormExtractionParams(FormExtractionParams.newBuilder().build())
* .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
* .setOcrParams(OcrParams.newBuilder().build())
* .setAutomlParams(AutoMlParams.newBuilder().build())
* .build();
* Document response = documentUnderstandingServiceClient.processDocument(request);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up
* resources such as threads. In the example above, try-with-resources is used, which automatically
* calls close().
Expand Down Expand Up @@ -162,6 +181,17 @@ public final OperationsClient getOperationsClient() {
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* List<ProcessDocumentRequest> requests = new ArrayList<>();
* BatchProcessDocumentsResponse response =
* documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
* }
* }</pre>
*
* @param requests Required. Individual requests for each document.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -177,6 +207,21 @@ public final OperationsClient getOperationsClient() {
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* BatchProcessDocumentsRequest request =
* BatchProcessDocumentsRequest.newBuilder()
* .addAllRequests(new ArrayList<ProcessDocumentRequest>())
* .setParent("parent-995424086")
* .build();
* BatchProcessDocumentsResponse response =
* documentUnderstandingServiceClient.batchProcessDocumentsAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -191,6 +236,23 @@ public final OperationsClient getOperationsClient() {
* the [Document] format.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* BatchProcessDocumentsRequest request =
* BatchProcessDocumentsRequest.newBuilder()
* .addAllRequests(new ArrayList<ProcessDocumentRequest>())
* .setParent("parent-995424086")
* .build();
* OperationFuture<BatchProcessDocumentsResponse, OperationMetadata> future =
* documentUnderstandingServiceClient
* .batchProcessDocumentsOperationCallable()
* .futureCall(request);
* // Do something.
* BatchProcessDocumentsResponse response = future.get();
* }
* }</pre>
*/
public final OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
Expand All @@ -204,6 +266,21 @@ public final OperationsClient getOperationsClient() {
* the [Document] format.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* BatchProcessDocumentsRequest request =
* BatchProcessDocumentsRequest.newBuilder()
* .addAllRequests(new ArrayList<ProcessDocumentRequest>())
* .setParent("parent-995424086")
* .build();
* ApiFuture<Operation> future =
* documentUnderstandingServiceClient.batchProcessDocumentsCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<BatchProcessDocumentsRequest, Operation>
batchProcessDocumentsCallable() {
Expand All @@ -214,6 +291,27 @@ public final OperationsClient getOperationsClient() {
/**
* Processes a single document.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* ProcessDocumentRequest request =
* ProcessDocumentRequest.newBuilder()
* .setParent("parent-995424086")
* .setInputConfig(InputConfig.newBuilder().build())
* .setOutputConfig(OutputConfig.newBuilder().build())
* .setDocumentType("documentType-1473196299")
* .setTableExtractionParams(TableExtractionParams.newBuilder().build())
* .setFormExtractionParams(FormExtractionParams.newBuilder().build())
* .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
* .setOcrParams(OcrParams.newBuilder().build())
* .setAutomlParams(AutoMlParams.newBuilder().build())
* .build();
* Document response = documentUnderstandingServiceClient.processDocument(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -226,6 +324,28 @@ public final Document processDocument(ProcessDocumentRequest request) {
* Processes a single document.
*
* <p>Sample code:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* ProcessDocumentRequest request =
* ProcessDocumentRequest.newBuilder()
* .setParent("parent-995424086")
* .setInputConfig(InputConfig.newBuilder().build())
* .setOutputConfig(OutputConfig.newBuilder().build())
* .setDocumentType("documentType-1473196299")
* .setTableExtractionParams(TableExtractionParams.newBuilder().build())
* .setFormExtractionParams(FormExtractionParams.newBuilder().build())
* .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
* .setOcrParams(OcrParams.newBuilder().build())
* .setAutomlParams(AutoMlParams.newBuilder().build())
* .build();
* ApiFuture<Document> future =
* documentUnderstandingServiceClient.processDocumentCallable().futureCall(request);
* // Do something.
* Document response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<ProcessDocumentRequest, Document> processDocumentCallable() {
return stub.processDocumentCallable();
Expand Down
Expand Up @@ -24,6 +24,25 @@
* vision, and translation.
*
* <p>Sample for DocumentUnderstandingServiceClient:
*
* <pre>{@code
* try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
* DocumentUnderstandingServiceClient.create()) {
* ProcessDocumentRequest request =
* ProcessDocumentRequest.newBuilder()
* .setParent("parent-995424086")
* .setInputConfig(InputConfig.newBuilder().build())
* .setOutputConfig(OutputConfig.newBuilder().build())
* .setDocumentType("documentType-1473196299")
* .setTableExtractionParams(TableExtractionParams.newBuilder().build())
* .setFormExtractionParams(FormExtractionParams.newBuilder().build())
* .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
* .setOcrParams(OcrParams.newBuilder().build())
* .setAutomlParams(AutoMlParams.newBuilder().build())
* .build();
* Document response = documentUnderstandingServiceClient.processDocument(request);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.documentai.v1beta2;
Expand Down