39
39
* <p>This class provides the ability to make remote calls to the backing service through method
40
40
* calls that map to API methods. Sample code to get started:
41
41
*
42
+ * <pre>{@code
43
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
44
+ * List<AnnotateImageRequest> requests = new ArrayList<>();
45
+ * BatchAnnotateImagesResponse response = imageAnnotatorClient.batchAnnotateImages(requests);
46
+ * }
47
+ * }</pre>
48
+ *
42
49
* <p>Note: close() needs to be called on the ImageAnnotatorClient object to clean up resources such
43
50
* as threads. In the example above, try-with-resources is used, which automatically calls close().
44
51
*
@@ -153,6 +160,15 @@ public final OperationsClient getOperationsClient() {
153
160
/**
154
161
* Run image detection and annotation for a batch of images.
155
162
*
163
+ * <p>Sample code:
164
+ *
165
+ * <pre>{@code
166
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
167
+ * List<AnnotateImageRequest> requests = new ArrayList<>();
168
+ * BatchAnnotateImagesResponse response = imageAnnotatorClient.batchAnnotateImages(requests);
169
+ * }
170
+ * }</pre>
171
+ *
156
172
* @param requests Required. Individual image annotation requests for this batch.
157
173
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
158
174
*/
@@ -167,6 +183,19 @@ public final BatchAnnotateImagesResponse batchAnnotateImages(
167
183
/**
168
184
* Run image detection and annotation for a batch of images.
169
185
*
186
+ * <p>Sample code:
187
+ *
188
+ * <pre>{@code
189
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
190
+ * BatchAnnotateImagesRequest request =
191
+ * BatchAnnotateImagesRequest.newBuilder()
192
+ * .addAllRequests(new ArrayList<AnnotateImageRequest>())
193
+ * .setParent("parent-995424086")
194
+ * .build();
195
+ * BatchAnnotateImagesResponse response = imageAnnotatorClient.batchAnnotateImages(request);
196
+ * }
197
+ * }</pre>
198
+ *
170
199
* @param request The request object containing all of the parameters for the API call.
171
200
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
172
201
*/
@@ -179,6 +208,20 @@ public final BatchAnnotateImagesResponse batchAnnotateImages(BatchAnnotateImages
179
208
* Run image detection and annotation for a batch of images.
180
209
*
181
210
* <p>Sample code:
211
+ *
212
+ * <pre>{@code
213
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
214
+ * BatchAnnotateImagesRequest request =
215
+ * BatchAnnotateImagesRequest.newBuilder()
216
+ * .addAllRequests(new ArrayList<AnnotateImageRequest>())
217
+ * .setParent("parent-995424086")
218
+ * .build();
219
+ * ApiFuture<BatchAnnotateImagesResponse> future =
220
+ * imageAnnotatorClient.batchAnnotateImagesCallable().futureCall(request);
221
+ * // Do something.
222
+ * BatchAnnotateImagesResponse response = future.get();
223
+ * }
224
+ * }</pre>
182
225
*/
183
226
public final UnaryCallable <BatchAnnotateImagesRequest , BatchAnnotateImagesResponse >
184
227
batchAnnotateImagesCallable () {
@@ -194,6 +237,15 @@ public final BatchAnnotateImagesResponse batchAnnotateImages(BatchAnnotateImages
194
237
* AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and
195
238
* perform detection and annotation for each image extracted.
196
239
*
240
+ * <p>Sample code:
241
+ *
242
+ * <pre>{@code
243
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
244
+ * List<AnnotateFileRequest> requests = new ArrayList<>();
245
+ * BatchAnnotateFilesResponse response = imageAnnotatorClient.batchAnnotateFiles(requests);
246
+ * }
247
+ * }</pre>
248
+ *
197
249
* @param requests Required. The list of file annotation requests. Right now we support only one
198
250
* AnnotateFileRequest in BatchAnnotateFilesRequest.
199
251
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -213,6 +265,19 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(List<AnnotateFileRequ
213
265
* AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and
214
266
* perform detection and annotation for each image extracted.
215
267
*
268
+ * <p>Sample code:
269
+ *
270
+ * <pre>{@code
271
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
272
+ * BatchAnnotateFilesRequest request =
273
+ * BatchAnnotateFilesRequest.newBuilder()
274
+ * .addAllRequests(new ArrayList<AnnotateFileRequest>())
275
+ * .setParent("parent-995424086")
276
+ * .build();
277
+ * BatchAnnotateFilesResponse response = imageAnnotatorClient.batchAnnotateFiles(request);
278
+ * }
279
+ * }</pre>
280
+ *
216
281
* @param request The request object containing all of the parameters for the API call.
217
282
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
218
283
*/
@@ -230,6 +295,20 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
230
295
* perform detection and annotation for each image extracted.
231
296
*
232
297
* <p>Sample code:
298
+ *
299
+ * <pre>{@code
300
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
301
+ * BatchAnnotateFilesRequest request =
302
+ * BatchAnnotateFilesRequest.newBuilder()
303
+ * .addAllRequests(new ArrayList<AnnotateFileRequest>())
304
+ * .setParent("parent-995424086")
305
+ * .build();
306
+ * ApiFuture<BatchAnnotateFilesResponse> future =
307
+ * imageAnnotatorClient.batchAnnotateFilesCallable().futureCall(request);
308
+ * // Do something.
309
+ * BatchAnnotateFilesResponse response = future.get();
310
+ * }
311
+ * }</pre>
233
312
*/
234
313
public final UnaryCallable <BatchAnnotateFilesRequest , BatchAnnotateFilesResponse >
235
314
batchAnnotateFilesCallable () {
@@ -247,6 +326,17 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
247
326
* <p>This service will write image annotation outputs to json files in customer GCS bucket, each
248
327
* json file containing BatchAnnotateImagesResponse proto.
249
328
*
329
+ * <p>Sample code:
330
+ *
331
+ * <pre>{@code
332
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
333
+ * List<AnnotateImageRequest> requests = new ArrayList<>();
334
+ * OutputConfig outputConfig = OutputConfig.newBuilder().build();
335
+ * AsyncBatchAnnotateImagesResponse response =
336
+ * imageAnnotatorClient.asyncBatchAnnotateImagesAsync(requests, outputConfig).get();
337
+ * }
338
+ * }</pre>
339
+ *
250
340
* @param requests Required. Individual image annotation requests for this batch.
251
341
* @param outputConfig Required. The desired output location and metadata (e.g. format).
252
342
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -273,6 +363,21 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
273
363
* <p>This service will write image annotation outputs to json files in customer GCS bucket, each
274
364
* json file containing BatchAnnotateImagesResponse proto.
275
365
*
366
+ * <p>Sample code:
367
+ *
368
+ * <pre>{@code
369
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
370
+ * AsyncBatchAnnotateImagesRequest request =
371
+ * AsyncBatchAnnotateImagesRequest.newBuilder()
372
+ * .addAllRequests(new ArrayList<AnnotateImageRequest>())
373
+ * .setOutputConfig(OutputConfig.newBuilder().build())
374
+ * .setParent("parent-995424086")
375
+ * .build();
376
+ * AsyncBatchAnnotateImagesResponse response =
377
+ * imageAnnotatorClient.asyncBatchAnnotateImagesAsync(request).get();
378
+ * }
379
+ * }</pre>
380
+ *
276
381
* @param request The request object containing all of the parameters for the API call.
277
382
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
278
383
*/
@@ -293,6 +398,21 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
293
398
* json file containing BatchAnnotateImagesResponse proto.
294
399
*
295
400
* <p>Sample code:
401
+ *
402
+ * <pre>{@code
403
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
404
+ * AsyncBatchAnnotateImagesRequest request =
405
+ * AsyncBatchAnnotateImagesRequest.newBuilder()
406
+ * .addAllRequests(new ArrayList<AnnotateImageRequest>())
407
+ * .setOutputConfig(OutputConfig.newBuilder().build())
408
+ * .setParent("parent-995424086")
409
+ * .build();
410
+ * OperationFuture<AsyncBatchAnnotateImagesResponse, OperationMetadata> future =
411
+ * imageAnnotatorClient.asyncBatchAnnotateImagesOperationCallable().futureCall(request);
412
+ * // Do something.
413
+ * AsyncBatchAnnotateImagesResponse response = future.get();
414
+ * }
415
+ * }</pre>
296
416
*/
297
417
public final OperationCallable <
298
418
AsyncBatchAnnotateImagesRequest , AsyncBatchAnnotateImagesResponse , OperationMetadata >
@@ -312,6 +432,21 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
312
432
* json file containing BatchAnnotateImagesResponse proto.
313
433
*
314
434
* <p>Sample code:
435
+ *
436
+ * <pre>{@code
437
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
438
+ * AsyncBatchAnnotateImagesRequest request =
439
+ * AsyncBatchAnnotateImagesRequest.newBuilder()
440
+ * .addAllRequests(new ArrayList<AnnotateImageRequest>())
441
+ * .setOutputConfig(OutputConfig.newBuilder().build())
442
+ * .setParent("parent-995424086")
443
+ * .build();
444
+ * ApiFuture<Operation> future =
445
+ * imageAnnotatorClient.asyncBatchAnnotateImagesCallable().futureCall(request);
446
+ * // Do something.
447
+ * Operation response = future.get();
448
+ * }
449
+ * }</pre>
315
450
*/
316
451
public final UnaryCallable <AsyncBatchAnnotateImagesRequest , Operation >
317
452
asyncBatchAnnotateImagesCallable () {
@@ -326,6 +461,16 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
326
461
* `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse`
327
462
* (results).
328
463
*
464
+ * <p>Sample code:
465
+ *
466
+ * <pre>{@code
467
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
468
+ * List<AsyncAnnotateFileRequest> requests = new ArrayList<>();
469
+ * AsyncBatchAnnotateFilesResponse response =
470
+ * imageAnnotatorClient.asyncBatchAnnotateFilesAsync(requests).get();
471
+ * }
472
+ * }</pre>
473
+ *
329
474
* @param requests Required. Individual async file annotation requests for this batch.
330
475
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
331
476
*/
@@ -344,6 +489,20 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
344
489
* `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse`
345
490
* (results).
346
491
*
492
+ * <p>Sample code:
493
+ *
494
+ * <pre>{@code
495
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
496
+ * AsyncBatchAnnotateFilesRequest request =
497
+ * AsyncBatchAnnotateFilesRequest.newBuilder()
498
+ * .addAllRequests(new ArrayList<AsyncAnnotateFileRequest>())
499
+ * .setParent("parent-995424086")
500
+ * .build();
501
+ * AsyncBatchAnnotateFilesResponse response =
502
+ * imageAnnotatorClient.asyncBatchAnnotateFilesAsync(request).get();
503
+ * }
504
+ * }</pre>
505
+ *
347
506
* @param request The request object containing all of the parameters for the API call.
348
507
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
349
508
*/
@@ -361,6 +520,20 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
361
520
* (results).
362
521
*
363
522
* <p>Sample code:
523
+ *
524
+ * <pre>{@code
525
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
526
+ * AsyncBatchAnnotateFilesRequest request =
527
+ * AsyncBatchAnnotateFilesRequest.newBuilder()
528
+ * .addAllRequests(new ArrayList<AsyncAnnotateFileRequest>())
529
+ * .setParent("parent-995424086")
530
+ * .build();
531
+ * OperationFuture<AsyncBatchAnnotateFilesResponse, OperationMetadata> future =
532
+ * imageAnnotatorClient.asyncBatchAnnotateFilesOperationCallable().futureCall(request);
533
+ * // Do something.
534
+ * AsyncBatchAnnotateFilesResponse response = future.get();
535
+ * }
536
+ * }</pre>
364
537
*/
365
538
public final OperationCallable <
366
539
AsyncBatchAnnotateFilesRequest , AsyncBatchAnnotateFilesResponse , OperationMetadata >
@@ -377,6 +550,20 @@ public final BatchAnnotateFilesResponse batchAnnotateFiles(BatchAnnotateFilesReq
377
550
* (results).
378
551
*
379
552
* <p>Sample code:
553
+ *
554
+ * <pre>{@code
555
+ * try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
556
+ * AsyncBatchAnnotateFilesRequest request =
557
+ * AsyncBatchAnnotateFilesRequest.newBuilder()
558
+ * .addAllRequests(new ArrayList<AsyncAnnotateFileRequest>())
559
+ * .setParent("parent-995424086")
560
+ * .build();
561
+ * ApiFuture<Operation> future =
562
+ * imageAnnotatorClient.asyncBatchAnnotateFilesCallable().futureCall(request);
563
+ * // Do something.
564
+ * Operation response = future.get();
565
+ * }
566
+ * }</pre>
380
567
*/
381
568
public final UnaryCallable <AsyncBatchAnnotateFilesRequest , Operation >
382
569
asyncBatchAnnotateFilesCallable () {
0 commit comments