ClientCalls

object ClientCalls

Helpers for gRPC clients implemented in Kotlin. Can be used directly, but intended to be used from generated Kotlin APIs.

Functions

bidiStreamingRpc
Link copied to clipboard
fun <RequestT, ResponseT> bidiStreamingRpc(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, requests: Flow<RequestT>, callOptions: CallOptions = CallOptions.DEFAULT, headers: Metadata = GrpcMetadata()): Flow<ResponseT>
Returns a Flow which launches the specified bidirectional-streaming RPC, collecting the requests flow, sending them to the server, and emitting the responses.
bidiStreamingRpcFunction
Link copied to clipboard
fun <RequestT, ResponseT> bidiStreamingRpcFunction(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, callOptions: CallOptions = CallOptions.DEFAULT, headers: suspend () -> Metadata = { GrpcMetadata() }): (Flow<RequestT>) -> Flow<ResponseT>
Returns a function object representing a bidirectional streaming RPC.
clientStreamingRpc
Link copied to clipboard
suspend fun <RequestT, ResponseT> clientStreamingRpc(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, requests: Flow<RequestT>, callOptions: CallOptions = CallOptions.DEFAULT, headers: Metadata = GrpcMetadata()): ResponseT
Launches a client-streaming RPC on the specified channel, suspending until the server returns the result.
clientStreamingRpcFunction
Link copied to clipboard
fun <RequestT, ResponseT> clientStreamingRpcFunction(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, callOptions: CallOptions = CallOptions.DEFAULT, headers: suspend () -> Metadata = { GrpcMetadata() }): suspend (Flow<RequestT>) -> ResponseT
Returns a function object representing a client streaming RPC.
serverStreamingRpc
Link copied to clipboard
fun <RequestT, ResponseT> serverStreamingRpc(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, request: RequestT, callOptions: CallOptions = CallOptions.DEFAULT, headers: Metadata = GrpcMetadata()): Flow<ResponseT>
Returns a Flow which launches the specified server-streaming RPC and emits the responses.
serverStreamingRpcFunction
Link copied to clipboard
fun <RequestT, ResponseT> serverStreamingRpcFunction(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, callOptions: CallOptions = CallOptions.DEFAULT, headers: suspend () -> Metadata = { GrpcMetadata() }): (RequestT) -> Flow<ResponseT>
Returns a function object representing a server streaming RPC.
unaryRpc
Link copied to clipboard
suspend fun <RequestT, ResponseT> unaryRpc(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, request: RequestT, callOptions: CallOptions = CallOptions.DEFAULT, headers: Metadata = GrpcMetadata()): ResponseT
Launches a unary RPC on the specified channel, suspending until the result is received.
unaryRpcFunction
Link copied to clipboard
fun <RequestT, ResponseT> unaryRpcFunction(channel: Channel, method: MethodDescriptor<RequestT, ResponseT>, callOptions: CallOptions = CallOptions.DEFAULT, headers: suspend () -> Metadata = { GrpcMetadata() }): suspend (RequestT) -> ResponseT
Returns a function object representing a unary RPC.

Sources

jvm source
Link copied to clipboard