[+] Special handler

This commit is contained in:
Azalea
2024-12-26 07:16:29 -05:00
parent 054b286388
commit 6938083463
2 changed files with 24 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package icu.samnyan.aqua.sega.general
import com.fasterxml.jackson.core.JsonProcessingException
import jakarta.servlet.http.HttpServletRequest
/**
* @author samnyan (privateamusement@protonmail.com)
@@ -9,3 +10,11 @@ fun interface BaseHandler {
@Throws(JsonProcessingException::class)
fun handle(request: Map<String, Any>): Any?
}
data class RequestContext(
val req: HttpServletRequest,
val data: Map<String, Any>,
)
typealias SpecialHandler = (RequestContext) -> Any?
fun BaseHandler.toSpecial() = { ctx: RequestContext -> handle(ctx.data) }