[Kotlin][Client] create request config method (#8617)

* [kotlin][client] create an api method to create the RequestConfig

* [kotlin][client] generate sample projects

* [kotlin] add docs to RequestConfig method

* [kotlin][client] generate sample projects

* [kotlin] improve docs on the RequestConfig method

* [kotlin][client] generate sample projects
This commit is contained in:
Bruno Coelho 2021-02-09 16:13:25 +00:00 committed by GitHub
parent 5a3ab4299f
commit 7a435ac1bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 5812 additions and 2636 deletions

View File

@ -12,5 +12,6 @@ package {{packageName}}.infrastructure
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -41,6 +41,37 @@ import {{packageName}}.infrastructure.toMultiValue
@Deprecated(message = "This operation is deprecated.")
{{/isDeprecated}}
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} {
val localVariableConfig = {{operationId}}RequestConfig({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
val localVarResponse = request<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Any?{{/returnType}}>(
localVariableConfig
)
return when (localVarResponse.responseType) {
ResponseType.Success -> {{#returnType}}(localVarResponse as Success<*>).data as {{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
val localVarError = localVarResponse as ClientError<*>
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
}
}
/**
* To obtain the request config of the operation {{operationId}}
*
{{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}* @return RequestConfig
*/
{{#isDeprecated}}
@Deprecated(message = "This operation is deprecated.")
{{/isDeprecated}}
fun {{operationId}}RequestConfig({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : RequestConfig {
val localVariableBody: kotlin.Any? = {{#hasBodyParam}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}null{{/hasFormParams}}{{#hasFormParams}}mapOf({{#formParams}}"{{{baseName}}}" to {{{paramName}}}{{^-last}}, {{/-last}}{{/formParams}}){{/hasFormParams}}{{/hasBodyParam}}
val localVariableQuery: MultiValueMap = {{^hasQueryParams}}mutableMapOf()
{{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf<kotlin.String, List<kotlin.String>>()
@ -68,30 +99,16 @@ import {{packageName}}.infrastructure.toMultiValue
{{#headerParams}}
{{{paramName}}}?.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }
{{/headerParams}}
val localVariableConfig = RequestConfig(
RequestMethod.{{httpMethod}},
"{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", "${{{paramName}}}"){{/pathParams}},
method = RequestMethod.{{httpMethod}},
path = "{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", "${{{paramName}}}"){{/pathParams}},
query = localVariableQuery,
headers = localVariableHeaders
)
val localVarResponse = request<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Any?{{/returnType}}>(
localVariableConfig,
localVariableBody
headers = localVariableHeaders,
body = localVariableBody
)
return when (localVarResponse.responseType) {
ResponseType.Success -> {{#returnType}}(localVarResponse as Success<*>).data as {{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
val localVarError = localVarResponse as ClientError<*>
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
}
return localVariableConfig
}
{{/operation}}

View File

@ -232,7 +232,7 @@ import org.threeten.bp.OffsetTime
}
{{/hasAuthMethods}}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
{{#jvm-okhttp3}}
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
{{/jvm-okhttp3}}
@ -276,12 +276,12 @@ import org.threeten.bp.OffsetTime
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -129,21 +158,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -161,6 +179,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get all pets
*
@ -173,23 +217,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
if (lastUpdated != null) {
put("lastUpdated", listOf(parseDateToQueryString(lastUpdated)))
}
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/getAll",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -207,6 +238,33 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getAllPets
*
* @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional)
* @return RequestConfig
*/
fun getAllPetsRequestConfig(lastUpdated: java.time.OffsetDateTime?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
if (lastUpdated != null) {
put("lastUpdated", listOf(parseDateToQueryString(lastUpdated)))
}
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/getAll",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -219,18 +277,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -248,6 +298,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -259,18 +331,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -288,6 +352,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -301,18 +387,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -330,6 +408,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -344,18 +446,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -373,4 +467,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ internal open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ internal open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ internal data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet? {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int>? {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order? {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order? {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User? {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String? {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -135,7 +135,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -172,12 +172,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(apiKey = apiKey, petId = petId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param apiKey (optional)
* @param petId Pet id to delete
* @return RequestConfig
*/
fun deletePetRequestConfig(apiKey: kotlin.String?, petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByStatus
*
* @param status Status values that need to be considered for filter
* @return RequestConfig
*/
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)