Skip to content

Commit ea2a9a4

Browse files
committed
Docs
1 parent 5273e1d commit ea2a9a4

File tree

1 file changed

+26
-0
lines changed
  • jacodb-ets/wire-client/src/main/kotlin/org/jacodb/ets/service

1 file changed

+26
-0
lines changed

jacodb-ets/wire-client/src/main/kotlin/org/jacodb/ets/service/GrpcClient.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ import okhttp3.Protocol
2323

2424
const val DEFAULT_PORT = 7777
2525

26+
/**
27+
* Creates a gRPC client with the specified port.
28+
*
29+
* ### Example:
30+
* ```kotlin
31+
* val client = grpcClient(7777)
32+
* ```
33+
*
34+
* ### Note:
35+
* You probably want to use [createGrpcClient] instead,
36+
* which is more convenient for creating specific clients.
37+
*
38+
* @param port The port on which the gRPC server is running.
39+
* @return A configured [GrpcClient] instance.
40+
*/
2641
fun grpcClient(port: Int = DEFAULT_PORT): GrpcClient {
2742
val okClient = OkHttpClient.Builder()
2843
.protocols(listOf(Protocol.H2_PRIOR_KNOWLEDGE))
@@ -33,6 +48,17 @@ fun grpcClient(port: Int = DEFAULT_PORT): GrpcClient {
3348
.build()
3449
}
3550

51+
/**
52+
* Creates a gRPC client for the specified service type.
53+
*
54+
* ### Example:
55+
* ```kotlin
56+
* val client = createGrpcClient<MyServiceClient>(7777)
57+
* ```
58+
*
59+
* @param port The port on which the gRPC server is running.
60+
* @return A configured instance of the specified service type [T].
61+
*/
3662
inline fun <reified T : Service> createGrpcClient(port: Int = DEFAULT_PORT): T {
3763
return grpcClient(port).create()
3864
}

0 commit comments

Comments
 (0)