From 22fe45dc22f022241b03df5aaf1c4cb3f2f68920 Mon Sep 17 00:00:00 2001 From: manujell73 Date: Wed, 20 May 2026 23:24:22 +0200 Subject: [PATCH 1/2] feat(kotlin-client): support dynamic auth credentials for okhttp client (#23835) --- .../resources/kotlin-client/api_doc.mustache | 32 +++++++-- .../infrastructure/ApiClient.kt.mustache | 18 +++-- .../kotlin-jvm-okhttp/docs/AuthApi.md | 22 ++++-- .../client/infrastructure/ApiClient.kt | 14 ++-- .../docs/AuthApi.md | 22 ++++-- .../docs/AuthApi.md | 22 ++++-- .../client/infrastructure/ApiClient.kt | 3 + .../docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../client/infrastructure/ApiClient.kt | 3 + .../docs/StuffApi.md | 10 ++- .../client/infrastructure/ApiClient.kt | 7 +- .../client/infrastructure/ApiClient.kt | 3 + .../client/infrastructure/ApiClient.kt | 3 + .../client/infrastructure/ApiClient.kt | 3 + .../client/infrastructure/ApiClient.kt | 3 + .../client/infrastructure/ApiClient.kt | 3 + .../client/infrastructure/ApiClient.kt | 3 + .../client/infrastructure/ApiClient.kt | 3 + .../client/infrastructure/ApiClient.kt | 3 + .../petstore/kotlin-explicit/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../petstore/kotlin-gson/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../petstore/kotlin-jackson/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../kotlin-json-request-string/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../kotlin-jvm-ktor-gson/docs/FakeApi.md | 10 ++- .../kotlin-jvm-ktor-gson/docs/PetApi.md | 70 +++++++++++++++---- .../kotlin-jvm-ktor-jackson/docs/PetApi.md | 70 +++++++++++++++---- .../docs/PetApi.md | 70 +++++++++++++++---- .../docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../docs/PetApi.md | 70 +++++++++++++++---- .../docs/PetApi.md | 70 +++++++++++++++---- .../docs/PetApi.md | 70 +++++++++++++++---- .../kotlin-jvm-vertx-gson/docs/PetApi.md | 70 +++++++++++++++---- .../docs/PetApi.md | 70 +++++++++++++++---- .../kotlin-jvm-vertx-jackson/docs/PetApi.md | 70 +++++++++++++++---- .../kotlin-jvm-vertx-moshi/docs/PetApi.md | 70 +++++++++++++++---- .../kotlin-kotlinx-datetime/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../kotlin-modelMutable/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../kotlin-moshi-codegen/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../docs/PetApi.md | 70 +++++++++++++++---- .../kotlin-multiplatform/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 3 + .../petstore/kotlin-nonpublic/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../petstore/kotlin-nullable/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../petstore/kotlin-string/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../petstore/kotlin-threetenbp/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- .../client/infrastructure/ApiClient.kt | 3 + samples/client/petstore/kotlin/docs/PetApi.md | 70 +++++++++++++++---- .../client/infrastructure/ApiClient.kt | 7 +- 61 files changed, 1679 insertions(+), 432 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache index a997cafd1621..92f59886abae 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache @@ -68,18 +68,36 @@ Configure {{name}}: {{/isApiKey}} {{#isBasic}} {{#isBasicBasic}} -Configure {{name}}: - ApiClient.username = "" - ApiClient.password = "" +Configure {{name}} statically: +```kotlin +ApiClient.username = "" +ApiClient.password = "" +``` +Configure {{name}} dynamically: +```kotlin +{{{classname}}}().userCredentialProvider = { "user" to "pass" } +``` {{/isBasicBasic}} {{#isBasicBearer}} -Configure {{name}}: - ApiClient.accessToken = "" +Configure {{name}} statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure {{name}} dynamically: +```kotlin +{{{classname}}}().accessTokenProvider = { "" } +``` {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} -Configure {{name}}: - ApiClient.accessToken = "" +Configure {{name}} statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure {{name}} dynamically: +```kotlin +{{{classname}}}().accessTokenProvider = { "" } +``` {{/isOAuth}} {{/authMethods}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache index 3dd83f71487a..6ef2ffec7051 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache @@ -148,6 +148,9 @@ import com.squareup.moshi.adapter {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val userCredentialsProvider: () -> Pair = { username to password } + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -460,25 +463,26 @@ import com.squareup.moshi.adapter {{#isBasic}} {{#isBasicBasic}} if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - username?.let { username -> - password?.let { password -> - requestConfig.headers[AUTHORIZATION] = okhttp3.Credentials.basic(username, password) + val (user, passw) = userCredentialsProvider() + user?.let { user -> + passw?.let { passw -> + requestConfig.headers[AUTHORIZATION] = okhttp3.Credentials.basic(user, passw) } } } {{/isBasicBasic}} {{#isBasicBearer}} if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken" + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token" } } {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } {{/isOAuth}} diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md b/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md index 2614b18e353a..5a301452111e 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md +++ b/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md @@ -45,9 +45,15 @@ This endpoint does not need any parameter. ### Authorization -Configure http_auth: - ApiClient.username = "" - ApiClient.password = "" +Configure http_auth statically: +```kotlin +ApiClient.username = "" +ApiClient.password = "" +``` +Configure http_auth dynamically: +```kotlin +AuthApi().userCredentialProvider = { "user" to "pass" } +``` ### HTTP request headers @@ -91,8 +97,14 @@ This endpoint does not need any parameter. ### Authorization -Configure http_bearer_auth: - ApiClient.accessToken = "" +Configure http_bearer_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure http_bearer_auth dynamically: +```kotlin +AuthApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 75def196d6e1..56258bc6610e 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,15 +360,16 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - username?.let { username -> - password?.let { password -> - requestConfig.headers[AUTHORIZATION] = okhttp3.Credentials.basic(username, password) + val (user, passw) = userCredentialsProvider() + user?.let { user -> + passw?.let { passw -> + requestConfig.headers[AUTHORIZATION] = okhttp3.Credentials.basic(user, passw) } } } if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken" + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token" } } } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md index 2614b18e353a..5a301452111e 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md @@ -45,9 +45,15 @@ This endpoint does not need any parameter. ### Authorization -Configure http_auth: - ApiClient.username = "" - ApiClient.password = "" +Configure http_auth statically: +```kotlin +ApiClient.username = "" +ApiClient.password = "" +``` +Configure http_auth dynamically: +```kotlin +AuthApi().userCredentialProvider = { "user" to "pass" } +``` ### HTTP request headers @@ -91,8 +97,14 @@ This endpoint does not need any parameter. ### Authorization -Configure http_bearer_auth: - ApiClient.accessToken = "" +Configure http_bearer_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure http_bearer_auth dynamically: +```kotlin +AuthApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md index 2614b18e353a..5a301452111e 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md @@ -45,9 +45,15 @@ This endpoint does not need any parameter. ### Authorization -Configure http_auth: - ApiClient.username = "" - ApiClient.password = "" +Configure http_auth statically: +```kotlin +ApiClient.username = "" +ApiClient.password = "" +``` +Configure http_auth dynamically: +```kotlin +AuthApi().userCredentialProvider = { "user" to "pass" } +``` ### HTTP request headers @@ -91,8 +97,14 @@ This endpoint does not need any parameter. ### Authorization -Configure http_bearer_auth: - ApiClient.accessToken = "" +Configure http_bearer_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure http_bearer_auth dynamically: +```kotlin +AuthApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md index e0bf879c9a65..205f5b4d209b 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 6ce203cc15e2..8a562c318fd6 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md b/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md index 5208c69e8d44..0f4cdd3a50cd 100644 --- a/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md +++ b/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md @@ -44,8 +44,14 @@ This endpoint does not need any parameter. ### Authorization -Configure bearerAuth: - ApiClient.accessToken = "" +Configure bearerAuth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure bearerAuth dynamically: +```kotlin +StuffApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 9c0e379663b8..403ce886df49 100644 --- a/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken" + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token" } } } diff --git a/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 5ae765ef16bd..50835528b690 100644 --- a/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -120,6 +120,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-explicit/docs/PetApi.md b/samples/client/petstore/kotlin-explicit/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin-explicit/docs/PetApi.md +++ b/samples/client/petstore/kotlin-explicit/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 8dde76474b55..d4fe3f2e82e9 100644 --- a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ public open class ApiClient(public val baseUrl: String, public val client: Call. public val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + public val userCredentialsProvider: () -> Pair = { username to password } + public val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ public open class ApiClient(public val baseUrl: String, public val client: Call. protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-gson/docs/PetApi.md b/samples/client/petstore/kotlin-gson/docs/PetApi.md index e0bf879c9a65..205f5b4d209b 100644 --- a/samples/client/petstore/kotlin-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-gson/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d6f907f7947c..a1d52329d1a1 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -356,8 +359,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jackson/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jackson/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 18912784874d..af5c25da5758 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -356,8 +359,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md index 318ca7c9e1e9..559e7cb12e10 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -192,8 +210,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -286,8 +310,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -335,8 +365,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -385,8 +421,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 44ee00b60b08..fcda28c84aaa 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -121,6 +121,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -364,8 +367,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md index 5d6e47a6f2b3..b401e7fee2c5 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md @@ -96,8 +96,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +FakeApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md index 0a13a8fa8ce3..ff1d656785ba 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md index 0b928e328e60..23e56a9e4710 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md index 0a13a8fa8ce3..ff1d656785ba 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index f4b11927a365..593bce881b46 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -122,6 +122,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -359,8 +362,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md index 9eb15f0e7013..59060a7c814d 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md index 9eb15f0e7013..59060a7c814d 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md index 9eb15f0e7013..59060a7c814d 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md index 9eb15f0e7013..59060a7c814d 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md index 9eb15f0e7013..59060a7c814d 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md index 9eb15f0e7013..59060a7c814d 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md index 9eb15f0e7013..59060a7c814d 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md @@ -54,8 +54,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -103,8 +109,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -151,8 +163,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -199,8 +217,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -296,8 +320,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -347,8 +377,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -399,8 +435,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md b/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md +++ b/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3f8f02e86937..ce718d987cf5 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md b/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md index e385754514fb..e08fa441ba2f 100644 --- a/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md +++ b/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3f8f02e86937..ce718d987cf5 100644 --- a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3f8f02e86937..ce718d987cf5 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md index 0b928e328e60..23e56a9e4710 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md b/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md index 0b928e328e60..23e56a9e4710 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 0197390a824a..ada718e5b777 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index aff54eb43a1b..d0701121d948 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ internal open class ApiClient(val baseUrl: String, val client: Call.Factory = de val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ internal open class ApiClient(val baseUrl: String, val client: Call.Factory = de protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-nullable/docs/PetApi.md b/samples/client/petstore/kotlin-nullable/docs/PetApi.md index c34fce5f4a46..9536f0e78883 100644 --- a/samples/client/petstore/kotlin-nullable/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nullable/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3f8f02e86937..ce718d987cf5 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-string/docs/PetApi.md b/samples/client/petstore/kotlin-string/docs/PetApi.md index ea42a0d82f60..930fa13e0d5a 100644 --- a/samples/client/petstore/kotlin-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-string/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3f8f02e86937..ce718d987cf5 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 8f316e316b2e..4e10972b702d 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 5ae765ef16bd..50835528b690 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -120,6 +120,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * diff --git a/samples/client/petstore/kotlin/docs/PetApi.md b/samples/client/petstore/kotlin/docs/PetApi.md index 6856ea516dab..4a8a35042ae9 100644 --- a/samples/client/petstore/kotlin/docs/PetApi.md +++ b/samples/client/petstore/kotlin/docs/PetApi.md @@ -51,8 +51,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -98,8 +104,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -146,8 +158,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -194,8 +212,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -288,8 +312,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -337,8 +367,14 @@ null (empty response body) ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers @@ -387,8 +423,14 @@ try { ### Authorization -Configure petstore_auth: - ApiClient.accessToken = "" +Configure petstore_auth statically: +```kotlin +ApiClient.accessToken = "" +``` +Configure petstore_auth dynamically: +```kotlin +PetApi().accessTokenProvider = { "" } +``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 3f8f02e86937..ce718d987cf5 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,6 +119,9 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } + val userCredentialsProvider: () -> Pair = { username to password } + val accessTokenProvider: () -> String? = { accessToken } + /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). * @@ -357,8 +360,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie protected fun updateAuthParams(requestConfig: RequestConfig) { if (requestConfig.headers[AUTHORIZATION].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[AUTHORIZATION] = "Bearer $accessToken " + accessTokenProvider()?.let { token -> + requestConfig.headers[AUTHORIZATION] = "Bearer $token " } } if (requestConfig.headers["api_key"].isNullOrEmpty()) { From 9f56ca8e5832a48a027340bbb1b37321a706a947 Mon Sep 17 00:00:00 2001 From: manujell73 Date: Thu, 21 May 2026 09:28:07 +0200 Subject: [PATCH 2/2] fix(Kotlin): make the credential providers assignable and fix docs (#23822) --- .../resources/kotlin-client/api_doc.mustache | 14 +++++++--- .../infrastructure/ApiClient.kt.mustache | 4 +-- .../kotlin-jvm-okhttp/docs/AuthApi.md | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../docs/AuthApi.md | 8 ------ .../docs/AuthApi.md | 8 ------ .../client/infrastructure/ApiClient.kt | 4 +-- .../docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../docs/StuffApi.md | 2 +- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- .../petstore/kotlin-explicit/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../petstore/kotlin-gson/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../petstore/kotlin-jackson/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../kotlin-json-request-string/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../kotlin-jvm-ktor-gson/docs/FakeApi.md | 4 --- .../kotlin-jvm-ktor-gson/docs/PetApi.md | 28 ------------------- .../kotlin-jvm-ktor-jackson/docs/PetApi.md | 28 ------------------- .../docs/PetApi.md | 28 ------------------- .../docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../docs/PetApi.md | 28 ------------------- .../docs/PetApi.md | 28 ------------------- .../docs/PetApi.md | 28 ------------------- .../kotlin-jvm-vertx-gson/docs/PetApi.md | 28 ------------------- .../docs/PetApi.md | 28 ------------------- .../kotlin-jvm-vertx-jackson/docs/PetApi.md | 28 ------------------- .../kotlin-jvm-vertx-moshi/docs/PetApi.md | 28 ------------------- .../kotlin-kotlinx-datetime/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../kotlin-modelMutable/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../kotlin-moshi-codegen/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../docs/PetApi.md | 28 ------------------- .../kotlin-multiplatform/docs/PetApi.md | 28 ------------------- .../client/infrastructure/ApiClient.kt | 4 +-- .../petstore/kotlin-nonpublic/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../petstore/kotlin-nullable/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../petstore/kotlin-string/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../petstore/kotlin-threetenbp/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- .../client/infrastructure/ApiClient.kt | 4 +-- samples/client/petstore/kotlin/docs/PetApi.md | 14 +++++----- .../client/infrastructure/ApiClient.kt | 4 +-- 61 files changed, 169 insertions(+), 519 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache index 92f59886abae..d8dcd68632cc 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/api_doc.mustache @@ -73,20 +73,24 @@ Configure {{name}} statically: ApiClient.username = "" ApiClient.password = "" ``` +{{#jvm-okhttp}} Configure {{name}} dynamically: ```kotlin -{{{classname}}}().userCredentialProvider = { "user" to "pass" } +apiInstance.userCredentialProvider = { "user" to "pass" } ``` +{{/jvm-okhttp}} {{/isBasicBasic}} {{#isBasicBearer}} Configure {{name}} statically: ```kotlin ApiClient.accessToken = "" ``` +{{#jvm-okhttp}} Configure {{name}} dynamically: ```kotlin -{{{classname}}}().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` +{{/jvm-okhttp}} {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} @@ -94,10 +98,12 @@ Configure {{name}} statically: ```kotlin ApiClient.accessToken = "" ``` +{{#jvm-okhttp}} Configure {{name}} dynamically: ```kotlin -{{{classname}}}().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` +{{/jvm-okhttp}} {{/isOAuth}} {{/authMethods}} @@ -107,4 +113,4 @@ Configure {{name}} dynamically: - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} {{/operation}} -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache index 6ef2ffec7051..c657675bb99c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache @@ -148,8 +148,8 @@ import com.squareup.moshi.adapter {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val userCredentialsProvider: () -> Pair = { username to password } - {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}val accessTokenProvider: () -> String? = { accessToken } + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}var userCredentialsProvider: () -> Pair = { username to password } + {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md b/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md index 5a301452111e..df299d51a1a2 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md +++ b/samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md @@ -52,7 +52,7 @@ ApiClient.password = "" ``` Configure http_auth dynamically: ```kotlin -AuthApi().userCredentialProvider = { "user" to "pass" } +apiInstance.userCredentialProvider = { "user" to "pass" } ``` ### HTTP request headers @@ -103,7 +103,7 @@ ApiClient.accessToken = "" ``` Configure http_bearer_auth dynamically: ```kotlin -AuthApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 56258bc6610e..d678c810e35f 100644 --- a/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/echo_api/kotlin-jvm-okhttp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md index 5a301452111e..185917cb7c25 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md @@ -50,10 +50,6 @@ Configure http_auth statically: ApiClient.username = "" ApiClient.password = "" ``` -Configure http_auth dynamically: -```kotlin -AuthApi().userCredentialProvider = { "user" to "pass" } -``` ### HTTP request headers @@ -101,10 +97,6 @@ Configure http_bearer_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure http_bearer_auth dynamically: -```kotlin -AuthApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md index 5a301452111e..185917cb7c25 100644 --- a/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md +++ b/samples/client/echo_api/kotlin-jvm-spring-3-webclient/docs/AuthApi.md @@ -50,10 +50,6 @@ Configure http_auth statically: ApiClient.username = "" ApiClient.password = "" ``` -Configure http_auth dynamically: -```kotlin -AuthApi().userCredentialProvider = { "user" to "pass" } -``` ### HTTP request headers @@ -101,10 +97,6 @@ Configure http_bearer_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure http_bearer_auth dynamically: -```kotlin -AuthApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md index 205f5b4d209b..38e8d3e890a5 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/docs/PetApi.md @@ -60,7 +60,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -115,7 +115,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -169,7 +169,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -223,7 +223,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -326,7 +326,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -383,7 +383,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -441,7 +441,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 8a562c318fd6..5debecf8c25b 100644 --- a/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-jvm-okhttp-non-ascii-headers/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md b/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md index 0f4cdd3a50cd..777d2a049b31 100644 --- a/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md +++ b/samples/client/others/kotlin-jvm-okhttp-path-comments/docs/StuffApi.md @@ -50,7 +50,7 @@ ApiClient.accessToken = "" ``` Configure bearerAuth dynamically: ```kotlin -StuffApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 403ce886df49..93bef21acd1a 100644 --- a/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/others/kotlin-jvm-okhttp-path-comments/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 50835528b690..b28f0b001886 100644 --- a/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-allOf-discriminator-kotlinx-serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -120,8 +120,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-allOf-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-array-integer-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-array-nullable-items/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-explicit/docs/PetApi.md b/samples/client/petstore/kotlin-explicit/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin-explicit/docs/PetApi.md +++ b/samples/client/petstore/kotlin-explicit/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d4fe3f2e82e9..b77ffdbfb22e 100644 --- a/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ public open class ApiClient(public val baseUrl: String, public val client: Call. public val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - public val userCredentialsProvider: () -> Pair = { username to password } - public val accessTokenProvider: () -> String? = { accessToken } + public var userCredentialsProvider: () -> Pair = { username to password } + public var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-gson/docs/PetApi.md b/samples/client/petstore/kotlin-gson/docs/PetApi.md index 205f5b4d209b..38e8d3e890a5 100644 --- a/samples/client/petstore/kotlin-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-gson/docs/PetApi.md @@ -60,7 +60,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -115,7 +115,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -169,7 +169,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -223,7 +223,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -326,7 +326,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -383,7 +383,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -441,7 +441,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index a1d52329d1a1..0be2f0b3bd69 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jackson/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jackson/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index af5c25da5758..2abbb30eb798 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md index 559e7cb12e10..3bebda4ecd49 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -216,7 +216,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -316,7 +316,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -371,7 +371,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -427,7 +427,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index fcda28c84aaa..c4289daa1493 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -121,8 +121,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md index b401e7fee2c5..c3412b1b0015 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md @@ -100,10 +100,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -FakeApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md index ff1d656785ba..b75318d1bc72 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md index 23e56a9e4710..bf941538de6c 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/docs/PetApi.md @@ -55,10 +55,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -108,10 +104,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -162,10 +154,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -216,10 +204,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -316,10 +300,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -371,10 +351,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -427,10 +403,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md index ff1d656785ba..b75318d1bc72 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 593bce881b46..9ec489f5ae54 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -122,8 +122,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md index 59060a7c814d..c185d4179761 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md index 59060a7c814d..c185d4179761 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md index 59060a7c814d..c185d4179761 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md index 59060a7c814d..c185d4179761 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md index 59060a7c814d..c185d4179761 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md index 59060a7c814d..c185d4179761 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md index 59060a7c814d..c185d4179761 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/docs/PetApi.md @@ -58,10 +58,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -113,10 +109,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -167,10 +159,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -221,10 +209,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -324,10 +308,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -381,10 +361,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -439,10 +415,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md b/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md +++ b/samples/client/petstore/kotlin-kotlinx-datetime/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ce718d987cf5..55f11cac9d72 100644 --- a/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md b/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md index e08fa441ba2f..1867aec4a0bc 100644 --- a/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md +++ b/samples/client/petstore/kotlin-modelMutable/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ce718d987cf5..55f11cac9d72 100644 --- a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ce718d987cf5..55f11cac9d72 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md index 23e56a9e4710..bf941538de6c 100644 --- a/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md +++ b/samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/docs/PetApi.md @@ -55,10 +55,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -108,10 +104,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -162,10 +154,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -216,10 +204,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -316,10 +300,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -371,10 +351,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -427,10 +403,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md b/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md index 23e56a9e4710..bf941538de6c 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md @@ -55,10 +55,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -108,10 +104,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -162,10 +154,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -216,10 +204,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -316,10 +300,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -371,10 +351,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers @@ -427,10 +403,6 @@ Configure petstore_auth statically: ```kotlin ApiClient.accessToken = "" ``` -Configure petstore_auth dynamically: -```kotlin -PetApi().accessTokenProvider = { "" } -``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ada718e5b777..88bc9ba0a7e3 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d0701121d948..eb0c4fa8d3f0 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ internal open class ApiClient(val baseUrl: String, val client: Call.Factory = de val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-nullable/docs/PetApi.md b/samples/client/petstore/kotlin-nullable/docs/PetApi.md index 9536f0e78883..5ca7d71d8184 100644 --- a/samples/client/petstore/kotlin-nullable/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nullable/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ce718d987cf5..55f11cac9d72 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-string/docs/PetApi.md b/samples/client/petstore/kotlin-string/docs/PetApi.md index 930fa13e0d5a..2fd292cbf9e0 100644 --- a/samples/client/petstore/kotlin-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-string/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ce718d987cf5..55f11cac9d72 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 4e10972b702d..ef9cb9e15418 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 50835528b690..b28f0b001886 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -120,8 +120,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream"). diff --git a/samples/client/petstore/kotlin/docs/PetApi.md b/samples/client/petstore/kotlin/docs/PetApi.md index 4a8a35042ae9..630fc891638b 100644 --- a/samples/client/petstore/kotlin/docs/PetApi.md +++ b/samples/client/petstore/kotlin/docs/PetApi.md @@ -57,7 +57,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -110,7 +110,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -164,7 +164,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -218,7 +218,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -318,7 +318,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -373,7 +373,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers @@ -429,7 +429,7 @@ ApiClient.accessToken = "" ``` Configure petstore_auth dynamically: ```kotlin -PetApi().accessTokenProvider = { "" } +apiInstance.accessTokenProvider = { "" } ``` ### HTTP request headers diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index ce718d987cf5..55f11cac9d72 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -119,8 +119,8 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie val builder: OkHttpClient.Builder = OkHttpClient.Builder() } - val userCredentialsProvider: () -> Pair = { username to password } - val accessTokenProvider: () -> String? = { accessToken } + var userCredentialsProvider: () -> Pair = { username to password } + var accessTokenProvider: () -> String? = { accessToken } /** * Guess Content-Type header from the given byteArray (defaults to "application/octet-stream").