22 * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33 */
44
5- package kotlinx.rpc.grpc
5+ package kotlinx.rpc.grpc.client
66
77import kotlinx.coroutines.flow.Flow
88import kotlinx.rpc.RpcCall
99import kotlinx.rpc.RpcClient
10+ import kotlinx.rpc.grpc.GrpcMetadata
11+ import kotlinx.rpc.grpc.client.internal.GrpcDefaultCallOptions
12+ import kotlinx.rpc.grpc.client.internal.ManagedChannel
13+ import kotlinx.rpc.grpc.client.internal.ManagedChannelBuilder
14+ import kotlinx.rpc.grpc.client.internal.bidirectionalStreamingRpc
15+ import kotlinx.rpc.grpc.client.internal.buildChannel
16+ import kotlinx.rpc.grpc.client.internal.clientStreamingRpc
17+ import kotlinx.rpc.grpc.client.internal.serverStreamingRpc
18+ import kotlinx.rpc.grpc.client.internal.unaryRpc
1019import kotlinx.rpc.grpc.codec.EmptyMessageCodecResolver
1120import kotlinx.rpc.grpc.codec.MessageCodecResolver
1221import kotlinx.rpc.grpc.codec.ThrowingMessageCodecResolver
1322import kotlinx.rpc.grpc.codec.plus
1423import kotlinx.rpc.grpc.descriptor.GrpcServiceDelegate
1524import kotlinx.rpc.grpc.descriptor.GrpcServiceDescriptor
16- import kotlinx.rpc.grpc.internal.GrpcDefaultCallOptions
17- import kotlinx.rpc.grpc.internal.MethodDescriptor
18- import kotlinx.rpc.grpc.internal.MethodType
19- import kotlinx.rpc.grpc.internal.bidirectionalStreamingRpc
20- import kotlinx.rpc.grpc.internal.clientStreamingRpc
21- import kotlinx.rpc.grpc.internal.serverStreamingRpc
22- import kotlinx.rpc.grpc.internal.type
23- import kotlinx.rpc.grpc.internal.unaryRpc
25+ import kotlinx.rpc.grpc.descriptor.MethodDescriptor
26+ import kotlinx.rpc.grpc.descriptor.MethodType
27+ import kotlinx.rpc.grpc.descriptor.methodType
2428import kotlinx.rpc.internal.utils.map.RpcInternalConcurrentHashMap
2529import kotlin.time.Duration
2630
@@ -29,7 +33,7 @@ private typealias RequestClient = Any
2933/* *
3034 * GrpcClient manages gRPC communication by providing implementation for making asynchronous RPC calls.
3135 *
32- * @field channel The [ManagedChannel] used to communicate with remote gRPC services.
36+ * @field channel The [kotlinx.rpc.grpc.client.internal. ManagedChannel] used to communicate with remote gRPC services.
3337 */
3438public class GrpcClient internal constructor(
3539 internal val channel : ManagedChannel ,
@@ -57,7 +61,7 @@ public class GrpcClient internal constructor(
5761 val callOptions = GrpcDefaultCallOptions
5862 val trailers = GrpcMetadata ()
5963
60- return when (methodDescriptor.type ) {
64+ return when (methodDescriptor.methodType ) {
6165 MethodType .UNARY -> unaryRpc(
6266 descriptor = methodDescriptor,
6367 request = request,
@@ -72,15 +76,15 @@ public class GrpcClient internal constructor(
7276 trailers = trailers,
7377 )
7478
75- else -> error(" Wrong method type ${methodDescriptor.type } " )
79+ else -> error(" Wrong method type ${methodDescriptor.methodType } " )
7680 }
7781 }
7882
7983 override fun <T > callServerStreaming (call : RpcCall ): Flow <T > = withGrpcCall(call) { methodDescriptor, request ->
8084 val callOptions = GrpcDefaultCallOptions
8185 val trailers = GrpcMetadata ()
8286
83- when (methodDescriptor.type ) {
87+ when (methodDescriptor.methodType ) {
8488 MethodType .SERVER_STREAMING -> serverStreamingRpc(
8589 descriptor = methodDescriptor,
8690 request = request,
@@ -95,7 +99,7 @@ public class GrpcClient internal constructor(
9599 trailers = trailers,
96100 )
97101
98- else -> error(" Wrong method type ${methodDescriptor.type } " )
102+ else -> error(" Wrong method type ${methodDescriptor.methodType } " )
99103 }
100104 }
101105
@@ -187,6 +191,10 @@ private fun GrpcClient(
187191 * Configuration class for a gRPC client, providing customization options
188192 * for client behavior, including interceptors, credentials, codec resolution,
189193 * and authority overrides.
194+ *
195+ * @see credentials
196+ * @see overrideAuthority
197+ * @see intercept
190198 */
191199public class GrpcClientConfiguration internal constructor() {
192200 internal val interceptors: MutableList <ClientInterceptor > = mutableListOf ()
@@ -222,6 +230,9 @@ public class GrpcClientConfiguration internal constructor() {
222230 * credentials = plaintext() // for testing purposes only!
223231 * }
224232 * ```
233+ *
234+ * @see tls
235+ * @see plaintext
225236 */
226237 public var credentials: ClientCredentials ? = null
227238
0 commit comments