[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:
William Cheng
2021-12-12 16:32:08 +08:00
committed by GitHub
parent 3247903caa
commit fbb61658df
163 changed files with 1076 additions and 1025 deletions

View File

@@ -74,6 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -76,6 +76,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -68,6 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -79,6 +79,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -98,6 +98,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
// this includes hard reserved words defined by https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java
// as well as keywords from https://kotlinlang.org/docs/reference/keyword-reference.html
reservedWords = new HashSet<>(Arrays.asList(
"ApiResponse", // Used in the auto-generated api client
"abstract",
"actual",
"annotation",

View File

@@ -541,7 +541,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
// jvm specific supporting files
supportingFiles.add(new SupportingFile("infrastructure/Errors.kt.mustache", infrastructureFolder, "Errors.kt"));
supportingFiles.add(new SupportingFile("infrastructure/ResponseExtensions.kt.mustache", infrastructureFolder, "ResponseExtensions.kt"));
supportingFiles.add(new SupportingFile("infrastructure/ApiInfrastructureResponse.kt.mustache", infrastructureFolder, "ApiInfrastructureResponse.kt"));
supportingFiles.add(new SupportingFile("infrastructure/ApiResponse.kt.mustache", infrastructureFolder, "ApiResponse.kt"));
}
private void processMultiplatformLibrary(final String infrastructureFolder) {

View File

@@ -13,7 +13,7 @@ import kotlinx.coroutines.withContext
{{/useCoroutines}}
{{/doNotUseRxAndCoroutines}}
import {{packageName}}.infrastructure.ApiClient
import {{packageName}}.infrastructure.ApiInfrastructureResponse
import {{packageName}}.infrastructure.ApiResponse
import {{packageName}}.infrastructure.ClientException
import {{packageName}}.infrastructure.ClientError
import {{packageName}}.infrastructure.ServerException
@@ -76,7 +76,7 @@ import {{packageName}}.infrastructure.toMultiValue
* {{summary}}
* {{notes}}
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}* @return ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>
{{/allParams}}* @return ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/{{#returnType}}
@@ -85,7 +85,7 @@ import {{packageName}}.infrastructure.toMultiValue
{{#isDeprecated}}
@Deprecated(message = "This operation is deprecated.")
{{/isDeprecated}}
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} {
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} {
{{#isDeprecated}}
@Suppress("DEPRECATION")
{{/isDeprecated}}

View File

@@ -309,7 +309,7 @@ import com.squareup.moshi.adapter
}
{{/hasAuthMethods}}
protected {{#useCoroutines}}suspend {{/useCoroutines}}inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
protected {{#useCoroutines}}suspend {{/useCoroutines}}inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiResponse<T?> {
{{#jvm-okhttp3}}
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
{{/jvm-okhttp3}}

View File

@@ -6,7 +6,7 @@ package {{packageName}}.infrastructure
{{#nonPublicApi}}internal {{/nonPublicApi}}interface Response
{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiResponse<T>(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map<String,List<String>>
}
@@ -15,29 +15,29 @@ package {{packageName}}.infrastructure
val data: T{{#nullableReturnType}}?{{/nullableReturnType}},
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
): ApiInfrastructureResponse<T>(ResponseType.Success)
): ApiResponse<T>(ResponseType.Success)
{{#nonPublicApi}}internal {{/nonPublicApi}}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)
{{#nonPublicApi}}internal {{/nonPublicApi}}class Redirection<T>(
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
) : ApiResponse<T>(ResponseType.Redirection)
{{#nonPublicApi}}internal {{/nonPublicApi}}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)
{{#nonPublicApi}}internal {{/nonPublicApi}}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)

View File

@@ -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

View File

@@ -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>(

View File

@@ -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()

View File

@@ -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)

View File

@@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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/ByteArrayAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
@@ -30,8 +30,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

0
samples/client/petstore/kotlin-gson/gradlew vendored Normal file → Executable file
View File

View File

@@ -22,11 +22,11 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
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
@@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = addPetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return request<Unit, Unit>(
@@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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 findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
return request<Unit, kotlin.collections.List<Pet>>(
@@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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 getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> {
fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return request<Unit, Pet>(
@@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = updatePetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return request<Map<String, Any?>, Unit>(
@@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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 uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> {
fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return request<Map<String, Any?>, ApiResponse>(
return request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.Order
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
@@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return request<Unit, Unit>(
@@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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 getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
val localVariableConfig = getInventoryRequestConfig()
return request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> {
fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return request<Unit, Order>(
@@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> {
fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> {
val localVariableConfig = placeOrderRequestConfig(body = body)
return request<Order, Order>(

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.User
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
@@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> {
fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> {
val localVariableConfig = createUserRequestConfig(body = body)
return request<User, Unit>(
@@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteUserRequestConfig(username = username)
return request<Unit, Unit>(
@@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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 getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> {
fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return request<Unit, User>(
@@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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 loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> {
fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return request<Unit, kotlin.String>(
@@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> {
fun logoutUserWithHttpInfo() : ApiResponse<Unit?> {
val localVariableConfig = logoutUserRequestConfig()
return request<Unit, Unit>(
@@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> {
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return request<User, Unit>(

View File

@@ -160,7 +160,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.")
// take authMethod from operation

View File

@@ -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)

View File

@@ -31,7 +31,7 @@ import com.google.gson.annotations.SerializedName
* @param message
*/
data class ApiResponse (
data class ModelApiResponse (
@SerializedName("code")
val code: kotlin.Int? = null,

View File

@@ -19,15 +19,15 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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/ByteArrayAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -22,11 +22,11 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
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
@@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = addPetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return request<Unit, Unit>(
@@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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 findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
return request<Unit, kotlin.collections.List<Pet>>(
@@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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 getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> {
fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return request<Unit, Pet>(
@@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = updatePetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return request<Map<String, Any?>, Unit>(
@@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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 uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> {
fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return request<Map<String, Any?>, ApiResponse>(
return request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.Order
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
@@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return request<Unit, Unit>(
@@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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 getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
val localVariableConfig = getInventoryRequestConfig()
return request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> {
fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return request<Unit, Order>(
@@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> {
fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> {
val localVariableConfig = placeOrderRequestConfig(body = body)
return request<Order, Order>(

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.User
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
@@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> {
fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> {
val localVariableConfig = createUserRequestConfig(body = body)
return request<User, Unit>(
@@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteUserRequestConfig(username = username)
return request<Unit, Unit>(
@@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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 getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> {
fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return request<Unit, User>(
@@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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 loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> {
fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return request<Unit, kotlin.String>(
@@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> {
fun logoutUserWithHttpInfo() : ApiResponse<Unit?> {
val localVariableConfig = logoutUserRequestConfig()
return request<Unit, Unit>(
@@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> {
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return request<User, Unit>(

View File

@@ -160,7 +160,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.")
// take authMethod from operation

View File

@@ -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)

View File

@@ -31,7 +31,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
* @param message
*/
data class ApiResponse (
data class ModelApiResponse (
@field:JsonProperty("code")
val code: kotlin.Int? = null,

View File

@@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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
@@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -352,7 +352,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -367,7 +367,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -388,7 +388,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -22,11 +22,11 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
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
@@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = addPetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return request<Unit, Unit>(
@@ -222,14 +222,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -298,13 +298,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get all pets
*
* @param lastUpdated When this endpoint was hit last to help identify if the client already has the latest copy. (optional)
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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 getAllPetsWithHttpInfo(lastUpdated: java.time.OffsetDateTime?) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun getAllPetsWithHttpInfo(lastUpdated: java.time.OffsetDateTime?) : ApiResponse<kotlin.collections.List<Pet>?> {
val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated)
return request<Unit, kotlin.collections.List<Pet>>(
@@ -373,13 +373,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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 getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> {
fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return request<Unit, Pet>(
@@ -442,12 +442,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = updatePetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -514,12 +514,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return request<Map<String, Any?>, Unit>(
@@ -555,7 +555,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -564,11 +564,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -588,16 +588,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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 uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> {
fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return request<Map<String, Any?>, ApiResponse>(
return request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.Order
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
@@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return request<Unit, Unit>(
@@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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 getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
val localVariableConfig = getInventoryRequestConfig()
return request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> {
fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return request<Unit, Order>(
@@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> {
fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> {
val localVariableConfig = placeOrderRequestConfig(body = body)
return request<Order, Order>(

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.User
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
@@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> {
fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> {
val localVariableConfig = createUserRequestConfig(body = body)
return request<User, Unit>(
@@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteUserRequestConfig(username = username)
return request<Unit, Unit>(
@@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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 getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> {
fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return request<Unit, User>(
@@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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 loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> {
fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return request<Unit, kotlin.String>(
@@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> {
fun logoutUserWithHttpInfo() : ApiResponse<Unit?> {
val localVariableConfig = logoutUserRequestConfig()
return request<Unit, Unit>(
@@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> {
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return request<User, Unit>(

View File

@@ -167,7 +167,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.")
// take authMethod from operation

View File

@@ -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)

View File

@@ -34,7 +34,7 @@ import kotlinx.parcelize.Parcelize
*/
@Parcelize
data class ApiResponse (
data class ModelApiResponse (
@Json(name = "code")
val code: kotlin.Int? = null,

View File

@@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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/ByteArrayAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
@@ -30,8 +30,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -22,13 +22,13 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
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
@@ -82,12 +82,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = addPetRequestConfig(body = body)
return@withContext request<Pet, Unit>(
@@ -152,12 +152,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return@withContext request<Unit, Unit>(
@@ -222,13 +222,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
suspend fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> = withContext(Dispatchers.IO) {
suspend fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> = withContext(Dispatchers.IO) {
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
return@withContext request<Unit, kotlin.collections.List<Pet>>(
@@ -297,14 +297,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
suspend fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> = withContext(Dispatchers.IO) {
suspend fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> = withContext(Dispatchers.IO) {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -373,13 +373,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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)
suspend fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> = withContext(Dispatchers.IO) {
suspend fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> = withContext(Dispatchers.IO) {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return@withContext request<Unit, Pet>(
@@ -442,12 +442,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = updatePetRequestConfig(body = body)
return@withContext request<Pet, Unit>(
@@ -514,12 +514,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return@withContext request<Map<String, Any?>, Unit>(
@@ -555,7 +555,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -564,11 +564,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse = withContext(Dispatchers.IO) {
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse = withContext(Dispatchers.IO) {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return@withContext when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -588,16 +588,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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)
suspend fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> = withContext(Dispatchers.IO) {
suspend fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> = withContext(Dispatchers.IO) {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return@withContext request<Map<String, Any?>, ApiResponse>(
return@withContext request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -27,7 +27,7 @@ import org.openapitools.client.models.Order
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
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
@@ -81,12 +81,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return@withContext request<Unit, Unit>(
@@ -147,13 +147,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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)
suspend fun getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> = withContext(Dispatchers.IO) {
suspend fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> = withContext(Dispatchers.IO) {
val localVariableConfig = getInventoryRequestConfig()
return@withContext request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -216,13 +216,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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)
suspend fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> = withContext(Dispatchers.IO) {
suspend fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> = withContext(Dispatchers.IO) {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return@withContext request<Unit, Order>(
@@ -286,13 +286,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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)
suspend fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> = withContext(Dispatchers.IO) {
suspend fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> = withContext(Dispatchers.IO) {
val localVariableConfig = placeOrderRequestConfig(body = body)
return@withContext request<Order, Order>(

View File

@@ -27,7 +27,7 @@ import org.openapitools.client.models.User
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
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
@@ -81,12 +81,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = createUserRequestConfig(body = body)
return@withContext request<User, Unit>(
@@ -148,12 +148,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return@withContext request<kotlin.collections.List<User>, Unit>(
@@ -215,12 +215,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return@withContext request<kotlin.collections.List<User>, Unit>(
@@ -282,12 +282,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = deleteUserRequestConfig(username = username)
return@withContext request<Unit, Unit>(
@@ -350,13 +350,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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)
suspend fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> = withContext(Dispatchers.IO) {
suspend fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> = withContext(Dispatchers.IO) {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return@withContext request<Unit, User>(
@@ -422,13 +422,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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)
suspend fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> = withContext(Dispatchers.IO) {
suspend fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> = withContext(Dispatchers.IO) {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return@withContext request<Unit, kotlin.String>(
@@ -494,12 +494,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun logoutUserWithHttpInfo() : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = logoutUserRequestConfig()
return@withContext request<Unit, Unit>(
@@ -562,12 +562,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
suspend fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> = withContext(Dispatchers.IO) {
suspend fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> = withContext(Dispatchers.IO) {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return@withContext request<User, Unit>(

View File

@@ -163,7 +163,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected suspend inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
protected suspend inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation

View File

@@ -1,43 +0,0 @@
package org.openapitools.client.infrastructure
enum class ResponseType {
Success, Informational, Redirection, ClientError, ServerError
}
interface Response
abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map<String,List<String>>
}
class Success<T>(
val data: T,
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
): ApiInfrastructureResponse<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)
class Redirection<T>(
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : ApiInfrastructureResponse<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)
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)

View File

@@ -0,0 +1,43 @@
package org.openapitools.client.infrastructure
enum class ResponseType {
Success, Informational, Redirection, ClientError, ServerError
}
interface Response
abstract class ApiResponse<T>(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map<String,List<String>>
}
class Success<T>(
val data: T,
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
): ApiResponse<T>(ResponseType.Success)
class Informational<T>(
val statusText: String,
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : ApiResponse<T>(ResponseType.Informational)
class Redirection<T>(
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : 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()
) : 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>>
): ApiResponse<T>(ResponseType.ServerError)

View File

@@ -32,7 +32,7 @@ import java.io.Serializable
* @param message
*/
data class ApiResponse (
data class ModelApiResponse (
@SerializedName("code")
val code: kotlin.Int? = null,

View File

@@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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
@@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -22,11 +22,11 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
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
@@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = addPetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return request<Unit, Unit>(
@@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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 findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
return request<Unit, kotlin.collections.List<Pet>>(
@@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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 getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> {
fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return request<Unit, Pet>(
@@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = updatePetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return request<Map<String, Any?>, Unit>(
@@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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 uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> {
fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return request<Map<String, Any?>, ApiResponse>(
return request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.Order
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
@@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return request<Unit, Unit>(
@@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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 getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
val localVariableConfig = getInventoryRequestConfig()
return request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> {
fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return request<Unit, Order>(
@@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> {
fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> {
val localVariableConfig = placeOrderRequestConfig(body = body)
return request<Order, Order>(

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.User
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
@@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> {
fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> {
val localVariableConfig = createUserRequestConfig(body = body)
return request<User, Unit>(
@@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteUserRequestConfig(username = username)
return request<Unit, Unit>(
@@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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 getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> {
fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return request<Unit, User>(
@@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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 loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> {
fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return request<Unit, kotlin.String>(
@@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> {
fun logoutUserWithHttpInfo() : ApiResponse<Unit?> {
val localVariableConfig = logoutUserRequestConfig()
return request<Unit, Unit>(
@@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> {
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return request<User, Unit>(

View File

@@ -161,7 +161,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.")
// take authMethod from operation

View File

@@ -1,43 +0,0 @@
package org.openapitools.client.infrastructure
enum class ResponseType {
Success, Informational, Redirection, ClientError, ServerError
}
interface Response
abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map<String,List<String>>
}
class Success<T>(
val data: T,
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
): ApiInfrastructureResponse<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)
class Redirection<T>(
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : ApiInfrastructureResponse<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)
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)

View File

@@ -0,0 +1,43 @@
package org.openapitools.client.infrastructure
enum class ResponseType {
Success, Informational, Redirection, ClientError, ServerError
}
interface Response
abstract class ApiResponse<T>(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map<String,List<String>>
}
class Success<T>(
val data: T,
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
): ApiResponse<T>(ResponseType.Success)
class Informational<T>(
val statusText: String,
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : ApiResponse<T>(ResponseType.Informational)
class Redirection<T>(
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : 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()
) : 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>>
): ApiResponse<T>(ResponseType.ServerError)

View File

@@ -32,7 +32,7 @@ import com.squareup.moshi.JsonClass
* @param message
*/
@JsonClass(generateAdapter = true)
data class ApiResponse (
data class ModelApiResponse (
@Json(name = "code")
val code: kotlin.Int? = null,

View File

@@ -26,8 +26,8 @@ src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt
src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt
src/commonMain/kotlin/org/openapitools/client/models/Category.kt
src/commonMain/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/commonMain/kotlin/org/openapitools/client/models/Order.kt
src/commonMain/kotlin/org/openapitools/client/models/Pet.kt
src/commonMain/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -51,8 +51,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : io.ktor.client.request.forms.InputProvider = BINARY_DATA_HERE // io.ktor.client.request.forms.InputProvider | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -20,7 +20,7 @@
package org.openapitools.client.apis
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
import org.openapitools.client.infrastructure.*
@@ -303,10 +303,10 @@ class PetApi(
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
*/
@Suppress("UNCHECKED_CAST")
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.ktor.client.request.forms.InputProvider?): HttpResponse<ApiResponse> {
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.ktor.client.request.forms.InputProvider?): HttpResponse<ModelApiResponse> {
val localVariableAuthNames = listOf<String>("petstore_auth")

View File

@@ -33,7 +33,7 @@ import kotlinx.serialization.encoding.*
* @param message
*/
@Serializable
data class ApiResponse (
data class ModelApiResponse (
@SerialName(value = "code") val code: kotlin.Int? = null,

View File

@@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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
@@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -22,11 +22,11 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
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
@@ -80,12 +80,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = addPetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -150,12 +150,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return request<Unit, Unit>(
@@ -220,13 +220,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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 findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
return request<Unit, kotlin.collections.List<Pet>>(
@@ -295,14 +295,14 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -371,13 +371,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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 getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> {
fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return request<Unit, Pet>(
@@ -440,12 +440,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = updatePetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -512,12 +512,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return request<Map<String, Any?>, Unit>(
@@ -553,7 +553,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -562,11 +562,11 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -586,16 +586,16 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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 uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> {
fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return request<Map<String, Any?>, ApiResponse>(
return request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.Order
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
@@ -79,12 +79,12 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return request<Unit, Unit>(
@@ -145,13 +145,13 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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 getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
val localVariableConfig = getInventoryRequestConfig()
return request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -214,13 +214,13 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> {
fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return request<Unit, Order>(
@@ -284,13 +284,13 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> {
fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> {
val localVariableConfig = placeOrderRequestConfig(body = body)
return request<Order, Order>(

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.User
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
@@ -79,12 +79,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> {
fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> {
val localVariableConfig = createUserRequestConfig(body = body)
return request<User, Unit>(
@@ -146,12 +146,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -213,12 +213,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -280,12 +280,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteUserRequestConfig(username = username)
return request<Unit, Unit>(
@@ -348,13 +348,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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 getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> {
fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return request<Unit, User>(
@@ -420,13 +420,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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 loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> {
fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return request<Unit, kotlin.String>(
@@ -492,12 +492,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> {
fun logoutUserWithHttpInfo() : ApiResponse<Unit?> {
val localVariableConfig = logoutUserRequestConfig()
return request<Unit, Unit>(
@@ -560,12 +560,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> {
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return request<User, Unit>(

View File

@@ -161,7 +161,7 @@ internal 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.")
// take authMethod from operation

View File

@@ -6,7 +6,7 @@ internal enum class ResponseType {
internal interface Response
internal abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
internal abstract class ApiResponse<T>(val responseType: ResponseType): Response {
abstract val statusCode: Int
abstract val headers: Map<String,List<String>>
}
@@ -15,29 +15,29 @@ internal 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)
internal 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)
internal class Redirection<T>(
override val statusCode: Int = -1,
override val headers: Map<String, List<String>> = mapOf()
) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
) : ApiResponse<T>(ResponseType.Redirection)
internal 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)
internal 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)

View File

@@ -0,0 +1,46 @@
/**
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* Please note:
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* Do not edit this file manually.
*/
@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)
package org.openapitools.client.models
import com.squareup.moshi.Json
/**
* Describes the result of uploading an image resource
*
* @param code
* @param type
* @param message
*/
internal data class ModelApiResponse (
@Json(name = "code")
val code: kotlin.Int? = null,
@Json(name = "type")
val type: kotlin.String? = null,
@Json(name = "message")
val message: kotlin.String? = null
)

View File

@@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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
@@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse? = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse? = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -22,11 +22,11 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
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
@@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = addPetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return request<Unit, Unit>(
@@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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 findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
return request<Unit, kotlin.collections.List<Pet>>(
@@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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 getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> {
fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return request<Unit, Pet>(
@@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = updatePetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return request<Map<String, Any?>, Unit>(
@@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse or null
* @return ModelApiResponse or null
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? {
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse? {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse?
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse?
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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 uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> {
fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return request<Map<String, Any?>, ApiResponse>(
return request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.Order
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
@@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return request<Unit, Unit>(
@@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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 getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
val localVariableConfig = getInventoryRequestConfig()
return request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> {
fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return request<Unit, Order>(
@@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> {
fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> {
val localVariableConfig = placeOrderRequestConfig(body = body)
return request<Order, Order>(

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.User
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
@@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> {
fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> {
val localVariableConfig = createUserRequestConfig(body = body)
return request<User, Unit>(
@@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteUserRequestConfig(username = username)
return request<Unit, Unit>(
@@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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 getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> {
fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return request<Unit, User>(
@@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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 loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> {
fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return request<Unit, kotlin.String>(
@@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> {
fun logoutUserWithHttpInfo() : ApiResponse<Unit?> {
val localVariableConfig = logoutUserRequestConfig()
return request<Unit, Unit>(
@@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> {
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return request<User, Unit>(

View File

@@ -161,7 +161,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.")
// take authMethod from operation

View File

@@ -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)

View File

@@ -32,7 +32,7 @@ import java.io.Serializable
* @param message
*/
data class ApiResponse (
data class ModelApiResponse (
@Json(name = "code")
val code: kotlin.Int? = null,

View File

@@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
src/main/kotlin/org/openapitools/client/apis/UserApi.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
@@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
src/main/kotlin/org/openapitools/client/models/ApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Category.kt
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/client/models/Order.kt
src/main/kotlin/org/openapitools/client/models/Pet.kt
src/main/kotlin/org/openapitools/client/models/Tag.kt

View File

@@ -60,8 +60,8 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
- [org.openapitools.client.models.Category](docs/Category.md)
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.client.models.Order](docs/Order.md)
- [org.openapitools.client.models.Pet](docs/Pet.md)
- [org.openapitools.client.models.Tag](docs/Tag.md)

View File

@@ -1,5 +1,5 @@
# ApiResponse
# ModelApiResponse
## Properties
Name | Type | Description | Notes

View File

@@ -354,7 +354,7 @@ Configure petstore_auth:
<a name="uploadFile"></a>
# **uploadFile**
> ApiResponse uploadFile(petId, additionalMetadata, file)
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
@@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
try {
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#uploadFile")
@@ -390,7 +390,7 @@ Name | Type | Description | Notes
### Return type
[**ApiResponse**](ApiResponse.md)
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization

View File

@@ -22,11 +22,11 @@ package org.openapitools.client.apis
import java.io.IOException
import org.openapitools.client.models.ApiResponse
import org.openapitools.client.models.ModelApiResponse
import org.openapitools.client.models.Pet
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
@@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun addPetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = addPetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
return request<Unit, Unit>(
@@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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 findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
return request<Unit, kotlin.collections.List<Pet>>(
@@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @return ApiInfrastructureResponse<kotlin.collections.List<Pet>?>
* @return ApiResponse<kotlin.collections.List<Pet>?>
* @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)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiInfrastructureResponse<kotlin.collections.List<Pet>?> {
fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List<kotlin.String>) : ApiResponse<kotlin.collections.List<Pet>?> {
@Suppress("DEPRECATION")
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
@@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @return ApiInfrastructureResponse<Pet?>
* @return ApiResponse<Pet?>
* @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 getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse<Pet?> {
fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse<Pet?> {
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
return request<Unit, Pet>(
@@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithHttpInfo(body: Pet) : ApiResponse<Unit?> {
val localVariableConfig = updatePetRequestConfig(body = body)
return request<Pet, Unit>(
@@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse<Unit?> {
fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse<Unit?> {
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
return request<Map<String, Any?>, Unit>(
@@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
* @return ModelApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse {
val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
@@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiInfrastructureResponse<ApiResponse?>
* @return ApiResponse<ModelApiResponse?>
* @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 uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse<ApiResponse?> {
fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse<ModelApiResponse?> {
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
return request<Map<String, Any?>, ApiResponse>(
return request<Map<String, Any?>, ModelApiResponse>(
localVariableConfig
)
}

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.Order
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
@@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
return request<Unit, Unit>(
@@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @return ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?>
* @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 getInventoryWithHttpInfo() : ApiInfrastructureResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
fun getInventoryWithHttpInfo() : ApiResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>?> {
val localVariableConfig = getInventoryRequestConfig()
return request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
@@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse<Order?> {
fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse<Order?> {
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
return request<Unit, Order>(
@@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @return ApiInfrastructureResponse<Order?>
* @return ApiResponse<Order?>
* @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 placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse<Order?> {
fun placeOrderWithHttpInfo(body: Order) : ApiResponse<Order?> {
val localVariableConfig = placeOrderRequestConfig(body = body)
return request<Order, Order>(

View File

@@ -25,7 +25,7 @@ import java.io.IOException
import org.openapitools.client.models.User
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
@@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse<Unit?> {
fun createUserWithHttpInfo(body: User) : ApiResponse<Unit?> {
val localVariableConfig = createUserRequestConfig(body = body)
return request<User, Unit>(
@@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Creates list of users with given input array
*
* @param body List of user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiInfrastructureResponse<Unit?> {
fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List<User>) : ApiResponse<Unit?> {
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
return request<kotlin.collections.List<User>, Unit>(
@@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<Unit?> {
fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse<Unit?> {
val localVariableConfig = deleteUserRequestConfig(username = username)
return request<Unit, Unit>(
@@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return ApiInfrastructureResponse<User?>
* @return ApiResponse<User?>
* @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 getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse<User?> {
fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse<User?> {
val localVariableConfig = getUserByNameRequestConfig(username = username)
return request<Unit, User>(
@@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*
* @param username The user name for login
* @param password The password for login in clear text
* @return ApiInfrastructureResponse<kotlin.String?>
* @return ApiResponse<kotlin.String?>
* @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 loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse<kotlin.String?> {
fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse<kotlin.String?> {
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
return request<Unit, kotlin.String>(
@@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
/**
* Logs out current logged in user session
*
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun logoutUserWithHttpInfo() : ApiInfrastructureResponse<Unit?> {
fun logoutUserWithHttpInfo() : ApiResponse<Unit?> {
val localVariableConfig = logoutUserRequestConfig()
return request<Unit, Unit>(
@@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
* @return ApiInfrastructureResponse<Unit?>
* @return ApiResponse<Unit?>
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse<Unit?> {
fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse<Unit?> {
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
return request<User, Unit>(

View File

@@ -158,7 +158,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 = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation

Some files were not shown because too many files have changed in this diff Show More