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.retail.v2; 17 18 import static io.grpc.MethodDescriptor.generateFullMethodName; 19 20 /** 21 * 22 * 23 * <pre> 24 * Autocomplete service for retail. 25 * This feature is only available for users who have Retail Search enabled. 26 * Enable Retail Search on Cloud Console before using this feature. 27 * </pre> 28 */ 29 @javax.annotation.Generated( 30 value = "by gRPC proto compiler", 31 comments = "Source: google/cloud/retail/v2/completion_service.proto") 32 @io.grpc.stub.annotations.GrpcGenerated 33 public final class CompletionServiceGrpc { 34 CompletionServiceGrpc()35 private CompletionServiceGrpc() {} 36 37 public static final String SERVICE_NAME = "google.cloud.retail.v2.CompletionService"; 38 39 // Static method descriptors that strictly reflect the proto. 40 private static volatile io.grpc.MethodDescriptor< 41 com.google.cloud.retail.v2.CompleteQueryRequest, 42 com.google.cloud.retail.v2.CompleteQueryResponse> 43 getCompleteQueryMethod; 44 45 @io.grpc.stub.annotations.RpcMethod( 46 fullMethodName = SERVICE_NAME + '/' + "CompleteQuery", 47 requestType = com.google.cloud.retail.v2.CompleteQueryRequest.class, 48 responseType = com.google.cloud.retail.v2.CompleteQueryResponse.class, 49 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 50 public static io.grpc.MethodDescriptor< 51 com.google.cloud.retail.v2.CompleteQueryRequest, 52 com.google.cloud.retail.v2.CompleteQueryResponse> getCompleteQueryMethod()53 getCompleteQueryMethod() { 54 io.grpc.MethodDescriptor< 55 com.google.cloud.retail.v2.CompleteQueryRequest, 56 com.google.cloud.retail.v2.CompleteQueryResponse> 57 getCompleteQueryMethod; 58 if ((getCompleteQueryMethod = CompletionServiceGrpc.getCompleteQueryMethod) == null) { 59 synchronized (CompletionServiceGrpc.class) { 60 if ((getCompleteQueryMethod = CompletionServiceGrpc.getCompleteQueryMethod) == null) { 61 CompletionServiceGrpc.getCompleteQueryMethod = 62 getCompleteQueryMethod = 63 io.grpc.MethodDescriptor 64 .<com.google.cloud.retail.v2.CompleteQueryRequest, 65 com.google.cloud.retail.v2.CompleteQueryResponse> 66 newBuilder() 67 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 68 .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CompleteQuery")) 69 .setSampledToLocalTracing(true) 70 .setRequestMarshaller( 71 io.grpc.protobuf.ProtoUtils.marshaller( 72 com.google.cloud.retail.v2.CompleteQueryRequest.getDefaultInstance())) 73 .setResponseMarshaller( 74 io.grpc.protobuf.ProtoUtils.marshaller( 75 com.google.cloud.retail.v2.CompleteQueryResponse 76 .getDefaultInstance())) 77 .setSchemaDescriptor( 78 new CompletionServiceMethodDescriptorSupplier("CompleteQuery")) 79 .build(); 80 } 81 } 82 } 83 return getCompleteQueryMethod; 84 } 85 86 private static volatile io.grpc.MethodDescriptor< 87 com.google.cloud.retail.v2.ImportCompletionDataRequest, com.google.longrunning.Operation> 88 getImportCompletionDataMethod; 89 90 @io.grpc.stub.annotations.RpcMethod( 91 fullMethodName = SERVICE_NAME + '/' + "ImportCompletionData", 92 requestType = com.google.cloud.retail.v2.ImportCompletionDataRequest.class, 93 responseType = com.google.longrunning.Operation.class, 94 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 95 public static io.grpc.MethodDescriptor< 96 com.google.cloud.retail.v2.ImportCompletionDataRequest, com.google.longrunning.Operation> getImportCompletionDataMethod()97 getImportCompletionDataMethod() { 98 io.grpc.MethodDescriptor< 99 com.google.cloud.retail.v2.ImportCompletionDataRequest, 100 com.google.longrunning.Operation> 101 getImportCompletionDataMethod; 102 if ((getImportCompletionDataMethod = CompletionServiceGrpc.getImportCompletionDataMethod) 103 == null) { 104 synchronized (CompletionServiceGrpc.class) { 105 if ((getImportCompletionDataMethod = CompletionServiceGrpc.getImportCompletionDataMethod) 106 == null) { 107 CompletionServiceGrpc.getImportCompletionDataMethod = 108 getImportCompletionDataMethod = 109 io.grpc.MethodDescriptor 110 .<com.google.cloud.retail.v2.ImportCompletionDataRequest, 111 com.google.longrunning.Operation> 112 newBuilder() 113 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 114 .setFullMethodName( 115 generateFullMethodName(SERVICE_NAME, "ImportCompletionData")) 116 .setSampledToLocalTracing(true) 117 .setRequestMarshaller( 118 io.grpc.protobuf.ProtoUtils.marshaller( 119 com.google.cloud.retail.v2.ImportCompletionDataRequest 120 .getDefaultInstance())) 121 .setResponseMarshaller( 122 io.grpc.protobuf.ProtoUtils.marshaller( 123 com.google.longrunning.Operation.getDefaultInstance())) 124 .setSchemaDescriptor( 125 new CompletionServiceMethodDescriptorSupplier("ImportCompletionData")) 126 .build(); 127 } 128 } 129 } 130 return getImportCompletionDataMethod; 131 } 132 133 /** Creates a new async stub that supports all call types for the service */ newStub(io.grpc.Channel channel)134 public static CompletionServiceStub newStub(io.grpc.Channel channel) { 135 io.grpc.stub.AbstractStub.StubFactory<CompletionServiceStub> factory = 136 new io.grpc.stub.AbstractStub.StubFactory<CompletionServiceStub>() { 137 @java.lang.Override 138 public CompletionServiceStub newStub( 139 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 140 return new CompletionServiceStub(channel, callOptions); 141 } 142 }; 143 return CompletionServiceStub.newStub(factory, channel); 144 } 145 146 /** 147 * Creates a new blocking-style stub that supports unary and streaming output calls on the service 148 */ newBlockingStub(io.grpc.Channel channel)149 public static CompletionServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { 150 io.grpc.stub.AbstractStub.StubFactory<CompletionServiceBlockingStub> factory = 151 new io.grpc.stub.AbstractStub.StubFactory<CompletionServiceBlockingStub>() { 152 @java.lang.Override 153 public CompletionServiceBlockingStub newStub( 154 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 155 return new CompletionServiceBlockingStub(channel, callOptions); 156 } 157 }; 158 return CompletionServiceBlockingStub.newStub(factory, channel); 159 } 160 161 /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ newFutureStub(io.grpc.Channel channel)162 public static CompletionServiceFutureStub newFutureStub(io.grpc.Channel channel) { 163 io.grpc.stub.AbstractStub.StubFactory<CompletionServiceFutureStub> factory = 164 new io.grpc.stub.AbstractStub.StubFactory<CompletionServiceFutureStub>() { 165 @java.lang.Override 166 public CompletionServiceFutureStub newStub( 167 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 168 return new CompletionServiceFutureStub(channel, callOptions); 169 } 170 }; 171 return CompletionServiceFutureStub.newStub(factory, channel); 172 } 173 174 /** 175 * 176 * 177 * <pre> 178 * Autocomplete service for retail. 179 * This feature is only available for users who have Retail Search enabled. 180 * Enable Retail Search on Cloud Console before using this feature. 181 * </pre> 182 */ 183 public interface AsyncService { 184 185 /** 186 * 187 * 188 * <pre> 189 * Completes the specified prefix with keyword suggestions. 190 * This feature is only available for users who have Retail Search enabled. 191 * Enable Retail Search on Cloud Console before using this feature. 192 * </pre> 193 */ completeQuery( com.google.cloud.retail.v2.CompleteQueryRequest request, io.grpc.stub.StreamObserver<com.google.cloud.retail.v2.CompleteQueryResponse> responseObserver)194 default void completeQuery( 195 com.google.cloud.retail.v2.CompleteQueryRequest request, 196 io.grpc.stub.StreamObserver<com.google.cloud.retail.v2.CompleteQueryResponse> 197 responseObserver) { 198 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 199 getCompleteQueryMethod(), responseObserver); 200 } 201 202 /** 203 * 204 * 205 * <pre> 206 * Bulk import of processed completion dataset. 207 * Request processing is asynchronous. Partial updating is not supported. 208 * The operation is successfully finished only after the imported suggestions 209 * are indexed successfully and ready for serving. The process takes hours. 210 * This feature is only available for users who have Retail Search enabled. 211 * Enable Retail Search on Cloud Console before using this feature. 212 * </pre> 213 */ importCompletionData( com.google.cloud.retail.v2.ImportCompletionDataRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)214 default void importCompletionData( 215 com.google.cloud.retail.v2.ImportCompletionDataRequest request, 216 io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { 217 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 218 getImportCompletionDataMethod(), responseObserver); 219 } 220 } 221 222 /** 223 * Base class for the server implementation of the service CompletionService. 224 * 225 * <pre> 226 * Autocomplete service for retail. 227 * This feature is only available for users who have Retail Search enabled. 228 * Enable Retail Search on Cloud Console before using this feature. 229 * </pre> 230 */ 231 public abstract static class CompletionServiceImplBase 232 implements io.grpc.BindableService, AsyncService { 233 234 @java.lang.Override bindService()235 public final io.grpc.ServerServiceDefinition bindService() { 236 return CompletionServiceGrpc.bindService(this); 237 } 238 } 239 240 /** 241 * A stub to allow clients to do asynchronous rpc calls to service CompletionService. 242 * 243 * <pre> 244 * Autocomplete service for retail. 245 * This feature is only available for users who have Retail Search enabled. 246 * Enable Retail Search on Cloud Console before using this feature. 247 * </pre> 248 */ 249 public static final class CompletionServiceStub 250 extends io.grpc.stub.AbstractAsyncStub<CompletionServiceStub> { CompletionServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)251 private CompletionServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 252 super(channel, callOptions); 253 } 254 255 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)256 protected CompletionServiceStub build( 257 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 258 return new CompletionServiceStub(channel, callOptions); 259 } 260 261 /** 262 * 263 * 264 * <pre> 265 * Completes the specified prefix with keyword suggestions. 266 * This feature is only available for users who have Retail Search enabled. 267 * Enable Retail Search on Cloud Console before using this feature. 268 * </pre> 269 */ completeQuery( com.google.cloud.retail.v2.CompleteQueryRequest request, io.grpc.stub.StreamObserver<com.google.cloud.retail.v2.CompleteQueryResponse> responseObserver)270 public void completeQuery( 271 com.google.cloud.retail.v2.CompleteQueryRequest request, 272 io.grpc.stub.StreamObserver<com.google.cloud.retail.v2.CompleteQueryResponse> 273 responseObserver) { 274 io.grpc.stub.ClientCalls.asyncUnaryCall( 275 getChannel().newCall(getCompleteQueryMethod(), getCallOptions()), 276 request, 277 responseObserver); 278 } 279 280 /** 281 * 282 * 283 * <pre> 284 * Bulk import of processed completion dataset. 285 * Request processing is asynchronous. Partial updating is not supported. 286 * The operation is successfully finished only after the imported suggestions 287 * are indexed successfully and ready for serving. The process takes hours. 288 * This feature is only available for users who have Retail Search enabled. 289 * Enable Retail Search on Cloud Console before using this feature. 290 * </pre> 291 */ importCompletionData( com.google.cloud.retail.v2.ImportCompletionDataRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)292 public void importCompletionData( 293 com.google.cloud.retail.v2.ImportCompletionDataRequest request, 294 io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { 295 io.grpc.stub.ClientCalls.asyncUnaryCall( 296 getChannel().newCall(getImportCompletionDataMethod(), getCallOptions()), 297 request, 298 responseObserver); 299 } 300 } 301 302 /** 303 * A stub to allow clients to do synchronous rpc calls to service CompletionService. 304 * 305 * <pre> 306 * Autocomplete service for retail. 307 * This feature is only available for users who have Retail Search enabled. 308 * Enable Retail Search on Cloud Console before using this feature. 309 * </pre> 310 */ 311 public static final class CompletionServiceBlockingStub 312 extends io.grpc.stub.AbstractBlockingStub<CompletionServiceBlockingStub> { CompletionServiceBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)313 private CompletionServiceBlockingStub( 314 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 315 super(channel, callOptions); 316 } 317 318 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)319 protected CompletionServiceBlockingStub build( 320 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 321 return new CompletionServiceBlockingStub(channel, callOptions); 322 } 323 324 /** 325 * 326 * 327 * <pre> 328 * Completes the specified prefix with keyword suggestions. 329 * This feature is only available for users who have Retail Search enabled. 330 * Enable Retail Search on Cloud Console before using this feature. 331 * </pre> 332 */ completeQuery( com.google.cloud.retail.v2.CompleteQueryRequest request)333 public com.google.cloud.retail.v2.CompleteQueryResponse completeQuery( 334 com.google.cloud.retail.v2.CompleteQueryRequest request) { 335 return io.grpc.stub.ClientCalls.blockingUnaryCall( 336 getChannel(), getCompleteQueryMethod(), getCallOptions(), request); 337 } 338 339 /** 340 * 341 * 342 * <pre> 343 * Bulk import of processed completion dataset. 344 * Request processing is asynchronous. Partial updating is not supported. 345 * The operation is successfully finished only after the imported suggestions 346 * are indexed successfully and ready for serving. The process takes hours. 347 * This feature is only available for users who have Retail Search enabled. 348 * Enable Retail Search on Cloud Console before using this feature. 349 * </pre> 350 */ importCompletionData( com.google.cloud.retail.v2.ImportCompletionDataRequest request)351 public com.google.longrunning.Operation importCompletionData( 352 com.google.cloud.retail.v2.ImportCompletionDataRequest request) { 353 return io.grpc.stub.ClientCalls.blockingUnaryCall( 354 getChannel(), getImportCompletionDataMethod(), getCallOptions(), request); 355 } 356 } 357 358 /** 359 * A stub to allow clients to do ListenableFuture-style rpc calls to service CompletionService. 360 * 361 * <pre> 362 * Autocomplete service for retail. 363 * This feature is only available for users who have Retail Search enabled. 364 * Enable Retail Search on Cloud Console before using this feature. 365 * </pre> 366 */ 367 public static final class CompletionServiceFutureStub 368 extends io.grpc.stub.AbstractFutureStub<CompletionServiceFutureStub> { CompletionServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)369 private CompletionServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 370 super(channel, callOptions); 371 } 372 373 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)374 protected CompletionServiceFutureStub build( 375 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 376 return new CompletionServiceFutureStub(channel, callOptions); 377 } 378 379 /** 380 * 381 * 382 * <pre> 383 * Completes the specified prefix with keyword suggestions. 384 * This feature is only available for users who have Retail Search enabled. 385 * Enable Retail Search on Cloud Console before using this feature. 386 * </pre> 387 */ 388 public com.google.common.util.concurrent.ListenableFuture< 389 com.google.cloud.retail.v2.CompleteQueryResponse> completeQuery(com.google.cloud.retail.v2.CompleteQueryRequest request)390 completeQuery(com.google.cloud.retail.v2.CompleteQueryRequest request) { 391 return io.grpc.stub.ClientCalls.futureUnaryCall( 392 getChannel().newCall(getCompleteQueryMethod(), getCallOptions()), request); 393 } 394 395 /** 396 * 397 * 398 * <pre> 399 * Bulk import of processed completion dataset. 400 * Request processing is asynchronous. Partial updating is not supported. 401 * The operation is successfully finished only after the imported suggestions 402 * are indexed successfully and ready for serving. The process takes hours. 403 * This feature is only available for users who have Retail Search enabled. 404 * Enable Retail Search on Cloud Console before using this feature. 405 * </pre> 406 */ 407 public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> importCompletionData(com.google.cloud.retail.v2.ImportCompletionDataRequest request)408 importCompletionData(com.google.cloud.retail.v2.ImportCompletionDataRequest request) { 409 return io.grpc.stub.ClientCalls.futureUnaryCall( 410 getChannel().newCall(getImportCompletionDataMethod(), getCallOptions()), request); 411 } 412 } 413 414 private static final int METHODID_COMPLETE_QUERY = 0; 415 private static final int METHODID_IMPORT_COMPLETION_DATA = 1; 416 417 private static final class MethodHandlers<Req, Resp> 418 implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, 419 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, 420 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, 421 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { 422 private final AsyncService serviceImpl; 423 private final int methodId; 424 MethodHandlers(AsyncService serviceImpl, int methodId)425 MethodHandlers(AsyncService serviceImpl, int methodId) { 426 this.serviceImpl = serviceImpl; 427 this.methodId = methodId; 428 } 429 430 @java.lang.Override 431 @java.lang.SuppressWarnings("unchecked") invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)432 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { 433 switch (methodId) { 434 case METHODID_COMPLETE_QUERY: 435 serviceImpl.completeQuery( 436 (com.google.cloud.retail.v2.CompleteQueryRequest) request, 437 (io.grpc.stub.StreamObserver<com.google.cloud.retail.v2.CompleteQueryResponse>) 438 responseObserver); 439 break; 440 case METHODID_IMPORT_COMPLETION_DATA: 441 serviceImpl.importCompletionData( 442 (com.google.cloud.retail.v2.ImportCompletionDataRequest) request, 443 (io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver); 444 break; 445 default: 446 throw new AssertionError(); 447 } 448 } 449 450 @java.lang.Override 451 @java.lang.SuppressWarnings("unchecked") invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)452 public io.grpc.stub.StreamObserver<Req> invoke( 453 io.grpc.stub.StreamObserver<Resp> responseObserver) { 454 switch (methodId) { 455 default: 456 throw new AssertionError(); 457 } 458 } 459 } 460 bindService(AsyncService service)461 public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { 462 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) 463 .addMethod( 464 getCompleteQueryMethod(), 465 io.grpc.stub.ServerCalls.asyncUnaryCall( 466 new MethodHandlers< 467 com.google.cloud.retail.v2.CompleteQueryRequest, 468 com.google.cloud.retail.v2.CompleteQueryResponse>( 469 service, METHODID_COMPLETE_QUERY))) 470 .addMethod( 471 getImportCompletionDataMethod(), 472 io.grpc.stub.ServerCalls.asyncUnaryCall( 473 new MethodHandlers< 474 com.google.cloud.retail.v2.ImportCompletionDataRequest, 475 com.google.longrunning.Operation>(service, METHODID_IMPORT_COMPLETION_DATA))) 476 .build(); 477 } 478 479 private abstract static class CompletionServiceBaseDescriptorSupplier 480 implements io.grpc.protobuf.ProtoFileDescriptorSupplier, 481 io.grpc.protobuf.ProtoServiceDescriptorSupplier { CompletionServiceBaseDescriptorSupplier()482 CompletionServiceBaseDescriptorSupplier() {} 483 484 @java.lang.Override getFileDescriptor()485 public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { 486 return com.google.cloud.retail.v2.CompletionServiceProto.getDescriptor(); 487 } 488 489 @java.lang.Override getServiceDescriptor()490 public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { 491 return getFileDescriptor().findServiceByName("CompletionService"); 492 } 493 } 494 495 private static final class CompletionServiceFileDescriptorSupplier 496 extends CompletionServiceBaseDescriptorSupplier { CompletionServiceFileDescriptorSupplier()497 CompletionServiceFileDescriptorSupplier() {} 498 } 499 500 private static final class CompletionServiceMethodDescriptorSupplier 501 extends CompletionServiceBaseDescriptorSupplier 502 implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { 503 private final String methodName; 504 CompletionServiceMethodDescriptorSupplier(String methodName)505 CompletionServiceMethodDescriptorSupplier(String methodName) { 506 this.methodName = methodName; 507 } 508 509 @java.lang.Override getMethodDescriptor()510 public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { 511 return getServiceDescriptor().findMethodByName(methodName); 512 } 513 } 514 515 private static volatile io.grpc.ServiceDescriptor serviceDescriptor; 516 getServiceDescriptor()517 public static io.grpc.ServiceDescriptor getServiceDescriptor() { 518 io.grpc.ServiceDescriptor result = serviceDescriptor; 519 if (result == null) { 520 synchronized (CompletionServiceGrpc.class) { 521 result = serviceDescriptor; 522 if (result == null) { 523 serviceDescriptor = 524 result = 525 io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) 526 .setSchemaDescriptor(new CompletionServiceFileDescriptorSupplier()) 527 .addMethod(getCompleteQueryMethod()) 528 .addMethod(getImportCompletionDataMethod()) 529 .build(); 530 } 531 } 532 } 533 return result; 534 } 535 } 536