3939 * <p>This class provides the ability to make remote calls to the backing service through method
4040 * calls that map to API methods. Sample code to get started:
4141 *
42+ * <pre>{@code
43+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
44+ * DocumentUnderstandingServiceClient.create()) {
45+ * ProcessDocumentRequest request =
46+ * ProcessDocumentRequest.newBuilder()
47+ * .setParent("parent-995424086")
48+ * .setInputConfig(InputConfig.newBuilder().build())
49+ * .setOutputConfig(OutputConfig.newBuilder().build())
50+ * .setDocumentType("documentType-1473196299")
51+ * .setTableExtractionParams(TableExtractionParams.newBuilder().build())
52+ * .setFormExtractionParams(FormExtractionParams.newBuilder().build())
53+ * .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
54+ * .setOcrParams(OcrParams.newBuilder().build())
55+ * .setAutomlParams(AutoMlParams.newBuilder().build())
56+ * .build();
57+ * Document response = documentUnderstandingServiceClient.processDocument(request);
58+ * }
59+ * }</pre>
60+ *
4261 * <p>Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up
4362 * resources such as threads. In the example above, try-with-resources is used, which automatically
4463 * calls close().
@@ -162,6 +181,17 @@ public final OperationsClient getOperationsClient() {
162181 * LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
163182 * the [Document] format.
164183 *
184+ * <p>Sample code:
185+ *
186+ * <pre>{@code
187+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
188+ * DocumentUnderstandingServiceClient.create()) {
189+ * List<ProcessDocumentRequest> requests = new ArrayList<>();
190+ * BatchProcessDocumentsResponse response =
191+ * documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
192+ * }
193+ * }</pre>
194+ *
165195 * @param requests Required. Individual requests for each document.
166196 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
167197 */
@@ -177,6 +207,21 @@ public final OperationsClient getOperationsClient() {
177207 * LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
178208 * the [Document] format.
179209 *
210+ * <p>Sample code:
211+ *
212+ * <pre>{@code
213+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
214+ * DocumentUnderstandingServiceClient.create()) {
215+ * BatchProcessDocumentsRequest request =
216+ * BatchProcessDocumentsRequest.newBuilder()
217+ * .addAllRequests(new ArrayList<ProcessDocumentRequest>())
218+ * .setParent("parent-995424086")
219+ * .build();
220+ * BatchProcessDocumentsResponse response =
221+ * documentUnderstandingServiceClient.batchProcessDocumentsAsync(request).get();
222+ * }
223+ * }</pre>
224+ *
180225 * @param request The request object containing all of the parameters for the API call.
181226 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
182227 */
@@ -191,6 +236,23 @@ public final OperationsClient getOperationsClient() {
191236 * the [Document] format.
192237 *
193238 * <p>Sample code:
239+ *
240+ * <pre>{@code
241+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
242+ * DocumentUnderstandingServiceClient.create()) {
243+ * BatchProcessDocumentsRequest request =
244+ * BatchProcessDocumentsRequest.newBuilder()
245+ * .addAllRequests(new ArrayList<ProcessDocumentRequest>())
246+ * .setParent("parent-995424086")
247+ * .build();
248+ * OperationFuture<BatchProcessDocumentsResponse, OperationMetadata> future =
249+ * documentUnderstandingServiceClient
250+ * .batchProcessDocumentsOperationCallable()
251+ * .futureCall(request);
252+ * // Do something.
253+ * BatchProcessDocumentsResponse response = future.get();
254+ * }
255+ * }</pre>
194256 */
195257 public final OperationCallable <
196258 BatchProcessDocumentsRequest , BatchProcessDocumentsResponse , OperationMetadata >
@@ -204,6 +266,21 @@ public final OperationsClient getOperationsClient() {
204266 * the [Document] format.
205267 *
206268 * <p>Sample code:
269+ *
270+ * <pre>{@code
271+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
272+ * DocumentUnderstandingServiceClient.create()) {
273+ * BatchProcessDocumentsRequest request =
274+ * BatchProcessDocumentsRequest.newBuilder()
275+ * .addAllRequests(new ArrayList<ProcessDocumentRequest>())
276+ * .setParent("parent-995424086")
277+ * .build();
278+ * ApiFuture<Operation> future =
279+ * documentUnderstandingServiceClient.batchProcessDocumentsCallable().futureCall(request);
280+ * // Do something.
281+ * Operation response = future.get();
282+ * }
283+ * }</pre>
207284 */
208285 public final UnaryCallable <BatchProcessDocumentsRequest , Operation >
209286 batchProcessDocumentsCallable () {
@@ -214,6 +291,27 @@ public final OperationsClient getOperationsClient() {
214291 /**
215292 * Processes a single document.
216293 *
294+ * <p>Sample code:
295+ *
296+ * <pre>{@code
297+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
298+ * DocumentUnderstandingServiceClient.create()) {
299+ * ProcessDocumentRequest request =
300+ * ProcessDocumentRequest.newBuilder()
301+ * .setParent("parent-995424086")
302+ * .setInputConfig(InputConfig.newBuilder().build())
303+ * .setOutputConfig(OutputConfig.newBuilder().build())
304+ * .setDocumentType("documentType-1473196299")
305+ * .setTableExtractionParams(TableExtractionParams.newBuilder().build())
306+ * .setFormExtractionParams(FormExtractionParams.newBuilder().build())
307+ * .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
308+ * .setOcrParams(OcrParams.newBuilder().build())
309+ * .setAutomlParams(AutoMlParams.newBuilder().build())
310+ * .build();
311+ * Document response = documentUnderstandingServiceClient.processDocument(request);
312+ * }
313+ * }</pre>
314+ *
217315 * @param request The request object containing all of the parameters for the API call.
218316 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
219317 */
@@ -226,6 +324,28 @@ public final Document processDocument(ProcessDocumentRequest request) {
226324 * Processes a single document.
227325 *
228326 * <p>Sample code:
327+ *
328+ * <pre>{@code
329+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
330+ * DocumentUnderstandingServiceClient.create()) {
331+ * ProcessDocumentRequest request =
332+ * ProcessDocumentRequest.newBuilder()
333+ * .setParent("parent-995424086")
334+ * .setInputConfig(InputConfig.newBuilder().build())
335+ * .setOutputConfig(OutputConfig.newBuilder().build())
336+ * .setDocumentType("documentType-1473196299")
337+ * .setTableExtractionParams(TableExtractionParams.newBuilder().build())
338+ * .setFormExtractionParams(FormExtractionParams.newBuilder().build())
339+ * .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
340+ * .setOcrParams(OcrParams.newBuilder().build())
341+ * .setAutomlParams(AutoMlParams.newBuilder().build())
342+ * .build();
343+ * ApiFuture<Document> future =
344+ * documentUnderstandingServiceClient.processDocumentCallable().futureCall(request);
345+ * // Do something.
346+ * Document response = future.get();
347+ * }
348+ * }</pre>
229349 */
230350 public final UnaryCallable <ProcessDocumentRequest , Document > processDocumentCallable () {
231351 return stub .processDocumentCallable ();
0 commit comments