mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-05 21:06:09 +00:00
Kotlin: Fix kotlinx_serialization code generation (#9576)
And update to Kotlin 1.5.0 and kotlinx.serialization 1.2.1. Fix nested enum annotation '@Serializable' instead of '@KSerializable' when 'kotlinx_serialization' is used. Fix missing JsonMediaType in ApiClient.kt (#9242). Add 'kotlinx_serialization' serialization library to documentation. Use explicity type in RequestConfig to keep type information for JSON serialization. Resolves #9242
This commit is contained in:
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
{{#jvm-retrofit2}}
|
{{#jvm-retrofit2}}
|
||||||
ext.retrofitVersion = '2.7.2'
|
ext.retrofitVersion = '2.7.2'
|
||||||
{{/jvm-retrofit2}}
|
{{/jvm-retrofit2}}
|
||||||
@@ -72,7 +72,7 @@ dependencies {
|
|||||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.1"
|
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.1"
|
||||||
{{/jackson}}
|
{{/jackson}}
|
||||||
{{#kotlinx_serialization}}
|
{{#kotlinx_serialization}}
|
||||||
compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0"
|
compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
||||||
{{/kotlinx_serialization}}
|
{{/kotlinx_serialization}}
|
||||||
{{#jvm-okhttp3}}
|
{{#jvm-okhttp3}}
|
||||||
compile "com.squareup.okhttp3:okhttp:3.12.13"
|
compile "com.squareup.okhttp3:okhttp:3.12.13"
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ import java.io.Serializable
|
|||||||
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
*/
|
*/
|
||||||
{{#kotlinx_serialization}}
|
{{#kotlinx_serialization}}
|
||||||
@KSerializable
|
{{#serializableModel}}@KSerializable{{/serializableModel}}{{^serializableModel}}@Serializable{{/serializableModel}}
|
||||||
{{/kotlinx_serialization}}
|
{{/kotlinx_serialization}}
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{{nameInCamelCase}}}(val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}) {
|
{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{{nameInCamelCase}}}(val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}) {
|
||||||
{{#allowableValues}}
|
{{#allowableValues}}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer
|
|||||||
* {{{description}}}
|
* {{{description}}}
|
||||||
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
*/
|
*/
|
||||||
{{#multiplatform}}@Serializable(with = {{classname}}.Serializer::class){{/multiplatform}}{{#kotlinx_serialization}}@Serializable(with = {{classname}}.Serializer::class){{/kotlinx_serialization}}
|
{{#multiplatform}}@Serializable(with = {{classname}}.Serializer::class){{/multiplatform}}{{#kotlinx_serialization}}@Serializable{{/kotlinx_serialization}}
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{classname}}(val value: {{{dataType}}}) {
|
{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{classname}}(val value: {{{dataType}}}) {
|
||||||
|
|
||||||
{{#allowableValues}}{{#enumVars}}
|
{{#allowableValues}}{{#enumVars}}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package {{packageName}}.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}data class RequestConfig(
|
{{#nonPublicApi}}internal {{/nonPublicApi}}data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -43,7 +43,7 @@ import {{packageName}}.infrastructure.toMultiValue
|
|||||||
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} {
|
{{^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 localVariableConfig = {{operationId}}RequestConfig({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
|
||||||
|
|
||||||
val localVarResponse = request<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Any?{{/returnType}}>(
|
val localVarResponse = request<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map<String, Any?>{{/hasFormParams}}{{/hasBodyParam}}, {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ import {{packageName}}.infrastructure.toMultiValue
|
|||||||
{{#isDeprecated}}
|
{{#isDeprecated}}
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
fun {{operationId}}RequestConfig({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : RequestConfig {
|
fun {{operationId}}RequestConfig({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : RequestConfig<{{#hasBodyParam}}{{#bodyParams}}{{{dataType}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{^hasFormParams}}Unit{{/hasFormParams}}{{#hasFormParams}}Map<String, Any?>{{/hasFormParams}}{{/hasBodyParam}}> {
|
||||||
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 localVariableBody = {{#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()
|
val localVariableQuery: MultiValueMap = {{^hasQueryParams}}mutableMapOf()
|
||||||
{{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf<kotlin.String, List<kotlin.String>>()
|
{{/hasQueryParams}}{{#hasQueryParams}}mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
@@ -99,16 +99,14 @@ import {{packageName}}.infrastructure.toMultiValue
|
|||||||
{{#headerParams}}
|
{{#headerParams}}
|
||||||
{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }
|
{{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.{{httpMethod}},
|
method = RequestMethod.{{httpMethod}},
|
||||||
path = "{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", "${{{paramName}}}"){{/pathParams}},
|
path = "{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", "${{{paramName}}}"){{/pathParams}},
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
|||||||
@@ -27,11 +27,10 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
{{^threetenbp}}
|
{{^threetenbp}}
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
@@ -39,6 +38,12 @@ import java.time.LocalTime
|
|||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
{{#kotlinx_serialization}}
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.encodeToString
|
||||||
|
{{/kotlinx_serialization}}
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
import org.threeten.bp.LocalDate
|
import org.threeten.bp.LocalDate
|
||||||
import org.threeten.bp.LocalDateTime
|
import org.threeten.bp.LocalDateTime
|
||||||
@@ -86,14 +91,10 @@ import org.threeten.bp.OffsetTime
|
|||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
{{#jvm-okhttp3}}
|
{{#jvm-okhttp3}}
|
||||||
content is File -> RequestBody.create(
|
content is File -> RequestBody.create(MediaType.parse(mediaType), content)
|
||||||
MediaType.parse(mediaType), content
|
|
||||||
)
|
|
||||||
{{/jvm-okhttp3}}
|
{{/jvm-okhttp3}}
|
||||||
{{#jvm-okhttp4}}
|
{{#jvm-okhttp4}}
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
{{/jvm-okhttp4}}
|
{{/jvm-okhttp4}}
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
@@ -154,12 +155,12 @@ import org.threeten.bp.OffsetTime
|
|||||||
MediaType.parse(mediaType), Serializer.jacksonObjectMapper.writeValueAsString(content)
|
MediaType.parse(mediaType), Serializer.jacksonObjectMapper.writeValueAsString(content)
|
||||||
{{/jackson}}
|
{{/jackson}}
|
||||||
{{#kotlinx_serialization}}
|
{{#kotlinx_serialization}}
|
||||||
MediaType.parse(mediaType), Serializer.jvmJson.decodeFromString<T>(content)
|
MediaType.parse(mediaType), Serializer.jvmJson.encodeToString(content)
|
||||||
{{/kotlinx_serialization}}
|
{{/kotlinx_serialization}}
|
||||||
)
|
)
|
||||||
{{/jvm-okhttp3}}
|
{{/jvm-okhttp3}}
|
||||||
{{#jvm-okhttp4}}
|
{{#jvm-okhttp4}}
|
||||||
mediaType == JsonMediaType -> {{#moshi}}Serializer.moshi.adapter(T::class.java).toJson(content){{/moshi}}{{#gson}}Serializer.gson.toJson(content, T::class.java){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.writeValueAsString(content){{/jackson}}{{#kotlinx_serialization}}Serializer.jvmJson.decodeFromString<T>(content){{/kotlinx_serialization}}.toRequestBody(
|
mediaType == JsonMediaType -> {{#moshi}}Serializer.moshi.adapter(T::class.java).toJson(content){{/moshi}}{{#gson}}Serializer.gson.toJson(content, T::class.java){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.writeValueAsString(content){{/jackson}}{{#kotlinx_serialization}}Serializer.jvmJson.encodeToString(content){{/kotlinx_serialization}}.toRequestBody(
|
||||||
mediaType.toMediaTypeOrNull()
|
mediaType.toMediaTypeOrNull()
|
||||||
)
|
)
|
||||||
{{/jvm-okhttp4}}
|
{{/jvm-okhttp4}}
|
||||||
@@ -196,13 +197,13 @@ import org.threeten.bp.OffsetTime
|
|||||||
return f as T
|
return f as T
|
||||||
}
|
}
|
||||||
return when(mediaType) {
|
return when(mediaType) {
|
||||||
JsonMediaType -> {{#moshi}}Serializer.moshi.adapter(T::class.java).fromJson(bodyContent){{/moshi}}{{#gson}}Serializer.gson.fromJson(bodyContent, T::class.java){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.readValue(bodyContent, T::class.java){{/jackson}}
|
JsonMediaType -> {{#moshi}}Serializer.moshi.adapter(T::class.java).fromJson(bodyContent){{/moshi}}{{#gson}}Serializer.gson.fromJson(bodyContent, T::class.java){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.readValue(bodyContent, T::class.java){{/jackson}}{{#kotlinx_serialization}}Serializer.jvmJson.decodeFromString<T>(bodyContent){{/kotlinx_serialization}}
|
||||||
else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.")
|
else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isApiKey}}
|
{{#isApiKey}}
|
||||||
{{#isKeyInHeader}}
|
{{#isKeyInHeader}}
|
||||||
@@ -259,7 +260,7 @@ import org.threeten.bp.OffsetTime
|
|||||||
}
|
}
|
||||||
{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
{{#jvm-okhttp3}}
|
{{#jvm-okhttp3}}
|
||||||
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
{{/jvm-okhttp3}}
|
{{/jvm-okhttp3}}
|
||||||
@@ -300,7 +301,7 @@ import org.threeten.bp.OffsetTime
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -315,57 +316,46 @@ import org.threeten.bp.OffsetTime
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}, accept),
|
responseBody(response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}, accept),
|
||||||
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
|
response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
|
||||||
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
|
response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
|
||||||
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||||
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ import {{packageName}}.auth.*
|
|||||||
else request(requestConfig, authNames = authNames)
|
else request(requestConfig, authNames = authNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List<String>): HttpResponse {
|
protected suspend inline fun <reified T: Any?> request(requestConfig: RequestConfig<T>, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
requestConfig.updateForAuth(authNames)
|
requestConfig.updateForAuth(authNames)
|
||||||
val headers = requestConfig.headers
|
val headers = requestConfig.headers
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,7 +156,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -186,23 +182,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,7 +213,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List<Pet> {
|
fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated)
|
val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,8 +238,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional)
|
* @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getAllPetsRequestConfig(lastUpdated: java.time.OffsetDateTime?) : RequestConfig {
|
fun getAllPetsRequestConfig(lastUpdated: java.time.OffsetDateTime?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
if (lastUpdated != null) {
|
if (lastUpdated != null) {
|
||||||
@@ -253,16 +247,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/getAll",
|
path = "/pet/getAll",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -279,7 +271,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -304,20 +296,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -333,7 +323,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -358,20 +348,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -389,7 +377,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -416,20 +404,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -448,7 +434,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -475,20 +461,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,16 +13,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -62,9 +63,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -137,7 +136,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -154,7 +153,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -188,7 +187,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -203,57 +202,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun addPet(body: Pet) : Unit {
|
suspend fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
suspend fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun getPetById(petId: kotlin.Long) : Pet {
|
suspend fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun updatePet(body: Pet) : Unit {
|
suspend fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
suspend fun deleteOrder(orderId: kotlin.String) : Unit {
|
suspend fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
suspend fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
suspend fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
suspend fun getOrderById(orderId: kotlin.Long) : Order {
|
suspend fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
suspend fun placeOrder(body: Order) : Order {
|
suspend fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun createUser(body: User) : Unit {
|
suspend fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
suspend fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
suspend fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun deleteUser(username: kotlin.String) : Unit {
|
suspend fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun getUserByName(username: kotlin.String) : User {
|
suspend fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun logoutUser() : Unit {
|
suspend fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
suspend fun updateUser(username: kotlin.String, body: User) : Unit {
|
suspend fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -155,7 +155,7 @@ open class ApiClient(
|
|||||||
else request(requestConfig, authNames = authNames)
|
else request(requestConfig, authNames = authNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List<String>): HttpResponse {
|
protected suspend inline fun <reified T: Any?> request(requestConfig: RequestConfig<T>, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List<String>): HttpResponse {
|
||||||
requestConfig.updateForAuth(authNames)
|
requestConfig.updateForAuth(authNames)
|
||||||
val headers = requestConfig.headers
|
val headers = requestConfig.headers
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
internal open class ApiClient(val baseUrl: String) {
|
internal open class ApiClient(val baseUrl: String) {
|
||||||
internal companion object {
|
internal companion object {
|
||||||
@@ -61,9 +62,7 @@ internal open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ internal open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ internal open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ internal open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ internal open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
internal data class RequestConfig(
|
internal data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet? {
|
fun getPetById(petId: kotlin.Long) : Pet? {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int>? {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int>? {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order? {
|
fun getOrderById(orderId: kotlin.Long) : Order? {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order? {
|
fun placeOrder(body: Order) : Order? {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User? {
|
fun getUserByName(username: kotlin.String) : User? {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String? {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String? {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,17 @@ import okhttp3.ResponseBody
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -59,9 +60,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> RequestBody.create(
|
content is File -> RequestBody.create(MediaType.parse(mediaType), content)
|
||||||
MediaType.parse(mediaType), content
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -129,7 +128,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -146,7 +145,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -180,7 +179,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -195,57 +194,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code(),
|
response.code(),
|
||||||
response.headers().toMultimap()
|
response.headers().toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message(),
|
response.message(),
|
||||||
response.code(),
|
response.code(),
|
||||||
response.headers().toMultimap()
|
response.headers().toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body(), accept),
|
responseBody(response.body(), accept),
|
||||||
response.code(),
|
response.code(),
|
||||||
response.headers().toMultimap()
|
response.headers().toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message(),
|
response.message(),
|
||||||
response.body()?.string(),
|
response.body()?.string(),
|
||||||
response.code(),
|
response.code(),
|
||||||
response.headers().toMultimap()
|
response.headers().toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message(),
|
response.message(),
|
||||||
response.body()?.string(),
|
response.body()?.string(),
|
||||||
response.code(),
|
response.code(),
|
||||||
response.headers().toMultimap()
|
response.headers().toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
ext.retrofitVersion = '2.7.2'
|
ext.retrofitVersion = '2.7.2'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -32,7 +32,7 @@ test {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0"
|
compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
||||||
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0"
|
compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0"
|
||||||
compile "com.squareup.okhttp3:logging-interceptor:4.9.0"
|
compile "com.squareup.okhttp3:logging-interceptor:4.9.0"
|
||||||
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
ext.retrofitVersion = '2.7.2'
|
ext.retrofitVersion = '2.7.2'
|
||||||
ext.rxJava3Version = '3.0.10'
|
ext.rxJava3Version = '3.0.10'
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
ext.retrofitVersion = '2.7.2'
|
ext.retrofitVersion = '2.7.2'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit {
|
fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(apiKey = apiKey, petId = petId)
|
val localVariableConfig = deletePetRequestConfig(apiKey = apiKey, petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId Pet id to delete
|
* @param petId Pet id to delete
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(apiKey: kotlin.String?, petId: kotlin.Long) : RequestConfig {
|
fun deletePetRequestConfig(apiKey: kotlin.String?, petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
import org.threeten.bp.LocalDate
|
import org.threeten.bp.LocalDate
|
||||||
import org.threeten.bp.LocalDateTime
|
import org.threeten.bp.LocalDateTime
|
||||||
import org.threeten.bp.LocalTime
|
import org.threeten.bp.LocalTime
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getEnum() : PetEnum {
|
fun getEnum() : PetEnum {
|
||||||
val localVariableConfig = getEnumRequestConfig()
|
val localVariableConfig = getEnumRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<PetEnum>(
|
val localVarResponse = request<Unit, PetEnum>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -70,20 +70,18 @@ class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getEnumRequestConfig() : RequestConfig {
|
fun getEnumRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/enum",
|
path = "/enum",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -132,7 +131,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
val url = httpUrl.newBuilder()
|
val url = httpUrl.newBuilder()
|
||||||
@@ -163,7 +162,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -178,57 +177,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,7 @@ wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.4.30'
|
ext.kotlin_version = '1.5.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://repo1.maven.org/maven2" }
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun addPet(body: Pet) : Unit {
|
fun addPet(body: Pet) : Unit {
|
||||||
val localVariableConfig = addPetRequestConfig(body = body)
|
val localVariableConfig = addPetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,20 +72,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
fun addPetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +100,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,21 +126,19 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param apiKey (optional)
|
* @param apiKey (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +155,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -184,23 +180,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("status", toMultiValue(status.toList(), "csv"))
|
put("status", toMultiValue(status.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByStatus",
|
path = "/pet/findByStatus",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +212,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
val localVarResponse = request<Unit, kotlin.collections.List<Pet>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -244,23 +238,21 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
@Deprecated(message = "This operation is deprecated.")
|
@Deprecated(message = "This operation is deprecated.")
|
||||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/findByTags",
|
path = "/pet/findByTags",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,7 +269,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getPetById(petId: kotlin.Long) : Pet {
|
fun getPetById(petId: kotlin.Long) : Pet {
|
||||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||||
|
|
||||||
val localVarResponse = request<Pet>(
|
val localVarResponse = request<Unit, Pet>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,20 +294,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -331,7 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePet(body: Pet) : Unit {
|
fun updatePet(body: Pet) : Unit {
|
||||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Pet, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -356,20 +346,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
fun updatePetRequestConfig(body: Pet) : RequestConfig<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/pet",
|
path = "/pet",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +375,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Map<String, Any?>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -414,20 +402,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param status Updated status of the pet (optional)
|
* @param status Updated status of the pet (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
val localVariableBody = mapOf("name" to name, "status" to status)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -446,7 +432,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||||
|
|
||||||
val localVarResponse = request<ApiResponse>(
|
val localVarResponse = request<Map<String, Any?>, ApiResponse>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -473,20 +459,18 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param file file to upload (optional)
|
* @param file file to upload (optional)
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig<Map<String, Any?>> {
|
||||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||||
val localVariableConfig = getInventoryRequestConfig()
|
val localVariableConfig = getInventoryRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
val localVarResponse = request<Unit, kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,20 +122,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getInventoryRequestConfig() : RequestConfig {
|
fun getInventoryRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/inventory",
|
path = "/store/inventory",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Unit, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +203,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
fun placeOrder(body: Order) : Order {
|
fun placeOrder(body: Order) : Order {
|
||||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Order>(
|
val localVarResponse = request<Order, Order>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,20 +228,18 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
|||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
fun placeOrderRequestConfig(body: Order) : RequestConfig<Order> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/store/order",
|
path = "/store/order",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUser(body: User) : Unit {
|
fun createUser(body: User) : Unit {
|
||||||
val localVariableConfig = createUserRequestConfig(body = body)
|
val localVariableConfig = createUserRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,20 +71,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Created user object
|
* @param body Created user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
fun createUserRequestConfig(body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user",
|
path = "/user",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +98,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,20 +123,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithArray",
|
path = "/user/createWithArray",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +150,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<kotlin.collections.List<User>, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -179,20 +175,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body List of user object
|
* @param body List of user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig<kotlin.collections.List<User>> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.POST,
|
method = RequestMethod.POST,
|
||||||
path = "/user/createWithList",
|
path = "/user/createWithList",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +202,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun deleteUser(username: kotlin.String) : Unit {
|
fun deleteUser(username: kotlin.String) : Unit {
|
||||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,20 +227,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.DELETE,
|
method = RequestMethod.DELETE,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,7 +255,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun getUserByName(username: kotlin.String) : User {
|
fun getUserByName(username: kotlin.String) : User {
|
||||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||||
|
|
||||||
val localVarResponse = request<User>(
|
val localVarResponse = request<Unit, User>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -288,20 +280,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +309,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||||
|
|
||||||
val localVarResponse = request<kotlin.String>(
|
val localVarResponse = request<Unit, kotlin.String>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,24 +335,22 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
put("username", listOf(username.toString()))
|
put("username", listOf(username.toString()))
|
||||||
put("password", listOf(password.toString()))
|
put("password", listOf(password.toString()))
|
||||||
}
|
}
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/login",
|
path = "/user/login",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,7 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun logoutUser() : Unit {
|
fun logoutUser() : Unit {
|
||||||
val localVariableConfig = logoutUserRequestConfig()
|
val localVariableConfig = logoutUserRequestConfig()
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<Unit, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -401,20 +389,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
*
|
*
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun logoutUserRequestConfig() : RequestConfig {
|
fun logoutUserRequestConfig() : RequestConfig<Unit> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.GET,
|
method = RequestMethod.GET,
|
||||||
path = "/user/logout",
|
path = "/user/logout",
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,7 +417,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||||
|
|
||||||
val localVarResponse = request<Any?>(
|
val localVarResponse = request<User, Unit>(
|
||||||
localVariableConfig
|
localVariableConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,20 +443,18 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
|||||||
* @param body Updated user object
|
* @param body Updated user object
|
||||||
* @return RequestConfig
|
* @return RequestConfig
|
||||||
*/
|
*/
|
||||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig<User> {
|
||||||
val localVariableBody: kotlin.Any? = body
|
val localVariableBody = body
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
val localVariableConfig = RequestConfig(
|
return RequestConfig(
|
||||||
method = RequestMethod.PUT,
|
method = RequestMethod.PUT,
|
||||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||||
query = localVariableQuery,
|
query = localVariableQuery,
|
||||||
headers = localVariableHeaders,
|
headers = localVariableHeaders,
|
||||||
body = localVariableBody
|
body = localVariableBody
|
||||||
)
|
)
|
||||||
|
|
||||||
return localVariableConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URLConnection
|
import java.net.URLConnection
|
||||||
import java.util.Date
|
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import java.time.OffsetTime
|
import java.time.OffsetTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
open class ApiClient(val baseUrl: String) {
|
open class ApiClient(val baseUrl: String) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,9 +62,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
|
|
||||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||||
when {
|
when {
|
||||||
content is File -> content.asRequestBody(
|
content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull())
|
||||||
mediaType.toMediaTypeOrNull()
|
|
||||||
)
|
|
||||||
mediaType == FormDataMediaType -> {
|
mediaType == FormDataMediaType -> {
|
||||||
MultipartBody.Builder()
|
MultipartBody.Builder()
|
||||||
.setType(MultipartBody.FORM)
|
.setType(MultipartBody.FORM)
|
||||||
@@ -131,7 +130,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateAuthParams(requestConfig: RequestConfig) {
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
|
||||||
if (apiKey["api_key"] != null) {
|
if (apiKey["api_key"] != null) {
|
||||||
if (apiKeyPrefix["api_key"] != null) {
|
if (apiKeyPrefix["api_key"] != null) {
|
||||||
@@ -148,7 +147,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiInfrastructureResponse<T?> {
|
||||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
// take authMethod from operation
|
// take authMethod from operation
|
||||||
@@ -182,7 +181,7 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support multiple contentType options here.
|
// TODO: support multiple contentType options here.
|
||||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault())
|
||||||
|
|
||||||
val request = when (requestConfig.method) {
|
val request = when (requestConfig.method) {
|
||||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
@@ -197,57 +196,46 @@ open class ApiClient(val baseUrl: String) {
|
|||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
val response = client.newCall(request).execute()
|
val response = client.newCall(request).execute()
|
||||||
val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||||
|
|
||||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
when {
|
return when {
|
||||||
response.isRedirect -> return Redirection(
|
response.isRedirect -> Redirection(
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isInformational -> return Informational(
|
response.isInformational -> Informational(
|
||||||
response.message,
|
response.message,
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isSuccessful -> return Success(
|
response.isSuccessful -> Success(
|
||||||
responseBody(response.body, accept),
|
responseBody(response.body, accept),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
response.isClientError -> return ClientError(
|
response.isClientError -> ClientError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
else -> return ServerError(
|
else -> ServerError(
|
||||||
response.message,
|
response.message,
|
||||||
response.body?.string(),
|
response.body?.string(),
|
||||||
response.code,
|
response.code,
|
||||||
response.headers.toMultimap()
|
response.headers.toMultimap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parameterToString(value: Any?): String {
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
when (value) {
|
null -> ""
|
||||||
null -> {
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
return ""
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
}
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
|
||||||
is Array<*> -> {
|
parseDateToQueryString(value)
|
||||||
return toMultiValue(value, "csv").toString()
|
else -> value.toString()
|
||||||
}
|
|
||||||
is Iterable<*> -> {
|
|
||||||
return toMultiValue(value, "csv").toString()
|
|
||||||
}
|
|
||||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
|
|
||||||
return parseDateToQueryString<Any>(value)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ package org.openapitools.client.infrastructure
|
|||||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
* multi-valued headers as csv-only.
|
* multi-valued headers as csv-only.
|
||||||
*/
|
*/
|
||||||
data class RequestConfig(
|
data class RequestConfig<T>(
|
||||||
val method: RequestMethod,
|
val method: RequestMethod,
|
||||||
val path: String,
|
val path: String,
|
||||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
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
|
val body: T? = null
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user