forked from loafle/openapi-generator-original
[kotlin][client] rename ApiInfrastructureResponse to ApiResponse (#11094)
* rename ApiInfrastructureResponse to ApiResponse * mark ApiResponse as reserved word * update samples, docs * fix typo
This commit is contained in:
@@ -10,7 +10,7 @@ settings.gradle
|
||||
src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt
|
||||
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.io.IOException
|
||||
import org.openapitools.client.models.ModelWithEnumPropertyHavingDefault
|
||||
|
||||
import org.openapitools.client.infrastructure.ApiClient
|
||||
import org.openapitools.client.infrastructure.ApiInfrastructureResponse
|
||||
import org.openapitools.client.infrastructure.ApiResponse
|
||||
import org.openapitools.client.infrastructure.ClientException
|
||||
import org.openapitools.client.infrastructure.ClientError
|
||||
import org.openapitools.client.infrastructure.ServerException
|
||||
@@ -78,13 +78,13 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return ApiInfrastructureResponse<ModelWithEnumPropertyHavingDefault?>
|
||||
* @return ApiResponse<ModelWithEnumPropertyHavingDefault?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun operationWithHttpInfo() : ApiInfrastructureResponse<ModelWithEnumPropertyHavingDefault?> {
|
||||
fun operationWithHttpInfo() : ApiResponse<ModelWithEnumPropertyHavingDefault?> {
|
||||
val localVariableConfig = operationRequestConfig()
|
||||
|
||||
return request<Unit, ModelWithEnumPropertyHavingDefault>(
|
||||
|
||||
@@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String) {
|
||||
}
|
||||
|
||||
|
||||
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiResponse<T?> {
|
||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||
|
||||
val url = httpUrl.newBuilder()
|
||||
|
||||
@@ -6,7 +6,7 @@ enum class ResponseType {
|
||||
|
||||
interface Response
|
||||
|
||||
abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
|
||||
abstract class ApiResponse<T>(val responseType: ResponseType): Response {
|
||||
abstract val statusCode: Int
|
||||
abstract val headers: Map<String,List<String>>
|
||||
}
|
||||
@@ -15,29 +15,29 @@ class Success<T>(
|
||||
val data: T,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
): ApiInfrastructureResponse<T>(ResponseType.Success)
|
||||
): ApiResponse<T>(ResponseType.Success)
|
||||
|
||||
class Informational<T>(
|
||||
val statusText: String,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.Informational)
|
||||
) : ApiResponse<T>(ResponseType.Informational)
|
||||
|
||||
class Redirection<T>(
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
|
||||
) : ApiResponse<T>(ResponseType.Redirection)
|
||||
|
||||
class ClientError<T>(
|
||||
val message: String? = null,
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
|
||||
) : ApiResponse<T>(ResponseType.ClientError)
|
||||
|
||||
class ServerError<T>(
|
||||
val message: String? = null,
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>>
|
||||
): ApiInfrastructureResponse<T>(ResponseType.ServerError)
|
||||
): ApiResponse<T>(ResponseType.ServerError)
|
||||
Reference in New Issue
Block a user