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.talent.v4; 17 18 import static io.grpc.MethodDescriptor.generateFullMethodName; 19 20 /** 21 * 22 * 23 * <pre> 24 * A service handles auto completion. 25 * </pre> 26 */ 27 @javax.annotation.Generated( 28 value = "by gRPC proto compiler", 29 comments = "Source: google/cloud/talent/v4/completion_service.proto") 30 @io.grpc.stub.annotations.GrpcGenerated 31 public final class CompletionGrpc { 32 CompletionGrpc()33 private CompletionGrpc() {} 34 35 public static final String SERVICE_NAME = "google.cloud.talent.v4.Completion"; 36 37 // Static method descriptors that strictly reflect the proto. 38 private static volatile io.grpc.MethodDescriptor< 39 com.google.cloud.talent.v4.CompleteQueryRequest, 40 com.google.cloud.talent.v4.CompleteQueryResponse> 41 getCompleteQueryMethod; 42 43 @io.grpc.stub.annotations.RpcMethod( 44 fullMethodName = SERVICE_NAME + '/' + "CompleteQuery", 45 requestType = com.google.cloud.talent.v4.CompleteQueryRequest.class, 46 responseType = com.google.cloud.talent.v4.CompleteQueryResponse.class, 47 methodType = io.grpc.MethodDescriptor.MethodType.UNARY) 48 public static io.grpc.MethodDescriptor< 49 com.google.cloud.talent.v4.CompleteQueryRequest, 50 com.google.cloud.talent.v4.CompleteQueryResponse> getCompleteQueryMethod()51 getCompleteQueryMethod() { 52 io.grpc.MethodDescriptor< 53 com.google.cloud.talent.v4.CompleteQueryRequest, 54 com.google.cloud.talent.v4.CompleteQueryResponse> 55 getCompleteQueryMethod; 56 if ((getCompleteQueryMethod = CompletionGrpc.getCompleteQueryMethod) == null) { 57 synchronized (CompletionGrpc.class) { 58 if ((getCompleteQueryMethod = CompletionGrpc.getCompleteQueryMethod) == null) { 59 CompletionGrpc.getCompleteQueryMethod = 60 getCompleteQueryMethod = 61 io.grpc.MethodDescriptor 62 .<com.google.cloud.talent.v4.CompleteQueryRequest, 63 com.google.cloud.talent.v4.CompleteQueryResponse> 64 newBuilder() 65 .setType(io.grpc.MethodDescriptor.MethodType.UNARY) 66 .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CompleteQuery")) 67 .setSampledToLocalTracing(true) 68 .setRequestMarshaller( 69 io.grpc.protobuf.ProtoUtils.marshaller( 70 com.google.cloud.talent.v4.CompleteQueryRequest.getDefaultInstance())) 71 .setResponseMarshaller( 72 io.grpc.protobuf.ProtoUtils.marshaller( 73 com.google.cloud.talent.v4.CompleteQueryResponse 74 .getDefaultInstance())) 75 .setSchemaDescriptor(new CompletionMethodDescriptorSupplier("CompleteQuery")) 76 .build(); 77 } 78 } 79 } 80 return getCompleteQueryMethod; 81 } 82 83 /** Creates a new async stub that supports all call types for the service */ newStub(io.grpc.Channel channel)84 public static CompletionStub newStub(io.grpc.Channel channel) { 85 io.grpc.stub.AbstractStub.StubFactory<CompletionStub> factory = 86 new io.grpc.stub.AbstractStub.StubFactory<CompletionStub>() { 87 @java.lang.Override 88 public CompletionStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 89 return new CompletionStub(channel, callOptions); 90 } 91 }; 92 return CompletionStub.newStub(factory, channel); 93 } 94 95 /** 96 * Creates a new blocking-style stub that supports unary and streaming output calls on the service 97 */ newBlockingStub(io.grpc.Channel channel)98 public static CompletionBlockingStub newBlockingStub(io.grpc.Channel channel) { 99 io.grpc.stub.AbstractStub.StubFactory<CompletionBlockingStub> factory = 100 new io.grpc.stub.AbstractStub.StubFactory<CompletionBlockingStub>() { 101 @java.lang.Override 102 public CompletionBlockingStub newStub( 103 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 104 return new CompletionBlockingStub(channel, callOptions); 105 } 106 }; 107 return CompletionBlockingStub.newStub(factory, channel); 108 } 109 110 /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ newFutureStub(io.grpc.Channel channel)111 public static CompletionFutureStub newFutureStub(io.grpc.Channel channel) { 112 io.grpc.stub.AbstractStub.StubFactory<CompletionFutureStub> factory = 113 new io.grpc.stub.AbstractStub.StubFactory<CompletionFutureStub>() { 114 @java.lang.Override 115 public CompletionFutureStub newStub( 116 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 117 return new CompletionFutureStub(channel, callOptions); 118 } 119 }; 120 return CompletionFutureStub.newStub(factory, channel); 121 } 122 123 /** 124 * 125 * 126 * <pre> 127 * A service handles auto completion. 128 * </pre> 129 */ 130 public interface AsyncService { 131 132 /** 133 * 134 * 135 * <pre> 136 * Completes the specified prefix with keyword suggestions. 137 * Intended for use by a job search auto-complete search box. 138 * </pre> 139 */ completeQuery( com.google.cloud.talent.v4.CompleteQueryRequest request, io.grpc.stub.StreamObserver<com.google.cloud.talent.v4.CompleteQueryResponse> responseObserver)140 default void completeQuery( 141 com.google.cloud.talent.v4.CompleteQueryRequest request, 142 io.grpc.stub.StreamObserver<com.google.cloud.talent.v4.CompleteQueryResponse> 143 responseObserver) { 144 io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( 145 getCompleteQueryMethod(), responseObserver); 146 } 147 } 148 149 /** 150 * Base class for the server implementation of the service Completion. 151 * 152 * <pre> 153 * A service handles auto completion. 154 * </pre> 155 */ 156 public abstract static class CompletionImplBase implements io.grpc.BindableService, AsyncService { 157 158 @java.lang.Override bindService()159 public final io.grpc.ServerServiceDefinition bindService() { 160 return CompletionGrpc.bindService(this); 161 } 162 } 163 164 /** 165 * A stub to allow clients to do asynchronous rpc calls to service Completion. 166 * 167 * <pre> 168 * A service handles auto completion. 169 * </pre> 170 */ 171 public static final class CompletionStub extends io.grpc.stub.AbstractAsyncStub<CompletionStub> { CompletionStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)172 private CompletionStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 173 super(channel, callOptions); 174 } 175 176 @java.lang.Override build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)177 protected CompletionStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 178 return new CompletionStub(channel, callOptions); 179 } 180 181 /** 182 * 183 * 184 * <pre> 185 * Completes the specified prefix with keyword suggestions. 186 * Intended for use by a job search auto-complete search box. 187 * </pre> 188 */ completeQuery( com.google.cloud.talent.v4.CompleteQueryRequest request, io.grpc.stub.StreamObserver<com.google.cloud.talent.v4.CompleteQueryResponse> responseObserver)189 public void completeQuery( 190 com.google.cloud.talent.v4.CompleteQueryRequest request, 191 io.grpc.stub.StreamObserver<com.google.cloud.talent.v4.CompleteQueryResponse> 192 responseObserver) { 193 io.grpc.stub.ClientCalls.asyncUnaryCall( 194 getChannel().newCall(getCompleteQueryMethod(), getCallOptions()), 195 request, 196 responseObserver); 197 } 198 } 199 200 /** 201 * A stub to allow clients to do synchronous rpc calls to service Completion. 202 * 203 * <pre> 204 * A service handles auto completion. 205 * </pre> 206 */ 207 public static final class CompletionBlockingStub 208 extends io.grpc.stub.AbstractBlockingStub<CompletionBlockingStub> { CompletionBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)209 private CompletionBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 210 super(channel, callOptions); 211 } 212 213 @java.lang.Override build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)214 protected CompletionBlockingStub build( 215 io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 216 return new CompletionBlockingStub(channel, callOptions); 217 } 218 219 /** 220 * 221 * 222 * <pre> 223 * Completes the specified prefix with keyword suggestions. 224 * Intended for use by a job search auto-complete search box. 225 * </pre> 226 */ completeQuery( com.google.cloud.talent.v4.CompleteQueryRequest request)227 public com.google.cloud.talent.v4.CompleteQueryResponse completeQuery( 228 com.google.cloud.talent.v4.CompleteQueryRequest request) { 229 return io.grpc.stub.ClientCalls.blockingUnaryCall( 230 getChannel(), getCompleteQueryMethod(), getCallOptions(), request); 231 } 232 } 233 234 /** 235 * A stub to allow clients to do ListenableFuture-style rpc calls to service Completion. 236 * 237 * <pre> 238 * A service handles auto completion. 239 * </pre> 240 */ 241 public static final class CompletionFutureStub 242 extends io.grpc.stub.AbstractFutureStub<CompletionFutureStub> { CompletionFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)243 private CompletionFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 244 super(channel, callOptions); 245 } 246 247 @java.lang.Override build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)248 protected CompletionFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { 249 return new CompletionFutureStub(channel, callOptions); 250 } 251 252 /** 253 * 254 * 255 * <pre> 256 * Completes the specified prefix with keyword suggestions. 257 * Intended for use by a job search auto-complete search box. 258 * </pre> 259 */ 260 public com.google.common.util.concurrent.ListenableFuture< 261 com.google.cloud.talent.v4.CompleteQueryResponse> completeQuery(com.google.cloud.talent.v4.CompleteQueryRequest request)262 completeQuery(com.google.cloud.talent.v4.CompleteQueryRequest request) { 263 return io.grpc.stub.ClientCalls.futureUnaryCall( 264 getChannel().newCall(getCompleteQueryMethod(), getCallOptions()), request); 265 } 266 } 267 268 private static final int METHODID_COMPLETE_QUERY = 0; 269 270 private static final class MethodHandlers<Req, Resp> 271 implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, 272 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, 273 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, 274 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { 275 private final AsyncService serviceImpl; 276 private final int methodId; 277 MethodHandlers(AsyncService serviceImpl, int methodId)278 MethodHandlers(AsyncService serviceImpl, int methodId) { 279 this.serviceImpl = serviceImpl; 280 this.methodId = methodId; 281 } 282 283 @java.lang.Override 284 @java.lang.SuppressWarnings("unchecked") invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)285 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { 286 switch (methodId) { 287 case METHODID_COMPLETE_QUERY: 288 serviceImpl.completeQuery( 289 (com.google.cloud.talent.v4.CompleteQueryRequest) request, 290 (io.grpc.stub.StreamObserver<com.google.cloud.talent.v4.CompleteQueryResponse>) 291 responseObserver); 292 break; 293 default: 294 throw new AssertionError(); 295 } 296 } 297 298 @java.lang.Override 299 @java.lang.SuppressWarnings("unchecked") invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)300 public io.grpc.stub.StreamObserver<Req> invoke( 301 io.grpc.stub.StreamObserver<Resp> responseObserver) { 302 switch (methodId) { 303 default: 304 throw new AssertionError(); 305 } 306 } 307 } 308 bindService(AsyncService service)309 public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { 310 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) 311 .addMethod( 312 getCompleteQueryMethod(), 313 io.grpc.stub.ServerCalls.asyncUnaryCall( 314 new MethodHandlers< 315 com.google.cloud.talent.v4.CompleteQueryRequest, 316 com.google.cloud.talent.v4.CompleteQueryResponse>( 317 service, METHODID_COMPLETE_QUERY))) 318 .build(); 319 } 320 321 private abstract static class CompletionBaseDescriptorSupplier 322 implements io.grpc.protobuf.ProtoFileDescriptorSupplier, 323 io.grpc.protobuf.ProtoServiceDescriptorSupplier { CompletionBaseDescriptorSupplier()324 CompletionBaseDescriptorSupplier() {} 325 326 @java.lang.Override getFileDescriptor()327 public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { 328 return com.google.cloud.talent.v4.CompletionServiceProto.getDescriptor(); 329 } 330 331 @java.lang.Override getServiceDescriptor()332 public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { 333 return getFileDescriptor().findServiceByName("Completion"); 334 } 335 } 336 337 private static final class CompletionFileDescriptorSupplier 338 extends CompletionBaseDescriptorSupplier { CompletionFileDescriptorSupplier()339 CompletionFileDescriptorSupplier() {} 340 } 341 342 private static final class CompletionMethodDescriptorSupplier 343 extends CompletionBaseDescriptorSupplier 344 implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { 345 private final String methodName; 346 CompletionMethodDescriptorSupplier(String methodName)347 CompletionMethodDescriptorSupplier(String methodName) { 348 this.methodName = methodName; 349 } 350 351 @java.lang.Override getMethodDescriptor()352 public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { 353 return getServiceDescriptor().findMethodByName(methodName); 354 } 355 } 356 357 private static volatile io.grpc.ServiceDescriptor serviceDescriptor; 358 getServiceDescriptor()359 public static io.grpc.ServiceDescriptor getServiceDescriptor() { 360 io.grpc.ServiceDescriptor result = serviceDescriptor; 361 if (result == null) { 362 synchronized (CompletionGrpc.class) { 363 result = serviceDescriptor; 364 if (result == null) { 365 serviceDescriptor = 366 result = 367 io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) 368 .setSchemaDescriptor(new CompletionFileDescriptorSupplier()) 369 .addMethod(getCompleteQueryMethod()) 370 .build(); 371 } 372 } 373 } 374 return result; 375 } 376 } 377