io.opengood.api.rest.contracts.Functions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest-api-contracts Show documentation
Show all versions of rest-api-contracts Show documentation
Reusable REST API contracts
package io.opengood.api.rest.contracts
import io.opengood.api.rest.contracts.page.PageData
import io.opengood.api.rest.contracts.record.RecordData
import io.opengood.api.rest.contracts.response.ActionResponse
import io.opengood.api.rest.contracts.response.DataResponse
import io.opengood.api.rest.contracts.response.OperationState
import org.springframework.http.ResponseEntity
fun actionFailedResponse(
message: String
) =
ResponseEntity.badRequest().body(
ActionResponse(
state = OperationState.FAILED,
message = message,
data = emptyList()
)
)
fun actionSuccessResponse(
message: String = "",
data: List