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

kotlin-client.infrastructure.ApiInfrastructureResponse.kt.mustache Maven / Gradle / Ivy

There is a newer version: 3.0.0-rc1
Show newest version
package {{packageName}}.infrastructure

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

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

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy