org.http4k.jsonrpc.jsonRpc.kt Maven / Gradle / Ivy
package org.http4k.jsonrpc
import org.http4k.format.AutoMarshallingJson
import org.http4k.format.Json
import org.http4k.jsonrpc.MethodBindings.Companion.Auto
import org.http4k.jsonrpc.MethodBindings.Companion.Manual
object JsonRpc {
fun auto(json: AutoMarshallingJson,
errorHandler: ErrorHandler = defaultErrorHandler,
fn: Auto.() -> Unit): JsonRpcService =
JsonRpcService(json, errorHandler, Auto(json).apply(fn))
fun manual(json: Json,
errorHandler: ErrorHandler = defaultErrorHandler,
fn: Manual.() -> Unit): JsonRpcService =
JsonRpcService(json, errorHandler, Manual(json).apply(fn))
}
typealias JsonRpcHandler = (IN) -> OUT
private val defaultErrorHandler: ErrorHandler = { null }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy