diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache index 18f64464c8e..c5d0f13b5e1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache @@ -7,18 +7,18 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' {{#jvm-retrofit2}} - ext.retrofitVersion = '2.7.2' + ext.retrofitVersion = '2.9.0' {{/jvm-retrofit2}} {{#useRxJava}} ext.rxJavaVersion = '1.3.8' {{/useRxJava}} {{#useRxJava2}} - ext.rxJava2Version = '2.2.20' + ext.rxJava2Version = '2.2.21' {{/useRxJava2}} {{#useRxJava3}} - ext.rxJava3Version = '3.0.10' + ext.rxJava3Version = '3.0.12' {{/useRxJava3}} repositories { @@ -52,67 +52,67 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" {{#moshi}} {{^moshiCodeGen}} - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" {{/moshiCodeGen}} {{#moshiCodeGen}} - compile "com.squareup.moshi:moshi:1.11.0" - kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0" + implementation "com.squareup.moshi:moshi:1.12.0" + kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0" {{/moshiCodeGen}} {{/moshi}} {{#gson}} - compile "com.google.code.gson:gson:2.8.6" + implementation "com.google.code.gson:gson:2.8.7" {{/gson}} {{#jackson}} - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1" - compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.1" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.3" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3" {{/jackson}} {{#kotlinx_serialization}} - compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1" {{/kotlinx_serialization}} {{#jvm-okhttp3}} - compile "com.squareup.okhttp3:okhttp:3.12.13" + implementation "com.squareup.okhttp3:okhttp:3.12.13" {{/jvm-okhttp3}} {{#jvm-okhttp4}} - compile "com.squareup.okhttp3:okhttp:4.9.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" {{/jvm-okhttp4}} {{#threetenbp}} - compile "org.threeten:threetenbp:1.5.0" + implementation "org.threeten:threetenbp:1.5.1" {{/threetenbp}} {{#jvm-retrofit2}} {{#hasOAuthMethods}} - compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" + implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2" {{/hasOAuthMethods}} - compile "com.squareup.okhttp3:logging-interceptor:4.9.0" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" {{#useRxJava}} - compile "io.reactivex:rxjava:$rxJavaVersion" - compile "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion" + implementation "io.reactivex:rxjava:$rxJavaVersion" + implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion" {{/useRxJava}} {{#useRxJava2}} - compile "io.reactivex.rxjava2:rxjava:$rxJava2Version" - compile "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion" + implementation "io.reactivex.rxjava2:rxjava:$rxJava2Version" + implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion" {{/useRxJava2}} {{#useRxJava3}} - compile "io.reactivex.rxjava3:rxjava:$rxJava3Version" - compile "com.squareup.retrofit2:adapter-rxjava3:2.9.0" + implementation "io.reactivex.rxjava3:rxjava:$rxJava3Version" + implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0" {{/useRxJava3}} - compile "com.squareup.retrofit2:retrofit:$retrofitVersion" + implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" {{#gson}} - compile "com.squareup.retrofit2:converter-gson:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion" {{/gson}} {{#moshi}} - compile "com.squareup.retrofit2:converter-moshi:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion" {{/moshi}} {{#kotlinx_serialization}} - compile "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0" + implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0" {{/kotlinx_serialization}} - compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion" {{/jvm-retrofit2}} - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } {{#kotlinx_serialization}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/auth/OAuthOkHttpClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/auth/OAuthOkHttpClient.kt.mustache index 106b0581994..5c30002e94b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/auth/OAuthOkHttpClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/auth/OAuthOkHttpClient.kt.mustache @@ -13,14 +13,13 @@ import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.toRequestBody class OAuthOkHttpClient( - private var client: OkHttpClient + private var client: OkHttpClient = OkHttpClient() ) : HttpClient { - constructor() : this(OkHttpClient()) - @Throws(OAuthSystemException::class, OAuthProblemException::class) override fun execute( request: OAuthClientRequest, @@ -39,7 +38,7 @@ class OAuthOkHttpClient( } } - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null + val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null requestBuilder.method(requestMethod, body) try { @@ -48,6 +47,7 @@ class OAuthOkHttpClient( response.body?.string(), response.body?.contentType()?.toString(), response.code, + response.headers.toMultimap(), responseClass) } catch (e: IOException) { throw OAuthSystemException(e) diff --git a/samples/client/petstore/kotlin-gson/build.gradle b/samples/client/petstore/kotlin-gson/build.gradle index a99b1cf2af2..5cad8581cb6 100644 --- a/samples/client/petstore/kotlin-gson/build.gradle +++ b/samples/client/petstore/kotlin-gson/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,8 +28,8 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "com.google.code.gson:gson:2.8.6" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "com.google.code.gson:gson:2.8.7" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-jackson/build.gradle b/samples/client/petstore/kotlin-jackson/build.gradle index 0429e1f7c30..5cbe1fb014f 100644 --- a/samples/client/petstore/kotlin-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jackson/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,10 +28,10 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1" - compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.1" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.3" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-json-request-string/build.gradle b/samples/client/petstore/kotlin-json-request-string/build.gradle index 378951fb75a..189e54f8195 100644 --- a/samples/client/petstore/kotlin-json-request-string/build.gradle +++ b/samples/client/petstore/kotlin-json-request-string/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -29,9 +29,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle index a99b1cf2af2..5cad8581cb6 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,8 +28,8 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "com.google.code.gson:gson:2.8.6" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "com.google.code.gson:gson:2.8.7" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-moshi-codegen/build.gradle b/samples/client/petstore/kotlin-moshi-codegen/build.gradle index 7fec302dc5a..ff73803f4b6 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/build.gradle +++ b/samples/client/petstore/kotlin-moshi-codegen/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -29,9 +29,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "com.squareup.moshi:moshi:1.11.0" - kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "com.squareup.moshi:moshi:1.12.0" + kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-nonpublic/build.gradle b/samples/client/petstore/kotlin-nonpublic/build.gradle index 260bd6bda6e..bb575e6e4bf 100644 --- a/samples/client/petstore/kotlin-nonpublic/build.gradle +++ b/samples/client/petstore/kotlin-nonpublic/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,9 +28,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-nullable/build.gradle b/samples/client/petstore/kotlin-nullable/build.gradle index 260bd6bda6e..bb575e6e4bf 100644 --- a/samples/client/petstore/kotlin-nullable/build.gradle +++ b/samples/client/petstore/kotlin-nullable/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,9 +28,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-okhttp3/build.gradle b/samples/client/petstore/kotlin-okhttp3/build.gradle index e872269b3fb..4d9f2f630d4 100644 --- a/samples/client/petstore/kotlin-okhttp3/build.gradle +++ b/samples/client/petstore/kotlin-okhttp3/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,9 +28,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:3.12.13" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:3.12.13" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle index f7a6d02171e..60257e31601 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle @@ -7,8 +7,8 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' - ext.retrofitVersion = '2.7.2' + ext.kotlin_version = '1.5.10' + ext.retrofitVersion = '2.9.0' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -31,14 +31,14 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1" - 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.retrofit2:retrofit:$retrofitVersion" - compile "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0" - compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1" + implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" + implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" + implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0" + implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt index 93adbda3fc9..aa70ca9d2f1 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt @@ -13,14 +13,13 @@ import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.toRequestBody class OAuthOkHttpClient( - private var client: OkHttpClient + private var client: OkHttpClient = OkHttpClient() ) : HttpClient { - constructor() : this(OkHttpClient()) - @Throws(OAuthSystemException::class, OAuthProblemException::class) override fun execute( request: OAuthClientRequest, @@ -39,7 +38,7 @@ class OAuthOkHttpClient( } } - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null + val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null requestBuilder.method(requestMethod, body) try { @@ -48,6 +47,7 @@ class OAuthOkHttpClient( response.body?.string(), response.body?.contentType()?.toString(), response.code, + response.headers.toMultimap(), responseClass) } catch (e: IOException) { throw OAuthSystemException(e) diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle b/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle index 3ddd8d97e8f..2f5e94a4fcd 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle @@ -7,9 +7,9 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' - ext.retrofitVersion = '2.7.2' - ext.rxJava3Version = '3.0.10' + ext.kotlin_version = '1.5.10' + ext.retrofitVersion = '2.9.0' + ext.rxJava3Version = '3.0.12' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,15 +30,15 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" - compile "com.squareup.okhttp3:logging-interceptor:4.9.0" - compile "io.reactivex.rxjava3:rxjava:$rxJava3Version" - compile "com.squareup.retrofit2:adapter-rxjava3:2.9.0" - compile "com.squareup.retrofit2:retrofit:$retrofitVersion" - compile "com.squareup.retrofit2:converter-moshi:$retrofitVersion" - compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" + implementation "io.reactivex.rxjava3:rxjava:$rxJava3Version" + implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0" + implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt index 93adbda3fc9..aa70ca9d2f1 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt @@ -13,14 +13,13 @@ import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.toRequestBody class OAuthOkHttpClient( - private var client: OkHttpClient + private var client: OkHttpClient = OkHttpClient() ) : HttpClient { - constructor() : this(OkHttpClient()) - @Throws(OAuthSystemException::class, OAuthProblemException::class) override fun execute( request: OAuthClientRequest, @@ -39,7 +38,7 @@ class OAuthOkHttpClient( } } - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null + val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null requestBuilder.method(requestMethod, body) try { @@ -48,6 +47,7 @@ class OAuthOkHttpClient( response.body?.string(), response.body?.contentType()?.toString(), response.code, + response.headers.toMultimap(), responseClass) } catch (e: IOException) { throw OAuthSystemException(e) diff --git a/samples/client/petstore/kotlin-retrofit2/build.gradle b/samples/client/petstore/kotlin-retrofit2/build.gradle index 6674970e550..ec9a8e9ac24 100644 --- a/samples/client/petstore/kotlin-retrofit2/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2/build.gradle @@ -7,8 +7,8 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' - ext.retrofitVersion = '2.7.2' + ext.kotlin_version = '1.5.10' + ext.retrofitVersion = '2.9.0' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -29,13 +29,13 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.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.retrofit2:retrofit:$retrofitVersion" - compile "com.squareup.retrofit2:converter-moshi:$retrofitVersion" - compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" + implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt index 93adbda3fc9..aa70ca9d2f1 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt @@ -13,14 +13,13 @@ import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.toRequestBody class OAuthOkHttpClient( - private var client: OkHttpClient + private var client: OkHttpClient = OkHttpClient() ) : HttpClient { - constructor() : this(OkHttpClient()) - @Throws(OAuthSystemException::class, OAuthProblemException::class) override fun execute( request: OAuthClientRequest, @@ -39,7 +38,7 @@ class OAuthOkHttpClient( } } - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null + val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null requestBuilder.method(requestMethod, body) try { @@ -48,6 +47,7 @@ class OAuthOkHttpClient( response.body?.string(), response.body?.contentType()?.toString(), response.code, + response.headers.toMultimap(), responseClass) } catch (e: IOException) { throw OAuthSystemException(e) diff --git a/samples/client/petstore/kotlin-string/build.gradle b/samples/client/petstore/kotlin-string/build.gradle index 260bd6bda6e..bb575e6e4bf 100644 --- a/samples/client/petstore/kotlin-string/build.gradle +++ b/samples/client/petstore/kotlin-string/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,9 +28,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-threetenbp/build.gradle b/samples/client/petstore/kotlin-threetenbp/build.gradle index 1d988072386..b4e0d0acc7a 100644 --- a/samples/client/petstore/kotlin-threetenbp/build.gradle +++ b/samples/client/petstore/kotlin-threetenbp/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,10 +28,10 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - compile "org.threeten:threetenbp:1.5.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "org.threeten:threetenbp:1.5.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin-uppercase-enum/build.gradle b/samples/client/petstore/kotlin-uppercase-enum/build.gradle index 260bd6bda6e..bb575e6e4bf 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/build.gradle +++ b/samples/client/petstore/kotlin-uppercase-enum/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,9 +28,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/samples/client/petstore/kotlin/build.gradle b/samples/client/petstore/kotlin/build.gradle index 260bd6bda6e..bb575e6e4bf 100644 --- a/samples/client/petstore/kotlin/build.gradle +++ b/samples/client/petstore/kotlin/build.gradle @@ -7,7 +7,7 @@ wrapper { } buildscript { - ext.kotlin_version = '1.5.0' + ext.kotlin_version = '1.5.10' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -28,9 +28,9 @@ test { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - compile "com.squareup.moshi:moshi-kotlin:1.11.0" - compile "com.squareup.okhttp3:okhttp:4.9.0" - testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.12.0" + implementation "com.squareup.okhttp3:okhttp:4.9.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" }