File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
jacodb-ets/wire-client/src/main/kotlin/org/jacodb/ets/service Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,21 @@ import okhttp3.Protocol
2323
2424const 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+ */
2641fun 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+ */
3662inline fun <reified T : Service > createGrpcClient (port : Int = DEFAULT_PORT ): T {
3763 return grpcClient(port).create()
3864}
You can’t perform that action at this time.
0 commit comments