1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.cloud.vision.v1; 17 18 import static io.grpc.MethodDescriptor.generateFullMethodName; 19 20 /** 21 * 22 * 23 * <pre> 24 * Service that performs Google Cloud Vision API detection tasks over client 25 * images, such as face, landmark, logo, label, and text detection. The 26 * ImageAnnotator service returns detected entities from the images. 27 * </pre> 28 */ 29 @javax.annotation.Generated( 30 value = "by gRPC proto compiler", 31 comments = "Source: google/cloud/vision/v1/image_annotator.proto") 32 @io.grpc.stub.annotations.GrpcGenerated 33 public final class ImageAnnotatorGrpc { 34 ImageAnnotatorGrpc()35 private ImageAnnotatorGrpc() {} 36 37 public static final String SERVICE_NAME = "google.cloud.vision.v1.ImageAnnotator"; 38 39 // Static method descriptors that strictly reflect the proto. 40 private static volatile io.grpc.MethodDescriptor< 41 com.google.cloud.vision.v1.BatchAnnotateImagesRequest, 42 com.google.cloud.vision.v1.BatchAnnotateImagesResponse> 43 getBatchAnnotateImagesMethod; 44 45 @io.grpc.stub.annotations.RpcMethod( 46 fullMethodName = SERVICE_NAME + '/' + "BatchAnnotateImages", 47 requestType = com.google.cloud.vision.v1.BatchAnnotateImagesRequest.class, 48 responseType = com.google.cloud.vision.v1.BatchAnnotateImagesResponse.class, 49 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 50 public static io.grpc.MethodDescriptor< 51 com.google.cloud.vision.v1.BatchAnnotateImagesRequest, 52 com.google.cloud.vision.v1.BatchAnnotateImagesResponse> getBatchAnnotateImagesMethod()53 getBatchAnnotateImagesMethod() { 54 io.grpc.MethodDescriptor< 55 com.google.cloud.vision.v1.BatchAnnotateImagesRequest, 56 com.google.cloud.vision.v1.BatchAnnotateImagesResponse> 57 getBatchAnnotateImagesMethod; 58 if ((getBatchAnnotateImagesMethod = ImageAnnotatorGrpc.getBatchAnnotateImagesMethod) == null) { 59 synchronized (ImageAnnotatorGrpc.class) { 60 if ((getBatchAnnotateImagesMethod = ImageAnnotatorGrpc.getBatchAnnotateImagesMethod) 61 == null) { 62 ImageAnnotatorGrpc.getBatchAnnotateImagesMethod = 63 getBatchAnnotateImagesMethod = 64 io.grpc.MethodDescriptor 65 .<com.google.cloud.vision.v1.BatchAnnotateImagesRequest, 66 com.google.cloud.vision.v1.BatchAnnotateImagesResponse> 67 newBuilder() 68 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 69 .setFullMethodName( 70 generateFullMethodName(SERVICE_NAME, "BatchAnnotateImages")) 71 .setSampledToLocalTracing(true) 72 .setRequestMarshaller( 73 io.grpc.protobuf.ProtoUtils.marshaller( 74 com.google.cloud.vision.v1.BatchAnnotateImagesRequest 75 .getDefaultInstance())) 76 .setResponseMarshaller( 77 io.grpc.protobuf.ProtoUtils.marshaller( 78 com.google.cloud.vision.v1.BatchAnnotateImagesResponse 79 .getDefaultInstance())) 80 .setSchemaDescriptor( 81 new ImageAnnotatorMethodDescriptorSupplier("BatchAnnotateImages")) 82 .build(); 83 } 84 } 85 } 86 return getBatchAnnotateImagesMethod; 87 } 88 89 private static volatile io.grpc.MethodDescriptor< 90 com.google.cloud.vision.v1.BatchAnnotateFilesRequest, 91 com.google.cloud.vision.v1.BatchAnnotateFilesResponse> 92 getBatchAnnotateFilesMethod; 93 94 @io.grpc.stub.annotations.RpcMethod( 95 fullMethodName = SERVICE_NAME + '/' + "BatchAnnotateFiles", 96 requestType = com.google.cloud.vision.v1.BatchAnnotateFilesRequest.class, 97 responseType = com.google.cloud.vision.v1.BatchAnnotateFilesResponse.class, 98 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 99 public static io.grpc.MethodDescriptor< 100 com.google.cloud.vision.v1.BatchAnnotateFilesRequest, 101 com.google.cloud.vision.v1.BatchAnnotateFilesResponse> getBatchAnnotateFilesMethod()102 getBatchAnnotateFilesMethod() { 103 io.grpc.MethodDescriptor< 104 com.google.cloud.vision.v1.BatchAnnotateFilesRequest, 105 com.google.cloud.vision.v1.BatchAnnotateFilesResponse> 106 getBatchAnnotateFilesMethod; 107 if ((getBatchAnnotateFilesMethod = ImageAnnotatorGrpc.getBatchAnnotateFilesMethod) == null) { 108 synchronized (ImageAnnotatorGrpc.class) { 109 if ((getBatchAnnotateFilesMethod = ImageAnnotatorGrpc.getBatchAnnotateFilesMethod) 110 == null) { 111 ImageAnnotatorGrpc.getBatchAnnotateFilesMethod = 112 getBatchAnnotateFilesMethod = 113 io.grpc.MethodDescriptor 114 .<com.google.cloud.vision.v1.BatchAnnotateFilesRequest, 115 com.google.cloud.vision.v1.BatchAnnotateFilesResponse> 116 newBuilder() 117 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 118 .setFullMethodName(generateFullMethodName(SERVICE_NAME, "BatchAnnotateFiles")) 119 .setSampledToLocalTracing(true) 120 .setRequestMarshaller( 121 io.grpc.protobuf.ProtoUtils.marshaller( 122 com.google.cloud.vision.v1.BatchAnnotateFilesRequest 123 .getDefaultInstance())) 124 .setResponseMarshaller( 125 io.grpc.protobuf.ProtoUtils.marshaller( 126 com.google.cloud.vision.v1.BatchAnnotateFilesResponse 127 .getDefaultInstance())) 128 .setSchemaDescriptor( 129 new ImageAnnotatorMethodDescriptorSupplier("BatchAnnotateFiles")) 130 .build(); 131 } 132 } 133 } 134 return getBatchAnnotateFilesMethod; 135 } 136 137 private static volatile io.grpc.MethodDescriptor< 138 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest, 139 com.google.longrunning.Operation> 140 getAsyncBatchAnnotateImagesMethod; 141 142 @io.grpc.stub.annotations.RpcMethod( 143 fullMethodName = SERVICE_NAME + '/' + "AsyncBatchAnnotateImages", 144 requestType = com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.class, 145 responseType = com.google.longrunning.Operation.class, 146 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 147 public static io.grpc.MethodDescriptor< 148 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest, 149 com.google.longrunning.Operation> getAsyncBatchAnnotateImagesMethod()150 getAsyncBatchAnnotateImagesMethod() { 151 io.grpc.MethodDescriptor< 152 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest, 153 com.google.longrunning.Operation> 154 getAsyncBatchAnnotateImagesMethod; 155 if ((getAsyncBatchAnnotateImagesMethod = ImageAnnotatorGrpc.getAsyncBatchAnnotateImagesMethod) 156 == null) { 157 synchronized (ImageAnnotatorGrpc.class) { 158 if ((getAsyncBatchAnnotateImagesMethod = 159 ImageAnnotatorGrpc.getAsyncBatchAnnotateImagesMethod) 160 == null) { 161 ImageAnnotatorGrpc.getAsyncBatchAnnotateImagesMethod = 162 getAsyncBatchAnnotateImagesMethod = 163 io.grpc.MethodDescriptor 164 .<com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest, 165 com.google.longrunning.Operation> 166 newBuilder() 167 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 168 .setFullMethodName( 169 generateFullMethodName(SERVICE_NAME, "AsyncBatchAnnotateImages")) 170 .setSampledToLocalTracing(true) 171 .setRequestMarshaller( 172 io.grpc.protobuf.ProtoUtils.marshaller( 173 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest 174 .getDefaultInstance())) 175 .setResponseMarshaller( 176 io.grpc.protobuf.ProtoUtils.marshaller( 177 com.google.longrunning.Operation.getDefaultInstance())) 178 .setSchemaDescriptor( 179 new ImageAnnotatorMethodDescriptorSupplier("AsyncBatchAnnotateImages")) 180 .build(); 181 } 182 } 183 } 184 return getAsyncBatchAnnotateImagesMethod; 185 } 186 187 private static volatile io.grpc.MethodDescriptor< 188 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest, 189 com.google.longrunning.Operation> 190 getAsyncBatchAnnotateFilesMethod; 191 192 @io.grpc.stub.annotations.RpcMethod( 193 fullMethodName = SERVICE_NAME + '/' + "AsyncBatchAnnotateFiles", 194 requestType = com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.class, 195 responseType = com.google.longrunning.Operation.class, 196 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 197 public static io.grpc.MethodDescriptor< 198 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest, 199 com.google.longrunning.Operation> getAsyncBatchAnnotateFilesMethod()200 getAsyncBatchAnnotateFilesMethod() { 201 io.grpc.MethodDescriptor< 202 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest, 203 com.google.longrunning.Operation> 204 getAsyncBatchAnnotateFilesMethod; 205 if ((getAsyncBatchAnnotateFilesMethod = ImageAnnotatorGrpc.getAsyncBatchAnnotateFilesMethod) 206 == null) { 207 synchronized (ImageAnnotatorGrpc.class) { 208 if ((getAsyncBatchAnnotateFilesMethod = ImageAnnotatorGrpc.getAsyncBatchAnnotateFilesMethod) 209 == null) { 210 ImageAnnotatorGrpc.getAsyncBatchAnnotateFilesMethod = 211 getAsyncBatchAnnotateFilesMethod = 212 io.grpc.MethodDescriptor 213 .<com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest, 214 com.google.longrunning.Operation> 215 newBuilder() 216 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 217 .setFullMethodName( 218 generateFullMethodName(SERVICE_NAME, "AsyncBatchAnnotateFiles")) 219 .setSampledToLocalTracing(true) 220 .setRequestMarshaller( 221 io.grpc.protobuf.ProtoUtils.marshaller( 222 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest 223 .getDefaultInstance())) 224 .setResponseMarshaller( 225 io.grpc.protobuf.ProtoUtils.marshaller( 226 com.google.longrunning.Operation.getDefaultInstance())) 227 .setSchemaDescriptor( 228 new ImageAnnotatorMethodDescriptorSupplier("AsyncBatchAnnotateFiles")) 229 .build(); 230 } 231 } 232 } 233 return getAsyncBatchAnnotateFilesMethod; 234 } 235 236 /** Creates a new async stub that supports all call types for the service */ newStub(io.grpc.Channel channel)237 public static ImageAnnotatorStub newStub(io.grpc.Channel channel) { 238 io.grpc.stub.AbstractStub.StubFactory<ImageAnnotatorStub> factory = 239 new io.grpc.stub.AbstractStub.StubFactory<ImageAnnotatorStub>() { 240 @java.lang.Override 241 public ImageAnnotatorStub newStub( 242 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 243 return new ImageAnnotatorStub(channel, callOptions); 244 } 245 }; 246 return ImageAnnotatorStub.newStub(factory, channel); 247 } 248 249 /** 250 * Creates a new blocking-style stub that supports unary and streaming output calls on the service 251 */ newBlockingStub(io.grpc.Channel channel)252 public static ImageAnnotatorBlockingStub newBlockingStub(io.grpc.Channel channel) { 253 io.grpc.stub.AbstractStub.StubFactory<ImageAnnotatorBlockingStub> factory = 254 new io.grpc.stub.AbstractStub.StubFactory<ImageAnnotatorBlockingStub>() { 255 @java.lang.Override 256 public ImageAnnotatorBlockingStub newStub( 257 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 258 return new ImageAnnotatorBlockingStub(channel, callOptions); 259 } 260 }; 261 return ImageAnnotatorBlockingStub.newStub(factory, channel); 262 } 263 264 /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ newFutureStub(io.grpc.Channel channel)265 public static ImageAnnotatorFutureStub newFutureStub(io.grpc.Channel channel) { 266 io.grpc.stub.AbstractStub.StubFactory<ImageAnnotatorFutureStub> factory = 267 new io.grpc.stub.AbstractStub.StubFactory<ImageAnnotatorFutureStub>() { 268 @java.lang.Override 269 public ImageAnnotatorFutureStub newStub( 270 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 271 return new ImageAnnotatorFutureStub(channel, callOptions); 272 } 273 }; 274 return ImageAnnotatorFutureStub.newStub(factory, channel); 275 } 276 277 /** 278 * 279 * 280 * <pre> 281 * Service that performs Google Cloud Vision API detection tasks over client 282 * images, such as face, landmark, logo, label, and text detection. The 283 * ImageAnnotator service returns detected entities from the images. 284 * </pre> 285 */ 286 public interface AsyncService { 287 288 /** 289 * 290 * 291 * <pre> 292 * Run image detection and annotation for a batch of images. 293 * </pre> 294 */ batchAnnotateImages( com.google.cloud.vision.v1.BatchAnnotateImagesRequest request, io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateImagesResponse> responseObserver)295 default void batchAnnotateImages( 296 com.google.cloud.vision.v1.BatchAnnotateImagesRequest request, 297 io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateImagesResponse> 298 responseObserver) { 299 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 300 getBatchAnnotateImagesMethod(), responseObserver); 301 } 302 303 /** 304 * 305 * 306 * <pre> 307 * Service that performs image detection and annotation for a batch of files. 308 * Now only "application/pdf", "image/tiff" and "image/gif" are supported. 309 * This service will extract at most 5 (customers can specify which 5 in 310 * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each 311 * file provided and perform detection and annotation for each image 312 * extracted. 313 * </pre> 314 */ batchAnnotateFiles( com.google.cloud.vision.v1.BatchAnnotateFilesRequest request, io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateFilesResponse> responseObserver)315 default void batchAnnotateFiles( 316 com.google.cloud.vision.v1.BatchAnnotateFilesRequest request, 317 io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateFilesResponse> 318 responseObserver) { 319 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 320 getBatchAnnotateFilesMethod(), responseObserver); 321 } 322 323 /** 324 * 325 * 326 * <pre> 327 * Run asynchronous image detection and annotation for a list of images. 328 * Progress and results can be retrieved through the 329 * `google.longrunning.Operations` interface. 330 * `Operation.metadata` contains `OperationMetadata` (metadata). 331 * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). 332 * This service will write image annotation outputs to json files in customer 333 * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. 334 * </pre> 335 */ asyncBatchAnnotateImages( com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)336 default void asyncBatchAnnotateImages( 337 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request, 338 io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { 339 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 340 getAsyncBatchAnnotateImagesMethod(), responseObserver); 341 } 342 343 /** 344 * 345 * 346 * <pre> 347 * Run asynchronous image detection and annotation for a list of generic 348 * files, such as PDF files, which may contain multiple pages and multiple 349 * images per page. Progress and results can be retrieved through the 350 * `google.longrunning.Operations` interface. 351 * `Operation.metadata` contains `OperationMetadata` (metadata). 352 * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). 353 * </pre> 354 */ asyncBatchAnnotateFiles( com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)355 default void asyncBatchAnnotateFiles( 356 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request, 357 io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { 358 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 359 getAsyncBatchAnnotateFilesMethod(), responseObserver); 360 } 361 } 362 363 /** 364 * Base class for the server implementation of the service ImageAnnotator. 365 * 366 * <pre> 367 * Service that performs Google Cloud Vision API detection tasks over client 368 * images, such as face, landmark, logo, label, and text detection. The 369 * ImageAnnotator service returns detected entities from the images. 370 * </pre> 371 */ 372 public abstract static class ImageAnnotatorImplBase 373 implements io.grpc.BindableService, AsyncService { 374 375 @java.lang.Override bindService()376 public final io.grpc.ServerServiceDefinition bindService() { 377 return ImageAnnotatorGrpc.bindService(this); 378 } 379 } 380 381 /** 382 * A stub to allow clients to do asynchronous rpc calls to service ImageAnnotator. 383 * 384 * <pre> 385 * Service that performs Google Cloud Vision API detection tasks over client 386 * images, such as face, landmark, logo, label, and text detection. The 387 * ImageAnnotator service returns detected entities from the images. 388 * </pre> 389 */ 390 public static final class ImageAnnotatorStub 391 extends io.grpc.stub.AbstractAsyncStub<ImageAnnotatorStub> { ImageAnnotatorStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)392 private ImageAnnotatorStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 393 super(channel, callOptions); 394 } 395 396 @java.lang.Override build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)397 protected ImageAnnotatorStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 398 return new ImageAnnotatorStub(channel, callOptions); 399 } 400 401 /** 402 * 403 * 404 * <pre> 405 * Run image detection and annotation for a batch of images. 406 * </pre> 407 */ batchAnnotateImages( com.google.cloud.vision.v1.BatchAnnotateImagesRequest request, io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateImagesResponse> responseObserver)408 public void batchAnnotateImages( 409 com.google.cloud.vision.v1.BatchAnnotateImagesRequest request, 410 io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateImagesResponse> 411 responseObserver) { 412 io.grpc.stub.ClientCalls.asyncUnaryCall( 413 getChannel().newCall(getBatchAnnotateImagesMethod(), getCallOptions()), 414 request, 415 responseObserver); 416 } 417 418 /** 419 * 420 * 421 * <pre> 422 * Service that performs image detection and annotation for a batch of files. 423 * Now only "application/pdf", "image/tiff" and "image/gif" are supported. 424 * This service will extract at most 5 (customers can specify which 5 in 425 * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each 426 * file provided and perform detection and annotation for each image 427 * extracted. 428 * </pre> 429 */ batchAnnotateFiles( com.google.cloud.vision.v1.BatchAnnotateFilesRequest request, io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateFilesResponse> responseObserver)430 public void batchAnnotateFiles( 431 com.google.cloud.vision.v1.BatchAnnotateFilesRequest request, 432 io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateFilesResponse> 433 responseObserver) { 434 io.grpc.stub.ClientCalls.asyncUnaryCall( 435 getChannel().newCall(getBatchAnnotateFilesMethod(), getCallOptions()), 436 request, 437 responseObserver); 438 } 439 440 /** 441 * 442 * 443 * <pre> 444 * Run asynchronous image detection and annotation for a list of images. 445 * Progress and results can be retrieved through the 446 * `google.longrunning.Operations` interface. 447 * `Operation.metadata` contains `OperationMetadata` (metadata). 448 * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). 449 * This service will write image annotation outputs to json files in customer 450 * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. 451 * </pre> 452 */ asyncBatchAnnotateImages( com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)453 public void asyncBatchAnnotateImages( 454 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request, 455 io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { 456 io.grpc.stub.ClientCalls.asyncUnaryCall( 457 getChannel().newCall(getAsyncBatchAnnotateImagesMethod(), getCallOptions()), 458 request, 459 responseObserver); 460 } 461 462 /** 463 * 464 * 465 * <pre> 466 * Run asynchronous image detection and annotation for a list of generic 467 * files, such as PDF files, which may contain multiple pages and multiple 468 * images per page. Progress and results can be retrieved through the 469 * `google.longrunning.Operations` interface. 470 * `Operation.metadata` contains `OperationMetadata` (metadata). 471 * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). 472 * </pre> 473 */ asyncBatchAnnotateFiles( com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)474 public void asyncBatchAnnotateFiles( 475 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request, 476 io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { 477 io.grpc.stub.ClientCalls.asyncUnaryCall( 478 getChannel().newCall(getAsyncBatchAnnotateFilesMethod(), getCallOptions()), 479 request, 480 responseObserver); 481 } 482 } 483 484 /** 485 * A stub to allow clients to do synchronous rpc calls to service ImageAnnotator. 486 * 487 * <pre> 488 * Service that performs Google Cloud Vision API detection tasks over client 489 * images, such as face, landmark, logo, label, and text detection. The 490 * ImageAnnotator service returns detected entities from the images. 491 * </pre> 492 */ 493 public static final class ImageAnnotatorBlockingStub 494 extends io.grpc.stub.AbstractBlockingStub<ImageAnnotatorBlockingStub> { ImageAnnotatorBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)495 private ImageAnnotatorBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 496 super(channel, callOptions); 497 } 498 499 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)500 protected ImageAnnotatorBlockingStub build( 501 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 502 return new ImageAnnotatorBlockingStub(channel, callOptions); 503 } 504 505 /** 506 * 507 * 508 * <pre> 509 * Run image detection and annotation for a batch of images. 510 * </pre> 511 */ batchAnnotateImages( com.google.cloud.vision.v1.BatchAnnotateImagesRequest request)512 public com.google.cloud.vision.v1.BatchAnnotateImagesResponse batchAnnotateImages( 513 com.google.cloud.vision.v1.BatchAnnotateImagesRequest request) { 514 return io.grpc.stub.ClientCalls.blockingUnaryCall( 515 getChannel(), getBatchAnnotateImagesMethod(), getCallOptions(), request); 516 } 517 518 /** 519 * 520 * 521 * <pre> 522 * Service that performs image detection and annotation for a batch of files. 523 * Now only "application/pdf", "image/tiff" and "image/gif" are supported. 524 * This service will extract at most 5 (customers can specify which 5 in 525 * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each 526 * file provided and perform detection and annotation for each image 527 * extracted. 528 * </pre> 529 */ batchAnnotateFiles( com.google.cloud.vision.v1.BatchAnnotateFilesRequest request)530 public com.google.cloud.vision.v1.BatchAnnotateFilesResponse batchAnnotateFiles( 531 com.google.cloud.vision.v1.BatchAnnotateFilesRequest request) { 532 return io.grpc.stub.ClientCalls.blockingUnaryCall( 533 getChannel(), getBatchAnnotateFilesMethod(), getCallOptions(), request); 534 } 535 536 /** 537 * 538 * 539 * <pre> 540 * Run asynchronous image detection and annotation for a list of images. 541 * Progress and results can be retrieved through the 542 * `google.longrunning.Operations` interface. 543 * `Operation.metadata` contains `OperationMetadata` (metadata). 544 * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). 545 * This service will write image annotation outputs to json files in customer 546 * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. 547 * </pre> 548 */ asyncBatchAnnotateImages( com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request)549 public com.google.longrunning.Operation asyncBatchAnnotateImages( 550 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request) { 551 return io.grpc.stub.ClientCalls.blockingUnaryCall( 552 getChannel(), getAsyncBatchAnnotateImagesMethod(), getCallOptions(), request); 553 } 554 555 /** 556 * 557 * 558 * <pre> 559 * Run asynchronous image detection and annotation for a list of generic 560 * files, such as PDF files, which may contain multiple pages and multiple 561 * images per page. Progress and results can be retrieved through the 562 * `google.longrunning.Operations` interface. 563 * `Operation.metadata` contains `OperationMetadata` (metadata). 564 * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). 565 * </pre> 566 */ asyncBatchAnnotateFiles( com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request)567 public com.google.longrunning.Operation asyncBatchAnnotateFiles( 568 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request) { 569 return io.grpc.stub.ClientCalls.blockingUnaryCall( 570 getChannel(), getAsyncBatchAnnotateFilesMethod(), getCallOptions(), request); 571 } 572 } 573 574 /** 575 * A stub to allow clients to do ListenableFuture-style rpc calls to service ImageAnnotator. 576 * 577 * <pre> 578 * Service that performs Google Cloud Vision API detection tasks over client 579 * images, such as face, landmark, logo, label, and text detection. The 580 * ImageAnnotator service returns detected entities from the images. 581 * </pre> 582 */ 583 public static final class ImageAnnotatorFutureStub 584 extends io.grpc.stub.AbstractFutureStub<ImageAnnotatorFutureStub> { ImageAnnotatorFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)585 private ImageAnnotatorFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 586 super(channel, callOptions); 587 } 588 589 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)590 protected ImageAnnotatorFutureStub build( 591 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 592 return new ImageAnnotatorFutureStub(channel, callOptions); 593 } 594 595 /** 596 * 597 * 598 * <pre> 599 * Run image detection and annotation for a batch of images. 600 * </pre> 601 */ 602 public com.google.common.util.concurrent.ListenableFuture< 603 com.google.cloud.vision.v1.BatchAnnotateImagesResponse> batchAnnotateImages(com.google.cloud.vision.v1.BatchAnnotateImagesRequest request)604 batchAnnotateImages(com.google.cloud.vision.v1.BatchAnnotateImagesRequest request) { 605 return io.grpc.stub.ClientCalls.futureUnaryCall( 606 getChannel().newCall(getBatchAnnotateImagesMethod(), getCallOptions()), request); 607 } 608 609 /** 610 * 611 * 612 * <pre> 613 * Service that performs image detection and annotation for a batch of files. 614 * Now only "application/pdf", "image/tiff" and "image/gif" are supported. 615 * This service will extract at most 5 (customers can specify which 5 in 616 * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each 617 * file provided and perform detection and annotation for each image 618 * extracted. 619 * </pre> 620 */ 621 public com.google.common.util.concurrent.ListenableFuture< 622 com.google.cloud.vision.v1.BatchAnnotateFilesResponse> batchAnnotateFiles(com.google.cloud.vision.v1.BatchAnnotateFilesRequest request)623 batchAnnotateFiles(com.google.cloud.vision.v1.BatchAnnotateFilesRequest request) { 624 return io.grpc.stub.ClientCalls.futureUnaryCall( 625 getChannel().newCall(getBatchAnnotateFilesMethod(), getCallOptions()), request); 626 } 627 628 /** 629 * 630 * 631 * <pre> 632 * Run asynchronous image detection and annotation for a list of images. 633 * Progress and results can be retrieved through the 634 * `google.longrunning.Operations` interface. 635 * `Operation.metadata` contains `OperationMetadata` (metadata). 636 * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). 637 * This service will write image annotation outputs to json files in customer 638 * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. 639 * </pre> 640 */ 641 public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> asyncBatchAnnotateImages( com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request)642 asyncBatchAnnotateImages( 643 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest request) { 644 return io.grpc.stub.ClientCalls.futureUnaryCall( 645 getChannel().newCall(getAsyncBatchAnnotateImagesMethod(), getCallOptions()), request); 646 } 647 648 /** 649 * 650 * 651 * <pre> 652 * Run asynchronous image detection and annotation for a list of generic 653 * files, such as PDF files, which may contain multiple pages and multiple 654 * images per page. Progress and results can be retrieved through the 655 * `google.longrunning.Operations` interface. 656 * `Operation.metadata` contains `OperationMetadata` (metadata). 657 * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). 658 * </pre> 659 */ 660 public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> asyncBatchAnnotateFiles(com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request)661 asyncBatchAnnotateFiles(com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest request) { 662 return io.grpc.stub.ClientCalls.futureUnaryCall( 663 getChannel().newCall(getAsyncBatchAnnotateFilesMethod(), getCallOptions()), request); 664 } 665 } 666 667 private static final int METHODID_BATCH_ANNOTATE_IMAGES = 0; 668 private static final int METHODID_BATCH_ANNOTATE_FILES = 1; 669 private static final int METHODID_ASYNC_BATCH_ANNOTATE_IMAGES = 2; 670 private static final int METHODID_ASYNC_BATCH_ANNOTATE_FILES = 3; 671 672 private static final class MethodHandlers<Req, Resp> 673 implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, 674 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, 675 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, 676 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { 677 private final AsyncService serviceImpl; 678 private final int methodId; 679 MethodHandlers(AsyncService serviceImpl, int methodId)680 MethodHandlers(AsyncService serviceImpl, int methodId) { 681 this.serviceImpl = serviceImpl; 682 this.methodId = methodId; 683 } 684 685 @java.lang.Override 686 @java.lang.SuppressWarnings("unchecked") invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)687 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { 688 switch (methodId) { 689 case METHODID_BATCH_ANNOTATE_IMAGES: 690 serviceImpl.batchAnnotateImages( 691 (com.google.cloud.vision.v1.BatchAnnotateImagesRequest) request, 692 (io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateImagesResponse>) 693 responseObserver); 694 break; 695 case METHODID_BATCH_ANNOTATE_FILES: 696 serviceImpl.batchAnnotateFiles( 697 (com.google.cloud.vision.v1.BatchAnnotateFilesRequest) request, 698 (io.grpc.stub.StreamObserver<com.google.cloud.vision.v1.BatchAnnotateFilesResponse>) 699 responseObserver); 700 break; 701 case METHODID_ASYNC_BATCH_ANNOTATE_IMAGES: 702 serviceImpl.asyncBatchAnnotateImages( 703 (com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest) request, 704 (io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver); 705 break; 706 case METHODID_ASYNC_BATCH_ANNOTATE_FILES: 707 serviceImpl.asyncBatchAnnotateFiles( 708 (com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest) request, 709 (io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver); 710 break; 711 default: 712 throw new AssertionError(); 713 } 714 } 715 716 @java.lang.Override 717 @java.lang.SuppressWarnings("unchecked") invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)718 public io.grpc.stub.StreamObserver<Req> invoke( 719 io.grpc.stub.StreamObserver<Resp> responseObserver) { 720 switch (methodId) { 721 default: 722 throw new AssertionError(); 723 } 724 } 725 } 726 bindService(AsyncService service)727 public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { 728 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) 729 .addMethod( 730 getBatchAnnotateImagesMethod(), 731 io.grpc.stub.ServerCalls.asyncUnaryCall( 732 new MethodHandlers< 733 com.google.cloud.vision.v1.BatchAnnotateImagesRequest, 734 com.google.cloud.vision.v1.BatchAnnotateImagesResponse>( 735 service, METHODID_BATCH_ANNOTATE_IMAGES))) 736 .addMethod( 737 getBatchAnnotateFilesMethod(), 738 io.grpc.stub.ServerCalls.asyncUnaryCall( 739 new MethodHandlers< 740 com.google.cloud.vision.v1.BatchAnnotateFilesRequest, 741 com.google.cloud.vision.v1.BatchAnnotateFilesResponse>( 742 service, METHODID_BATCH_ANNOTATE_FILES))) 743 .addMethod( 744 getAsyncBatchAnnotateImagesMethod(), 745 io.grpc.stub.ServerCalls.asyncUnaryCall( 746 new MethodHandlers< 747 com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest, 748 com.google.longrunning.Operation>( 749 service, METHODID_ASYNC_BATCH_ANNOTATE_IMAGES))) 750 .addMethod( 751 getAsyncBatchAnnotateFilesMethod(), 752 io.grpc.stub.ServerCalls.asyncUnaryCall( 753 new MethodHandlers< 754 com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest, 755 com.google.longrunning.Operation>( 756 service, METHODID_ASYNC_BATCH_ANNOTATE_FILES))) 757 .build(); 758 } 759 760 private abstract static class ImageAnnotatorBaseDescriptorSupplier 761 implements io.grpc.protobuf.ProtoFileDescriptorSupplier, 762 io.grpc.protobuf.ProtoServiceDescriptorSupplier { ImageAnnotatorBaseDescriptorSupplier()763 ImageAnnotatorBaseDescriptorSupplier() {} 764 765 @java.lang.Override getFileDescriptor()766 public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { 767 return com.google.cloud.vision.v1.ImageAnnotatorProto.getDescriptor(); 768 } 769 770 @java.lang.Override getServiceDescriptor()771 public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { 772 return getFileDescriptor().findServiceByName("ImageAnnotator"); 773 } 774 } 775 776 private static final class ImageAnnotatorFileDescriptorSupplier 777 extends ImageAnnotatorBaseDescriptorSupplier { ImageAnnotatorFileDescriptorSupplier()778 ImageAnnotatorFileDescriptorSupplier() {} 779 } 780 781 private static final class ImageAnnotatorMethodDescriptorSupplier 782 extends ImageAnnotatorBaseDescriptorSupplier 783 implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { 784 private final String methodName; 785 ImageAnnotatorMethodDescriptorSupplier(String methodName)786 ImageAnnotatorMethodDescriptorSupplier(String methodName) { 787 this.methodName = methodName; 788 } 789 790 @java.lang.Override getMethodDescriptor()791 public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { 792 return getServiceDescriptor().findMethodByName(methodName); 793 } 794 } 795 796 private static volatile io.grpc.ServiceDescriptor serviceDescriptor; 797 getServiceDescriptor()798 public static io.grpc.ServiceDescriptor getServiceDescriptor() { 799 io.grpc.ServiceDescriptor result = serviceDescriptor; 800 if (result == null) { 801 synchronized (ImageAnnotatorGrpc.class) { 802 result = serviceDescriptor; 803 if (result == null) { 804 serviceDescriptor = 805 result = 806 io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) 807 .setSchemaDescriptor(new ImageAnnotatorFileDescriptorSupplier()) 808 .addMethod(getBatchAnnotateImagesMethod()) 809 .addMethod(getBatchAnnotateFilesMethod()) 810 .addMethod(getAsyncBatchAnnotateImagesMethod()) 811 .addMethod(getAsyncBatchAnnotateFilesMethod()) 812 .build(); 813 } 814 } 815 } 816 return result; 817 } 818 } 819