[kotlin][client] fix warning (#18560)

* [kotlin] Target correct library in jvm-spring-webclient sample

* [kotlin] Fixed warning in jvm-spring-restclient
This commit is contained in:
Stefan Koppier 2024-05-03 10:47:55 +02:00 committed by GitHub
parent ef2fa03e96
commit 30dc35de44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 217 additions and 189 deletions

View File

@ -1,6 +1,6 @@
generatorName: kotlin generatorName: kotlin
outputDir: samples/client/echo_api/kotlin-jvm-spring-3-webclient outputDir: samples/client/echo_api/kotlin-jvm-spring-3-webclient
library: jvm-spring-restclient library: jvm-spring-webclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties: additionalProperties:

View File

@ -67,7 +67,7 @@ import {{packageName}}.infrastructure.*
@Deprecated(message = "This operation is deprecated.") @Deprecated(message = "This operation is deprecated.")
{{/isDeprecated}} {{/isDeprecated}}
fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{#defaultValue}} = {{>param_default_value}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} { fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{#defaultValue}} = {{>param_default_value}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} {
val result = {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) {{#returnType}}val result = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
{{#returnType}} {{#returnType}}
return result.body!! return result.body!!
{{/returnType}} {{/returnType}}

View File

@ -9,6 +9,7 @@ wrapper {
buildscript { buildscript {
ext.kotlin_version = '1.8.10' ext.kotlin_version = '1.8.10'
ext.spring_boot_version = "3.2.4" ext.spring_boot_version = "3.2.4"
ext.reactor_version = "3.6.4"
// 6.13.0 is the latest stable release that supports JDK8 // 6.13.0 is the latest stable release that supports JDK8
ext.spotless_version = "6.13.0" ext.spotless_version = "6.13.0"
@ -59,11 +60,13 @@ kotlin {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(JavaLanguageVersion.of(17))
} }
} }
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.17.0" implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.17.0"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.0" implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.0"
implementation "org.springframework.boot:spring-boot-starter-web:$spring_boot_version" implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
implementation "io.projectreactor:reactor-core:$reactor_version"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
} }

View File

@ -17,33 +17,37 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import org.springframework.web.client.RestClient import org.springframework.web.reactive.function.client.WebClient
import org.springframework.web.client.RestClientResponseException import org.springframework.web.reactive.function.client.WebClientResponseException
import org.springframework.http.codec.json.Jackson2JsonDecoder
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType import org.springframework.http.MediaType
import reactor.core.publisher.Mono
import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.infrastructure.* import org.openapitools.client.infrastructure.*
class AuthApi(client: RestClient) : ApiClient(client) { class AuthApi(client: WebClient) : ApiClient(client) {
constructor(baseUrl: String) : this(RestClient.builder() constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl) .baseUrl(baseUrl)
.messageConverters { it.add(MappingJackson2HttpMessageConverter()) } .codecs {
it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
}
.build() .build()
) )
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testAuthHttpBasic(): kotlin.String { fun testAuthHttpBasic(): Mono<kotlin.String> {
val result = testAuthHttpBasicWithHttpInfo() return testAuthHttpBasicWithHttpInfo()
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testAuthHttpBasicWithHttpInfo(): ResponseEntity<kotlin.String> { fun testAuthHttpBasicWithHttpInfo(): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testAuthHttpBasicRequestConfig() val localVariableConfig = testAuthHttpBasicRequestConfig()
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig
@ -71,14 +75,14 @@ class AuthApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testAuthHttpBearer(): kotlin.String { fun testAuthHttpBearer(): Mono<kotlin.String> {
val result = testAuthHttpBearerWithHttpInfo() return testAuthHttpBearerWithHttpInfo()
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testAuthHttpBearerWithHttpInfo(): ResponseEntity<kotlin.String> { fun testAuthHttpBearerWithHttpInfo(): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testAuthHttpBearerRequestConfig() val localVariableConfig = testAuthHttpBearerRequestConfig()
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig

View File

@ -17,35 +17,39 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import org.springframework.web.client.RestClient import org.springframework.web.reactive.function.client.WebClient
import org.springframework.web.client.RestClientResponseException import org.springframework.web.reactive.function.client.WebClientResponseException
import org.springframework.http.codec.json.Jackson2JsonDecoder
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType import org.springframework.http.MediaType
import reactor.core.publisher.Mono
import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
import org.openapitools.client.models.Tag import org.openapitools.client.models.Tag
import org.openapitools.client.infrastructure.* import org.openapitools.client.infrastructure.*
class BodyApi(client: RestClient) : ApiClient(client) { class BodyApi(client: WebClient) : ApiClient(client) {
constructor(baseUrl: String) : this(RestClient.builder() constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl) .baseUrl(baseUrl)
.messageConverters { it.add(MappingJackson2HttpMessageConverter()) } .codecs {
it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
}
.build() .build()
) )
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBinaryGif(): java.io.File { fun testBinaryGif(): Mono<java.io.File> {
val result = testBinaryGifWithHttpInfo() return testBinaryGifWithHttpInfo()
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBinaryGifWithHttpInfo(): ResponseEntity<java.io.File> { fun testBinaryGifWithHttpInfo(): Mono<ResponseEntity<java.io.File>> {
val localVariableConfig = testBinaryGifRequestConfig() val localVariableConfig = testBinaryGifRequestConfig()
return request<Unit, java.io.File>( return request<Unit, java.io.File>(
localVariableConfig localVariableConfig
@ -73,14 +77,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null): kotlin.String { fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null): Mono<kotlin.String> {
val result = testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body) return testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File? = null): ResponseEntity<kotlin.String> { fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body) val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body)
return request<java.io.File, kotlin.String>( return request<java.io.File, kotlin.String>(
localVariableConfig localVariableConfig
@ -109,14 +113,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List<java.io.File>): kotlin.String { fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List<java.io.File>): Mono<kotlin.String> {
val result = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files) return testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List<java.io.File>): ResponseEntity<kotlin.String> { fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List<java.io.File>): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files) val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files)
return request<Map<String, PartConfig<*>>, kotlin.String>( return request<Map<String, PartConfig<*>>, kotlin.String>(
localVariableConfig localVariableConfig
@ -145,14 +149,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null): kotlin.String { fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null): Mono<kotlin.String> {
val result = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile) return testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File? = null): ResponseEntity<kotlin.String> { fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile) val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile)
return request<Map<String, PartConfig<*>>, kotlin.String>( return request<Map<String, PartConfig<*>>, kotlin.String>(
localVariableConfig localVariableConfig
@ -181,14 +185,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null): kotlin.String { fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null): Mono<kotlin.String> {
val result = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body) return testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any? = null): ResponseEntity<kotlin.String> { fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body) val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body)
return request<kotlin.Any, kotlin.String>( return request<kotlin.Any, kotlin.String>(
localVariableConfig localVariableConfig
@ -217,14 +221,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyPet(pet: Pet? = null): Pet { fun testEchoBodyPet(pet: Pet? = null): Mono<Pet> {
val result = testEchoBodyPetWithHttpInfo(pet = pet) return testEchoBodyPetWithHttpInfo(pet = pet)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyPetWithHttpInfo(pet: Pet? = null): ResponseEntity<Pet> { fun testEchoBodyPetWithHttpInfo(pet: Pet? = null): Mono<ResponseEntity<Pet>> {
val localVariableConfig = testEchoBodyPetRequestConfig(pet = pet) val localVariableConfig = testEchoBodyPetRequestConfig(pet = pet)
return request<Pet, Pet>( return request<Pet, Pet>(
localVariableConfig localVariableConfig
@ -253,14 +257,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyPetResponseString(pet: Pet? = null): kotlin.String { fun testEchoBodyPetResponseString(pet: Pet? = null): Mono<kotlin.String> {
val result = testEchoBodyPetResponseStringWithHttpInfo(pet = pet) return testEchoBodyPetResponseStringWithHttpInfo(pet = pet)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyPetResponseStringWithHttpInfo(pet: Pet? = null): ResponseEntity<kotlin.String> { fun testEchoBodyPetResponseStringWithHttpInfo(pet: Pet? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(pet = pet) val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(pet = pet)
return request<Pet, kotlin.String>( return request<Pet, kotlin.String>(
localVariableConfig localVariableConfig
@ -289,14 +293,14 @@ class BodyApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyTagResponseString(tag: Tag? = null): kotlin.String { fun testEchoBodyTagResponseString(tag: Tag? = null): Mono<kotlin.String> {
val result = testEchoBodyTagResponseStringWithHttpInfo(tag = tag) return testEchoBodyTagResponseStringWithHttpInfo(tag = tag)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEchoBodyTagResponseStringWithHttpInfo(tag: Tag? = null): ResponseEntity<kotlin.String> { fun testEchoBodyTagResponseStringWithHttpInfo(tag: Tag? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(tag = tag) val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(tag = tag)
return request<Tag, kotlin.String>( return request<Tag, kotlin.String>(
localVariableConfig localVariableConfig

View File

@ -17,33 +17,37 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import org.springframework.web.client.RestClient import org.springframework.web.reactive.function.client.WebClient
import org.springframework.web.client.RestClientResponseException import org.springframework.web.reactive.function.client.WebClientResponseException
import org.springframework.http.codec.json.Jackson2JsonDecoder
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType import org.springframework.http.MediaType
import reactor.core.publisher.Mono
import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.infrastructure.* import org.openapitools.client.infrastructure.*
class FormApi(client: RestClient) : ApiClient(client) { class FormApi(client: WebClient) : ApiClient(client) {
constructor(baseUrl: String) : this(RestClient.builder() constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl) .baseUrl(baseUrl)
.messageConverters { it.add(MappingJackson2HttpMessageConverter()) } .codecs {
it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
}
.build() .build()
) )
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): kotlin.String { fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): Mono<kotlin.String> {
val result = testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) return testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): ResponseEntity<kotlin.String> { fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
return request<Map<String, PartConfig<*>>, kotlin.String>( return request<Map<String, PartConfig<*>>, kotlin.String>(
localVariableConfig localVariableConfig
@ -74,14 +78,14 @@ class FormApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): kotlin.String { fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): Mono<kotlin.String> {
val result = testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) return testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testFormOneofWithHttpInfo(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): ResponseEntity<kotlin.String> { fun testFormOneofWithHttpInfo(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
return request<Map<String, PartConfig<*>>, kotlin.String>( return request<Map<String, PartConfig<*>>, kotlin.String>(
localVariableConfig localVariableConfig

View File

@ -17,22 +17,26 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import org.springframework.web.client.RestClient import org.springframework.web.reactive.function.client.WebClient
import org.springframework.web.client.RestClientResponseException import org.springframework.web.reactive.function.client.WebClientResponseException
import org.springframework.http.codec.json.Jackson2JsonDecoder
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType import org.springframework.http.MediaType
import reactor.core.publisher.Mono
import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.StringEnumRef import org.openapitools.client.models.StringEnumRef
import org.openapitools.client.infrastructure.* import org.openapitools.client.infrastructure.*
class HeaderApi(client: RestClient) : ApiClient(client) { class HeaderApi(client: WebClient) : ApiClient(client) {
constructor(baseUrl: String) : this(RestClient.builder() constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl) .baseUrl(baseUrl)
.messageConverters { it.add(MappingJackson2HttpMessageConverter()) } .codecs {
it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
}
.build() .build()
) )
@ -46,14 +50,14 @@ class HeaderApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): kotlin.String { fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): Mono<kotlin.String> {
val result = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) return testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): ResponseEntity<kotlin.String> { fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig

View File

@ -17,22 +17,26 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import org.springframework.web.client.RestClient import org.springframework.web.reactive.function.client.WebClient
import org.springframework.web.client.RestClientResponseException import org.springframework.web.reactive.function.client.WebClientResponseException
import org.springframework.http.codec.json.Jackson2JsonDecoder
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType import org.springframework.http.MediaType
import reactor.core.publisher.Mono
import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.StringEnumRef import org.openapitools.client.models.StringEnumRef
import org.openapitools.client.infrastructure.* import org.openapitools.client.infrastructure.*
class PathApi(client: RestClient) : ApiClient(client) { class PathApi(client: WebClient) : ApiClient(client) {
constructor(baseUrl: String) : this(RestClient.builder() constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl) .baseUrl(baseUrl)
.messageConverters { it.add(MappingJackson2HttpMessageConverter()) } .codecs {
it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
}
.build() .build()
) )
@ -46,14 +50,14 @@ class PathApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): kotlin.String { fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): Mono<kotlin.String> {
val result = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): ResponseEntity<kotlin.String> { fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig

View File

@ -17,24 +17,28 @@ package org.openapitools.client.apis
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import org.springframework.web.client.RestClient import org.springframework.web.reactive.function.client.WebClient
import org.springframework.web.client.RestClientResponseException import org.springframework.web.reactive.function.client.WebClientResponseException
import org.springframework.http.codec.json.Jackson2JsonDecoder
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter import org.springframework.http.codec.json.Jackson2JsonEncoder
import org.springframework.http.ResponseEntity import org.springframework.http.ResponseEntity
import org.springframework.http.MediaType import org.springframework.http.MediaType
import reactor.core.publisher.Mono
import org.springframework.util.LinkedMultiValueMap
import org.openapitools.client.models.Pet import org.openapitools.client.models.Pet
import org.openapitools.client.models.StringEnumRef import org.openapitools.client.models.StringEnumRef
import org.openapitools.client.models.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter import org.openapitools.client.models.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
import org.openapitools.client.infrastructure.* import org.openapitools.client.infrastructure.*
class QueryApi(client: RestClient) : ApiClient(client) { class QueryApi(client: WebClient) : ApiClient(client) {
constructor(baseUrl: String) : this(RestClient.builder() constructor(baseUrl: String) : this(WebClient.builder()
.baseUrl(baseUrl) .baseUrl(baseUrl)
.messageConverters { it.add(MappingJackson2HttpMessageConverter()) } .codecs {
it.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
it.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(Serializer.jacksonObjectMapper, MediaType.APPLICATION_JSON))
}
.build() .build()
) )
@ -48,14 +52,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): kotlin.String { fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): Mono<kotlin.String> {
val result = testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) return testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): ResponseEntity<kotlin.String> { fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig
@ -91,14 +95,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): kotlin.String { fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): Mono<kotlin.String> {
val result = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) return testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): ResponseEntity<kotlin.String> { fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig
@ -137,14 +141,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): kotlin.String { fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): Mono<kotlin.String> {
val result = testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) return testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): ResponseEntity<kotlin.String> { fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig
@ -183,14 +187,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: Pet? = null): kotlin.String { fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: Pet? = null): Mono<kotlin.String> {
val result = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject) return testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity<kotlin.String> { fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject) val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig
@ -223,14 +227,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryStyleFormExplodeTrueArrayString(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): kotlin.String { fun testQueryStyleFormExplodeTrueArrayString(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): Mono<kotlin.String> {
val result = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject) return testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): ResponseEntity<kotlin.String> { fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject) val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig
@ -263,14 +267,14 @@ class QueryApi(client: RestClient) : ApiClient(client) {
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryStyleFormExplodeTrueObject(queryObject: Pet? = null): kotlin.String { fun testQueryStyleFormExplodeTrueObject(queryObject: Pet? = null): Mono<kotlin.String> {
val result = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject) return testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
return result.body!! .map { it.body }
} }
@Throws(RestClientResponseException::class) @Throws(WebClientResponseException::class)
fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity<kotlin.String> { fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): Mono<ResponseEntity<kotlin.String>> {
val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject) val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject)
return request<Unit, kotlin.String>( return request<Unit, kotlin.String>(
localVariableConfig localVariableConfig

View File

@ -4,13 +4,14 @@ import org.springframework.core.ParameterizedTypeReference
import org.springframework.http.HttpHeaders import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod import org.springframework.http.HttpMethod
import org.springframework.http.MediaType import org.springframework.http.MediaType
import org.springframework.web.client.RestClient import org.springframework.web.reactive.function.client.WebClient
import org.springframework.http.ResponseEntity import org.springframework.http.ResponseEntity
import org.springframework.util.LinkedMultiValueMap import org.springframework.util.LinkedMultiValueMap
import reactor.core.publisher.Mono
open class ApiClient(protected val client: RestClient) { open class ApiClient(protected val client: WebClient) {
protected inline fun <reified I : Any, reified T: Any?> request(requestConfig: RequestConfig<I>): ResponseEntity<T> { protected inline fun <reified I : Any, reified T: Any?> request(requestConfig: RequestConfig<I>): Mono<ResponseEntity<T>> {
return prepare(defaults(requestConfig)) return prepare(defaults(requestConfig))
.retrieve() .retrieve()
.toEntity(object : ParameterizedTypeReference<T>() {}) .toEntity(object : ParameterizedTypeReference<T>() {})
@ -20,7 +21,7 @@ open class ApiClient(protected val client: RestClient) {
client.method(requestConfig) client.method(requestConfig)
.uri(requestConfig) .uri(requestConfig)
.headers(requestConfig) .headers(requestConfig)
.nullableBody(requestConfig) .body(requestConfig)
protected fun <I> defaults(requestConfig: RequestConfig<I>) = protected fun <I> defaults(requestConfig: RequestConfig<I>) =
requestConfig.apply { requestConfig.apply {
@ -32,10 +33,10 @@ open class ApiClient(protected val client: RestClient) {
} }
} }
private fun <I> RestClient.method(requestConfig: RequestConfig<I>)= private fun <I> WebClient.method(requestConfig: RequestConfig<I>)=
method(HttpMethod.valueOf(requestConfig.method.name)) method(HttpMethod.valueOf(requestConfig.method.name))
private fun <I> RestClient.RequestBodyUriSpec.uri(requestConfig: RequestConfig<I>) = private fun <I> WebClient.RequestBodyUriSpec.uri(requestConfig: RequestConfig<I>) =
uri { builder -> uri { builder ->
builder builder
.path(requestConfig.path) .path(requestConfig.path)
@ -43,11 +44,11 @@ open class ApiClient(protected val client: RestClient) {
.build(requestConfig.params) .build(requestConfig.params)
} }
private fun <I> RestClient.RequestBodySpec.headers(requestConfig: RequestConfig<I>) = private fun <I> WebClient.RequestBodySpec.headers(requestConfig: RequestConfig<I>) =
apply { requestConfig.headers.forEach { (name, value) -> header(name, value) } } apply { requestConfig.headers.forEach { (name, value) -> header(name, value) } }
private fun <I : Any> RestClient.RequestBodySpec.nullableBody(requestConfig: RequestConfig<I>) = private fun <I : Any> WebClient.RequestBodySpec.body(requestConfig: RequestConfig<I>) =
apply { if (requestConfig.body != null) body(requestConfig.body) } apply { if (requestConfig.body != null) bodyValue(requestConfig.body) }
} }
inline fun <reified T: Any> parseDateToQueryString(value : T): String { inline fun <reified T: Any> parseDateToQueryString(value : T): String {

View File

@ -77,7 +77,7 @@ class PetApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null): Unit { fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null): Unit {
val result = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) deletePetWithHttpInfo(petId = petId, apiKey = apiKey)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
@ -273,7 +273,7 @@ class PetApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Unit { fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Unit {
val result = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)

View File

@ -39,7 +39,7 @@ class StoreApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun deleteOrder(orderId: kotlin.String): Unit { fun deleteOrder(orderId: kotlin.String): Unit {
val result = deleteOrderWithHttpInfo(orderId = orderId) deleteOrderWithHttpInfo(orderId = orderId)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)

View File

@ -39,7 +39,7 @@ class UserApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun createUser(user: User): Unit { fun createUser(user: User): Unit {
val result = createUserWithHttpInfo(user = user) createUserWithHttpInfo(user = user)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
@ -73,7 +73,7 @@ class UserApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun createUsersWithArrayInput(user: kotlin.collections.List<User>): Unit { fun createUsersWithArrayInput(user: kotlin.collections.List<User>): Unit {
val result = createUsersWithArrayInputWithHttpInfo(user = user) createUsersWithArrayInputWithHttpInfo(user = user)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
@ -107,7 +107,7 @@ class UserApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun createUsersWithListInput(user: kotlin.collections.List<User>): Unit { fun createUsersWithListInput(user: kotlin.collections.List<User>): Unit {
val result = createUsersWithListInputWithHttpInfo(user = user) createUsersWithListInputWithHttpInfo(user = user)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
@ -141,7 +141,7 @@ class UserApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun deleteUser(username: kotlin.String): Unit { fun deleteUser(username: kotlin.String): Unit {
val result = deleteUserWithHttpInfo(username = username) deleteUserWithHttpInfo(username = username)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
@ -250,7 +250,7 @@ class UserApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun logoutUser(): Unit { fun logoutUser(): Unit {
val result = logoutUserWithHttpInfo() logoutUserWithHttpInfo()
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
@ -283,7 +283,7 @@ class UserApi(client: RestClient) : ApiClient(client) {
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)
fun updateUser(username: kotlin.String, user: User): Unit { fun updateUser(username: kotlin.String, user: User): Unit {
val result = updateUserWithHttpInfo(username = username, user = user) updateUserWithHttpInfo(username = username, user = user)
} }
@Throws(RestClientResponseException::class) @Throws(RestClientResponseException::class)