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

Commit

Permalink
docs: generate sample code in the Java microgenerator (#338)
Browse files Browse the repository at this point in the history
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/83d27b1b-599d-4795-9959-95d65d1baad5/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 356341083
Source-Link: googleapis/googleapis@8d8c008
  • Loading branch information
yoshi-automation committed Feb 9, 2021
1 parent f341106 commit 33a1eda
Show file tree
Hide file tree
Showing 7 changed files with 433 additions and 7 deletions.
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

0 comments on commit 33a1eda

Please sign in to comment.