RpcObject

interface RpcObject<T : RpcService>

Interface for generated companions of RpcService.

Samples

import com.monkopedia.ksrpc.RpcService
import com.monkopedia.ksrpc.annotation.KsMethod
import com.monkopedia.ksrpc.annotation.KsService
import com.monkopedia.ksrpc.ksrpcEnvironment
import com.monkopedia.ksrpc.rpcObject
import com.monkopedia.ksrpc.serialized
import com.monkopedia.ksrpc.toStub
import kotlinx.serialization.Serializable

fun main() { 
   //sampleStart 
   // Define a service interface with @KsService and @KsMethod annotations.
// The compiler plugin generates a companion RpcObject and stub automatically.
val rpcObj = rpcObject<GreetingService>()
val endpoint = rpcObj.findEndpoint("greet") 
   //sampleEnd
}

Properties

Link copied to clipboard
abstract val endpoints: List<String>
Link copied to clipboard
abstract val serviceName: String
Link copied to clipboard

The minimum transport capability tier this service requires, as determined by the compiler plugin from the service's method signatures. Used by transport registration checks to reject services that can't work on a given channel.

Functions

Link copied to clipboard
abstract fun <S> createStub(channel: SerializedService<S>): T
Link copied to clipboard
abstract fun findEndpoint(endpoint: String): RpcMethod<*, *, *>