ru.testit.kotlin.client.infrastructure.ApiResponse.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testit-api-client-kotlin Show documentation
Show all versions of testit-api-client-kotlin Show documentation
Kotlin API client for TestIT.
package ru.testit.kotlin.client.infrastructure
enum class ResponseType {
Success, Informational, Redirection, ClientError, ServerError
}
interface Response
abstract class ApiResponse(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map>
}
class Success(
val data: T,
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
): ApiResponse(ResponseType.Success)
class Informational(
val statusText: String,
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
) : ApiResponse(ResponseType.Informational)
class Redirection(
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
) : ApiResponse(ResponseType.Redirection)
class ClientError(
val message: String? = null,
val body: Any? = null,
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
) : ApiResponse(ResponseType.ClientError)
class ServerError(
val message: String? = null,
val body: Any? = null,
override val statusCode: Int = -1,
override val headers: Map>
): ApiResponse(ResponseType.ServerError)
© 2015 - 2024 Weber Informatics LLC | Privacy Policy