From 2f8ef97ea7030c6933a95a52a085d5f807864943 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@gmail.com> Date: Mon, 7 Oct 2019 12:02:45 +0100 Subject: [PATCH 1/6] [kotlin] add option for non public api --- bin/kotlin-client-nonpublic.sh | 34 ++ .../languages/AbstractKotlinCodegen.java | 17 + .../main/resources/kotlin-client/api.mustache | 2 +- .../kotlin-client/data_class.mustache | 6 +- .../kotlin-client/enum_class.mustache | 4 +- .../ApiAbstractions.kt.mustache | 8 +- .../infrastructure/RequestConfig.kt.mustache | 2 +- .../infrastructure/RequestMethod.kt.mustache | 2 +- .../jvm/infrastructure/ApiClient.kt.mustache | 4 +- .../ApiInfrastructureResponse.kt.mustache | 14 +- .../ApplicationDelegates.kt.mustache | 2 +- .../ByteArrayAdapter.kt.mustache | 2 +- .../jvm/infrastructure/Errors.kt.mustache | 4 +- .../LocalDateAdapter.kt.mustache | 2 +- .../LocalDateTimeAdapter.kt.mustache | 2 +- .../ResponseExtensions.kt.mustache | 8 +- .../jvm/infrastructure/Serializer.kt.mustache | 2 +- .../infrastructure/UUIDAdapter.kt.mustache | 2 +- .../libraries/multiplatform/api.mustache | 4 +- .../infrastructure/ApiClient.kt.mustache | 4 +- .../infrastructure/HttpResponse.kt.mustache | 14 +- .../kotlin-client/visibility.mustache | 1 + .../org/openapitools/client/apis/PetApi.kt | 4 +- .../org/openapitools/client/apis/StoreApi.kt | 4 +- .../org/openapitools/client/apis/UserApi.kt | 4 +- .../client/infrastructure/ApiAbstractions.kt | 8 +- .../client/infrastructure/ApiClient.kt | 4 +- .../client/infrastructure/HttpResponse.kt | 14 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../openapitools/client/models/ApiResponse.kt | 2 +- .../openapitools/client/models/Category.kt | 2 +- .../org/openapitools/client/models/Order.kt | 6 +- .../org/openapitools/client/models/Pet.kt | 6 +- .../org/openapitools/client/models/Tag.kt | 2 +- .../org/openapitools/client/models/User.kt | 2 +- .../.openapi-generator-ignore | 23 + .../.openapi-generator/VERSION | 1 + .../petstore/kotlin-nonpublic/README.md | 90 ++++ .../petstore/kotlin-nonpublic/build.gradle | 37 ++ .../kotlin-nonpublic/docs/ApiResponse.md | 12 + .../kotlin-nonpublic/docs/Category.md | 11 + .../petstore/kotlin-nonpublic/docs/Order.md | 22 + .../petstore/kotlin-nonpublic/docs/Pet.md | 22 + .../petstore/kotlin-nonpublic/docs/PetApi.md | 405 ++++++++++++++++++ .../kotlin-nonpublic/docs/StoreApi.md | 196 +++++++++ .../petstore/kotlin-nonpublic/docs/Tag.md | 11 + .../petstore/kotlin-nonpublic/docs/User.md | 17 + .../petstore/kotlin-nonpublic/docs/UserApi.md | 376 ++++++++++++++++ .../petstore/kotlin-nonpublic/settings.gradle | 2 + .../org/openapitools/client/apis/PetApi.kt | 280 ++++++++++++ .../org/openapitools/client/apis/StoreApi.kt | 152 +++++++ .../org/openapitools/client/apis/UserApi.kt | 273 ++++++++++++ .../client/infrastructure/ApiAbstractions.kt | 23 + .../client/infrastructure/ApiClient.kt | 170 ++++++++ .../ApiInfrastructureResponse.kt | 40 ++ .../infrastructure/ApplicationDelegates.kt | 29 ++ .../client/infrastructure/ByteArrayAdapter.kt | 12 + .../client/infrastructure/Errors.kt | 42 ++ .../client/infrastructure/LocalDateAdapter.kt | 19 + .../infrastructure/LocalDateTimeAdapter.kt | 19 + .../client/infrastructure/RequestConfig.kt | 16 + .../client/infrastructure/RequestMethod.kt | 8 + .../infrastructure/ResponseExtensions.kt | 23 + .../client/infrastructure/Serializer.kt | 18 + .../client/infrastructure/UUIDAdapter.kt | 13 + .../openapitools/client/models/ApiResponse.kt | 33 ++ .../openapitools/client/models/Category.kt | 30 ++ .../org/openapitools/client/models/Order.kt | 62 +++ .../org/openapitools/client/models/Pet.kt | 64 +++ .../org/openapitools/client/models/Tag.kt | 30 ++ .../org/openapitools/client/models/User.kt | 49 +++ .../org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 +- .../client/infrastructure/ApiClient.kt | 4 +- .../ApiInfrastructureResponse.kt | 14 +- .../infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../client/infrastructure/Errors.kt | 4 +- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../infrastructure/ResponseExtensions.kt | 8 +- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../openapitools/client/models/ApiResponse.kt | 2 +- .../openapitools/client/models/Category.kt | 2 +- .../org/openapitools/client/models/Order.kt | 4 +- .../org/openapitools/client/models/Pet.kt | 4 +- .../org/openapitools/client/models/Tag.kt | 2 +- .../org/openapitools/client/models/User.kt | 2 +- .../org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 +- .../client/infrastructure/ApiClient.kt | 4 +- .../ApiInfrastructureResponse.kt | 14 +- .../infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../client/infrastructure/Errors.kt | 4 +- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../infrastructure/ResponseExtensions.kt | 8 +- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../openapitools/client/models/ApiResponse.kt | 2 +- .../openapitools/client/models/Category.kt | 2 +- .../org/openapitools/client/models/Order.kt | 4 +- .../org/openapitools/client/models/Pet.kt | 4 +- .../org/openapitools/client/models/Tag.kt | 2 +- .../org/openapitools/client/models/User.kt | 2 +- .../org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 +- .../client/infrastructure/ApiClient.kt | 4 +- .../ApiInfrastructureResponse.kt | 14 +- .../infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../client/infrastructure/Errors.kt | 4 +- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../infrastructure/ResponseExtensions.kt | 8 +- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../openapitools/client/models/ApiResponse.kt | 2 +- .../openapitools/client/models/Category.kt | 2 +- .../org/openapitools/client/models/Order.kt | 4 +- .../org/openapitools/client/models/Pet.kt | 4 +- .../org/openapitools/client/models/Tag.kt | 2 +- .../org/openapitools/client/models/User.kt | 2 +- 138 files changed, 2871 insertions(+), 189 deletions(-) create mode 100755 bin/kotlin-client-nonpublic.sh create mode 100644 modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache create mode 100644 samples/client/petstore/kotlin-nonpublic/.openapi-generator-ignore create mode 100644 samples/client/petstore/kotlin-nonpublic/.openapi-generator/VERSION create mode 100644 samples/client/petstore/kotlin-nonpublic/README.md create mode 100644 samples/client/petstore/kotlin-nonpublic/build.gradle create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/Category.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/Order.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/Pet.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/PetApi.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/Tag.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/User.md create mode 100644 samples/client/petstore/kotlin-nonpublic/docs/UserApi.md create mode 100644 samples/client/petstore/kotlin-nonpublic/settings.gradle create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt diff --git a/bin/kotlin-client-nonpublic.sh b/bin/kotlin-client-nonpublic.sh new file mode 100755 index 000000000000..620a6fe3c8cc --- /dev/null +++ b/bin/kotlin-client-nonpublic.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=$(ls -ld "$SCRIPT") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=$(dirname "$SCRIPT")/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=$(dirname "$SCRIPT")/.. + APP_DIR=$(cd "${APP_DIR}"; pwd) +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-nonpublic --additional-properties nonPublicApi=true -o samples/client/petstore/kotlin-nonpublic $@" + +java ${JAVA_OPTS} -jar ${executable} ${ags} + +cp CI/samples.ci/client/petstore/kotlin-string/pom.xml samples/client/petstore/kotlin-string/pom.xml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index da9f4f14192c..cb0df1bc8adf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -56,6 +56,8 @@ public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson} protected boolean serializableModel = false; + protected boolean nonPublicApi = false; + protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase; protected SERIALIZATION_LIBRARY_TYPE serializationLibrary = SERIALIZATION_LIBRARY_TYPE.moshi; @@ -426,6 +428,12 @@ public void processOpts() { additionalProperties.put(CodegenConstants.PARCELIZE_MODELS, parcelizeModels); } + if (additionalProperties.containsKey(CodegenConstants.NON_PUBLIC_API)) { + this.setNonPublicApi(Boolean.valueOf((String) additionalProperties.get(CodegenConstants.NON_PUBLIC_API))); + } else { + additionalProperties.put(CodegenConstants.NON_PUBLIC_API, nonPublicApi); + } + additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage()); additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage()); @@ -476,6 +484,15 @@ public boolean isSerializableModel() { public void setSerializableModel(boolean serializableModel) { this.serializableModel = serializableModel; } + + public boolean nonPublicApi() { + return nonPublicApi; + } + + public void setNonPublicApi(boolean nonPublicApi) { + this.nonPublicApi = nonPublicApi; + } + /** * Return the sanitized variable name for enum * diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache index 9ee04616e1db..3c85038e5c7a 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache @@ -17,7 +17,7 @@ import {{packageName}}.infrastructure.Success import {{packageName}}.infrastructure.toMultiValue {{#operations}} -class {{classname}}(basePath: kotlin.String = "{{{basePath}}}") : ApiClient(basePath) { +{{>visibility}} class {{classname}}(basePath: kotlin.String = "{{{basePath}}}") : ApiClient(basePath) { {{#operation}} /** diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache index 1cb58bb49e9e..8023d329c3b1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache @@ -28,7 +28,7 @@ import java.io.Serializable @Parcelize {{/parcelizeModels}} {{#multiplatform}}@Serializable{{/multiplatform}} -data class {{classname}} ( +{{>visibility}} data class {{classname}} ( {{#requiredVars}} {{>data_class_req_var}}{{^-last}}, {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, @@ -45,7 +45,7 @@ data class {{classname}} ( * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ {{#multiplatform}}@Serializable(with = {{nameInCamelCase}}.Serializer::class){{/multiplatform}} - enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){ + {{>visibility}} enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){ {{#allowableValues}}{{#enumVars}} {{#jvm}} {{#moshi}} @@ -61,7 +61,7 @@ data class {{classname}} ( {{/enumVars}}{{/allowableValues}} {{#multiplatform}} - object Serializer : CommonEnumSerializer<{{nameInCamelCase}}>("{{nameInCamelCase}}", values(), values().map { it.value }.toTypedArray()) + {{>visibility}} object Serializer : CommonEnumSerializer<{{nameInCamelCase}}>("{{nameInCamelCase}}", values(), values().map { it.value }.toTypedArray()) {{/multiplatform}} } {{/isEnum}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache index ccf8eb0c89f6..775776331ed9 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache @@ -16,7 +16,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ {{#multiplatform}}@Serializable(with = {{classname}}.Serializer::class){{/multiplatform}} -enum class {{classname}}(val value: {{{dataType}}}){ +{{>visibility}} enum class {{classname}}(val value: {{{dataType}}}){ {{#allowableValues}}{{#enumVars}} {{#jvm}} @@ -42,6 +42,6 @@ enum class {{classname}}(val value: {{{dataType}}}){ {{/enumVars}}{{/allowableValues}} {{#multiplatform}} - object Serializer : CommonEnumSerializer<{{classname}}>("{{classname}}", values(), values().map { it.value }.toTypedArray()) + {{>visibility}} object Serializer : CommonEnumSerializer<{{classname}}>("{{classname}}", values(), values().map { it.value }.toTypedArray()) {{/multiplatform}} } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache index 6123c8b01b14..f408107974c8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache @@ -2,7 +2,7 @@ package {{packageName}}.infrastructure typealias MultiValueMap = Map> -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +{{>visibility}} fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { else -> "" } -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +{{>visibility}} val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +{{>visibility}} fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +{{>visibility}} fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache index 7216feeb0114..eee242a413ea 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache @@ -8,7 +8,7 @@ package {{packageName}}.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -data class RequestConfig( +{{>visibility}} data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache index 5774235985c2..17a42eb351f8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache @@ -3,6 +3,6 @@ package {{packageName}}.infrastructure /** * Provides enumerated HTTP verbs */ -enum class RequestMethod { +{{>visibility}} enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache index e57a0addfd46..ea275198b0bd 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache @@ -11,8 +11,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -open class ApiClient(val baseUrl: String) { - companion object { +{{>visibility}} open class ApiClient(val baseUrl: String) { + {{>visibility}} companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache index 9b6bdad4ba5e..ba36341d3320 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache @@ -1,38 +1,38 @@ package {{packageName}}.infrastructure -enum class ResponseType { +{{>visibility}} enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +{{>visibility}} abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -class Success( +{{>visibility}} class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -class Informational( +{{>visibility}} class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -class Redirection( +{{>visibility}} class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -class ClientError( +{{>visibility}} class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -class ServerError( +{{>visibility}} class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache index bc4e1cd6a1b4..61a391a3ae72 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -object ApplicationDelegates { +{{>visibility}} object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache index 404f093eb653..9823af568663 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -class ByteArrayAdapter { +{{>visibility}} class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache index 1f6d106d947f..857c05919b23 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import java.lang.RuntimeException -open class ClientException : RuntimeException { +{{>visibility}} open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ open class ClientException : RuntimeException { } } -open class ServerException : RuntimeException { +{{>visibility}} open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache index 5f5d93af65d6..bbc8e0aa7b76 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache @@ -11,7 +11,7 @@ import org.threeten.bp.LocalDate import org.threeten.bp.format.DateTimeFormatter {{/threetenbp}} -class LocalDateAdapter { +{{>visibility}} class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache index 765144bad5a4..702b837c8c88 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache @@ -11,7 +11,7 @@ import org.threeten.bp.LocalDateTime import org.threeten.bp.format.DateTimeFormatter {{/threetenbp}} -class LocalDateTimeAdapter { +{{>visibility}} class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache index 8dd893998378..74efd803d1f4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -val Response.isInformational : Boolean get() = this.code in 100..199 +{{>visibility}} val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -val Response.isRedirect : Boolean get() = this.code in 300..399 +{{>visibility}} val Response.isRedirect : Boolean get() = this.code in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -val Response.isClientError : Boolean get() = this.code in 400..499 +{{>visibility}} val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +{{>visibility}} val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache index b370c468c615..749781a8012e 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -object Serializer { +{{>visibility}} object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache index cd973554cd67..4021dd82d269 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -class UUIDAdapter { +{{>visibility}} class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache index bab78f865b07..386f0dead18a 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache @@ -16,7 +16,7 @@ import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor {{#operations}} -class {{classname}} @UseExperimental(UnstableDefault::class) constructor( +{{>visibility}} class {{classname}} @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "{{{basePath}}}", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -101,7 +101,7 @@ class {{classname}} @UseExperimental(UnstableDefault::class) constructor( {{/operation}} - companion object { + {{>visibility}} companion object { internal fun setMappers(serializer: KotlinxSerializer) { {{#operation}} {{#hasBodyParam}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache index fdb83114b7b7..304aba6d4cd6 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache @@ -24,7 +24,7 @@ import kotlinx.serialization.json.JsonConfiguration import {{apiPackage}}.* import {{modelPackage}}.* -open class ApiClient( +{{>visibility}} open class ApiClient( private val baseUrl: String, httpClientEngine: HttpClientEngine?, serializer: KotlinxSerializer) { @@ -46,7 +46,7 @@ open class ApiClient( httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } - companion object { + {{>visibility}} companion object { protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) private fun setMappers(serializer: KotlinxSerializer) { diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache index 6bf43085b735..e0c80300e3e9 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache @@ -5,14 +5,14 @@ import io.ktor.client.call.typeInfo import io.ktor.http.Headers import io.ktor.http.isSuccess -open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { +{{>visibility}} open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { val status: Int = response.status.value val success: Boolean = response.status.isSuccess() val headers: Map> = response.headers.mapEntries() suspend fun body(): T = provider.body(response) suspend fun typedBody(type: TypeInfo): V = provider.typedBody(response, type) - companion object { + {{>visibility}} companion object { private fun Headers.mapEntries(): Map> { val result = mutableMapOf>() entries().forEach { result[it.key] = it.value } @@ -21,12 +21,12 @@ open class HttpResponse(val response: io.ktor.client.response.HttpRespo } } -interface BodyProvider { +{{>visibility}} interface BodyProvider { suspend fun body(response: io.ktor.client.response.HttpResponse): T suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V } -class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { +{{>visibility}} class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { @Suppress("UNCHECKED_CAST") override suspend fun body(response: io.ktor.client.response.HttpResponse): T = response.call.receive(type) as T @@ -36,7 +36,7 @@ class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { response.call.receive(type) as V } -class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { +{{>visibility}} class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { override suspend fun body(response: io.ktor.client.response.HttpResponse): T = block(provider.body(response)) @@ -44,8 +44,8 @@ class MappedBodyProvider(private val provider: BodyProvider provider.typedBody(response, type) } -inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = +{{>visibility}} inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = HttpResponse(this, TypedBodyProvider(typeInfo())) -fun HttpResponse.map(block: T.() -> V): HttpResponse = +{{>visibility}} fun HttpResponse.map(block: T.() -> V): HttpResponse = HttpResponse(response, MappedBodyProvider(provider, block)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache new file mode 100644 index 000000000000..a1d1f4163d41 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache @@ -0,0 +1 @@ +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index 59c49b3efdf9..931664923d65 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -25,7 +25,7 @@ import io.ktor.http.ParametersBuilder import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor -class PetApi @UseExperimental(UnstableDefault::class) constructor( +public class PetApi @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "http://petstore.swagger.io/v2", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -309,7 +309,7 @@ private class FindPetsByTagsResponse(val value: List) { - companion object { + public companion object { internal fun setMappers(serializer: KotlinxSerializer) { serializer.setMapper(FindPetsByStatusResponse::class, FindPetsByStatusResponse.serializer()) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index 86f32c9f9789..02cdc27f7ebe 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -24,7 +24,7 @@ import io.ktor.http.ParametersBuilder import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor -class StoreApi @UseExperimental(UnstableDefault::class) constructor( +public class StoreApi @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "http://petstore.swagger.io/v2", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -166,7 +166,7 @@ private class GetInventoryResponse(val value: Map) { - companion object { + public companion object { internal fun setMappers(serializer: KotlinxSerializer) { serializer.setMapper(GetInventoryResponse::class, GetInventoryResponse.serializer()) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt index 1977979c1d93..43eed93662e9 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt @@ -24,7 +24,7 @@ import io.ktor.http.ParametersBuilder import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor -class UserApi @UseExperimental(UnstableDefault::class) constructor( +public class UserApi @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "http://petstore.swagger.io/v2", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -293,7 +293,7 @@ private class CreateUsersWithListInputRequest(val value: List) { - companion object { + public companion object { internal fun setMappers(serializer: KotlinxSerializer) { serializer.setMapper(CreateUsersWithArrayInputRequest::class, CreateUsersWithArrayInputRequest.serializer()) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index f97cb88d2338..623755feea82 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { else -> "" } -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 66a5140d254f..6f4f349184bc 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -24,7 +24,7 @@ import kotlinx.serialization.json.JsonConfiguration import org.openapitools.client.apis.* import org.openapitools.client.models.* -open class ApiClient( +public open class ApiClient( private val baseUrl: String, httpClientEngine: HttpClientEngine?, serializer: KotlinxSerializer) { @@ -46,7 +46,7 @@ open class ApiClient( httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } - companion object { + public companion object { protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) private fun setMappers(serializer: KotlinxSerializer) { diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt index c457eb4bce0b..005751b3d4e3 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt @@ -5,14 +5,14 @@ import io.ktor.client.call.typeInfo import io.ktor.http.Headers import io.ktor.http.isSuccess -open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { +public open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { val status: Int = response.status.value val success: Boolean = response.status.isSuccess() val headers: Map> = response.headers.mapEntries() suspend fun body(): T = provider.body(response) suspend fun typedBody(type: TypeInfo): V = provider.typedBody(response, type) - companion object { + public companion object { private fun Headers.mapEntries(): Map> { val result = mutableMapOf>() entries().forEach { result[it.key] = it.value } @@ -21,12 +21,12 @@ open class HttpResponse(val response: io.ktor.client.response.HttpRespo } } -interface BodyProvider { +public interface BodyProvider { suspend fun body(response: io.ktor.client.response.HttpResponse): T suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V } -class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { +public class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { @Suppress("UNCHECKED_CAST") override suspend fun body(response: io.ktor.client.response.HttpResponse): T = response.call.receive(type) as T @@ -36,7 +36,7 @@ class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { response.call.receive(type) as V } -class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { +public class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { override suspend fun body(response: io.ktor.client.response.HttpResponse): T = block(provider.body(response)) @@ -44,8 +44,8 @@ class MappedBodyProvider(private val provider: BodyProvider provider.typedBody(response, type) } -inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = +public inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = HttpResponse(this, TypedBodyProvider(typeInfo())) -fun HttpResponse.map(block: T.() -> V): HttpResponse = +public fun HttpResponse.map(block: T.() -> V): HttpResponse = HttpResponse(response, MappedBodyProvider(provider, block)) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 53e689237d71..3fea211aa6ce 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -data class RequestConfig( +public data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 931b12b8bd7a..7a24729ce1b8 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -enum class RequestMethod { +public enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt index 3f05f17779e7..7ab427aa2975 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,7 +21,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param message */ @Serializable -data class ApiResponse ( +public data class ApiResponse ( @SerialName(value = "code") val code: kotlin.Int? = null, @SerialName(value = "type") val type: kotlin.String? = null, @SerialName(value = "message") val message: kotlin.String? = null diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt index eff7d12a4abd..c346a3478782 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt @@ -20,7 +20,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param name */ @Serializable -data class Category ( +public data class Category ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "name") val name: kotlin.String? = null ) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt index 76b9cf068ed9..62918ec6f071 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt @@ -24,7 +24,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param complete */ @Serializable -data class Order ( +public data class Order ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "petId") val petId: kotlin.Long? = null, @SerialName(value = "quantity") val quantity: kotlin.Int? = null, @@ -42,7 +42,7 @@ data class Order ( * Values: placed,approved,delivered */ @Serializable(with = Status.Serializer::class) - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ placed("placed"), @@ -51,7 +51,7 @@ data class Order ( delivered("delivered"); - object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) + public object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) } } diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt index 145683fe5784..daeb3419175f 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt @@ -26,7 +26,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param status pet status in the store */ @Serializable -data class Pet ( +public data class Pet ( @SerialName(value = "name") @Required val name: kotlin.String, @SerialName(value = "photoUrls") @Required val photoUrls: kotlin.Array, @SerialName(value = "id") val id: kotlin.Long? = null, @@ -44,7 +44,7 @@ data class Pet ( * Values: available,pending,sold */ @Serializable(with = Status.Serializer::class) - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ available("available"), @@ -53,7 +53,7 @@ data class Pet ( sold("sold"); - object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) + public object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) } } diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt index 6c5ce642e78e..f1ce51b09444 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt @@ -20,7 +20,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param name */ @Serializable -data class Tag ( +public data class Tag ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "name") val name: kotlin.String? = null ) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt index dd092dfd7074..07b823000f31 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt @@ -26,7 +26,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param userStatus User Status */ @Serializable -data class User ( +public data class User ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "username") val username: kotlin.String? = null, @SerialName(value = "firstName") val firstName: kotlin.String? = null, diff --git a/samples/client/petstore/kotlin-nonpublic/.openapi-generator-ignore b/samples/client/petstore/kotlin-nonpublic/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/kotlin-nonpublic/.openapi-generator/VERSION b/samples/client/petstore/kotlin-nonpublic/.openapi-generator/VERSION new file mode 100644 index 000000000000..c3a2c7076fa8 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/README.md b/samples/client/petstore/kotlin-nonpublic/README.md new file mode 100644 index 000000000000..aef4ea15beed --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/README.md @@ -0,0 +1,90 @@ +# org.openapitools.client - Kotlin client library for OpenAPI Petstore + +## Requires + +* Kotlin 1.3.41 +* Gradle 4.9 + +## Build + +First, create the gradle wrapper script: + +``` +gradle wrapper +``` + +Then, run: + +``` +./gradlew check assemble +``` + +This runs all tests and packages the library. + +## Features/Implementation Notes + +* Supports JSON inputs/outputs, File inputs, and Form inputs. +* Supports collection formats for query parameters: csv, tsv, ssv, pipes. +* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. +* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + + +## Documentation for Models + + - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) + - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.Order](docs/Order.md) + - [org.openapitools.client.models.Pet](docs/Pet.md) + - [org.openapitools.client.models.Tag](docs/Tag.md) + - [org.openapitools.client.models.User](docs/User.md) + + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + diff --git a/samples/client/petstore/kotlin-nonpublic/build.gradle b/samples/client/petstore/kotlin-nonpublic/build.gradle new file mode 100644 index 000000000000..c09f7912cfe1 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/build.gradle @@ -0,0 +1,37 @@ +group 'org.openapitools' +version '1.0.0' + +wrapper { + gradleVersion = '4.9' + distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" +} + +buildscript { + ext.kotlin_version = '1.3.41' + + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +test { + useJUnitPlatform() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + compile "com.squareup.moshi:moshi-kotlin:1.8.0" + compile "com.squareup.moshi:moshi-adapters:1.8.0" + compile "com.squareup.okhttp3:okhttp:4.0.1" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.1.0" +} diff --git a/samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md b/samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md new file mode 100644 index 000000000000..6b4c6bf27795 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md @@ -0,0 +1,12 @@ + +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **kotlin.Int** | | [optional] +**type** | **kotlin.String** | | [optional] +**message** | **kotlin.String** | | [optional] + + + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Category.md b/samples/client/petstore/kotlin-nonpublic/docs/Category.md new file mode 100644 index 000000000000..2c28a670fc79 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | | [optional] +**name** | **kotlin.String** | | [optional] + + + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Order.md b/samples/client/petstore/kotlin-nonpublic/docs/Order.md new file mode 100644 index 000000000000..ef31dbf2f4f4 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/Order.md @@ -0,0 +1,22 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | | [optional] +**petId** | **kotlin.Long** | | [optional] +**quantity** | **kotlin.Int** | | [optional] +**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional] +**status** | [**inline**](#StatusEnum) | Order Status | [optional] +**complete** | **kotlin.Boolean** | | [optional] + + + +## Enum: status +Name | Value +---- | ----- +status | placed, approved, delivered + + + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Pet.md b/samples/client/petstore/kotlin-nonpublic/docs/Pet.md new file mode 100644 index 000000000000..ec7756007379 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/Pet.md @@ -0,0 +1,22 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **kotlin.String** | | +**photoUrls** | **kotlin.Array<kotlin.String>** | | +**tags** | [**kotlin.Array<Tag>**](Tag.md) | | [optional] +**status** | [**inline**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: status +Name | Value +---- | ----- +status | available, pending, sold + + + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md new file mode 100644 index 000000000000..ea93e1745279 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md @@ -0,0 +1,405 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val body : Pet = // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(body) +} catch (e: ClientException) { + println("4xx response calling PetApi#addPet") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#addPet") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val petId : kotlin.Long = 789 // kotlin.Long | Pet id to delete +val apiKey : kotlin.String = apiKey_example // kotlin.String | +try { + apiInstance.deletePet(petId, apiKey) +} catch (e: ClientException) { + println("4xx response calling PetApi#deletePet") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#deletePet") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **kotlin.Long**| Pet id to delete | + **apiKey** | **kotlin.String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **findPetsByStatus** +> kotlin.Array<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val status : kotlin.Array = // kotlin.Array | Status values that need to be considered for filter +try { + val result : kotlin.Array = apiInstance.findPetsByStatus(status) + println(result) +} catch (e: ClientException) { + println("4xx response calling PetApi#findPetsByStatus") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#findPetsByStatus") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + +### Return type + +[**kotlin.Array<Pet>**](Pet.md) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByTags** +> kotlin.Array<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val tags : kotlin.Array = // kotlin.Array | Tags to filter by +try { + val result : kotlin.Array = apiInstance.findPetsByTags(tags) + println(result) +} catch (e: ClientException) { + println("4xx response calling PetApi#findPetsByTags") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#findPetsByTags") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | + +### Return type + +[**kotlin.Array<Pet>**](Pet.md) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to return +try { + val result : Pet = apiInstance.getPetById(petId) + println(result) +} catch (e: ClientException) { + println("4xx response calling PetApi#getPetById") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#getPetById") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **kotlin.Long**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updatePet** +> updatePet(body) + +Update an existing pet + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val body : Pet = // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(body) +} catch (e: ClientException) { + println("4xx response calling PetApi#updatePet") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#updatePet") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val petId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be updated +val name : kotlin.String = name_example // kotlin.String | Updated name of the pet +val status : kotlin.String = status_example // kotlin.String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status) +} catch (e: ClientException) { + println("4xx response calling PetApi#updatePetWithForm") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#updatePetWithForm") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **kotlin.Long**| ID of pet that needs to be updated | + **name** | **kotlin.String**| Updated name of the pet | [optional] + **status** | **kotlin.String**| Updated status of the pet | [optional] + +### Return type + +null (empty response body) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + + +# **uploadFile** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PetApi() +val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update +val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server +val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload +try { + val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + println(result) +} catch (e: ClientException) { + println("4xx response calling PetApi#uploadFile") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PetApi#uploadFile") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **kotlin.Long**| ID of pet to update | + **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] + **file** | **java.io.File**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md b/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md new file mode 100644 index 000000000000..f4986041af8c --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md @@ -0,0 +1,196 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = StoreApi() +val orderId : kotlin.String = orderId_example // kotlin.String | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId) +} catch (e: ClientException) { + println("4xx response calling StoreApi#deleteOrder") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling StoreApi#deleteOrder") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **kotlin.String**| ID of the order that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **getInventory** +> kotlin.collections.Map<kotlin.String, kotlin.Int> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = StoreApi() +try { + val result : kotlin.collections.Map = apiInstance.getInventory() + println(result) +} catch (e: ClientException) { + println("4xx response calling StoreApi#getInventory") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling StoreApi#getInventory") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**kotlin.collections.Map<kotlin.String, kotlin.Int>** + +### Authorization + + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = StoreApi() +val orderId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be fetched +try { + val result : Order = apiInstance.getOrderById(orderId) + println(result) +} catch (e: ClientException) { + println("4xx response calling StoreApi#getOrderById") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling StoreApi#getOrderById") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = StoreApi() +val body : Order = // Order | order placed for purchasing the pet +try { + val result : Order = apiInstance.placeOrder(body) + println(result) +} catch (e: ClientException) { + println("4xx response calling StoreApi#placeOrder") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling StoreApi#placeOrder") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Tag.md b/samples/client/petstore/kotlin-nonpublic/docs/Tag.md new file mode 100644 index 000000000000..60ce1bcdbad3 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | | [optional] +**name** | **kotlin.String** | | [optional] + + + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/User.md b/samples/client/petstore/kotlin-nonpublic/docs/User.md new file mode 100644 index 000000000000..e801729b5ed1 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | | [optional] +**username** | **kotlin.String** | | [optional] +**firstName** | **kotlin.String** | | [optional] +**lastName** | **kotlin.String** | | [optional] +**email** | **kotlin.String** | | [optional] +**password** | **kotlin.String** | | [optional] +**phone** | **kotlin.String** | | [optional] +**userStatus** | **kotlin.Int** | User Status | [optional] + + + diff --git a/samples/client/petstore/kotlin-nonpublic/docs/UserApi.md b/samples/client/petstore/kotlin-nonpublic/docs/UserApi.md new file mode 100644 index 000000000000..0f55f06bc629 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/docs/UserApi.md @@ -0,0 +1,376 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +val body : User = // User | Created user object +try { + apiInstance.createUser(body) +} catch (e: ClientException) { + println("4xx response calling UserApi#createUser") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#createUser") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +val body : kotlin.Array = // kotlin.Array | List of user object +try { + apiInstance.createUsersWithArrayInput(body) +} catch (e: ClientException) { + println("4xx response calling UserApi#createUsersWithArrayInput") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#createUsersWithArrayInput") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**kotlin.Array<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +val body : kotlin.Array = // kotlin.Array | List of user object +try { + apiInstance.createUsersWithListInput(body) +} catch (e: ClientException) { + println("4xx response calling UserApi#createUsersWithListInput") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#createUsersWithListInput") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**kotlin.Array<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +val username : kotlin.String = username_example // kotlin.String | The name that needs to be deleted +try { + apiInstance.deleteUser(username) +} catch (e: ClientException) { + println("4xx response calling UserApi#deleteUser") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#deleteUser") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **kotlin.String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +val username : kotlin.String = username_example // kotlin.String | The name that needs to be fetched. Use user1 for testing. +try { + val result : User = apiInstance.getUserByName(username) + println(result) +} catch (e: ClientException) { + println("4xx response calling UserApi#getUserByName") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#getUserByName") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **loginUser** +> kotlin.String loginUser(username, password) + +Logs user into the system + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +val username : kotlin.String = username_example // kotlin.String | The user name for login +val password : kotlin.String = password_example // kotlin.String | The password for login in clear text +try { + val result : kotlin.String = apiInstance.loginUser(username, password) + println(result) +} catch (e: ClientException) { + println("4xx response calling UserApi#loginUser") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#loginUser") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **kotlin.String**| The user name for login | + **password** | **kotlin.String**| The password for login in clear text | + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +try { + apiInstance.logoutUser() +} catch (e: ClientException) { + println("4xx response calling UserApi#logoutUser") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#logoutUser") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = UserApi() +val username : kotlin.String = username_example // kotlin.String | name that need to be deleted +val body : User = // User | Updated user object +try { + apiInstance.updateUser(username, body) +} catch (e: ClientException) { + println("4xx response calling UserApi#updateUser") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling UserApi#updateUser") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **kotlin.String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + diff --git a/samples/client/petstore/kotlin-nonpublic/settings.gradle b/samples/client/petstore/kotlin-nonpublic/settings.gradle new file mode 100644 index 000000000000..b6d700d5a984 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/settings.gradle @@ -0,0 +1,2 @@ + +rootProject.name = 'kotlin-petstore-nonpublic' \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt new file mode 100644 index 000000000000..ea0bccdd44ef --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -0,0 +1,280 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.apis + +import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.Pet + +import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ClientException +import org.openapitools.client.infrastructure.ClientError +import org.openapitools.client.infrastructure.ServerException +import org.openapitools.client.infrastructure.ServerError +import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.RequestConfig +import org.openapitools.client.infrastructure.RequestMethod +import org.openapitools.client.infrastructure.ResponseType +import org.openapitools.client.infrastructure.Success +import org.openapitools.client.infrastructure.toMultiValue + +internal class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + * @return void + */ + fun addPet(body: Pet) : Unit { + val localVariableBody: kotlin.Any? = body + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/pet", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey (optional) + * @return void + */ + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableConfig = RequestConfig( + RequestMethod.DELETE, + "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter + * @return kotlin.Array + */ + @Suppress("UNCHECKED_CAST") + fun findPetsByStatus(status: kotlin.Array) : kotlin.Array { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf("status" to toMultiValue(status.toList(), "csv")) + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/pet/findByStatus", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request>( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + * @return kotlin.Array + */ + @Suppress("UNCHECKED_CAST") + fun findPetsByTags(tags: kotlin.Array) : kotlin.Array { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf("tags" to toMultiValue(tags.toList(), "csv")) + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/pet/findByTags", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request>( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return + * @return Pet + */ + @Suppress("UNCHECKED_CAST") + fun getPetById(petId: kotlin.Long) : Pet { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as Pet + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @return void + */ + fun updatePet(body: Pet) : Unit { + val localVariableBody: kotlin.Any? = body + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.PUT, + "/pet", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return void + */ + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { + val localVariableBody: kotlin.Any? = mapOf("name" to "$name", "status" to "$status") + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "") + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ApiResponse + */ + @Suppress("UNCHECKED_CAST") + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to "$additionalMetadata", "file" to "$file") + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "") + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as ApiResponse + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt new file mode 100644 index 000000000000..e2bf37917fe8 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -0,0 +1,152 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.apis + +import org.openapitools.client.models.Order + +import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ClientException +import org.openapitools.client.infrastructure.ClientError +import org.openapitools.client.infrastructure.ServerException +import org.openapitools.client.infrastructure.ServerError +import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.RequestConfig +import org.openapitools.client.infrastructure.RequestMethod +import org.openapitools.client.infrastructure.ResponseType +import org.openapitools.client.infrastructure.Success +import org.openapitools.client.infrastructure.toMultiValue + +internal class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @return void + */ + fun deleteOrder(orderId: kotlin.String) : Unit { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.DELETE, + "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return kotlin.collections.Map + */ + @Suppress("UNCHECKED_CAST") + fun getInventory() : kotlin.collections.Map { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/store/inventory", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request>( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.collections.Map + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @return Order + */ + @Suppress("UNCHECKED_CAST") + fun getOrderById(orderId: kotlin.Long) : Order { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as Order + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + * @return Order + */ + @Suppress("UNCHECKED_CAST") + fun placeOrder(body: Order) : Order { + val localVariableBody: kotlin.Any? = body + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/store/order", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as Order + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt new file mode 100644 index 000000000000..18506d2a276b --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -0,0 +1,273 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.apis + +import org.openapitools.client.models.User + +import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ClientException +import org.openapitools.client.infrastructure.ClientError +import org.openapitools.client.infrastructure.ServerException +import org.openapitools.client.infrastructure.ServerError +import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.RequestConfig +import org.openapitools.client.infrastructure.RequestMethod +import org.openapitools.client.infrastructure.ResponseType +import org.openapitools.client.infrastructure.Success +import org.openapitools.client.infrastructure.toMultiValue + +internal class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + * @return void + */ + fun createUser(body: User) : Unit { + val localVariableBody: kotlin.Any? = body + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/user", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ + fun createUsersWithArrayInput(body: kotlin.Array) : Unit { + val localVariableBody: kotlin.Any? = body + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/user/createWithArray", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ + fun createUsersWithListInput(body: kotlin.Array) : Unit { + val localVariableBody: kotlin.Any? = body + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/user/createWithList", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return void + */ + fun deleteUser(username: kotlin.String) : Unit { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.DELETE, + "/user/{username}".replace("{"+"username"+"}", "$username"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + */ + @Suppress("UNCHECKED_CAST") + fun getUserByName(username: kotlin.String) : User { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/user/{username}".replace("{"+"username"+"}", "$username"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as User + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + * @return kotlin.String + */ + @Suppress("UNCHECKED_CAST") + fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf("username" to listOf("$username"), "password" to listOf("$password")) + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/user/login", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.String + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Logs out current logged in user session + * + * @return void + */ + fun logoutUser() : Unit { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/user/logout", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param body Updated user object + * @return void + */ + fun updateUser(username: kotlin.String, body: User) : Unit { + val localVariableBody: kotlin.Any? = body + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.PUT, + "/user/{username}".replace("{"+"username"+"}", "$username"), + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> Unit + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + } + } + +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 000000000000..b85d18def780 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +typealias MultiValueMap = Map> + +internal fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipes" -> "|" + "ssv" -> " " + else -> "" +} + +internal val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +internal fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) + = toMultiValue(items.asIterable(), collectionFormat, map) + +internal fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { + return when(collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) + } +} \ No newline at end of file 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 new file mode 100644 index 000000000000..9a712b4cee46 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -0,0 +1,170 @@ +package org.openapitools.client.infrastructure + +import okhttp3.OkHttpClient +import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.asRequestBody +import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.FormBody +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import okhttp3.ResponseBody +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.Request +import java.io.File + +internal open class ApiClient(val baseUrl: String) { + internal companion object { + protected const val ContentType = "Content-Type" + protected const val Accept = "Accept" + protected const val Authorization = "Authorization" + protected const val JsonMediaType = "application/json" + protected const val FormDataMediaType = "multipart/form-data" + protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" + protected const val XmlMediaType = "application/xml" + + val apiKey: MutableMap = mutableMapOf() + val apiKeyPrefix: MutableMap = mutableMapOf() + var username: String? = null + var password: String? = null + var accessToken: String? = null + + @JvmStatic + val client: OkHttpClient by lazy { + builder.build() + } + + @JvmStatic + val builder: OkHttpClient.Builder = OkHttpClient.Builder() + } + + protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + when { + content is File -> content.asRequestBody( + mediaType.toMediaTypeOrNull() + ) + mediaType == FormDataMediaType || mediaType == FormUrlEncMediaType -> { + FormBody.Builder().apply { + // content's type *must* be Map + @Suppress("UNCHECKED_CAST") + (content as Map).forEach { (key, value) -> + add(key, value) + } + }.build() + } + mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( + mediaType.toMediaTypeOrNull() + ) + mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") + // TODO: this should be extended with other serializers + else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") + } + + protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { + if(body == null) { + return null + } + val bodyContent = body.string() + if (bodyContent.isEmpty()) { + return null + } + return when(mediaType) { + JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) + else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") + } + } + + protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers["api_key"].isNullOrEmpty()) { + if (apiKey["api_key"] != null) { + if (apiKeyPrefix["api_key"] != null) { + requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! + } else { + requestConfig.headers["api_key"] = apiKey["api_key"]!! + } + } + } + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + requestConfig.headers[Authorization] = "Bearer " + accessToken + } + } + + protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { + val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") + + // take authMethod from operation + updateAuthParams(requestConfig) + + val url = httpUrl.newBuilder() + .addPathSegments(requestConfig.path.trimStart('/')) + .apply { + requestConfig.query.forEach { query -> + query.value.forEach { queryValue -> + addQueryParameter(query.key, queryValue) + } + } + }.build() + + // take content-type/accept from spec or set to default (application/json) if not defined + if (requestConfig.headers[ContentType].isNullOrEmpty()) { + requestConfig.headers[ContentType] = JsonMediaType + } + if (requestConfig.headers[Accept].isNullOrEmpty()) { + requestConfig.headers[Accept] = JsonMediaType + } + val headers = requestConfig.headers + + if(headers[ContentType] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") + } + + if(headers[Accept] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Accept header. This is required.") + } + + // TODO: support multiple contentType options here. + val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() + + val request = when (requestConfig.method) { + RequestMethod.DELETE -> Request.Builder().url(url).delete() + RequestMethod.GET -> Request.Builder().url(url) + RequestMethod.HEAD -> Request.Builder().url(url).head() + RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) + RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) + RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) + RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) + }.apply { + headers.forEach { header -> addHeader(header.key, header.value) } + }.build() + + val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() + + // TODO: handle specific mapping types. e.g. Map> + when { + response.isRedirect -> return Redirection( + response.code, + response.headers.toMultimap() + ) + response.isInformational -> return Informational( + response.message, + response.code, + response.headers.toMultimap() + ) + response.isSuccessful -> return Success( + responseBody(response.body, accept), + response.code, + response.headers.toMultimap() + ) + response.isClientError -> return ClientError( + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + else -> return ServerError( + null, + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + } + } +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt new file mode 100644 index 000000000000..6f38b7aa18c3 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -0,0 +1,40 @@ +package org.openapitools.client.infrastructure + +internal enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +internal abstract class ApiInfrastructureResponse(val responseType: ResponseType) { + abstract val statusCode: Int + abstract val headers: Map> +} + +internal class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiInfrastructureResponse(ResponseType.Success) + +internal class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.Informational) + +internal class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.Redirection) + +internal class ClientError( + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.ClientError) + +internal class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt new file mode 100644 index 000000000000..d7f9079c0d54 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -0,0 +1,29 @@ +package org.openapitools.client.infrastructure + +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KProperty + +internal object ApplicationDelegates { + /** + * Provides a property delegate, allowing the property to be set once and only once. + * + * If unset (no default value), a get on the property will throw [IllegalStateException]. + */ + fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) + + private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { + private var isSet = false + private var value: T? = defaultValue + + override fun getValue(thisRef: Any?, property: KProperty<*>): T { + return value ?: throw IllegalStateException("${property.name} not initialized") + } + + override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { + if (!isSet) { + this.value = value + isSet = true + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt new file mode 100644 index 000000000000..8e1cefd24852 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -0,0 +1,12 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson + +internal class ByteArrayAdapter { + @ToJson + fun toJson(data: ByteArray): String = String(data) + + @FromJson + fun fromJson(data: String): ByteArray = data.toByteArray() +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt new file mode 100644 index 000000000000..f1a47a02bd69 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -0,0 +1,42 @@ +@file:Suppress("unused") +package org.openapitools.client.infrastructure + +import java.lang.RuntimeException + +internal open class ClientException : RuntimeException { + + /** + * Constructs an [ClientException] with no detail message. + */ + constructor() : super() + + /** + * Constructs an [ClientException] with the specified detail message. + + * @param message the detail message. + */ + constructor(message: kotlin.String) : super(message) + + companion object { + private const val serialVersionUID: Long = 123L + } +} + +internal open class ServerException : RuntimeException { + + /** + * Constructs an [ServerException] with no detail message. + */ + constructor() : super() + + /** + * Constructs an [ServerException] with the specified detail message. + + * @param message the detail message. + */ + constructor(message: kotlin.String) : super(message) + + companion object { + private const val serialVersionUID: Long = 456L + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt new file mode 100644 index 000000000000..e86215d5717d --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +internal class LocalDateAdapter { + @ToJson + fun toJson(value: LocalDate): String { + return DateTimeFormatter.ISO_LOCAL_DATE.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDate { + return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) + } + +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt new file mode 100644 index 000000000000..fe7069904ca3 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter + +internal class LocalDateTimeAdapter { + @ToJson + fun toJson(value: LocalDateTime): String { + return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDateTime { + return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + } + +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt new file mode 100644 index 000000000000..14b306918fc8 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -0,0 +1,16 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +internal data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val query: Map> = mapOf() +) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt new file mode 100644 index 000000000000..e0fbb1e6526c --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -0,0 +1,8 @@ +package org.openapitools.client.infrastructure + +/** + * Provides enumerated HTTP verbs + */ +internal enum class RequestMethod { + GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt new file mode 100644 index 000000000000..fe3cf91512e4 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +import okhttp3.Response + +/** + * Provides an extension to evaluation whether the response is a 1xx code + */ +internal val Response.isInformational : Boolean get() = this.code in 100..199 + +/** + * Provides an extension to evaluation whether the response is a 3xx code + */ +internal val Response.isRedirect : Boolean get() = this.code in 300..399 + +/** + * Provides an extension to evaluation whether the response is a 4xx code + */ +internal val Response.isClientError : Boolean get() = this.code in 400..499 + +/** + * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code + */ +internal val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt new file mode 100644 index 000000000000..051082f5628f --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -0,0 +1,18 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.Moshi +import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter +import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory +import java.util.Date + +internal object Serializer { + @JvmStatic + val moshi: Moshi = Moshi.Builder() + .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) + .add(LocalDateTimeAdapter()) + .add(LocalDateAdapter()) + .add(UUIDAdapter()) + .add(ByteArrayAdapter()) + .add(KotlinJsonAdapterFactory()) + .build() +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt new file mode 100644 index 000000000000..02fa692b57dc --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.util.UUID + +internal class UUIDAdapter { + @ToJson + fun toJson(uuid: UUID) = uuid.toString() + + @FromJson + fun fromJson(s: String) = UUID.fromString(s) +} diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt new file mode 100644 index 000000000000..a5bb44489147 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -0,0 +1,33 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.models + + +import com.squareup.moshi.Json +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ + +internal data class ApiResponse ( + @Json(name = "code") + val code: kotlin.Int? = null, + @Json(name = "type") + val type: kotlin.String? = null, + @Json(name = "message") + val message: kotlin.String? = null +) + + + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt new file mode 100644 index 000000000000..70ed6b25e578 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -0,0 +1,30 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.models + + +import com.squareup.moshi.Json +/** + * A category for a pet + * @param id + * @param name + */ + +internal data class Category ( + @Json(name = "id") + val id: kotlin.Long? = null, + @Json(name = "name") + val name: kotlin.String? = null +) + + + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt new file mode 100644 index 000000000000..e33e76f8c6f5 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -0,0 +1,62 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.models + + +import com.squareup.moshi.Json +/** + * An order for a pets from the pet store + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status Order Status + * @param complete + */ + +internal data class Order ( + @Json(name = "id") + val id: kotlin.Long? = null, + @Json(name = "petId") + val petId: kotlin.Long? = null, + @Json(name = "quantity") + val quantity: kotlin.Int? = null, + @Json(name = "shipDate") + val shipDate: java.time.LocalDateTime? = null, + /* Order Status */ + @Json(name = "status") + val status: Order.Status? = null, + @Json(name = "complete") + val complete: kotlin.Boolean? = null +) + + +{ + + /** + * Order Status + * Values: placed,approved,delivered + */ + + internal enum class Status(val value: kotlin.String){ + + @Json(name = "placed") placed("placed"), + + @Json(name = "approved") approved("approved"), + + @Json(name = "delivered") delivered("delivered"); + + + } + +} + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt new file mode 100644 index 000000000000..0911760f062b --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -0,0 +1,64 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.models + +import org.openapitools.client.models.Category +import org.openapitools.client.models.Tag + +import com.squareup.moshi.Json +/** + * A pet for sale in the pet store + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags + * @param status pet status in the store + */ + +internal data class Pet ( + @Json(name = "name") + val name: kotlin.String, + @Json(name = "photoUrls") + val photoUrls: kotlin.Array, + @Json(name = "id") + val id: kotlin.Long? = null, + @Json(name = "category") + val category: Category? = null, + @Json(name = "tags") + val tags: kotlin.Array? = null, + /* pet status in the store */ + @Json(name = "status") + val status: Pet.Status? = null +) + + +{ + + /** + * pet status in the store + * Values: available,pending,sold + */ + + internal enum class Status(val value: kotlin.String){ + + @Json(name = "available") available("available"), + + @Json(name = "pending") pending("pending"), + + @Json(name = "sold") sold("sold"); + + + } + +} + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt new file mode 100644 index 000000000000..0c36f402fda2 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -0,0 +1,30 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.models + + +import com.squareup.moshi.Json +/** + * A tag for a pet + * @param id + * @param name + */ + +internal data class Tag ( + @Json(name = "id") + val id: kotlin.Long? = null, + @Json(name = "name") + val name: kotlin.String? = null +) + + + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt new file mode 100644 index 000000000000..2070fe6d80b5 --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt @@ -0,0 +1,49 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.models + + +import com.squareup.moshi.Json +/** + * A User who is purchasing from the pet store + * @param id + * @param username + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + */ + +internal data class User ( + @Json(name = "id") + val id: kotlin.Long? = null, + @Json(name = "username") + val username: kotlin.String? = null, + @Json(name = "firstName") + val firstName: kotlin.String? = null, + @Json(name = "lastName") + val lastName: kotlin.String? = null, + @Json(name = "email") + val email: kotlin.String? = null, + @Json(name = "password") + val password: kotlin.String? = null, + @Json(name = "phone") + val phone: kotlin.String? = null, + /* User Status */ + @Json(name = "userStatus") + val userStatus: kotlin.Int? = null +) + + + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 15f63f2a1b5b..9f0c70a43516 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 90d681f8f347..e4e49ee43ce5 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index daaaeae31508..8105c119a3bf 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index f97cb88d2338..623755feea82 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { else -> "" } -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) 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 def00253aed0..575601bf4917 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 @@ -11,8 +11,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -open class ApiClient(val baseUrl: String) { - companion object { +public open class ApiClient(val baseUrl: String) { + public companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index f1a8aecc914b..af039fa152a3 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -enum class ResponseType { +public enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -class Success( +public class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -class Informational( +public class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -class Redirection( +public class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -class ClientError( +public class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -class ServerError( +public class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index dd34bd48b2c0..99a6de553a4f 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -object ApplicationDelegates { +public object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index 617ac3fe9069..ee977334dddc 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -class ByteArrayAdapter { +public class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 2f3b0157ba70..04641dd77cf9 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -open class ClientException : RuntimeException { +public open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ open class ClientException : RuntimeException { } } -open class ServerException : RuntimeException { +public open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index b2e1654479a0..07dd526a9361 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDate import java.time.format.DateTimeFormatter -class LocalDateAdapter { +public class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index e082db94811d..bd306c1e1fc9 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDateTime import java.time.format.DateTimeFormatter -class LocalDateTimeAdapter { +public class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 53e689237d71..3fea211aa6ce 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -data class RequestConfig( +public data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 931b12b8bd7a..7a24729ce1b8 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -enum class RequestMethod { +public enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 934962ec6b50..6e03c1862844 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -val Response.isInformational : Boolean get() = this.code in 100..199 +public val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -val Response.isRedirect : Boolean get() = this.code in 300..399 +public val Response.isRedirect : Boolean get() = this.code in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -val Response.isClientError : Boolean get() = this.code in 400..499 +public val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +public val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 7c5a353e0f7f..475ab334b3bc 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -object Serializer { +public object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index a4a44cc18b73..28dd4fa1f09d 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -class UUIDAdapter { +public class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 6d5c231ccc84..b10325946382 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,7 +21,7 @@ import java.io.Serializable * @param message */ -data class ApiResponse ( +public data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt index 1fe92af826c1..86088490722c 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -data class Category ( +public data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt index 81cc2b0940b0..40f49fc6944b 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,7 +24,7 @@ import java.io.Serializable * @param complete */ -data class Order ( +public data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -48,7 +48,7 @@ data class Order ( * Values: placed,approved,delivered */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt index 3b4dfc22abdc..6b1fdba77f34 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param status pet status in the store */ -data class Pet ( +public data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -50,7 +50,7 @@ data class Pet ( * Values: available,pending,sold */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt index 1d97954c460b..ae24b1117951 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -data class Tag ( +public data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt index df835a5d9685..1d80cb548619 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param userStatus User Status */ -data class User ( +public data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 15f63f2a1b5b..9f0c70a43516 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 90d681f8f347..e4e49ee43ce5 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index daaaeae31508..8105c119a3bf 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index f97cb88d2338..623755feea82 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { else -> "" } -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) 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 def00253aed0..575601bf4917 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 @@ -11,8 +11,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -open class ApiClient(val baseUrl: String) { - companion object { +public open class ApiClient(val baseUrl: String) { + public companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index f1a8aecc914b..af039fa152a3 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -enum class ResponseType { +public enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -class Success( +public class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -class Informational( +public class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -class Redirection( +public class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -class ClientError( +public class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -class ServerError( +public class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index dd34bd48b2c0..99a6de553a4f 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -object ApplicationDelegates { +public object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index 617ac3fe9069..ee977334dddc 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -class ByteArrayAdapter { +public class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 2f3b0157ba70..04641dd77cf9 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -open class ClientException : RuntimeException { +public open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ open class ClientException : RuntimeException { } } -open class ServerException : RuntimeException { +public open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index ff5439aeb42f..f7f1f34b5ebb 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import org.threeten.bp.LocalDate import org.threeten.bp.format.DateTimeFormatter -class LocalDateAdapter { +public class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index 710a9cc13178..b5d286c2af6c 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import org.threeten.bp.LocalDateTime import org.threeten.bp.format.DateTimeFormatter -class LocalDateTimeAdapter { +public class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 53e689237d71..3fea211aa6ce 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -data class RequestConfig( +public data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 931b12b8bd7a..7a24729ce1b8 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -enum class RequestMethod { +public enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 934962ec6b50..6e03c1862844 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -val Response.isInformational : Boolean get() = this.code in 100..199 +public val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -val Response.isRedirect : Boolean get() = this.code in 300..399 +public val Response.isRedirect : Boolean get() = this.code in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -val Response.isClientError : Boolean get() = this.code in 400..499 +public val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +public val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 7c5a353e0f7f..475ab334b3bc 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -object Serializer { +public object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index a4a44cc18b73..28dd4fa1f09d 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -class UUIDAdapter { +public class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 47766821f186..f7fd0bee4781 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -20,7 +20,7 @@ import com.squareup.moshi.Json * @param message */ -data class ApiResponse ( +public data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt index edb16cc1270a..3cf06c39ca0e 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -19,7 +19,7 @@ import com.squareup.moshi.Json * @param name */ -data class Category ( +public data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt index af6dcb45604f..aebd15811b7b 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -23,7 +23,7 @@ import com.squareup.moshi.Json * @param complete */ -data class Order ( +public data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -47,7 +47,7 @@ data class Order ( * Values: placed,approved,delivered */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt index 8015b6dab720..24cf2c8ba53a 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -25,7 +25,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -data class Pet ( +public data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -49,7 +49,7 @@ data class Pet ( * Values: available,pending,sold */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt index 05dc7c9afefe..00eb91b5400b 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -19,7 +19,7 @@ import com.squareup.moshi.Json * @param name */ -data class Tag ( +public data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt index 537b01d3c278..c0fe8ed581f0 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt @@ -25,7 +25,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -data class User ( +public data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 15f63f2a1b5b..9f0c70a43516 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 90d681f8f347..e4e49ee43ce5 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index daaaeae31508..8105c119a3bf 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index f97cb88d2338..623755feea82 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { else -> "" } -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) 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 def00253aed0..575601bf4917 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 @@ -11,8 +11,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -open class ApiClient(val baseUrl: String) { - companion object { +public open class ApiClient(val baseUrl: String) { + public companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index f1a8aecc914b..af039fa152a3 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -enum class ResponseType { +public enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -class Success( +public class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -class Informational( +public class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -class Redirection( +public class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -class ClientError( +public class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -class ServerError( +public class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index dd34bd48b2c0..99a6de553a4f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -object ApplicationDelegates { +public object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index 617ac3fe9069..ee977334dddc 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -class ByteArrayAdapter { +public class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 2f3b0157ba70..04641dd77cf9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -open class ClientException : RuntimeException { +public open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ open class ClientException : RuntimeException { } } -open class ServerException : RuntimeException { +public open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index b2e1654479a0..07dd526a9361 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDate import java.time.format.DateTimeFormatter -class LocalDateAdapter { +public class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index e082db94811d..bd306c1e1fc9 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDateTime import java.time.format.DateTimeFormatter -class LocalDateTimeAdapter { +public class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 53e689237d71..3fea211aa6ce 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -data class RequestConfig( +public data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 931b12b8bd7a..7a24729ce1b8 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -enum class RequestMethod { +public enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 934962ec6b50..6e03c1862844 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -val Response.isInformational : Boolean get() = this.code in 100..199 +public val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -val Response.isRedirect : Boolean get() = this.code in 300..399 +public val Response.isRedirect : Boolean get() = this.code in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -val Response.isClientError : Boolean get() = this.code in 400..499 +public val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +public val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 7c5a353e0f7f..475ab334b3bc 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -object Serializer { +public object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index a4a44cc18b73..28dd4fa1f09d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -class UUIDAdapter { +public class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 6d5c231ccc84..b10325946382 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,7 +21,7 @@ import java.io.Serializable * @param message */ -data class ApiResponse ( +public data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index 1fe92af826c1..86088490722c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -data class Category ( +public data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index a5478a616261..3d8c8910702d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,7 +24,7 @@ import java.io.Serializable * @param complete */ -data class Order ( +public data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -48,7 +48,7 @@ data class Order ( * Values: placed,approved,delivered */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index 3b4dfc22abdc..6b1fdba77f34 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param status pet status in the store */ -data class Pet ( +public data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -50,7 +50,7 @@ data class Pet ( * Values: available,pending,sold */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index 1d97954c460b..ae24b1117951 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -data class Tag ( +public data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index df835a5d9685..1d80cb548619 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param userStatus User Status */ -data class User ( +public data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") From 836f550d3c4e3bd82483b6650e14f902d56e6e96 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@gmail.com> Date: Wed, 9 Oct 2019 09:31:45 +0100 Subject: [PATCH 2/6] [kotlin] update petstores --- .../org/openapitools/client/infrastructure/ApiClient.kt | 2 +- .../kotlin/org/openapitools/client/models/ApiResponse.kt | 2 ++ .../main/kotlin/org/openapitools/client/models/Category.kt | 2 ++ .../src/main/kotlin/org/openapitools/client/models/Order.kt | 5 +++-- .../src/main/kotlin/org/openapitools/client/models/Pet.kt | 5 +++-- .../src/main/kotlin/org/openapitools/client/models/Tag.kt | 2 ++ .../src/main/kotlin/org/openapitools/client/models/User.kt | 2 ++ .../kotlin/org/openapitools/client/models/ApiResponse.kt | 4 ++-- .../main/kotlin/org/openapitools/client/models/Category.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/Tag.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/User.kt | 4 ++-- .../kotlin/org/openapitools/client/models/ApiResponse.kt | 4 ++-- .../main/kotlin/org/openapitools/client/models/Category.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/Tag.kt | 4 ++-- .../src/main/kotlin/org/openapitools/client/models/User.kt | 4 ++-- 19 files changed, 39 insertions(+), 29 deletions(-) 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 9a712b4cee46..7a82f3eef2de 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 @@ -124,7 +124,7 @@ internal open class ApiClient(val baseUrl: String) { val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete() + RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) RequestMethod.GET -> Request.Builder().url(url) RequestMethod.HEAD -> Request.Builder().url(url).head() RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index a5bb44489147..dc9689401825 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -31,3 +31,5 @@ internal data class ApiResponse ( + + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt index 70ed6b25e578..9292c8669b50 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -28,3 +28,5 @@ internal data class Category ( + + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt index e33e76f8c6f5..d5208fc22dd4 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -40,7 +40,8 @@ internal data class Order ( ) -{ + + /** * Order Status @@ -58,5 +59,5 @@ internal data class Order ( } -} + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt index 0911760f062b..71862b29bf8a 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -42,7 +42,8 @@ internal data class Pet ( ) -{ + + /** * pet status in the store @@ -60,5 +61,5 @@ internal data class Pet ( } -} + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt index 0c36f402fda2..5e74dbd783c5 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -28,3 +28,5 @@ internal data class Tag ( + + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt index 2070fe6d80b5..968730441fbb 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/User.kt @@ -47,3 +47,5 @@ internal data class User ( + + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f7c258244f3b..f7d31a67d9fd 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -31,9 +31,9 @@ public data class ApiResponse ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt index 3a299bf6518d..ae094b135090 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -28,9 +28,9 @@ public data class Category ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt index 106f50d5c5af..0e12258c9a59 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -41,7 +41,7 @@ public data class Order ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } @@ -63,5 +63,5 @@ public data class Order ( } -} + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt index bcf54796a13a..87e6473b65ce 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -43,7 +43,7 @@ public data class Pet ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } @@ -65,5 +65,5 @@ public data class Pet ( } -} + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt index f2967f5a6818..b6423e2b3875 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -28,9 +28,9 @@ public data class Tag ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt index 699a24141ada..1fb7e11815a1 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt @@ -47,9 +47,9 @@ public data class User ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f7c258244f3b..f7d31a67d9fd 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -31,9 +31,9 @@ public data class ApiResponse ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index 3a299bf6518d..ae094b135090 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -28,9 +28,9 @@ public data class Category ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index be863d1e5cd5..73f1a738e276 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -41,7 +41,7 @@ public data class Order ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } @@ -63,5 +63,5 @@ public data class Order ( } -} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index bcf54796a13a..87e6473b65ce 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -43,7 +43,7 @@ public data class Pet ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } @@ -65,5 +65,5 @@ public data class Pet ( } -} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index f2967f5a6818..b6423e2b3875 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -28,9 +28,9 @@ public data class Tag ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index 699a24141ada..1fb7e11815a1 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -47,9 +47,9 @@ public data class User ( ) : Serializable -{ + companion object { private const val serialVersionUID: Long = 123 } -} + From 4d9ae1d4ef1b3da6e8d4eae82dd801372f4ba7cb Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@gmail.com> Date: Wed, 9 Oct 2019 10:26:37 +0100 Subject: [PATCH 3/6] [kotlin] add missing script to kotlin-client-all.sh --- bin/kotlin-client-all.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/kotlin-client-all.sh b/bin/kotlin-client-all.sh index e7b2114e6652..175752d797f1 100755 --- a/bin/kotlin-client-all.sh +++ b/bin/kotlin-client-all.sh @@ -1,5 +1,6 @@ #!/bin/sh +./bin/kotlin-client-nonpublic.sh ./bin/kotlin-client-okhttp3.sh ./bin/kotlin-client-petstore-multiplatform.sh ./bin/kotlin-client-petstore.sh From fecc4162708620ed372dd1a5a84f7fbd155b136c Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@gmail.com> Date: Wed, 9 Oct 2019 10:46:18 +0100 Subject: [PATCH 4/6] [kotlin] update pet projects --- .../client/petstore/kotlin-nonpublic/build.gradle | 2 +- .../client/infrastructure/ResponseExtensions.kt | 2 +- .../kotlin-okhttp3/.openapi-generator/VERSION | 2 +- .../kotlin/org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../kotlin/org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 ++++---- .../client/infrastructure/ApiClient.kt | 6 +++--- .../infrastructure/ApiInfrastructureResponse.kt | 14 +++++++------- .../client/infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../openapitools/client/infrastructure/Errors.kt | 4 ++-- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../client/infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../client/infrastructure/ResponseExtensions.kt | 8 ++++---- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 8 ++++++-- .../org/openapitools/client/models/Category.kt | 8 ++++++-- .../kotlin/org/openapitools/client/models/Order.kt | 13 ++++++++----- .../kotlin/org/openapitools/client/models/Pet.kt | 13 ++++++++----- .../kotlin/org/openapitools/client/models/Tag.kt | 8 ++++++-- .../kotlin/org/openapitools/client/models/User.kt | 8 ++++++-- .../client/infrastructure/ResponseExtensions.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 4 ++-- .../org/openapitools/client/models/Category.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Tag.kt | 4 ++-- .../kotlin/org/openapitools/client/models/User.kt | 4 ++-- .../client/infrastructure/ResponseExtensions.kt | 2 +- .../client/infrastructure/ResponseExtensions.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 4 ++-- .../org/openapitools/client/models/Category.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Tag.kt | 4 ++-- .../kotlin/org/openapitools/client/models/User.kt | 4 ++-- 40 files changed, 101 insertions(+), 79 deletions(-) diff --git a/samples/client/petstore/kotlin-nonpublic/build.gradle b/samples/client/petstore/kotlin-nonpublic/build.gradle index c09f7912cfe1..98ac4f243e6f 100644 --- a/samples/client/petstore/kotlin-nonpublic/build.gradle +++ b/samples/client/petstore/kotlin-nonpublic/build.gradle @@ -32,6 +32,6 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "com.squareup.moshi:moshi-kotlin:1.8.0" compile "com.squareup.moshi:moshi-adapters:1.8.0" - compile "com.squareup.okhttp3:okhttp:4.0.1" + compile "com.squareup.okhttp3:okhttp:4.2.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.1.0" } diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index fe3cf91512e4..5b71262046ad 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -20,4 +20,4 @@ internal val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -internal val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +internal val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-okhttp3/.openapi-generator/VERSION b/samples/client/petstore/kotlin-okhttp3/.openapi-generator/VERSION index 0e97bd19efbf..c3a2c7076fa8 100644 --- a/samples/client/petstore/kotlin-okhttp3/.openapi-generator/VERSION +++ b/samples/client/petstore/kotlin-okhttp3/.openapi-generator/VERSION @@ -1 +1 @@ -4.1.3-SNAPSHOT \ No newline at end of file +4.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 15f63f2a1b5b..9f0c70a43516 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 90d681f8f347..e4e49ee43ce5 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index daaaeae31508..8105c119a3bf 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index f97cb88d2338..623755feea82 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { else -> "" } -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 5b4056205eb3..2e5cb77beb0b 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -9,8 +9,8 @@ import okhttp3.ResponseBody import okhttp3.Request import java.io.File -open class ApiClient(val baseUrl: String) { - companion object { +public open class ApiClient(val baseUrl: String) { + public companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" @@ -122,7 +122,7 @@ open class ApiClient(val baseUrl: String) { val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete() + RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) RequestMethod.GET -> Request.Builder().url(url) RequestMethod.HEAD -> Request.Builder().url(url).head() RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index f1a8aecc914b..af039fa152a3 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -enum class ResponseType { +public enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -class Success( +public class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -class Informational( +public class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -class Redirection( +public class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -class ClientError( +public class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -class ServerError( +public class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index dd34bd48b2c0..99a6de553a4f 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -object ApplicationDelegates { +public object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index 617ac3fe9069..ee977334dddc 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -class ByteArrayAdapter { +public class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 2f3b0157ba70..04641dd77cf9 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -open class ClientException : RuntimeException { +public open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ open class ClientException : RuntimeException { } } -open class ServerException : RuntimeException { +public open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index b2e1654479a0..07dd526a9361 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDate import java.time.format.DateTimeFormatter -class LocalDateAdapter { +public class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index e082db94811d..bd306c1e1fc9 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDateTime import java.time.format.DateTimeFormatter -class LocalDateTimeAdapter { +public class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 53e689237d71..3fea211aa6ce 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -data class RequestConfig( +public data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 931b12b8bd7a..7a24729ce1b8 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -enum class RequestMethod { +public enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index f50104a6f352..55e84462cb98 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -val Response.isInformational : Boolean get() = this.code() in 100..199 +public val Response.isInformational : Boolean get() = this.code() in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -val Response.isRedirect : Boolean get() = this.code() in 300..399 +public val Response.isRedirect : Boolean get() = this.code() in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -val Response.isClientError : Boolean get() = this.code() in 400..499 +public val Response.isClientError : Boolean get() = this.code() in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -val Response.isServerError : Boolean get() = this.code() in 500..999 \ No newline at end of file +public val Response.isServerError : Boolean get() = this.code() in 500..999 diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 7c5a353e0f7f..475ab334b3bc 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -object Serializer { +public object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index a4a44cc18b73..28dd4fa1f09d 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -class UUIDAdapter { +public class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 4bbbf9bf0270..2161182e0793 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -24,12 +24,16 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -data class ApiResponse ( +public data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") val type: kotlin.String? = null, @Json(name = "message") val message: kotlin.String? = null -) : Parcelable +) : Parcelable + + + + diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt index 39e411bca0b5..8694f1b710fc 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -23,10 +23,14 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -data class Category ( +public data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) : Parcelable +) : Parcelable + + + + diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt index 23d2053b7865..f8a702746ff7 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -27,7 +27,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -data class Order ( +public data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -41,15 +41,18 @@ data class Order ( val status: Order.Status? = null, @Json(name = "complete") val complete: kotlin.Boolean? = null -) : Parcelable -{ +) : Parcelable + + + + /** * Order Status * Values: placed,approved,delivered */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @@ -60,5 +63,5 @@ data class Order ( } -} + diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt index 73c8e9036792..4cd097ff7c16 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -29,7 +29,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -data class Pet ( +public data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -43,15 +43,18 @@ data class Pet ( /* pet status in the store */ @Json(name = "status") val status: Pet.Status? = null -) : Parcelable -{ +) : Parcelable + + + + /** * pet status in the store * Values: available,pending,sold */ - enum class Status(val value: kotlin.String){ + public enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @@ -62,5 +65,5 @@ data class Pet ( } -} + diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt index 817461e739b3..ae7b0125fb8b 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -23,10 +23,14 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -data class Tag ( +public data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") val name: kotlin.String? = null -) : Parcelable +) : Parcelable + + + + diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt index 9ed1a2a11886..85d658a4690d 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt @@ -29,7 +29,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -data class User ( +public data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -47,5 +47,9 @@ data class User ( /* User Status */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null -) : Parcelable +) : Parcelable + + + + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 6e03c1862844..4566d6f8a48d 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -20,4 +20,4 @@ public val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -public val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +public val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f7d31a67d9fd..f7c258244f3b 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -31,9 +31,9 @@ public data class ApiResponse ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt index ae094b135090..3a299bf6518d 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -28,9 +28,9 @@ public data class Category ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt index 0e12258c9a59..106f50d5c5af 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -41,7 +41,7 @@ public data class Order ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } @@ -63,5 +63,5 @@ public data class Order ( } - +} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt index 87e6473b65ce..bcf54796a13a 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -43,7 +43,7 @@ public data class Pet ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } @@ -65,5 +65,5 @@ public data class Pet ( } - +} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt index b6423e2b3875..f2967f5a6818 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -28,9 +28,9 @@ public data class Tag ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt index 1fb7e11815a1..699a24141ada 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt @@ -47,9 +47,9 @@ public data class User ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 6e03c1862844..4566d6f8a48d 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -20,4 +20,4 @@ public val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -public val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +public val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 6e03c1862844..4566d6f8a48d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -20,4 +20,4 @@ public val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -public val Response.isServerError : Boolean get() = this.code in 500..999 \ No newline at end of file +public val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f7d31a67d9fd..f7c258244f3b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -31,9 +31,9 @@ public data class ApiResponse ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index ae094b135090..3a299bf6518d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -28,9 +28,9 @@ public data class Category ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index 73f1a738e276..be863d1e5cd5 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -41,7 +41,7 @@ public data class Order ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } @@ -63,5 +63,5 @@ public data class Order ( } - +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index 87e6473b65ce..bcf54796a13a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -43,7 +43,7 @@ public data class Pet ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } @@ -65,5 +65,5 @@ public data class Pet ( } - +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index b6423e2b3875..f2967f5a6818 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -28,9 +28,9 @@ public data class Tag ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index 1fb7e11815a1..699a24141ada 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -47,9 +47,9 @@ public data class User ( ) : Serializable - +{ companion object { private const val serialVersionUID: Long = 123 } - +} From 708c7654be74d64866caf1152149fc412d4fc68e Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@gmail.com> Date: Wed, 9 Oct 2019 11:04:05 +0100 Subject: [PATCH 5/6] [kotlin] remove public modifier --- .../src/main/resources/kotlin-client/api.mustache | 2 +- .../resources/kotlin-client/data_class.mustache | 6 +++--- .../resources/kotlin-client/enum_class.mustache | 4 ++-- .../infrastructure/ApiAbstractions.kt.mustache | 8 ++++---- .../infrastructure/RequestConfig.kt.mustache | 2 +- .../infrastructure/RequestMethod.kt.mustache | 2 +- .../jvm/infrastructure/ApiClient.kt.mustache | 4 ++-- .../ApiInfrastructureResponse.kt.mustache | 14 +++++++------- .../ApplicationDelegates.kt.mustache | 2 +- .../infrastructure/ByteArrayAdapter.kt.mustache | 2 +- .../jvm/infrastructure/Errors.kt.mustache | 4 ++-- .../infrastructure/LocalDateAdapter.kt.mustache | 2 +- .../LocalDateTimeAdapter.kt.mustache | 2 +- .../infrastructure/ResponseExtensions.kt.mustache | 8 ++++---- .../jvm/infrastructure/Serializer.kt.mustache | 2 +- .../jvm/infrastructure/UUIDAdapter.kt.mustache | 2 +- .../libraries/multiplatform/api.mustache | 4 ++-- .../infrastructure/ApiClient.kt.mustache | 4 ++-- .../infrastructure/HttpResponse.kt.mustache | 14 +++++++------- .../resources/kotlin-client/visibility.mustache | 2 +- .../kotlin/org/openapitools/client/apis/PetApi.kt | 4 ++-- .../org/openapitools/client/apis/StoreApi.kt | 4 ++-- .../kotlin/org/openapitools/client/apis/UserApi.kt | 4 ++-- .../client/infrastructure/ApiAbstractions.kt | 8 ++++---- .../client/infrastructure/ApiClient.kt | 4 ++-- .../client/infrastructure/HttpResponse.kt | 14 +++++++------- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 2 +- .../org/openapitools/client/models/Category.kt | 2 +- .../kotlin/org/openapitools/client/models/Order.kt | 6 +++--- .../kotlin/org/openapitools/client/models/Pet.kt | 6 +++--- .../kotlin/org/openapitools/client/models/Tag.kt | 2 +- .../kotlin/org/openapitools/client/models/User.kt | 2 +- .../kotlin/org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../kotlin/org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 ++++---- .../client/infrastructure/ApiClient.kt | 4 ++-- .../infrastructure/ApiInfrastructureResponse.kt | 14 +++++++------- .../client/infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../openapitools/client/infrastructure/Errors.kt | 4 ++-- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../client/infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../client/infrastructure/ResponseExtensions.kt | 8 ++++---- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 2 +- .../org/openapitools/client/models/Category.kt | 2 +- .../kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Tag.kt | 2 +- .../kotlin/org/openapitools/client/models/User.kt | 2 +- .../kotlin/org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../kotlin/org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 ++++---- .../client/infrastructure/ApiClient.kt | 4 ++-- .../infrastructure/ApiInfrastructureResponse.kt | 14 +++++++------- .../client/infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../openapitools/client/infrastructure/Errors.kt | 4 ++-- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../client/infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../client/infrastructure/ResponseExtensions.kt | 8 ++++---- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 2 +- .../org/openapitools/client/models/Category.kt | 2 +- .../kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Tag.kt | 2 +- .../kotlin/org/openapitools/client/models/User.kt | 2 +- .../kotlin/org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../kotlin/org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 ++++---- .../client/infrastructure/ApiClient.kt | 4 ++-- .../infrastructure/ApiInfrastructureResponse.kt | 14 +++++++------- .../client/infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../openapitools/client/infrastructure/Errors.kt | 4 ++-- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../client/infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../client/infrastructure/ResponseExtensions.kt | 8 ++++---- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 2 +- .../org/openapitools/client/models/Category.kt | 2 +- .../kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Tag.kt | 2 +- .../kotlin/org/openapitools/client/models/User.kt | 2 +- .../kotlin/org/openapitools/client/apis/PetApi.kt | 2 +- .../org/openapitools/client/apis/StoreApi.kt | 2 +- .../kotlin/org/openapitools/client/apis/UserApi.kt | 2 +- .../client/infrastructure/ApiAbstractions.kt | 8 ++++---- .../client/infrastructure/ApiClient.kt | 4 ++-- .../infrastructure/ApiInfrastructureResponse.kt | 14 +++++++------- .../client/infrastructure/ApplicationDelegates.kt | 2 +- .../client/infrastructure/ByteArrayAdapter.kt | 2 +- .../openapitools/client/infrastructure/Errors.kt | 4 ++-- .../client/infrastructure/LocalDateAdapter.kt | 2 +- .../client/infrastructure/LocalDateTimeAdapter.kt | 2 +- .../client/infrastructure/RequestConfig.kt | 2 +- .../client/infrastructure/RequestMethod.kt | 2 +- .../client/infrastructure/ResponseExtensions.kt | 8 ++++---- .../client/infrastructure/Serializer.kt | 2 +- .../client/infrastructure/UUIDAdapter.kt | 2 +- .../org/openapitools/client/models/ApiResponse.kt | 2 +- .../org/openapitools/client/models/Category.kt | 2 +- .../kotlin/org/openapitools/client/models/Order.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Pet.kt | 4 ++-- .../kotlin/org/openapitools/client/models/Tag.kt | 2 +- .../kotlin/org/openapitools/client/models/User.kt | 2 +- 122 files changed, 228 insertions(+), 228 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache index 3c85038e5c7a..ea3ab7427559 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache @@ -17,7 +17,7 @@ import {{packageName}}.infrastructure.Success import {{packageName}}.infrastructure.toMultiValue {{#operations}} -{{>visibility}} class {{classname}}(basePath: kotlin.String = "{{{basePath}}}") : ApiClient(basePath) { +{{>visibility}}class {{classname}}(basePath: kotlin.String = "{{{basePath}}}") : ApiClient(basePath) { {{#operation}} /** diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache index 8ed81f0cb21b..51c7f7f71f4e 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache @@ -28,7 +28,7 @@ import java.io.Serializable @Parcelize {{/parcelizeModels}} {{#multiplatform}}@Serializable{{/multiplatform}} -{{>visibility}} data class {{classname}} ( +{{>visibility}}data class {{classname}} ( {{#requiredVars}} {{>data_class_req_var}}{{^-last}}, {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, @@ -49,7 +49,7 @@ import java.io.Serializable * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ {{#multiplatform}}@Serializable(with = {{nameInCamelCase}}.Serializer::class){{/multiplatform}} - {{>visibility}} enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){ + {{>visibility}}enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){ {{#allowableValues}}{{#enumVars}} {{#jvm}} {{#moshi}} @@ -65,7 +65,7 @@ import java.io.Serializable {{/enumVars}}{{/allowableValues}} {{#multiplatform}} - {{>visibility}} object Serializer : CommonEnumSerializer<{{nameInCamelCase}}>("{{nameInCamelCase}}", values(), values().map { it.value }.toTypedArray()) + {{>visibility}}object Serializer : CommonEnumSerializer<{{nameInCamelCase}}>("{{nameInCamelCase}}", values(), values().map { it.value }.toTypedArray()) {{/multiplatform}} } {{/isEnum}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache index 775776331ed9..1a0891f34bd9 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache @@ -16,7 +16,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ {{#multiplatform}}@Serializable(with = {{classname}}.Serializer::class){{/multiplatform}} -{{>visibility}} enum class {{classname}}(val value: {{{dataType}}}){ +{{>visibility}}enum class {{classname}}(val value: {{{dataType}}}){ {{#allowableValues}}{{#enumVars}} {{#jvm}} @@ -42,6 +42,6 @@ import kotlinx.serialization.internal.CommonEnumSerializer {{/enumVars}}{{/allowableValues}} {{#multiplatform}} - {{>visibility}} object Serializer : CommonEnumSerializer<{{classname}}>("{{classname}}", values(), values().map { it.value }.toTypedArray()) + {{>visibility}}object Serializer : CommonEnumSerializer<{{classname}}>("{{classname}}", values(), values().map { it.value }.toTypedArray()) {{/multiplatform}} } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache index f408107974c8..0a0c21b97687 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache @@ -2,7 +2,7 @@ package {{packageName}}.infrastructure typealias MultiValueMap = Map> -{{>visibility}} fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +{{>visibility}}fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ typealias MultiValueMap = Map> else -> "" } -{{>visibility}} val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +{{>visibility}}val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -{{>visibility}} fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +{{>visibility}}fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -{{>visibility}} fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +{{>visibility}}fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache index eee242a413ea..e2107a51b169 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache @@ -8,7 +8,7 @@ package {{packageName}}.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -{{>visibility}} data class RequestConfig( +{{>visibility}}data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache index 17a42eb351f8..404f9494edab 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache @@ -3,6 +3,6 @@ package {{packageName}}.infrastructure /** * Provides enumerated HTTP verbs */ -{{>visibility}} enum class RequestMethod { +{{>visibility}}enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache index b01c20bdfa4a..d0e63ff82ec5 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache @@ -23,8 +23,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -{{>visibility}} open class ApiClient(val baseUrl: String) { - {{>visibility}} companion object { +{{>visibility}}open class ApiClient(val baseUrl: String) { + {{>visibility}}companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache index ba36341d3320..4ff0991d3ce8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache @@ -1,38 +1,38 @@ package {{packageName}}.infrastructure -{{>visibility}} enum class ResponseType { +{{>visibility}}enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -{{>visibility}} abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +{{>visibility}}abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -{{>visibility}} class Success( +{{>visibility}}class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -{{>visibility}} class Informational( +{{>visibility}}class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -{{>visibility}} class Redirection( +{{>visibility}}class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -{{>visibility}} class ClientError( +{{>visibility}}class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -{{>visibility}} class ServerError( +{{>visibility}}class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache index 61a391a3ae72..d621811de8e4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -{{>visibility}} object ApplicationDelegates { +{{>visibility}}object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache index 9823af568663..9a9cb6e818dd 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -{{>visibility}} class ByteArrayAdapter { +{{>visibility}}class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache index 857c05919b23..5da2586fcbb5 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import java.lang.RuntimeException -{{>visibility}} open class ClientException : RuntimeException { +{{>visibility}}open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ import java.lang.RuntimeException } } -{{>visibility}} open class ServerException : RuntimeException { +{{>visibility}}open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache index bbc8e0aa7b76..fab45dd576a6 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache @@ -11,7 +11,7 @@ import org.threeten.bp.LocalDate import org.threeten.bp.format.DateTimeFormatter {{/threetenbp}} -{{>visibility}} class LocalDateAdapter { +{{>visibility}}class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache index 702b837c8c88..7c08927d2577 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache @@ -11,7 +11,7 @@ import org.threeten.bp.LocalDateTime import org.threeten.bp.format.DateTimeFormatter {{/threetenbp}} -{{>visibility}} class LocalDateTimeAdapter { +{{>visibility}}class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache index 7703e8773ea0..81dc36548dbf 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -{{>visibility}} val Response.isInformational : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 100..199 +{{>visibility}}val Response.isInformational : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -{{>visibility}} val Response.isRedirect : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 300..399 +{{>visibility}}val Response.isRedirect : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -{{>visibility}} val Response.isClientError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 400..499 +{{>visibility}}val Response.isClientError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -{{>visibility}} val Response.isServerError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 500..999 +{{>visibility}}val Response.isServerError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 500..999 diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache index 749781a8012e..0a3a9bf31a57 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -{{>visibility}} object Serializer { +{{>visibility}}object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache index 4021dd82d269..35a2a1b6f226 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -{{>visibility}} class UUIDAdapter { +{{>visibility}}class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache index 386f0dead18a..2445c9fbcec0 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache @@ -16,7 +16,7 @@ import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor {{#operations}} -{{>visibility}} class {{classname}} @UseExperimental(UnstableDefault::class) constructor( +{{>visibility}}class {{classname}} @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "{{{basePath}}}", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -101,7 +101,7 @@ import kotlinx.serialization.internal.StringDescriptor {{/operation}} - {{>visibility}} companion object { + {{>visibility}}companion object { internal fun setMappers(serializer: KotlinxSerializer) { {{#operation}} {{#hasBodyParam}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache index 304aba6d4cd6..44d9f28b5508 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache @@ -24,7 +24,7 @@ import kotlinx.serialization.json.JsonConfiguration import {{apiPackage}}.* import {{modelPackage}}.* -{{>visibility}} open class ApiClient( +{{>visibility}}open class ApiClient( private val baseUrl: String, httpClientEngine: HttpClientEngine?, serializer: KotlinxSerializer) { @@ -46,7 +46,7 @@ import {{modelPackage}}.* httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } - {{>visibility}} companion object { + {{>visibility}}companion object { protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) private fun setMappers(serializer: KotlinxSerializer) { diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache index e0c80300e3e9..a0b7f77b70c0 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache @@ -5,14 +5,14 @@ import io.ktor.client.call.typeInfo import io.ktor.http.Headers import io.ktor.http.isSuccess -{{>visibility}} open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { +{{>visibility}}open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { val status: Int = response.status.value val success: Boolean = response.status.isSuccess() val headers: Map> = response.headers.mapEntries() suspend fun body(): T = provider.body(response) suspend fun typedBody(type: TypeInfo): V = provider.typedBody(response, type) - {{>visibility}} companion object { + {{>visibility}}companion object { private fun Headers.mapEntries(): Map> { val result = mutableMapOf>() entries().forEach { result[it.key] = it.value } @@ -21,12 +21,12 @@ import io.ktor.http.isSuccess } } -{{>visibility}} interface BodyProvider { +{{>visibility}}interface BodyProvider { suspend fun body(response: io.ktor.client.response.HttpResponse): T suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V } -{{>visibility}} class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { +{{>visibility}}class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { @Suppress("UNCHECKED_CAST") override suspend fun body(response: io.ktor.client.response.HttpResponse): T = response.call.receive(type) as T @@ -36,7 +36,7 @@ import io.ktor.http.isSuccess response.call.receive(type) as V } -{{>visibility}} class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { +{{>visibility}}class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { override suspend fun body(response: io.ktor.client.response.HttpResponse): T = block(provider.body(response)) @@ -44,8 +44,8 @@ import io.ktor.http.isSuccess provider.typedBody(response, type) } -{{>visibility}} inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = +{{>visibility}}inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = HttpResponse(this, TypedBodyProvider(typeInfo())) -{{>visibility}} fun HttpResponse.map(block: T.() -> V): HttpResponse = +{{>visibility}}fun HttpResponse.map(block: T.() -> V): HttpResponse = HttpResponse(response, MappedBodyProvider(provider, block)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache index a1d1f4163d41..0a4f47725cdc 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache @@ -1 +1 @@ -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} \ No newline at end of file +{{#nonPublicApi}}internal {{/nonPublicApi}} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index 931664923d65..59c49b3efdf9 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -25,7 +25,7 @@ import io.ktor.http.ParametersBuilder import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor -public class PetApi @UseExperimental(UnstableDefault::class) constructor( +class PetApi @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "http://petstore.swagger.io/v2", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -309,7 +309,7 @@ private class FindPetsByTagsResponse(val value: List) { - public companion object { + companion object { internal fun setMappers(serializer: KotlinxSerializer) { serializer.setMapper(FindPetsByStatusResponse::class, FindPetsByStatusResponse.serializer()) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt index 02cdc27f7ebe..86f32c9f9789 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -24,7 +24,7 @@ import io.ktor.http.ParametersBuilder import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor -public class StoreApi @UseExperimental(UnstableDefault::class) constructor( +class StoreApi @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "http://petstore.swagger.io/v2", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -166,7 +166,7 @@ private class GetInventoryResponse(val value: Map) { - public companion object { + companion object { internal fun setMappers(serializer: KotlinxSerializer) { serializer.setMapper(GetInventoryResponse::class, GetInventoryResponse.serializer()) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt index 43eed93662e9..1977979c1d93 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt @@ -24,7 +24,7 @@ import io.ktor.http.ParametersBuilder import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor -public class UserApi @UseExperimental(UnstableDefault::class) constructor( +class UserApi @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "http://petstore.swagger.io/v2", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -293,7 +293,7 @@ private class CreateUsersWithListInputRequest(val value: List) { - public companion object { + companion object { internal fun setMappers(serializer: KotlinxSerializer) { serializer.setMapper(CreateUsersWithArrayInputRequest::class, CreateUsersWithArrayInputRequest.serializer()) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index 623755feea82..f97cb88d2338 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat else -> "" } -public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 6f4f349184bc..66a5140d254f 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -24,7 +24,7 @@ import kotlinx.serialization.json.JsonConfiguration import org.openapitools.client.apis.* import org.openapitools.client.models.* -public open class ApiClient( +open class ApiClient( private val baseUrl: String, httpClientEngine: HttpClientEngine?, serializer: KotlinxSerializer) { @@ -46,7 +46,7 @@ public open class ApiClient( httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } - public companion object { + companion object { protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) private fun setMappers(serializer: KotlinxSerializer) { diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt index 005751b3d4e3..c457eb4bce0b 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt @@ -5,14 +5,14 @@ import io.ktor.client.call.typeInfo import io.ktor.http.Headers import io.ktor.http.isSuccess -public open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { +open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { val status: Int = response.status.value val success: Boolean = response.status.isSuccess() val headers: Map> = response.headers.mapEntries() suspend fun body(): T = provider.body(response) suspend fun typedBody(type: TypeInfo): V = provider.typedBody(response, type) - public companion object { + companion object { private fun Headers.mapEntries(): Map> { val result = mutableMapOf>() entries().forEach { result[it.key] = it.value } @@ -21,12 +21,12 @@ public open class HttpResponse(val response: io.ktor.client.response.Ht } } -public interface BodyProvider { +interface BodyProvider { suspend fun body(response: io.ktor.client.response.HttpResponse): T suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V } -public class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { +class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { @Suppress("UNCHECKED_CAST") override suspend fun body(response: io.ktor.client.response.HttpResponse): T = response.call.receive(type) as T @@ -36,7 +36,7 @@ public class TypedBodyProvider(private val type: TypeInfo) : BodyProvid response.call.receive(type) as V } -public class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { +class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { override suspend fun body(response: io.ktor.client.response.HttpResponse): T = block(provider.body(response)) @@ -44,8 +44,8 @@ public class MappedBodyProvider(private val provider: BodyProv provider.typedBody(response, type) } -public inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = +inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = HttpResponse(this, TypedBodyProvider(typeInfo())) -public fun HttpResponse.map(block: T.() -> V): HttpResponse = +fun HttpResponse.map(block: T.() -> V): HttpResponse = HttpResponse(response, MappedBodyProvider(provider, block)) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 3fea211aa6ce..53e689237d71 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -public data class RequestConfig( +data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 7a24729ce1b8..931b12b8bd7a 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -public enum class RequestMethod { +enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt index 34deb65fa7c2..831b50ef770c 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,7 +21,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param message */ @Serializable -public data class ApiResponse ( +data class ApiResponse ( @SerialName(value = "code") val code: kotlin.Int? = null, @SerialName(value = "type") val type: kotlin.String? = null, @SerialName(value = "message") val message: kotlin.String? = null diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt index 5be6cff813be..2f08fc27d6b2 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt @@ -20,7 +20,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param name */ @Serializable -public data class Category ( +data class Category ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "name") val name: kotlin.String? = null ) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt index e7f9e5360bc8..57ebfbf1a67a 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt @@ -24,7 +24,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param complete */ @Serializable -public data class Order ( +data class Order ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "petId") val petId: kotlin.Long? = null, @SerialName(value = "quantity") val quantity: kotlin.Int? = null, @@ -43,7 +43,7 @@ public data class Order ( * Values: placed,approved,delivered */ @Serializable(with = Status.Serializer::class) - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ placed("placed"), @@ -52,7 +52,7 @@ public data class Order ( delivered("delivered"); - public object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) + object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) } diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt index 5993a33cc667..1e0d08a1b855 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt @@ -26,7 +26,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param status pet status in the store */ @Serializable -public data class Pet ( +data class Pet ( @SerialName(value = "name") @Required val name: kotlin.String, @SerialName(value = "photoUrls") @Required val photoUrls: kotlin.Array, @SerialName(value = "id") val id: kotlin.Long? = null, @@ -45,7 +45,7 @@ public data class Pet ( * Values: available,pending,sold */ @Serializable(with = Status.Serializer::class) - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ available("available"), @@ -54,7 +54,7 @@ public data class Pet ( sold("sold"); - public object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) + object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value }.toTypedArray()) } diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt index dd412b990a52..29ebfaf424f4 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt @@ -20,7 +20,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param name */ @Serializable -public data class Tag ( +data class Tag ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "name") val name: kotlin.String? = null ) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt index 59f8ebb0fe23..78d48510adec 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt @@ -26,7 +26,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param userStatus User Status */ @Serializable -public data class User ( +data class User ( @SerialName(value = "id") val id: kotlin.Long? = null, @SerialName(value = "username") val username: kotlin.String? = null, @SerialName(value = "firstName") val firstName: kotlin.String? = null, diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9f0c70a43516..15f63f2a1b5b 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e4e49ee43ce5..90d681f8f347 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 8105c119a3bf..daaaeae31508 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index 623755feea82..f97cb88d2338 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat else -> "" } -public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 2e5cb77beb0b..3c5a60ccd305 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -9,8 +9,8 @@ import okhttp3.ResponseBody import okhttp3.Request import java.io.File -public open class ApiClient(val baseUrl: String) { - public companion object { +open class ApiClient(val baseUrl: String) { + companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index af039fa152a3..f1a8aecc914b 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -public enum class ResponseType { +enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -public class Success( +class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -public class Informational( +class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -public class Redirection( +class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -public class ClientError( +class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -public class ServerError( +class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index 99a6de553a4f..dd34bd48b2c0 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -public object ApplicationDelegates { +object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index ee977334dddc..617ac3fe9069 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -public class ByteArrayAdapter { +class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 04641dd77cf9..2f3b0157ba70 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -public open class ClientException : RuntimeException { +open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ public open class ClientException : RuntimeException { } } -public open class ServerException : RuntimeException { +open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index 07dd526a9361..b2e1654479a0 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDate import java.time.format.DateTimeFormatter -public class LocalDateAdapter { +class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index bd306c1e1fc9..e082db94811d 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDateTime import java.time.format.DateTimeFormatter -public class LocalDateTimeAdapter { +class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 3fea211aa6ce..53e689237d71 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -public data class RequestConfig( +data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 7a24729ce1b8..931b12b8bd7a 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -public enum class RequestMethod { +enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 55e84462cb98..68209f916594 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -public val Response.isInformational : Boolean get() = this.code() in 100..199 +val Response.isInformational : Boolean get() = this.code() in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -public val Response.isRedirect : Boolean get() = this.code() in 300..399 +val Response.isRedirect : Boolean get() = this.code() in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -public val Response.isClientError : Boolean get() = this.code() in 400..499 +val Response.isClientError : Boolean get() = this.code() in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -public val Response.isServerError : Boolean get() = this.code() in 500..999 +val Response.isServerError : Boolean get() = this.code() in 500..999 diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 475ab334b3bc..7c5a353e0f7f 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -public object Serializer { +object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index 28dd4fa1f09d..a4a44cc18b73 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -public class UUIDAdapter { +class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 2161182e0793..071ac7068b8f 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -24,7 +24,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -public data class ApiResponse ( +data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt index 8694f1b710fc..9c5139798628 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -23,7 +23,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -public data class Category ( +data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt index f8a702746ff7..ef5d8c666a81 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -27,7 +27,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -public data class Order ( +data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -52,7 +52,7 @@ public data class Order ( * Values: placed,approved,delivered */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt index 4cd097ff7c16..68c79eb39e22 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -29,7 +29,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -public data class Pet ( +data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -54,7 +54,7 @@ public data class Pet ( * Values: available,pending,sold */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt index ae7b0125fb8b..f8e85f127fb3 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -23,7 +23,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -public data class Tag ( +data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt index 85d658a4690d..4b4c09a9631c 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/User.kt @@ -29,7 +29,7 @@ import kotlinx.android.parcel.Parcelize */ @Parcelize -public data class User ( +data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9f0c70a43516..15f63f2a1b5b 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e4e49ee43ce5..90d681f8f347 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 8105c119a3bf..daaaeae31508 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index 623755feea82..f97cb88d2338 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat else -> "" } -public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) 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 ebfa0fa5e299..3df0d806a913 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 @@ -11,8 +11,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -public open class ApiClient(val baseUrl: String) { - public companion object { +open class ApiClient(val baseUrl: String) { + companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index af039fa152a3..f1a8aecc914b 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -public enum class ResponseType { +enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -public class Success( +class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -public class Informational( +class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -public class Redirection( +class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -public class ClientError( +class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -public class ServerError( +class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index 99a6de553a4f..dd34bd48b2c0 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -public object ApplicationDelegates { +object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index ee977334dddc..617ac3fe9069 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -public class ByteArrayAdapter { +class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 04641dd77cf9..2f3b0157ba70 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -public open class ClientException : RuntimeException { +open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ public open class ClientException : RuntimeException { } } -public open class ServerException : RuntimeException { +open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index 07dd526a9361..b2e1654479a0 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDate import java.time.format.DateTimeFormatter -public class LocalDateAdapter { +class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index bd306c1e1fc9..e082db94811d 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDateTime import java.time.format.DateTimeFormatter -public class LocalDateTimeAdapter { +class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 3fea211aa6ce..53e689237d71 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -public data class RequestConfig( +data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 7a24729ce1b8..931b12b8bd7a 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -public enum class RequestMethod { +enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 4566d6f8a48d..69b562becb07 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -public val Response.isInformational : Boolean get() = this.code in 100..199 +val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -public val Response.isRedirect : Boolean get() = this.code in 300..399 +val Response.isRedirect : Boolean get() = this.code in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -public val Response.isClientError : Boolean get() = this.code in 400..499 +val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -public val Response.isServerError : Boolean get() = this.code in 500..999 +val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 475ab334b3bc..7c5a353e0f7f 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -public object Serializer { +object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index 28dd4fa1f09d..a4a44cc18b73 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -public class UUIDAdapter { +class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f7c258244f3b..8d5c8448f049 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,7 +21,7 @@ import java.io.Serializable * @param message */ -public data class ApiResponse ( +data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt index 3a299bf6518d..7895d7627ab1 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -public data class Category ( +data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt index 106f50d5c5af..451109b15f54 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,7 +24,7 @@ import java.io.Serializable * @param complete */ -public data class Order ( +data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -52,7 +52,7 @@ public data class Order ( * Values: placed,approved,delivered */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt index bcf54796a13a..9771dda248c4 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param status pet status in the store */ -public data class Pet ( +data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -54,7 +54,7 @@ public data class Pet ( * Values: available,pending,sold */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt index f2967f5a6818..7fb743571254 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -public data class Tag ( +data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt index 699a24141ada..e66f3cf09fed 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param userStatus User Status */ -public data class User ( +data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9f0c70a43516..15f63f2a1b5b 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e4e49ee43ce5..90d681f8f347 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 8105c119a3bf..daaaeae31508 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index 623755feea82..f97cb88d2338 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat else -> "" } -public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) 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 ebfa0fa5e299..3df0d806a913 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 @@ -11,8 +11,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -public open class ApiClient(val baseUrl: String) { - public companion object { +open class ApiClient(val baseUrl: String) { + companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index af039fa152a3..f1a8aecc914b 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -public enum class ResponseType { +enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -public class Success( +class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -public class Informational( +class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -public class Redirection( +class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -public class ClientError( +class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -public class ServerError( +class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index 99a6de553a4f..dd34bd48b2c0 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -public object ApplicationDelegates { +object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index ee977334dddc..617ac3fe9069 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -public class ByteArrayAdapter { +class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 04641dd77cf9..2f3b0157ba70 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -public open class ClientException : RuntimeException { +open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ public open class ClientException : RuntimeException { } } -public open class ServerException : RuntimeException { +open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index f7f1f34b5ebb..ff5439aeb42f 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import org.threeten.bp.LocalDate import org.threeten.bp.format.DateTimeFormatter -public class LocalDateAdapter { +class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index b5d286c2af6c..710a9cc13178 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import org.threeten.bp.LocalDateTime import org.threeten.bp.format.DateTimeFormatter -public class LocalDateTimeAdapter { +class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 3fea211aa6ce..53e689237d71 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -public data class RequestConfig( +data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 7a24729ce1b8..931b12b8bd7a 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -public enum class RequestMethod { +enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 4566d6f8a48d..69b562becb07 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -public val Response.isInformational : Boolean get() = this.code in 100..199 +val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -public val Response.isRedirect : Boolean get() = this.code in 300..399 +val Response.isRedirect : Boolean get() = this.code in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -public val Response.isClientError : Boolean get() = this.code in 400..499 +val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -public val Response.isServerError : Boolean get() = this.code in 500..999 +val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 475ab334b3bc..7c5a353e0f7f 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -public object Serializer { +object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index 28dd4fa1f09d..a4a44cc18b73 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -public class UUIDAdapter { +class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f6941615232c..90b60bdccfc7 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -20,7 +20,7 @@ import com.squareup.moshi.Json * @param message */ -public data class ApiResponse ( +data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt index bec1c63b1d52..f28b1fa2cddc 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -19,7 +19,7 @@ import com.squareup.moshi.Json * @param name */ -public data class Category ( +data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt index 8db3dda82491..800a7fd6406c 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -23,7 +23,7 @@ import com.squareup.moshi.Json * @param complete */ -public data class Order ( +data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -48,7 +48,7 @@ public data class Order ( * Values: placed,approved,delivered */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt index 08af5de132f5..a85f990e1e88 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -25,7 +25,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -public data class Pet ( +data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -50,7 +50,7 @@ public data class Pet ( * Values: available,pending,sold */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt index c76a4aee4e83..16c40f6039c8 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -19,7 +19,7 @@ import com.squareup.moshi.Json * @param name */ -public data class Tag ( +data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt index ce8a3aeab45d..bb6442aefcba 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/User.kt @@ -25,7 +25,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -public data class User ( +data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9f0c70a43516..15f63f2a1b5b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -26,7 +26,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Add a new pet to the store diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e4e49ee43ce5..90d681f8f347 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Delete purchase order by ID diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 8105c119a3bf..daaaeae31508 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -public class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { +class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { /** * Create user diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt index 623755feea82..f97cb88d2338 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -2,7 +2,7 @@ package org.openapitools.client.infrastructure typealias MultiValueMap = Map> -public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ public fun collectionDelimiter(collectionFormat: String) = when(collectionFormat else -> "" } -public val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -public fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -public fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) 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 ebfa0fa5e299..3df0d806a913 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 @@ -11,8 +11,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -public open class ApiClient(val baseUrl: String) { - public companion object { +open class ApiClient(val baseUrl: String) { + companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt index af039fa152a3..f1a8aecc914b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -1,38 +1,38 @@ package org.openapitools.client.infrastructure -public enum class ResponseType { +enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -public abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -public class Success( +class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -public class Informational( +class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -public class Redirection( +class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -public class ClientError( +class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -public class ServerError( +class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt index 99a6de553a4f..dd34bd48b2c0 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -public object ApplicationDelegates { +object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt index ee977334dddc..617ac3fe9069 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -public class ByteArrayAdapter { +class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index 04641dd77cf9..2f3b0157ba70 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -3,7 +3,7 @@ package org.openapitools.client.infrastructure import java.lang.RuntimeException -public open class ClientException : RuntimeException { +open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -22,7 +22,7 @@ public open class ClientException : RuntimeException { } } -public open class ServerException : RuntimeException { +open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt index 07dd526a9361..b2e1654479a0 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDate import java.time.format.DateTimeFormatter -public class LocalDateAdapter { +class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt index bd306c1e1fc9..e082db94811d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.ToJson import java.time.LocalDateTime import java.time.format.DateTimeFormatter -public class LocalDateTimeAdapter { +class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 3fea211aa6ce..53e689237d71 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -8,7 +8,7 @@ package org.openapitools.client.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -public data class RequestConfig( +data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt index 7a24729ce1b8..931b12b8bd7a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -3,6 +3,6 @@ package org.openapitools.client.infrastructure /** * Provides enumerated HTTP verbs */ -public enum class RequestMethod { +enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 4566d6f8a48d..69b562becb07 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -public val Response.isInformational : Boolean get() = this.code in 100..199 +val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -public val Response.isRedirect : Boolean get() = this.code in 300..399 +val Response.isRedirect : Boolean get() = this.code in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -public val Response.isClientError : Boolean get() = this.code in 400..499 +val Response.isClientError : Boolean get() = this.code in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -public val Response.isServerError : Boolean get() = this.code in 500..999 +val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 475ab334b3bc..7c5a353e0f7f 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -public object Serializer { +object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt index 28dd4fa1f09d..a4a44cc18b73 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -public class UUIDAdapter { +class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index f7c258244f3b..8d5c8448f049 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -21,7 +21,7 @@ import java.io.Serializable * @param message */ -public data class ApiResponse ( +data class ApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt index 3a299bf6518d..7895d7627ab1 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -public data class Category ( +data class Category ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt index be863d1e5cd5..2e883cccdd09 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -24,7 +24,7 @@ import java.io.Serializable * @param complete */ -public data class Order ( +data class Order ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -52,7 +52,7 @@ public data class Order ( * Values: placed,approved,delivered */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt index bcf54796a13a..9771dda248c4 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param status pet status in the store */ -public data class Pet ( +data class Pet ( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -54,7 +54,7 @@ public data class Pet ( * Values: available,pending,sold */ - public enum class Status(val value: kotlin.String){ + enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt index f2967f5a6818..7fb743571254 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -20,7 +20,7 @@ import java.io.Serializable * @param name */ -public data class Tag ( +data class Tag ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt index 699a24141ada..e66f3cf09fed 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/User.kt @@ -26,7 +26,7 @@ import java.io.Serializable * @param userStatus User Status */ -public data class User ( +data class User ( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") From d3a33b6143a3eb6957ad8e3374131c8958cb02cf Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@gmail.com> Date: Thu, 10 Oct 2019 09:47:51 +0100 Subject: [PATCH 6/6] [kotlin-client] inline visibility modifier --- .../src/main/resources/kotlin-client/api.mustache | 2 +- .../resources/kotlin-client/data_class.mustache | 8 ++++---- .../resources/kotlin-client/enum_class.mustache | 4 ++-- .../infrastructure/ApiAbstractions.kt.mustache | 8 ++++---- .../infrastructure/RequestConfig.kt.mustache | 2 +- .../infrastructure/RequestMethod.kt.mustache | 2 +- .../jvm/infrastructure/ApiClient.kt.mustache | 4 ++-- .../ApiInfrastructureResponse.kt.mustache | 14 +++++++------- .../ApplicationDelegates.kt.mustache | 2 +- .../infrastructure/ByteArrayAdapter.kt.mustache | 2 +- .../jvm/infrastructure/Errors.kt.mustache | 8 ++++---- .../infrastructure/LocalDateAdapter.kt.mustache | 2 +- .../LocalDateTimeAdapter.kt.mustache | 2 +- .../infrastructure/ResponseExtensions.kt.mustache | 8 ++++---- .../jvm/infrastructure/Serializer.kt.mustache | 2 +- .../jvm/infrastructure/UUIDAdapter.kt.mustache | 2 +- .../libraries/multiplatform/api.mustache | 4 ++-- .../infrastructure/ApiClient.kt.mustache | 4 ++-- .../infrastructure/HttpResponse.kt.mustache | 14 +++++++------- .../serial_wrapper_request_list.mustache | 2 +- .../serial_wrapper_request_map.mustache | 2 +- .../serial_wrapper_response_list.mustache | 2 +- .../serial_wrapper_response_map.mustache | 2 +- .../resources/kotlin-client/visibility.mustache | 1 - .../openapitools/client/infrastructure/Errors.kt | 4 ++-- 25 files changed, 53 insertions(+), 54 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache index ea3ab7427559..14e11991fa3b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/api.mustache @@ -17,7 +17,7 @@ import {{packageName}}.infrastructure.Success import {{packageName}}.infrastructure.toMultiValue {{#operations}} -{{>visibility}}class {{classname}}(basePath: kotlin.String = "{{{basePath}}}") : ApiClient(basePath) { +{{#nonPublicApi}}internal {{/nonPublicApi}}class {{classname}}(basePath: kotlin.String = "{{{basePath}}}") : ApiClient(basePath) { {{#operation}} /** diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache index 51c7f7f71f4e..67dfd0d8f3df 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache @@ -28,7 +28,7 @@ import java.io.Serializable @Parcelize {{/parcelizeModels}} {{#multiplatform}}@Serializable{{/multiplatform}} -{{>visibility}}data class {{classname}} ( +{{#nonPublicApi}}internal {{/nonPublicApi}}data class {{classname}} ( {{#requiredVars}} {{>data_class_req_var}}{{^-last}}, {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, @@ -39,7 +39,7 @@ import java.io.Serializable {{#parcelizeModels}}{{#serializableModel}} : Parcelable, Serializable {{/serializableModel}}{{/parcelizeModels}} {{#needsDataClassBody}}{{=<% %>=}}{<%={{ }}=%>{{/needsDataClassBody}} {{#serializableModel}} - companion object { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { private const val serialVersionUID: Long = 123 } {{/serializableModel}}{{#hasEnums}} @@ -49,7 +49,7 @@ import java.io.Serializable * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ {{#multiplatform}}@Serializable(with = {{nameInCamelCase}}.Serializer::class){{/multiplatform}} - {{>visibility}}enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){ + {{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){ {{#allowableValues}}{{#enumVars}} {{#jvm}} {{#moshi}} @@ -65,7 +65,7 @@ import java.io.Serializable {{/enumVars}}{{/allowableValues}} {{#multiplatform}} - {{>visibility}}object Serializer : CommonEnumSerializer<{{nameInCamelCase}}>("{{nameInCamelCase}}", values(), values().map { it.value }.toTypedArray()) + {{#nonPublicApi}}internal {{/nonPublicApi}}object Serializer : CommonEnumSerializer<{{nameInCamelCase}}>("{{nameInCamelCase}}", values(), values().map { it.value }.toTypedArray()) {{/multiplatform}} } {{/isEnum}}{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache index 1a0891f34bd9..102a2a2f9398 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/enum_class.mustache @@ -16,7 +16,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ {{#multiplatform}}@Serializable(with = {{classname}}.Serializer::class){{/multiplatform}} -{{>visibility}}enum class {{classname}}(val value: {{{dataType}}}){ +{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{classname}}(val value: {{{dataType}}}){ {{#allowableValues}}{{#enumVars}} {{#jvm}} @@ -42,6 +42,6 @@ import kotlinx.serialization.internal.CommonEnumSerializer {{/enumVars}}{{/allowableValues}} {{#multiplatform}} - {{>visibility}}object Serializer : CommonEnumSerializer<{{classname}}>("{{classname}}", values(), values().map { it.value }.toTypedArray()) + {{#nonPublicApi}}internal {{/nonPublicApi}}object Serializer : CommonEnumSerializer<{{classname}}>("{{classname}}", values(), values().map { it.value }.toTypedArray()) {{/multiplatform}} } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache index 0a0c21b97687..7cdc8cc962e7 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/ApiAbstractions.kt.mustache @@ -2,7 +2,7 @@ package {{packageName}}.infrastructure typealias MultiValueMap = Map> -{{>visibility}}fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { +{{#nonPublicApi}}internal {{/nonPublicApi}}fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" @@ -10,12 +10,12 @@ typealias MultiValueMap = Map> else -> "" } -{{>visibility}}val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } +{{#nonPublicApi}}internal {{/nonPublicApi}}val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } -{{>visibility}}fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) +{{#nonPublicApi}}internal {{/nonPublicApi}}fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) = toMultiValue(items.asIterable(), collectionFormat, map) -{{>visibility}}fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { +{{#nonPublicApi}}internal {{/nonPublicApi}}fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { return when(collectionFormat) { "multi" -> items.map(map) else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache index e2107a51b169..bac8d60f7a96 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestConfig.kt.mustache @@ -8,7 +8,7 @@ package {{packageName}}.infrastructure * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ -{{>visibility}}data class RequestConfig( +{{#nonPublicApi}}internal {{/nonPublicApi}}data class RequestConfig( val method: RequestMethod, val path: String, val headers: MutableMap = mutableMapOf(), diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache index 404f9494edab..8c7c162f477f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/infrastructure/RequestMethod.kt.mustache @@ -3,6 +3,6 @@ package {{packageName}}.infrastructure /** * Provides enumerated HTTP verbs */ -{{>visibility}}enum class RequestMethod { +{{#nonPublicApi}}internal {{/nonPublicApi}}enum class RequestMethod { GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache index d0e63ff82ec5..1cd9edcf4b2c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiClient.kt.mustache @@ -23,8 +23,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import java.io.File -{{>visibility}}open class ApiClient(val baseUrl: String) { - {{>visibility}}companion object { +{{#nonPublicApi}}internal {{/nonPublicApi}}open class ApiClient(val baseUrl: String) { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" protected const val Authorization = "Authorization" diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache index 4ff0991d3ce8..1970b34824ab 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApiInfrastructureResponse.kt.mustache @@ -1,38 +1,38 @@ package {{packageName}}.infrastructure -{{>visibility}}enum class ResponseType { +{{#nonPublicApi}}internal {{/nonPublicApi}}enum class ResponseType { Success, Informational, Redirection, ClientError, ServerError } -{{>visibility}}abstract class ApiInfrastructureResponse(val responseType: ResponseType) { +{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiInfrastructureResponse(val responseType: ResponseType) { abstract val statusCode: Int abstract val headers: Map> } -{{>visibility}}class Success( +{{#nonPublicApi}}internal {{/nonPublicApi}}class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() ): ApiInfrastructureResponse(ResponseType.Success) -{{>visibility}}class Informational( +{{#nonPublicApi}}internal {{/nonPublicApi}}class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Informational) -{{>visibility}}class Redirection( +{{#nonPublicApi}}internal {{/nonPublicApi}}class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.Redirection) -{{>visibility}}class ClientError( +{{#nonPublicApi}}internal {{/nonPublicApi}}class ClientError( val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() ) : ApiInfrastructureResponse(ResponseType.ClientError) -{{>visibility}}class ServerError( +{{#nonPublicApi}}internal {{/nonPublicApi}}class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache index d621811de8e4..631122631764 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ApplicationDelegates.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -{{>visibility}}object ApplicationDelegates { +{{#nonPublicApi}}internal {{/nonPublicApi}}object ApplicationDelegates { /** * Provides a property delegate, allowing the property to be set once and only once. * diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache index 9a9cb6e818dd..aacd100ea7aa 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ByteArrayAdapter.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson -{{>visibility}}class ByteArrayAdapter { +{{#nonPublicApi}}internal {{/nonPublicApi}}class ByteArrayAdapter { @ToJson fun toJson(data: ByteArray): String = String(data) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache index 5da2586fcbb5..e1043e95b1f2 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Errors.kt.mustache @@ -3,7 +3,7 @@ package {{packageName}}.infrastructure import java.lang.RuntimeException -{{>visibility}}open class ClientException : RuntimeException { +{{#nonPublicApi}}internal {{/nonPublicApi}}open class ClientException : RuntimeException { /** * Constructs an [ClientException] with no detail message. @@ -17,12 +17,12 @@ import java.lang.RuntimeException */ constructor(message: kotlin.String) : super(message) - companion object { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { private const val serialVersionUID: Long = 123L } } -{{>visibility}}open class ServerException : RuntimeException { +{{#nonPublicApi}}internal {{/nonPublicApi}}open class ServerException : RuntimeException { /** * Constructs an [ServerException] with no detail message. @@ -36,7 +36,7 @@ import java.lang.RuntimeException */ constructor(message: kotlin.String) : super(message) - companion object { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { private const val serialVersionUID: Long = 456L } } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache index fab45dd576a6..84635bd2f123 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateAdapter.kt.mustache @@ -11,7 +11,7 @@ import org.threeten.bp.LocalDate import org.threeten.bp.format.DateTimeFormatter {{/threetenbp}} -{{>visibility}}class LocalDateAdapter { +{{#nonPublicApi}}internal {{/nonPublicApi}}class LocalDateAdapter { @ToJson fun toJson(value: LocalDate): String { return DateTimeFormatter.ISO_LOCAL_DATE.format(value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache index 7c08927d2577..48f40dbe7c07 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/LocalDateTimeAdapter.kt.mustache @@ -11,7 +11,7 @@ import org.threeten.bp.LocalDateTime import org.threeten.bp.format.DateTimeFormatter {{/threetenbp}} -{{>visibility}}class LocalDateTimeAdapter { +{{#nonPublicApi}}internal {{/nonPublicApi}}class LocalDateTimeAdapter { @ToJson fun toJson(value: LocalDateTime): String { return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache index 81dc36548dbf..93c69816bcce 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/ResponseExtensions.kt.mustache @@ -5,19 +5,19 @@ import okhttp3.Response /** * Provides an extension to evaluation whether the response is a 1xx code */ -{{>visibility}}val Response.isInformational : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 100..199 +{{#nonPublicApi}}internal {{/nonPublicApi}}val Response.isInformational : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ -{{>visibility}}val Response.isRedirect : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 300..399 +{{#nonPublicApi}}internal {{/nonPublicApi}}val Response.isRedirect : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 300..399 /** * Provides an extension to evaluation whether the response is a 4xx code */ -{{>visibility}}val Response.isClientError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 400..499 +{{#nonPublicApi}}internal {{/nonPublicApi}}val Response.isClientError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 400..499 /** * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code */ -{{>visibility}}val Response.isServerError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 500..999 +{{#nonPublicApi}}internal {{/nonPublicApi}}val Response.isServerError : Boolean get() = this.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}} in 500..999 diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache index 0a3a9bf31a57..699a78f923f4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/Serializer.kt.mustache @@ -5,7 +5,7 @@ import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date -{{>visibility}}object Serializer { +{{#nonPublicApi}}internal {{/nonPublicApi}}object Serializer { @JvmStatic val moshi: Moshi = Moshi.Builder() .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache index 35a2a1b6f226..a1ebc2cfced3 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm/infrastructure/UUIDAdapter.kt.mustache @@ -4,7 +4,7 @@ import com.squareup.moshi.FromJson import com.squareup.moshi.ToJson import java.util.UUID -{{>visibility}}class UUIDAdapter { +{{#nonPublicApi}}internal {{/nonPublicApi}}class UUIDAdapter { @ToJson fun toJson(uuid: UUID) = uuid.toString() diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache index 2445c9fbcec0..89777b14b8bf 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache @@ -16,7 +16,7 @@ import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor {{#operations}} -{{>visibility}}class {{classname}} @UseExperimental(UnstableDefault::class) constructor( +{{#nonPublicApi}}internal {{/nonPublicApi}}class {{classname}} @UseExperimental(UnstableDefault::class) constructor( baseUrl: kotlin.String = "{{{basePath}}}", httpClientEngine: HttpClientEngine? = null, serializer: KotlinxSerializer) @@ -101,7 +101,7 @@ import kotlinx.serialization.internal.StringDescriptor {{/operation}} - {{>visibility}}companion object { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { internal fun setMappers(serializer: KotlinxSerializer) { {{#operation}} {{#hasBodyParam}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache index 44d9f28b5508..26927bfd481c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache @@ -24,7 +24,7 @@ import kotlinx.serialization.json.JsonConfiguration import {{apiPackage}}.* import {{modelPackage}}.* -{{>visibility}}open class ApiClient( +{{#nonPublicApi}}internal {{/nonPublicApi}}open class ApiClient( private val baseUrl: String, httpClientEngine: HttpClientEngine?, serializer: KotlinxSerializer) { @@ -46,7 +46,7 @@ import {{modelPackage}}.* httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } - {{>visibility}}companion object { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) private fun setMappers(serializer: KotlinxSerializer) { diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache index a0b7f77b70c0..87f27a5cf56f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/HttpResponse.kt.mustache @@ -5,14 +5,14 @@ import io.ktor.client.call.typeInfo import io.ktor.http.Headers import io.ktor.http.isSuccess -{{>visibility}}open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { +{{#nonPublicApi}}internal {{/nonPublicApi}}open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { val status: Int = response.status.value val success: Boolean = response.status.isSuccess() val headers: Map> = response.headers.mapEntries() suspend fun body(): T = provider.body(response) suspend fun typedBody(type: TypeInfo): V = provider.typedBody(response, type) - {{>visibility}}companion object { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { private fun Headers.mapEntries(): Map> { val result = mutableMapOf>() entries().forEach { result[it.key] = it.value } @@ -21,12 +21,12 @@ import io.ktor.http.isSuccess } } -{{>visibility}}interface BodyProvider { +{{#nonPublicApi}}internal {{/nonPublicApi}}interface BodyProvider { suspend fun body(response: io.ktor.client.response.HttpResponse): T suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V } -{{>visibility}}class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { +{{#nonPublicApi}}internal {{/nonPublicApi}}class TypedBodyProvider(private val type: TypeInfo) : BodyProvider { @Suppress("UNCHECKED_CAST") override suspend fun body(response: io.ktor.client.response.HttpResponse): T = response.call.receive(type) as T @@ -36,7 +36,7 @@ import io.ktor.http.isSuccess response.call.receive(type) as V } -{{>visibility}}class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { +{{#nonPublicApi}}internal {{/nonPublicApi}}class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : BodyProvider { override suspend fun body(response: io.ktor.client.response.HttpResponse): T = block(provider.body(response)) @@ -44,8 +44,8 @@ import io.ktor.http.isSuccess provider.typedBody(response, type) } -{{>visibility}}inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = +{{#nonPublicApi}}internal {{/nonPublicApi}}inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = HttpResponse(this, TypedBodyProvider(typeInfo())) -{{>visibility}}fun HttpResponse.map(block: T.() -> V): HttpResponse = +{{#nonPublicApi}}internal {{/nonPublicApi}}fun HttpResponse.map(block: T.() -> V): HttpResponse = HttpResponse(response, MappedBodyProvider(provider, block)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache index 1e240683b80a..6b07c05f44e4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_list.mustache @@ -1,7 +1,7 @@ @Serializable private class {{operationIdCamelCase}}Request(val value: List<{{#bodyParam}}{{baseType}}{{/bodyParam}}>) { @Serializer({{operationIdCamelCase}}Request::class) - companion object : KSerializer<{{operationIdCamelCase}}Request> { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Request> { private val serializer: KSerializer> = {{#bodyParam}}{{baseType}}{{/bodyParam}}.serializer().list override val descriptor = StringDescriptor.withName("{{operationIdCamelCase}}Request") override fun serialize(encoder: Encoder, obj: {{operationIdCamelCase}}Request) = serializer.serialize(encoder, obj.value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache index 7da90c9974b9..f3a28700adf1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_request_map.mustache @@ -1,7 +1,7 @@ @Serializable private class {{operationIdCamelCase}}Request(val value: Map) { @Serializer({{operationIdCamelCase}}Request::class) - companion object : KSerializer<{{operationIdCamelCase}}Request> { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Request> { private val serializer: KSerializer> = (kotlin.String.serializer() to {{#bodyParam}}{{baseType}}{{/bodyParam}}.serializer()).map override val descriptor = StringDescriptor.withName("{{operationIdCamelCase}}Request") override fun serialize(encoder: Encoder, obj: {{operationIdCamelCase}}Request) = serializer.serialize(encoder, obj.value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache index 91403ee50b4b..838a8f1e53f3 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_list.mustache @@ -1,7 +1,7 @@ @Serializable private class {{operationIdCamelCase}}Response(val value: List<{{returnBaseType}}>) { @Serializer({{operationIdCamelCase}}Response::class) - companion object : KSerializer<{{operationIdCamelCase}}Response> { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Response> { private val serializer: KSerializer> = {{returnBaseType}}.serializer().list override val descriptor = StringDescriptor.withName("{{operationIdCamelCase}}Response") override fun serialize(encoder: Encoder, obj: {{operationIdCamelCase}}Response) = serializer.serialize(encoder, obj.value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache index 730e0b672c5e..c23dcadcdc5b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/serial_wrapper_response_map.mustache @@ -1,7 +1,7 @@ @Serializable private class {{operationIdCamelCase}}Response(val value: Map) { @Serializer({{operationIdCamelCase}}Response::class) - companion object : KSerializer<{{operationIdCamelCase}}Response> { + {{#nonPublicApi}}internal {{/nonPublicApi}}companion object : KSerializer<{{operationIdCamelCase}}Response> { private val serializer: KSerializer> = (kotlin.String.serializer() to {{returnBaseType}}.serializer()).map override val descriptor = StringDescriptor.withName("{{operationIdCamelCase}}Response") override fun serialize(encoder: Encoder, obj: {{operationIdCamelCase}}Response) = serializer.serialize(encoder, obj.value) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache deleted file mode 100644 index 0a4f47725cdc..000000000000 --- a/modules/openapi-generator/src/main/resources/kotlin-client/visibility.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#nonPublicApi}}internal {{/nonPublicApi}} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt index f1a47a02bd69..2521ff5e08fa 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -17,7 +17,7 @@ internal open class ClientException : RuntimeException { */ constructor(message: kotlin.String) : super(message) - companion object { + internal companion object { private const val serialVersionUID: Long = 123L } } @@ -36,7 +36,7 @@ internal open class ServerException : RuntimeException { */ constructor(message: kotlin.String) : super(message) - companion object { + internal companion object { private const val serialVersionUID: Long = 456L } } \ No newline at end of file