commonMain.com.huawei.hilink.c2c.integration.helper.requestHandlers.HiLinkService.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of helper-jvm Show documentation
Show all versions of helper-jvm Show documentation
The helper library streamlines the HiLink C2C integration and exposes a simple API.
package com.huawei.hilink.c2c.integration.helper.requestHandlers
import com.huawei.hilink.c2c.integration.helper.api.UserInfo
import com.huawei.hilink.c2c.integration.helper.dto.HiLinkResultCodes
import com.huawei.hilink.c2c.integration.helper.dto.common.HiLinkHeader
import com.huawei.hilink.c2c.integration.helper.dto.inbound.response.HiLinkResponse
internal abstract class HiLinkService(val handledRequest: String) {
abstract suspend fun handle(requestHeader: HiLinkHeader, requestJson: String, userInfo: UserInfo): HiLinkResponse
abstract fun prepareErrorResponse(
requestHeader: HiLinkHeader,
resultCode: HiLinkResultCodes,
description: String
): HiLinkResponse
fun prepareErrorResponse(
requestHeader: HiLinkHeader,
resultCode: HiLinkResultCodes,
): HiLinkResponse =
prepareErrorResponse(requestHeader, resultCode, resultCode.description)
}