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