public class ClientCalls
Helpers for gRPC clients implemented in Kotlin. Can be used directly, but intended to be used from generated Kotlin APIs.
public static ClientCalls INSTANCE
Helpers for gRPC clients implemented in Kotlin. Can be used directly, but intended to be used from generated Kotlin APIs.
@Nullable
public <RequestT,ResponseT> java.lang.Object unaryRpc(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
RequestT request,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
io.grpc.Metadata headers,
@NotNull
kotlin.coroutines.Continuation<? super ResponseT> p)
Launches a unary RPC on the specified channel, suspending until the result is received.
@NotNull
public <RequestT,ResponseT> kotlin.jvm.functions.Function2<RequestT,kotlin.coroutines.Continuation,java.lang.Object> unaryRpcFunction(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
kotlin.jvm.functions.Function1<? super kotlin.coroutines.Continuation<? super io.grpc.Metadata>,? extends java.lang.Object> headers)
Returns a function object representing a unary RPC.
The input headers may be asynchronously formed. headers will be called each time the returned
RPC is called - the headers are not cached.
headers@NotNull
public <RequestT,ResponseT> kotlinx.coroutines.flow.Flow<ResponseT> serverStreamingRpc(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
RequestT request,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
io.grpc.Metadata headers)
Returns a Flow which launches the specified server-streaming RPC and emits the responses.
@NotNull
public <RequestT,ResponseT> kotlin.jvm.functions.Function1<RequestT,kotlinx.coroutines.flow.Flow> serverStreamingRpcFunction(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
kotlin.jvm.functions.Function1<? super kotlin.coroutines.Continuation<? super io.grpc.Metadata>,? extends java.lang.Object> headers)
Returns a function object representing a server streaming RPC.
The input headers may be asynchronously formed. headers will be called each time the returned
RPC is called - the headers are not cached.
headers@Nullable
public <RequestT,ResponseT> java.lang.Object clientStreamingRpc(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
@NotNull
kotlinx.coroutines.flow.Flow<? extends RequestT> requests,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
io.grpc.Metadata headers,
@NotNull
kotlin.coroutines.Continuation<? super ResponseT> p)
Launches a client-streaming RPC on the specified channel, suspending until the server returns the result. The caller is expected to provide a Flow of requests.
@NotNull
public <RequestT,ResponseT> kotlin.jvm.functions.Function2<kotlinx.coroutines.flow.Flow,kotlin.coroutines.Continuation,java.lang.Object> clientStreamingRpcFunction(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
kotlin.jvm.functions.Function1<? super kotlin.coroutines.Continuation<? super io.grpc.Metadata>,? extends java.lang.Object> headers)
Returns a function object representing a client streaming RPC.
The input headers may be asynchronously formed. headers will be called each time the returned
RPC is called - the headers are not cached.
headers@NotNull
public <RequestT,ResponseT> kotlinx.coroutines.flow.Flow<ResponseT> bidiStreamingRpc(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
@NotNull
kotlinx.coroutines.flow.Flow<? extends RequestT> requests,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
io.grpc.Metadata headers)
Returns a Flow which launches the specified bidirectional-streaming RPC, collecting the requests flow, sending them to the server, and emitting the responses.
Cancelling collection of the flow cancels the RPC upstream and collection of the requests.
For example, if responses.take(2).toList() is executed, the RPC will be cancelled after
the first two responses are returned.
@NotNull
public <RequestT,ResponseT> kotlin.jvm.functions.Function1<kotlinx.coroutines.flow.Flow,kotlinx.coroutines.flow.Flow> bidiStreamingRpcFunction(@NotNull
io.grpc.Channel channel,
@NotNull
io.grpc.MethodDescriptor<RequestT,ResponseT> method,
@NotNull
io.grpc.CallOptions callOptions,
@NotNull
kotlin.jvm.functions.Function1<? super kotlin.coroutines.Continuation<? super io.grpc.Metadata>,? extends java.lang.Object> headers)
Returns a function object representing a bidirectional streaming RPC.
The input headers may be asynchronously formed. headers will be called each time the returned
RPC is called - the headers are not cached.
headers