com.google.cloud.speech.v1.SpeechGrpc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grpc-google-cloud-speech-v1 Show documentation
Show all versions of grpc-google-cloud-speech-v1 Show documentation
GRPC library for grpc-google-cloud-speech-v1
package com.google.cloud.speech.v1;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
/**
*
* Service that implements Google Cloud Speech API.
*
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.0.1)",
comments = "Source: google/cloud/speech/v1/cloud_speech.proto")
public class SpeechGrpc {
private SpeechGrpc() {}
public static final String SERVICE_NAME = "google.cloud.speech.v1.Speech";
// Static method descriptors that strictly reflect the proto.
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
public static final io.grpc.MethodDescriptor METHOD_RECOGNIZE =
io.grpc.MethodDescriptor.create(
io.grpc.MethodDescriptor.MethodType.UNARY,
generateFullMethodName(
"google.cloud.speech.v1.Speech", "Recognize"),
io.grpc.protobuf.ProtoUtils.marshaller(com.google.cloud.speech.v1.RecognizeRequest.getDefaultInstance()),
io.grpc.protobuf.ProtoUtils.marshaller(com.google.cloud.speech.v1.RecognizeResponse.getDefaultInstance()));
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
public static final io.grpc.MethodDescriptor METHOD_LONG_RUNNING_RECOGNIZE =
io.grpc.MethodDescriptor.create(
io.grpc.MethodDescriptor.MethodType.UNARY,
generateFullMethodName(
"google.cloud.speech.v1.Speech", "LongRunningRecognize"),
io.grpc.protobuf.ProtoUtils.marshaller(com.google.cloud.speech.v1.LongRunningRecognizeRequest.getDefaultInstance()),
io.grpc.protobuf.ProtoUtils.marshaller(com.google.longrunning.Operation.getDefaultInstance()));
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
public static final io.grpc.MethodDescriptor METHOD_STREAMING_RECOGNIZE =
io.grpc.MethodDescriptor.create(
io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
generateFullMethodName(
"google.cloud.speech.v1.Speech", "StreamingRecognize"),
io.grpc.protobuf.ProtoUtils.marshaller(com.google.cloud.speech.v1.StreamingRecognizeRequest.getDefaultInstance()),
io.grpc.protobuf.ProtoUtils.marshaller(com.google.cloud.speech.v1.StreamingRecognizeResponse.getDefaultInstance()));
/**
* Creates a new async stub that supports all call types for the service
*/
public static SpeechStub newStub(io.grpc.Channel channel) {
return new SpeechStub(channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static SpeechBlockingStub newBlockingStub(
io.grpc.Channel channel) {
return new SpeechBlockingStub(channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
*/
public static SpeechFutureStub newFutureStub(
io.grpc.Channel channel) {
return new SpeechFutureStub(channel);
}
/**
*
* Service that implements Google Cloud Speech API.
*
*/
public static abstract class SpeechImplBase implements io.grpc.BindableService {
/**
*
* Performs synchronous speech recognition: receive results after all audio
* has been sent and processed.
*
*/
public void recognize(com.google.cloud.speech.v1.RecognizeRequest request,
io.grpc.stub.StreamObserver responseObserver) {
asyncUnimplementedUnaryCall(METHOD_RECOGNIZE, responseObserver);
}
/**
*
* Performs asynchronous speech recognition: receive results via the
* google.longrunning.Operations interface. Returns either an
* `Operation.error` or an `Operation.response` which contains
* a `LongRunningRecognizeResponse` message.
*
*/
public void longRunningRecognize(com.google.cloud.speech.v1.LongRunningRecognizeRequest request,
io.grpc.stub.StreamObserver responseObserver) {
asyncUnimplementedUnaryCall(METHOD_LONG_RUNNING_RECOGNIZE, responseObserver);
}
/**
*
* Performs bidirectional streaming speech recognition: receive results while
* sending audio. This method is only available via the gRPC API (not REST).
*
*/
public io.grpc.stub.StreamObserver streamingRecognize(
io.grpc.stub.StreamObserver responseObserver) {
return asyncUnimplementedStreamingCall(METHOD_STREAMING_RECOGNIZE, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
METHOD_RECOGNIZE,
asyncUnaryCall(
new MethodHandlers<
com.google.cloud.speech.v1.RecognizeRequest,
com.google.cloud.speech.v1.RecognizeResponse>(
this, METHODID_RECOGNIZE)))
.addMethod(
METHOD_LONG_RUNNING_RECOGNIZE,
asyncUnaryCall(
new MethodHandlers<
com.google.cloud.speech.v1.LongRunningRecognizeRequest,
com.google.longrunning.Operation>(
this, METHODID_LONG_RUNNING_RECOGNIZE)))
.addMethod(
METHOD_STREAMING_RECOGNIZE,
asyncBidiStreamingCall(
new MethodHandlers<
com.google.cloud.speech.v1.StreamingRecognizeRequest,
com.google.cloud.speech.v1.StreamingRecognizeResponse>(
this, METHODID_STREAMING_RECOGNIZE)))
.build();
}
}
/**
*
* Service that implements Google Cloud Speech API.
*
*/
public static final class SpeechStub extends io.grpc.stub.AbstractStub {
private SpeechStub(io.grpc.Channel channel) {
super(channel);
}
private SpeechStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected SpeechStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new SpeechStub(channel, callOptions);
}
/**
*
* Performs synchronous speech recognition: receive results after all audio
* has been sent and processed.
*
*/
public void recognize(com.google.cloud.speech.v1.RecognizeRequest request,
io.grpc.stub.StreamObserver responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_RECOGNIZE, getCallOptions()), request, responseObserver);
}
/**
*
* Performs asynchronous speech recognition: receive results via the
* google.longrunning.Operations interface. Returns either an
* `Operation.error` or an `Operation.response` which contains
* a `LongRunningRecognizeResponse` message.
*
*/
public void longRunningRecognize(com.google.cloud.speech.v1.LongRunningRecognizeRequest request,
io.grpc.stub.StreamObserver responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_LONG_RUNNING_RECOGNIZE, getCallOptions()), request, responseObserver);
}
/**
*
* Performs bidirectional streaming speech recognition: receive results while
* sending audio. This method is only available via the gRPC API (not REST).
*
*/
public io.grpc.stub.StreamObserver streamingRecognize(
io.grpc.stub.StreamObserver responseObserver) {
return asyncBidiStreamingCall(
getChannel().newCall(METHOD_STREAMING_RECOGNIZE, getCallOptions()), responseObserver);
}
}
/**
*
* Service that implements Google Cloud Speech API.
*
*/
public static final class SpeechBlockingStub extends io.grpc.stub.AbstractStub {
private SpeechBlockingStub(io.grpc.Channel channel) {
super(channel);
}
private SpeechBlockingStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected SpeechBlockingStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new SpeechBlockingStub(channel, callOptions);
}
/**
*
* Performs synchronous speech recognition: receive results after all audio
* has been sent and processed.
*
*/
public com.google.cloud.speech.v1.RecognizeResponse recognize(com.google.cloud.speech.v1.RecognizeRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_RECOGNIZE, getCallOptions(), request);
}
/**
*
* Performs asynchronous speech recognition: receive results via the
* google.longrunning.Operations interface. Returns either an
* `Operation.error` or an `Operation.response` which contains
* a `LongRunningRecognizeResponse` message.
*
*/
public com.google.longrunning.Operation longRunningRecognize(com.google.cloud.speech.v1.LongRunningRecognizeRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_LONG_RUNNING_RECOGNIZE, getCallOptions(), request);
}
}
/**
*
* Service that implements Google Cloud Speech API.
*
*/
public static final class SpeechFutureStub extends io.grpc.stub.AbstractStub {
private SpeechFutureStub(io.grpc.Channel channel) {
super(channel);
}
private SpeechFutureStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected SpeechFutureStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new SpeechFutureStub(channel, callOptions);
}
/**
*
* Performs synchronous speech recognition: receive results after all audio
* has been sent and processed.
*
*/
public com.google.common.util.concurrent.ListenableFuture recognize(
com.google.cloud.speech.v1.RecognizeRequest request) {
return futureUnaryCall(
getChannel().newCall(METHOD_RECOGNIZE, getCallOptions()), request);
}
/**
*
* Performs asynchronous speech recognition: receive results via the
* google.longrunning.Operations interface. Returns either an
* `Operation.error` or an `Operation.response` which contains
* a `LongRunningRecognizeResponse` message.
*
*/
public com.google.common.util.concurrent.ListenableFuture longRunningRecognize(
com.google.cloud.speech.v1.LongRunningRecognizeRequest request) {
return futureUnaryCall(
getChannel().newCall(METHOD_LONG_RUNNING_RECOGNIZE, getCallOptions()), request);
}
}
private static final int METHODID_RECOGNIZE = 0;
private static final int METHODID_LONG_RUNNING_RECOGNIZE = 1;
private static final int METHODID_STREAMING_RECOGNIZE = 2;
private static class MethodHandlers implements
io.grpc.stub.ServerCalls.UnaryMethod,
io.grpc.stub.ServerCalls.ServerStreamingMethod,
io.grpc.stub.ServerCalls.ClientStreamingMethod,
io.grpc.stub.ServerCalls.BidiStreamingMethod {
private final SpeechImplBase serviceImpl;
private final int methodId;
public MethodHandlers(SpeechImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
case METHODID_RECOGNIZE:
serviceImpl.recognize((com.google.cloud.speech.v1.RecognizeRequest) request,
(io.grpc.stub.StreamObserver) responseObserver);
break;
case METHODID_LONG_RUNNING_RECOGNIZE:
serviceImpl.longRunningRecognize((com.google.cloud.speech.v1.LongRunningRecognizeRequest) request,
(io.grpc.stub.StreamObserver) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver invoke(
io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
case METHODID_STREAMING_RECOGNIZE:
return (io.grpc.stub.StreamObserver) serviceImpl.streamingRecognize(
(io.grpc.stub.StreamObserver) responseObserver);
default:
throw new AssertionError();
}
}
}
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
return new io.grpc.ServiceDescriptor(SERVICE_NAME,
METHOD_RECOGNIZE,
METHOD_LONG_RUNNING_RECOGNIZE,
METHOD_STREAMING_RECOGNIZE);
}
}