handlebars.kotlin-client.infrastructure.ApiInfrastructureResponse.kt.mustache Maven / Gradle / Ivy
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)