All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.jsonrpc.jsonRpc.kt Maven / Gradle / Ivy

There is a newer version: 5.41.0.0
Show newest version
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