kotlin-client.libraries.jvm-okhttp.infrastructure.ApiInfrastructureResponse.kt.mustache Maven / Gradle / Ivy
package {{packageName}}.infrastructure
{{#nonPublicApi}}internal {{/nonPublicApi}}enum class ResponseType {
Success, Informational, Redirection, ClientError, ServerError
}
{{#nonPublicApi}}internal {{/nonPublicApi}}interface Response
{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map>
}
{{#nonPublicApi}}internal {{/nonPublicApi}}class Success(
val data: T{{#nullableReturnType}}?{{/nullableReturnType}},
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
): ApiInfrastructureResponse(ResponseType.Success)
{{#nonPublicApi}}internal {{/nonPublicApi}}class Informational(
val statusText: String,
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
) : ApiInfrastructureResponse(ResponseType.Informational)
{{#nonPublicApi}}internal {{/nonPublicApi}}class Redirection(
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
) : ApiInfrastructureResponse(ResponseType.Redirection)
{{#nonPublicApi}}internal {{/nonPublicApi}}class ClientError(
val message: String? = null,
val body: Any? = null,
override val statusCode: Int = -1,
override val headers: Map> = mapOf()
) : ApiInfrastructureResponse(ResponseType.ClientError)
{{#nonPublicApi}}internal {{/nonPublicApi}}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