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

tech.carpentum.sdk.payment.internal.generated.infrastructure.ApiResponse.kt Maven / Gradle / Ivy

There is a newer version: 2.1021.0
Show newest version
package tech.carpentum.sdk.payment.internal.generated.infrastructure

enum class ResponseType {
    Success, Informational, Redirection, ClientError, ServerError
}

sealed interface Response

abstract class ApiResponse(val responseType: ResponseType): Response {
    abstract val statusCode: Int
    abstract val headers: Map>
}

data class Success(
    val data: T,
    override val statusCode: Int = -1,
    override val headers: Map> = mapOf()
): ApiResponse(ResponseType.Success)

data class Informational(
    val statusText: String,
    override val statusCode: Int = -1,
    override val headers: Map> = mapOf()
) : ApiResponse(ResponseType.Informational)

data class Redirection(
    override val statusCode: Int = -1,
    override val headers: Map> = mapOf()
) : ApiResponse(ResponseType.Redirection)

data class ClientError(
    val message: String? = null,
    val body: Any? = null,
    override val statusCode: Int = -1,
    override val headers: Map> = mapOf()
) : ApiResponse(ResponseType.ClientError)

data class ServerError(
    val message: String? = null,
    val body: Any? = null,
    override val statusCode: Int = -1,
    override val headers: Map>
): ApiResponse(ResponseType.ServerError)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy