From 33bab0553bceaa174b11b3fb7a9ba9d4de63526a Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Fri, 3 Dec 2021 21:49:03 -0600 Subject: Added Swagger auto-generated API client (no Ktor yet) --- .../infrastructure/ApiInfrastructureResponse.kt | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt') diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt new file mode 100644 index 0000000..bc0b4fb --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt @@ -0,0 +1,40 @@ +package mx.trackermap.TrackerMap.client.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) \ No newline at end of file -- cgit v1.2.3