• 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.speech.v1p1beta1;
17 
18 import static io.grpc.MethodDescriptor.generateFullMethodName;
19 
20 /**
21  *
22  *
23  * <pre>
24  * Service that implements Google Cloud Speech API.
25  * </pre>
26  */
27 @javax.annotation.Generated(
28     value = "by gRPC proto compiler",
29     comments = "Source: google/cloud/speech/v1p1beta1/cloud_speech.proto")
30 @io.grpc.stub.annotations.GrpcGenerated
31 public final class SpeechGrpc {
32 
SpeechGrpc()33   private SpeechGrpc() {}
34 
35   public static final String SERVICE_NAME = "google.cloud.speech.v1p1beta1.Speech";
36 
37   // Static method descriptors that strictly reflect the proto.
38   private static volatile io.grpc.MethodDescriptor<
39           com.google.cloud.speech.v1p1beta1.RecognizeRequest,
40           com.google.cloud.speech.v1p1beta1.RecognizeResponse>
41       getRecognizeMethod;
42 
43   @io.grpc.stub.annotations.RpcMethod(
44       fullMethodName = SERVICE_NAME + '/' + "Recognize",
45       requestType = com.google.cloud.speech.v1p1beta1.RecognizeRequest.class,
46       responseType = com.google.cloud.speech.v1p1beta1.RecognizeResponse.class,
47       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
48   public static io.grpc.MethodDescriptor<
49           com.google.cloud.speech.v1p1beta1.RecognizeRequest,
50           com.google.cloud.speech.v1p1beta1.RecognizeResponse>
getRecognizeMethod()51       getRecognizeMethod() {
52     io.grpc.MethodDescriptor<
53             com.google.cloud.speech.v1p1beta1.RecognizeRequest,
54             com.google.cloud.speech.v1p1beta1.RecognizeResponse>
55         getRecognizeMethod;
56     if ((getRecognizeMethod = SpeechGrpc.getRecognizeMethod) == null) {
57       synchronized (SpeechGrpc.class) {
58         if ((getRecognizeMethod = SpeechGrpc.getRecognizeMethod) == null) {
59           SpeechGrpc.getRecognizeMethod =
60               getRecognizeMethod =
61                   io.grpc.MethodDescriptor
62                       .<com.google.cloud.speech.v1p1beta1.RecognizeRequest,
63                           com.google.cloud.speech.v1p1beta1.RecognizeResponse>
64                           newBuilder()
65                       .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
66                       .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Recognize"))
67                       .setSampledToLocalTracing(true)
68                       .setRequestMarshaller(
69                           io.grpc.protobuf.ProtoUtils.marshaller(
70                               com.google.cloud.speech.v1p1beta1.RecognizeRequest
71                                   .getDefaultInstance()))
72                       .setResponseMarshaller(
73                           io.grpc.protobuf.ProtoUtils.marshaller(
74                               com.google.cloud.speech.v1p1beta1.RecognizeResponse
75                                   .getDefaultInstance()))
76                       .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("Recognize"))
77                       .build();
78         }
79       }
80     }
81     return getRecognizeMethod;
82   }
83 
84   private static volatile io.grpc.MethodDescriptor<
85           com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest,
86           com.google.longrunning.Operation>
87       getLongRunningRecognizeMethod;
88 
89   @io.grpc.stub.annotations.RpcMethod(
90       fullMethodName = SERVICE_NAME + '/' + "LongRunningRecognize",
91       requestType = com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest.class,
92       responseType = com.google.longrunning.Operation.class,
93       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
94   public static io.grpc.MethodDescriptor<
95           com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest,
96           com.google.longrunning.Operation>
getLongRunningRecognizeMethod()97       getLongRunningRecognizeMethod() {
98     io.grpc.MethodDescriptor<
99             com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest,
100             com.google.longrunning.Operation>
101         getLongRunningRecognizeMethod;
102     if ((getLongRunningRecognizeMethod = SpeechGrpc.getLongRunningRecognizeMethod) == null) {
103       synchronized (SpeechGrpc.class) {
104         if ((getLongRunningRecognizeMethod = SpeechGrpc.getLongRunningRecognizeMethod) == null) {
105           SpeechGrpc.getLongRunningRecognizeMethod =
106               getLongRunningRecognizeMethod =
107                   io.grpc.MethodDescriptor
108                       .<com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest,
109                           com.google.longrunning.Operation>
110                           newBuilder()
111                       .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
112                       .setFullMethodName(
113                           generateFullMethodName(SERVICE_NAME, "LongRunningRecognize"))
114                       .setSampledToLocalTracing(true)
115                       .setRequestMarshaller(
116                           io.grpc.protobuf.ProtoUtils.marshaller(
117                               com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest
118                                   .getDefaultInstance()))
119                       .setResponseMarshaller(
120                           io.grpc.protobuf.ProtoUtils.marshaller(
121                               com.google.longrunning.Operation.getDefaultInstance()))
122                       .setSchemaDescriptor(
123                           new SpeechMethodDescriptorSupplier("LongRunningRecognize"))
124                       .build();
125         }
126       }
127     }
128     return getLongRunningRecognizeMethod;
129   }
130 
131   private static volatile io.grpc.MethodDescriptor<
132           com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest,
133           com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>
134       getStreamingRecognizeMethod;
135 
136   @io.grpc.stub.annotations.RpcMethod(
137       fullMethodName = SERVICE_NAME + '/' + "StreamingRecognize",
138       requestType = com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest.class,
139       responseType = com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.class,
140       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
141   public static io.grpc.MethodDescriptor<
142           com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest,
143           com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>
getStreamingRecognizeMethod()144       getStreamingRecognizeMethod() {
145     io.grpc.MethodDescriptor<
146             com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest,
147             com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>
148         getStreamingRecognizeMethod;
149     if ((getStreamingRecognizeMethod = SpeechGrpc.getStreamingRecognizeMethod) == null) {
150       synchronized (SpeechGrpc.class) {
151         if ((getStreamingRecognizeMethod = SpeechGrpc.getStreamingRecognizeMethod) == null) {
152           SpeechGrpc.getStreamingRecognizeMethod =
153               getStreamingRecognizeMethod =
154                   io.grpc.MethodDescriptor
155                       .<com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest,
156                           com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>
157                           newBuilder()
158                       .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
159                       .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingRecognize"))
160                       .setSampledToLocalTracing(true)
161                       .setRequestMarshaller(
162                           io.grpc.protobuf.ProtoUtils.marshaller(
163                               com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest
164                                   .getDefaultInstance()))
165                       .setResponseMarshaller(
166                           io.grpc.protobuf.ProtoUtils.marshaller(
167                               com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse
168                                   .getDefaultInstance()))
169                       .setSchemaDescriptor(new SpeechMethodDescriptorSupplier("StreamingRecognize"))
170                       .build();
171         }
172       }
173     }
174     return getStreamingRecognizeMethod;
175   }
176 
177   /** Creates a new async stub that supports all call types for the service */
newStub(io.grpc.Channel channel)178   public static SpeechStub newStub(io.grpc.Channel channel) {
179     io.grpc.stub.AbstractStub.StubFactory<SpeechStub> factory =
180         new io.grpc.stub.AbstractStub.StubFactory<SpeechStub>() {
181           @java.lang.Override
182           public SpeechStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
183             return new SpeechStub(channel, callOptions);
184           }
185         };
186     return SpeechStub.newStub(factory, channel);
187   }
188 
189   /**
190    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
191    */
newBlockingStub(io.grpc.Channel channel)192   public static SpeechBlockingStub newBlockingStub(io.grpc.Channel channel) {
193     io.grpc.stub.AbstractStub.StubFactory<SpeechBlockingStub> factory =
194         new io.grpc.stub.AbstractStub.StubFactory<SpeechBlockingStub>() {
195           @java.lang.Override
196           public SpeechBlockingStub newStub(
197               io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
198             return new SpeechBlockingStub(channel, callOptions);
199           }
200         };
201     return SpeechBlockingStub.newStub(factory, channel);
202   }
203 
204   /** Creates a new ListenableFuture-style stub that supports unary calls on the service */
newFutureStub(io.grpc.Channel channel)205   public static SpeechFutureStub newFutureStub(io.grpc.Channel channel) {
206     io.grpc.stub.AbstractStub.StubFactory<SpeechFutureStub> factory =
207         new io.grpc.stub.AbstractStub.StubFactory<SpeechFutureStub>() {
208           @java.lang.Override
209           public SpeechFutureStub newStub(
210               io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
211             return new SpeechFutureStub(channel, callOptions);
212           }
213         };
214     return SpeechFutureStub.newStub(factory, channel);
215   }
216 
217   /**
218    *
219    *
220    * <pre>
221    * Service that implements Google Cloud Speech API.
222    * </pre>
223    */
224   public interface AsyncService {
225 
226     /**
227      *
228      *
229      * <pre>
230      * Performs synchronous speech recognition: receive results after all audio
231      * has been sent and processed.
232      * </pre>
233      */
recognize( com.google.cloud.speech.v1p1beta1.RecognizeRequest request, io.grpc.stub.StreamObserver<com.google.cloud.speech.v1p1beta1.RecognizeResponse> responseObserver)234     default void recognize(
235         com.google.cloud.speech.v1p1beta1.RecognizeRequest request,
236         io.grpc.stub.StreamObserver<com.google.cloud.speech.v1p1beta1.RecognizeResponse>
237             responseObserver) {
238       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRecognizeMethod(), responseObserver);
239     }
240 
241     /**
242      *
243      *
244      * <pre>
245      * Performs asynchronous speech recognition: receive results via the
246      * google.longrunning.Operations interface. Returns either an
247      * `Operation.error` or an `Operation.response` which contains
248      * a `LongRunningRecognizeResponse` message.
249      * For more information on asynchronous speech recognition, see the
250      * [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
251      * </pre>
252      */
longRunningRecognize( com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)253     default void longRunningRecognize(
254         com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request,
255         io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
256       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
257           getLongRunningRecognizeMethod(), responseObserver);
258     }
259 
260     /**
261      *
262      *
263      * <pre>
264      * Performs bidirectional streaming speech recognition: receive results while
265      * sending audio. This method is only available via the gRPC API (not REST).
266      * </pre>
267      */
268     default io.grpc.stub.StreamObserver<com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest>
streamingRecognize( io.grpc.stub.StreamObserver< com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse> responseObserver)269         streamingRecognize(
270             io.grpc.stub.StreamObserver<
271                     com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>
272                 responseObserver) {
273       return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(
274           getStreamingRecognizeMethod(), responseObserver);
275     }
276   }
277 
278   /**
279    * Base class for the server implementation of the service Speech.
280    *
281    * <pre>
282    * Service that implements Google Cloud Speech API.
283    * </pre>
284    */
285   public abstract static class SpeechImplBase implements io.grpc.BindableService, AsyncService {
286 
287     @java.lang.Override
bindService()288     public final io.grpc.ServerServiceDefinition bindService() {
289       return SpeechGrpc.bindService(this);
290     }
291   }
292 
293   /**
294    * A stub to allow clients to do asynchronous rpc calls to service Speech.
295    *
296    * <pre>
297    * Service that implements Google Cloud Speech API.
298    * </pre>
299    */
300   public static final class SpeechStub extends io.grpc.stub.AbstractAsyncStub<SpeechStub> {
SpeechStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)301     private SpeechStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
302       super(channel, callOptions);
303     }
304 
305     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)306     protected SpeechStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
307       return new SpeechStub(channel, callOptions);
308     }
309 
310     /**
311      *
312      *
313      * <pre>
314      * Performs synchronous speech recognition: receive results after all audio
315      * has been sent and processed.
316      * </pre>
317      */
recognize( com.google.cloud.speech.v1p1beta1.RecognizeRequest request, io.grpc.stub.StreamObserver<com.google.cloud.speech.v1p1beta1.RecognizeResponse> responseObserver)318     public void recognize(
319         com.google.cloud.speech.v1p1beta1.RecognizeRequest request,
320         io.grpc.stub.StreamObserver<com.google.cloud.speech.v1p1beta1.RecognizeResponse>
321             responseObserver) {
322       io.grpc.stub.ClientCalls.asyncUnaryCall(
323           getChannel().newCall(getRecognizeMethod(), getCallOptions()), request, responseObserver);
324     }
325 
326     /**
327      *
328      *
329      * <pre>
330      * Performs asynchronous speech recognition: receive results via the
331      * google.longrunning.Operations interface. Returns either an
332      * `Operation.error` or an `Operation.response` which contains
333      * a `LongRunningRecognizeResponse` message.
334      * For more information on asynchronous speech recognition, see the
335      * [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
336      * </pre>
337      */
longRunningRecognize( com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver)338     public void longRunningRecognize(
339         com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request,
340         io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
341       io.grpc.stub.ClientCalls.asyncUnaryCall(
342           getChannel().newCall(getLongRunningRecognizeMethod(), getCallOptions()),
343           request,
344           responseObserver);
345     }
346 
347     /**
348      *
349      *
350      * <pre>
351      * Performs bidirectional streaming speech recognition: receive results while
352      * sending audio. This method is only available via the gRPC API (not REST).
353      * </pre>
354      */
355     public io.grpc.stub.StreamObserver<com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest>
streamingRecognize( io.grpc.stub.StreamObserver< com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse> responseObserver)356         streamingRecognize(
357             io.grpc.stub.StreamObserver<
358                     com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>
359                 responseObserver) {
360       return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
361           getChannel().newCall(getStreamingRecognizeMethod(), getCallOptions()), responseObserver);
362     }
363   }
364 
365   /**
366    * A stub to allow clients to do synchronous rpc calls to service Speech.
367    *
368    * <pre>
369    * Service that implements Google Cloud Speech API.
370    * </pre>
371    */
372   public static final class SpeechBlockingStub
373       extends io.grpc.stub.AbstractBlockingStub<SpeechBlockingStub> {
SpeechBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)374     private SpeechBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
375       super(channel, callOptions);
376     }
377 
378     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)379     protected SpeechBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
380       return new SpeechBlockingStub(channel, callOptions);
381     }
382 
383     /**
384      *
385      *
386      * <pre>
387      * Performs synchronous speech recognition: receive results after all audio
388      * has been sent and processed.
389      * </pre>
390      */
recognize( com.google.cloud.speech.v1p1beta1.RecognizeRequest request)391     public com.google.cloud.speech.v1p1beta1.RecognizeResponse recognize(
392         com.google.cloud.speech.v1p1beta1.RecognizeRequest request) {
393       return io.grpc.stub.ClientCalls.blockingUnaryCall(
394           getChannel(), getRecognizeMethod(), getCallOptions(), request);
395     }
396 
397     /**
398      *
399      *
400      * <pre>
401      * Performs asynchronous speech recognition: receive results via the
402      * google.longrunning.Operations interface. Returns either an
403      * `Operation.error` or an `Operation.response` which contains
404      * a `LongRunningRecognizeResponse` message.
405      * For more information on asynchronous speech recognition, see the
406      * [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
407      * </pre>
408      */
longRunningRecognize( com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request)409     public com.google.longrunning.Operation longRunningRecognize(
410         com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request) {
411       return io.grpc.stub.ClientCalls.blockingUnaryCall(
412           getChannel(), getLongRunningRecognizeMethod(), getCallOptions(), request);
413     }
414   }
415 
416   /**
417    * A stub to allow clients to do ListenableFuture-style rpc calls to service Speech.
418    *
419    * <pre>
420    * Service that implements Google Cloud Speech API.
421    * </pre>
422    */
423   public static final class SpeechFutureStub
424       extends io.grpc.stub.AbstractFutureStub<SpeechFutureStub> {
SpeechFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)425     private SpeechFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
426       super(channel, callOptions);
427     }
428 
429     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)430     protected SpeechFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
431       return new SpeechFutureStub(channel, callOptions);
432     }
433 
434     /**
435      *
436      *
437      * <pre>
438      * Performs synchronous speech recognition: receive results after all audio
439      * has been sent and processed.
440      * </pre>
441      */
442     public com.google.common.util.concurrent.ListenableFuture<
443             com.google.cloud.speech.v1p1beta1.RecognizeResponse>
recognize(com.google.cloud.speech.v1p1beta1.RecognizeRequest request)444         recognize(com.google.cloud.speech.v1p1beta1.RecognizeRequest request) {
445       return io.grpc.stub.ClientCalls.futureUnaryCall(
446           getChannel().newCall(getRecognizeMethod(), getCallOptions()), request);
447     }
448 
449     /**
450      *
451      *
452      * <pre>
453      * Performs asynchronous speech recognition: receive results via the
454      * google.longrunning.Operations interface. Returns either an
455      * `Operation.error` or an `Operation.response` which contains
456      * a `LongRunningRecognizeResponse` message.
457      * For more information on asynchronous speech recognition, see the
458      * [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
459      * </pre>
460      */
461     public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation>
longRunningRecognize( com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request)462         longRunningRecognize(
463             com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest request) {
464       return io.grpc.stub.ClientCalls.futureUnaryCall(
465           getChannel().newCall(getLongRunningRecognizeMethod(), getCallOptions()), request);
466     }
467   }
468 
469   private static final int METHODID_RECOGNIZE = 0;
470   private static final int METHODID_LONG_RUNNING_RECOGNIZE = 1;
471   private static final int METHODID_STREAMING_RECOGNIZE = 2;
472 
473   private static final class MethodHandlers<Req, Resp>
474       implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
475           io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
476           io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
477           io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
478     private final AsyncService serviceImpl;
479     private final int methodId;
480 
MethodHandlers(AsyncService serviceImpl, int methodId)481     MethodHandlers(AsyncService serviceImpl, int methodId) {
482       this.serviceImpl = serviceImpl;
483       this.methodId = methodId;
484     }
485 
486     @java.lang.Override
487     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)488     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
489       switch (methodId) {
490         case METHODID_RECOGNIZE:
491           serviceImpl.recognize(
492               (com.google.cloud.speech.v1p1beta1.RecognizeRequest) request,
493               (io.grpc.stub.StreamObserver<com.google.cloud.speech.v1p1beta1.RecognizeResponse>)
494                   responseObserver);
495           break;
496         case METHODID_LONG_RUNNING_RECOGNIZE:
497           serviceImpl.longRunningRecognize(
498               (com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest) request,
499               (io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver);
500           break;
501         default:
502           throw new AssertionError();
503       }
504     }
505 
506     @java.lang.Override
507     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)508     public io.grpc.stub.StreamObserver<Req> invoke(
509         io.grpc.stub.StreamObserver<Resp> responseObserver) {
510       switch (methodId) {
511         case METHODID_STREAMING_RECOGNIZE:
512           return (io.grpc.stub.StreamObserver<Req>)
513               serviceImpl.streamingRecognize(
514                   (io.grpc.stub.StreamObserver<
515                           com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>)
516                       responseObserver);
517         default:
518           throw new AssertionError();
519       }
520     }
521   }
522 
bindService(AsyncService service)523   public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
524     return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
525         .addMethod(
526             getRecognizeMethod(),
527             io.grpc.stub.ServerCalls.asyncUnaryCall(
528                 new MethodHandlers<
529                     com.google.cloud.speech.v1p1beta1.RecognizeRequest,
530                     com.google.cloud.speech.v1p1beta1.RecognizeResponse>(
531                     service, METHODID_RECOGNIZE)))
532         .addMethod(
533             getLongRunningRecognizeMethod(),
534             io.grpc.stub.ServerCalls.asyncUnaryCall(
535                 new MethodHandlers<
536                     com.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest,
537                     com.google.longrunning.Operation>(service, METHODID_LONG_RUNNING_RECOGNIZE)))
538         .addMethod(
539             getStreamingRecognizeMethod(),
540             io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
541                 new MethodHandlers<
542                     com.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest,
543                     com.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse>(
544                     service, METHODID_STREAMING_RECOGNIZE)))
545         .build();
546   }
547 
548   private abstract static class SpeechBaseDescriptorSupplier
549       implements io.grpc.protobuf.ProtoFileDescriptorSupplier,
550           io.grpc.protobuf.ProtoServiceDescriptorSupplier {
SpeechBaseDescriptorSupplier()551     SpeechBaseDescriptorSupplier() {}
552 
553     @java.lang.Override
getFileDescriptor()554     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
555       return com.google.cloud.speech.v1p1beta1.SpeechProto.getDescriptor();
556     }
557 
558     @java.lang.Override
getServiceDescriptor()559     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
560       return getFileDescriptor().findServiceByName("Speech");
561     }
562   }
563 
564   private static final class SpeechFileDescriptorSupplier extends SpeechBaseDescriptorSupplier {
SpeechFileDescriptorSupplier()565     SpeechFileDescriptorSupplier() {}
566   }
567 
568   private static final class SpeechMethodDescriptorSupplier extends SpeechBaseDescriptorSupplier
569       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
570     private final String methodName;
571 
SpeechMethodDescriptorSupplier(String methodName)572     SpeechMethodDescriptorSupplier(String methodName) {
573       this.methodName = methodName;
574     }
575 
576     @java.lang.Override
getMethodDescriptor()577     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
578       return getServiceDescriptor().findMethodByName(methodName);
579     }
580   }
581 
582   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
583 
getServiceDescriptor()584   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
585     io.grpc.ServiceDescriptor result = serviceDescriptor;
586     if (result == null) {
587       synchronized (SpeechGrpc.class) {
588         result = serviceDescriptor;
589         if (result == null) {
590           serviceDescriptor =
591               result =
592                   io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
593                       .setSchemaDescriptor(new SpeechFileDescriptorSupplier())
594                       .addMethod(getRecognizeMethod())
595                       .addMethod(getLongRunningRecognizeMethod())
596                       .addMethod(getStreamingRecognizeMethod())
597                       .build();
598         }
599       }
600     }
601     return result;
602   }
603 }
604