diff --git a/.gitignore b/.gitignore index e24cf380cfea..efe3fab179e0 100644 --- a/.gitignore +++ b/.gitignore @@ -195,14 +195,11 @@ samples/server/petstore/aspnetcore/.vs/ effective.pom # kotlin -samples/client/petstore/kotlin/src/main/kotlin/test/ -samples/client/petstore/kotlin-threetenbp/build -samples/client/petstore/kotlin-string/build +samples/client/petstore/kotlin*/build +samples/client/petstore/kotlin*/.gradle samples/openapi3/client/petstore/kotlin/build samples/server/petstore/kotlin-server/ktor/build samples/server/petstore/kotlin-springboot/build -samples/client/petstore/kotlin-multiplatform/build/ -samples/client/petstore/kotlin-okhttp3/build/ \? # haskell diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index c53f7f7a59df..1960dcae3c88 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -10,7 +10,7 @@ sidebar_label: kotlin |artifactVersion|Generated artifact's package version.| |1.0.0| |collectionType|Option. Collection type to use|
**array**
kotlin.Array
**list**
kotlin.collections.List
|list| |dateLibrary|Option. Date library to use|
**threetenbp-localdatetime**
Threetenbp - Backport of JSR310 (jvm only, for legacy app only)
**string**
String
**java8-localdatetime**
Java 8 native JSR310 (jvm only, for legacy app only)
**java8**
Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)
**threetenbp**
Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)
|java8| -|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase| +|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| |groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools| |library|Library template (sub-template) to use|
**jvm-okhttp4**
[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.
**jvm-okhttp3**
Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.
**jvm-retrofit2**
Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.
**multiplatform**
Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.
|jvm-okhttp4| |modelMutable|Create mutable models| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index 1ac723a984e1..f376392238aa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -72,6 +72,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen { // (mustache does not allow for boolean operators so we need this extra field) protected boolean doNotUseRxAndCoroutines = true; + protected String baseFolder; protected String authFolder; public enum DateLibrary { @@ -150,6 +151,8 @@ public KotlinClientCodegen() { // cliOptions default redefinition need to be updated updateOption(CodegenConstants.ARTIFACT_ID, this.artifactId); updateOption(CodegenConstants.PACKAGE_NAME, this.packageName); + // Kotlin convention + updateOption(CodegenConstants.ENUM_PROPERTY_NAMING, "PascalCase"); outputFolder = "generated-code" + File.separator + "kotlin-client"; modelTemplateFiles.put("model.mustache", ".kt"); @@ -284,7 +287,7 @@ public void processOpts() { super.processOpts(); if (MULTIPLATFORM.equals(getLibrary())) { - sourceFolder = "src/commonMain/kotlin"; + sourceFolder = "src/common/main"; } @@ -311,13 +314,13 @@ public void processOpts() { if (hasConflict) { LOGGER.warn("You specified RxJava versions 1 and 2 and 3 or Coroutines together, please choose one of them."); } else if (hasRx) { - this.setUseRxJava(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA).toString())); + this.setUseRxJava(Boolean.parseBoolean(additionalProperties.get(USE_RX_JAVA).toString())); } else if (hasRx2) { - this.setUseRxJava2(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA2).toString())); + this.setUseRxJava2(Boolean.parseBoolean(additionalProperties.get(USE_RX_JAVA2).toString())); } else if (hasRx3) { - this.setUseRxJava3(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA3).toString())); + this.setUseRxJava3(Boolean.parseBoolean(additionalProperties.get(USE_RX_JAVA3).toString())); } else if (hasCoroutines) { - this.setUseCoroutines(Boolean.valueOf(additionalProperties.get(USE_COROUTINES).toString())); + this.setUseCoroutines(Boolean.parseBoolean(additionalProperties.get(USE_COROUTINES).toString())); } if (!hasRx && !hasRx2 && !hasRx3 && !hasCoroutines) { @@ -327,7 +330,8 @@ public void processOpts() { // infrastructure destination folder final String infrastructureFolder = (sourceFolder + File.separator + packageName + File.separator + "infrastructure").replace(".", "/"); - authFolder = (sourceFolder + File.separator + packageName + File.separator + "auth").replace(".", "/"); + authFolder = (sourceFolder + File.separator + packageName + File.separator + "auth").replace(".", File.separator); + baseFolder = (sourceFolder + File.separator + packageName).replace(".", File.separator); // additional properties if (additionalProperties.containsKey(DATE_LIBRARY)) { @@ -496,6 +500,7 @@ private void processJVMOkHttpLibrary(final String infrastructureFolder) { setLibrary(JVM_OKHTTP); // jvm specific supporting files + supportingFiles.add(new SupportingFile("infrastructure/ApiClient.kt.mustache", infrastructureFolder, "ApiClient.kt")); supportingFiles.add(new SupportingFile("infrastructure/ApplicationDelegates.kt.mustache", infrastructureFolder, "ApplicationDelegates.kt")); supportingFiles.add(new SupportingFile("infrastructure/Errors.kt.mustache", infrastructureFolder, "Errors.kt")); supportingFiles.add(new SupportingFile("infrastructure/ResponseExtensions.kt.mustache", infrastructureFolder, "ResponseExtensions.kt")); @@ -533,11 +538,16 @@ private void processMultiplatformLibrary(final String infrastructureFolder) { importMapping.put("Base64ByteArray", packageName + ".infrastructure.Base64ByteArray"); importMapping.put("OctetByteArray", packageName + ".infrastructure.OctetByteArray"); + // bundled client file + supportingFiles.add(new SupportingFile("ApiClient.kt.mustache", baseFolder, "ApiClient.kt")); + // multiplatform specific supporting files + supportingFiles.add(new SupportingFile("infrastructure/ApiClientBase.kt.mustache", infrastructureFolder, "ApiClientBase.kt")); supportingFiles.add(new SupportingFile("infrastructure/Base64ByteArray.kt.mustache", infrastructureFolder, "Base64ByteArray.kt")); supportingFiles.add(new SupportingFile("infrastructure/Bytes.kt.mustache", infrastructureFolder, "Bytes.kt")); supportingFiles.add(new SupportingFile("infrastructure/HttpResponse.kt.mustache", infrastructureFolder, "HttpResponse.kt")); supportingFiles.add(new SupportingFile("infrastructure/OctetByteArray.kt.mustache", infrastructureFolder, "OctetByteArray.kt")); + supportingFiles.add(new SupportingFile("infrastructure/encoding.kt.mustache", infrastructureFolder, "encoding.kt")); // multiplatform specific auth supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.kt.mustache", authFolder, "ApiKeyAuth.kt")); @@ -547,30 +557,35 @@ private void processMultiplatformLibrary(final String infrastructureFolder) { supportingFiles.add(new SupportingFile("auth/OAuth.kt.mustache", authFolder, "OAuth.kt")); // multiplatform specific testing files - supportingFiles.add(new SupportingFile("commonTest/Coroutine.kt.mustache", "src/commonTest/kotlin/util", "Coroutine.kt")); - supportingFiles.add(new SupportingFile("iosTest/Coroutine.kt.mustache", "src/iosTest/kotlin/util", "Coroutine.kt")); - supportingFiles.add(new SupportingFile("jsTest/Coroutine.kt.mustache", "src/jsTest/kotlin/util", "Coroutine.kt")); - supportingFiles.add(new SupportingFile("jvmTest/Coroutine.kt.mustache", "src/jvmTest/kotlin/util", "Coroutine.kt")); + supportingFiles.add(new SupportingFile("commonTest/Coroutine.kt.mustache", "src/common/test/util", "Coroutine.kt")); + supportingFiles.add(new SupportingFile("iosTest/Coroutine.kt.mustache", "src/ios/test/util", "Coroutine.kt")); + supportingFiles.add(new SupportingFile("jsTest/Coroutine.kt.mustache", "src/js/test/util", "Coroutine.kt")); + supportingFiles.add(new SupportingFile("jvmTest/Coroutine.kt.mustache", "src/jvm/test/util", "Coroutine.kt")); // gradle wrapper supporting files supportingFiles.add(new SupportingFile("gradlew.mustache", "", "gradlew")); supportingFiles.add(new SupportingFile("gradlew.bat.mustache", "", "gradlew.bat")); + supportingFiles.add(new SupportingFile("gradle.properties", "", "gradle.properties")); supportingFiles.add(new SupportingFile("gradle-wrapper.properties.mustache", "gradle.wrapper".replace(".", File.separator), "gradle-wrapper.properties")); supportingFiles.add(new SupportingFile("gradle-wrapper.jar", "gradle.wrapper".replace(".", File.separator), "gradle-wrapper.jar")); } private void commonJvmMultiplatformSupportingFiles(String infrastructureFolder) { - supportingFiles.add(new SupportingFile("infrastructure/ApiClient.kt.mustache", infrastructureFolder, "ApiClient.kt")); supportingFiles.add(new SupportingFile("infrastructure/ApiAbstractions.kt.mustache", infrastructureFolder, "ApiAbstractions.kt")); supportingFiles.add(new SupportingFile("infrastructure/RequestConfig.kt.mustache", infrastructureFolder, "RequestConfig.kt")); supportingFiles.add(new SupportingFile("infrastructure/RequestMethod.kt.mustache", infrastructureFolder, "RequestMethod.kt")); } private void commonSupportingFiles() { + if (MULTIPLATFORM.equals(getLibrary())) { + supportingFiles.add(new SupportingFile("build.gradle.kts.mustache", "", "build.gradle.kts")); + supportingFiles.add(new SupportingFile("settings.gradle.kts.mustache", "", "settings.gradle.kts")); + } else { + supportingFiles.add(new SupportingFile("build.gradle.mustache", "", "build.gradle")); + supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle")); + } supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - supportingFiles.add(new SupportingFile("build.gradle.mustache", "", "build.gradle")); - supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle")); } @Override diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache index eebddf4b1961..85e183eed494 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/README.mustache @@ -7,7 +7,7 @@ * Gradle 4.9 {{/jvm}} {{#multiplatform}} -* Kotlin 1.3.50 +* Kotlin 1.3.72 {{/multiplatform}} ## Build @@ -36,7 +36,7 @@ This runs all tests and packages the library. {{#jvm}}* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets.{{/jvm}} {{#generateApiDocs}} - + ## Documentation for API Endpoints All URIs are relative to *{{{basePath}}}* @@ -48,7 +48,7 @@ Class | Method | HTTP request | Description {{/generateApiDocs}} {{#generateModelDocs}} - + ## Documentation for Models {{#modelPackage}} @@ -60,7 +60,7 @@ No model defined in this package {{/modelPackage}} {{/generateModelDocs}} -{{! TODO: optional documentation for authorization? }} +{{! TODO: optional documentation for authorization? }} ## Documentation for Authorization {{^authMethods}} @@ -72,7 +72,7 @@ Authentication schemes defined for the API: {{/last}} {{/authMethods}} {{#authMethods}} - + ### {{name}} {{#isApiKey}}- **Type**: API key diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache index a3405b25c845..b6b482afb78b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/class_doc.mustache @@ -7,7 +7,7 @@ Name | Type | Description | Notes {{/vars}} {{#vars}}{{#isEnum}} -{{!NOTE: see java's resources "pojo_doc.mustache" once enums are fully implemented}} +{{!NOTE: see java's resources "pojo_doc.mustache" once enums are fully implemented}} ## Enum: {{baseName}} Name | Value ---- | -----{{#allowableValues}} 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 1b63b0878117..ba3132e00d60 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 @@ -23,14 +23,15 @@ import kotlinx.android.parcel.Parcelize {{/multiplatform}} {{#multiplatform}} import kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer {{/multiplatform}} {{#serializableModel}} import java.io.Serializable {{/serializableModel}} +import kotlin.collections.* /** * {{{description}}} + * {{#allVars}} * @param {{{name}}} {{{description}}} {{/allVars}} @@ -42,7 +43,7 @@ import java.io.Serializable {{#isDeprecated}} @Deprecated(message = "This schema is deprecated.") {{/isDeprecated}} -{{#nonPublicApi}}internal {{/nonPublicApi}}{{#discriminator}}interface{{/discriminator}}{{^discriminator}}data class{{/discriminator}} {{classname}}{{^discriminator}} ( +{{#nonPublicApi}}internal {{/nonPublicApi}}{{#discriminator}}interface{{/discriminator}}{{^discriminator}}data class{{/discriminator}} {{classname}}{{^discriminator}}( {{#allVars}} {{#required}}{{>data_class_req_var}}{{/required}}{{^required}}{{>data_class_opt_var}}{{/required}}{{^-last}},{{/-last}} {{/allVars}} @@ -60,14 +61,13 @@ import java.io.Serializable {{#vars}} {{#isEnum}} /** - * {{{description}}} - * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} - */ - {{#multiplatform}}@Serializable(with = {{nameInCamelCase}}.Serializer::class){{/multiplatform}} - {{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{{nameInCamelCase}}}(val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}){ + * {{{description}}} + * + * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} + */ + {{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{{nameInCamelCase}}}(val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}){ {{#allowableValues}} {{#enumVars}} - {{^multiplatform}} {{#moshi}} @Json(name = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} {{/moshi}} @@ -77,16 +77,11 @@ import java.io.Serializable {{#jackson}} @JsonProperty(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} {{/jackson}} - {{/multiplatform}} {{#multiplatform}} - {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} {{/multiplatform}} {{/enumVars}} {{/allowableValues}} - {{#multiplatform}} - - {{#nonPublicApi}}internal {{/nonPublicApi}}object Serializer : CommonEnumSerializer<{{nameInCamelCase}}>("{{nameInCamelCase}}", values(), values().map { it.value.toString() }.toTypedArray()) - {{/multiplatform}} } {{/isEnum}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache index cbf85029fcab..1b58be900a66 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_opt_var.mustache @@ -1,5 +1,7 @@ {{#description}} - /* {{{description}}} */ + /** + * {{{description}}} + */ {{/description}} {{^multiplatform}} {{#moshi}} @@ -12,7 +14,10 @@ @field:JsonProperty("{{{vendorExtensions.x-base-name-literal}}}") {{/jackson}} {{/multiplatform}} + {{#multiplatform}} + @SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") + {{/multiplatform}} {{#deprecated}} @Deprecated(message = "This property is deprecated.") {{/deprecated}} - {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}List{{/isList}}{{^isList}}Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache index eb18e85c4ce7..fd9740086a77 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class_req_var.mustache @@ -1,5 +1,7 @@ {{#description}} - /* {{{description}}} */ + /** + * {{{description}}} + */ {{/description}} {{^multiplatform}} {{#moshi}} @@ -15,4 +17,8 @@ {{#deprecated}} @Deprecated(message = "This property is deprecated.") {{/deprecated}} - {{#multiplatform}}@SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") @Required {{/multiplatform}}{{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}} \ No newline at end of file + {{#multiplatform}} + @SerialName(value = "{{{vendorExtensions.x-base-name-literal}}}") + @Required + {{/multiplatform}} + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}List{{/isList}}{{^isList}}Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}} \ No newline at end of file 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 8de73d460492..8b9d30eb4593 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 @@ -11,15 +11,15 @@ import com.fasterxml.jackson.annotation.JsonProperty {{/multiplatform}} {{#multiplatform}} import kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer {{/multiplatform}} /** -* {{{description}}} -* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} -*/ -{{#multiplatform}}@Serializable(with = {{classname}}.Serializer::class){{/multiplatform}} -{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{classname}}(val value: {{{dataType}}}){ + * {{{description}}} + * + * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} + */ +{{#multiplatform}}@Serializable{{/multiplatform}} +{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{classname}}(val value: {{{dataType}}}) { {{#allowableValues}}{{#enumVars}} {{^multiplatform}} @@ -33,6 +33,9 @@ import kotlinx.serialization.internal.CommonEnumSerializer @JsonProperty(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{/jackson}} {{/multiplatform}} + {{#multiplatform}} + @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) + {{/multiplatform}} {{#isListContainer}} {{#isList}} {{&name}}(listOf({{{value}}})){{^-last}},{{/-last}}{{#-last}};{{/-last}} @@ -48,14 +51,10 @@ import kotlinx.serialization.internal.CommonEnumSerializer {{/enumVars}}{{/allowableValues}} /** - This override toString avoids using the enum var name and uses the actual api value instead. - In cases the var name and value are different, the client would send incorrect enums to the server. - **/ + * This override toString avoids using the enum var name and uses the actual api value instead. + * In cases the var name and value are different, the client would send incorrect enums to the server. + */ override fun toString(): String { return value{{^isString}}.toString(){{/isString}} } - -{{#multiplatform}} - {{#nonPublicApi}}internal {{/nonPublicApi}}object Serializer : CommonEnumSerializer<{{classname}}>("{{classname}}", values(), values().map { it.value.toString() }.toTypedArray()) -{{/multiplatform}} } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/gradle.properties b/modules/openapi-generator/src/main/resources/kotlin-client/gradle.properties new file mode 100644 index 000000000000..29e08e8ca88f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/interface_opt_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/interface_opt_var.mustache index 3284d7b1db41..3c12573fbff6 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/interface_opt_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/interface_opt_var.mustache @@ -1,5 +1,7 @@ {{#description}} - /* {{{description}}} */ + /** + * {{{description}}} + */ {{/description}} {{^multiplatform}} {{#moshi}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/interface_req_var.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/interface_req_var.mustache index ee62fbb2d126..cef7ea0a283f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/interface_req_var.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/interface_req_var.mustache @@ -1,5 +1,7 @@ {{#description}} - /* {{{description}}} */ + /** + * {{{description}}} + */ {{/description}} {{^multiplatform}} {{#moshi}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/ApiClient.kt.mustache new file mode 100644 index 000000000000..a2d303780706 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/ApiClient.kt.mustache @@ -0,0 +1,95 @@ +package {{packageName}} + +import io.ktor.client.engine.HttpClientEngine +import kotlinx.serialization.json.Json +import {{packageName}}.apis.* +import {{packageName}}.infrastructure.ApiClientBase + +{{#nonPublicApi}}internal {{/nonPublicApi}}class ApiClient( + baseUrl: String = "{{{basePath}}}", + httpClientEngine: HttpClientEngine? = null, + json: Json = Json {} +) { + {{! TODO: Remove backticks when conflicts are resolved }} + {{#apiInfo}} + {{#apis}} + val `{{{classVarName}}}` = {{{classFilename}}}(baseUrl, httpClientEngine, json) + {{/apis}} + {{/apiInfo}} + + val allClients: Set = setOf( + {{#apiInfo}} + {{#apis}} + `{{{classVarName}}}`, + {{/apis}} + {{/apiInfo}} + ) + + /** + * Set the username for the first HTTP basic authentication for all apis. + * + * @param username Username + */ + fun setUsername(username: String) { + for (client in allClients) { + client.setUsername(username) + } + } + + /** + * Set the password for the first HTTP basic authentication for all apis. + * + * @param password Password + */ + fun setPassword(password: String) { + for (client in allClients) { + client.setPassword(password) + } + } + + /** + * Set the API key value for the first API key authentication for all apis. + * + * @param apiKey API key + * @param paramName The name of the API key parameter, or null or set the first key. + */ + fun setApiKey(apiKey: String, paramName: String? = null) { + for (client in allClients) { + client.setApiKey(apiKey, paramName) + } + } + + /** + * Set the API key prefix for the first API key authentication for all apis. + * + * @param apiKeyPrefix API key prefix + * @param paramName The name of the API key parameter, or null or set the first key. + */ + fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) { + for (client in allClients) { + client.setApiKeyPrefix(apiKeyPrefix, paramName) + } + } + + /** + * Set the access token for the first OAuth2 authentication for all apis. + * + * @param accessToken Access token + */ + fun setAccessToken(accessToken: String) { + for (client in allClients) { + client.setAccessToken(accessToken) + } + } + + /** + * Set the access token for the first Bearer authentication for all apis. + * + * @param bearerToken The bearer token. + */ + fun setBearerToken(bearerToken: String) { + for (client in allClients) { + client.setBearerToken(bearerToken) + } + } +} 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 d268f23a77d3..45f81b639a2c 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 @@ -6,29 +6,27 @@ package {{apiPackage}} import {{packageName}}.infrastructure.* import io.ktor.client.request.forms.formData -import kotlinx.serialization.UnstableDefault import io.ktor.client.engine.HttpClientEngine -import io.ktor.client.features.json.serializer.KotlinxSerializer +import io.ktor.client.request.forms.FormPart +import io.ktor.client.utils.EmptyContent import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonConfiguration import io.ktor.http.ParametersBuilder -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.builtins.list +import kotlinx.serialization.builtins.serializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder {{#operations}} -{{#nonPublicApi}}internal {{/nonPublicApi}}class {{classname}} @UseExperimental(UnstableDefault::class) constructor( +{{#nonPublicApi}}internal {{/nonPublicApi}}class {{classname}} constructor( baseUrl: kotlin.String = "{{{basePath}}}", httpClientEngine: HttpClientEngine? = null, - serializer: KotlinxSerializer -) : ApiClient(baseUrl, httpClientEngine, serializer) { - - @UseExperimental(UnstableDefault::class) - constructor( - baseUrl: kotlin.String = "{{{basePath}}}", - httpClientEngine: HttpClientEngine? = null, - jsonConfiguration: JsonConfiguration = JsonConfiguration.Default - ) : this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration))) - + json: Json = Json {}, +) : ApiClientBase(baseUrl, httpClientEngine, json) { {{#operation}} /** * {{summary}} @@ -39,58 +37,74 @@ import kotlinx.serialization.internal.StringDescriptor {{#returnType}} @Suppress("UNCHECKED_CAST") {{/returnType}} - suspend fun {{operationId}}({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): HttpResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> { - - val localVariableAuthNames = listOf({{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}}) + suspend fun {{operationId}}( + {{#allParams}} + {{{paramName}}}: {{{dataType}}}{{^required}}? = null{{/required}}{{#hasMore}},{{/hasMore}} + {{/allParams}} + ): HttpResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> { + {{! TODO: Optimize all the ?.let to only the places where it's needed }} + val authNamesOag = listOf({{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}}) - val localVariableBody = {{#hasBodyParam}}{{#bodyParam}}{{#isListContainer}}{{operationIdCamelCase}}Request({{{paramName}}}{{^isList}}.asList(){{/isList}}){{/isListContainer}}{{^isListContainer}}{{#isMapContainer}}{{operationIdCamelCase}}Request({{{paramName}}}){{/isMapContainer}}{{^isMapContainer}}{{{paramName}}}{{/isMapContainer}}{{/isListContainer}}{{/bodyParam}}{{/hasBodyParam}} + val bodyOag = {{#hasBodyParam}}{{#bodyParam}}{{#isListContainer}}{{^required}}{{{paramName}}}?.let { {{/required}}{{operationIdCamelCase}}Request({{{paramName}}}{{^isList}}.asList(){{/isList}}){{^required}} }{{/required}}{{/isListContainer}}{{^isListContainer}}{{#isMapContainer}}{{^required}}{{{paramName}}}?.let { {{/required}}{{operationIdCamelCase}}Request({{{paramName}}}){{^required}} }{{/required}}{{/isMapContainer}}{{^isMapContainer}}{{{paramName}}}{{/isMapContainer}}{{/isListContainer}}{{/bodyParam}}{{/hasBodyParam}} {{^hasBodyParam}} {{#hasFormParams}} {{#isMultipart}} formData { {{#formParams}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}) } + {{^required}}{{{paramName}}}?.let { {{/required}}append(FormPart("{{{baseName}}}", {{{paramName}}})){{^required}} }{{/required}} {{/formParams}} } {{/isMultipart}} {{^isMultipart}} ParametersBuilder().also { {{#formParams}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.toString()) } + {{^required}}{{{paramName}}}?.apply { {{/required}}it.append("{{{baseName}}}", {{{paramName}}}.toString()){{^required}} }{{/required}} {{/formParams}} }.build() {{/isMultipart}} {{/hasFormParams}} {{^hasFormParams}} - io.ktor.client.utils.EmptyContent + EmptyContent {{/hasFormParams}} {{/hasBodyParam}} - val localVariableQuery = mutableMapOf>() - {{#queryParams}} - {{{paramName}}}?.apply { localVariableQuery["{{baseName}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf("${{{paramName}}}"){{/isContainer}} } - {{/queryParams}} + val queriesOag = Queries { + {{#queryParams}} + {{#isContainer}} + {{#isMapContainer}} + {{^required}}if ({{{paramName}}} != null) {{/required}}addMap({{{paramName}}}) + {{/isMapContainer}} + {{^isMapContainer}} + {{^required}}if ({{{paramName}}} != null) {{/required}}addMulti("{{baseName}}", {{{paramName}}}, "{{collectionFormat}}") + {{/isMapContainer}} + {{/isContainer}} + {{^isContainer}} + add("{{baseName}}", {{{paramName}}}) + {{/isContainer}} + {{/queryParams}} + } - val localVariableHeaders = mutableMapOf() - {{#headerParams}} - {{{paramName}}}?.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } - {{/headerParams}} + val headersOag = mutableMapOf( + {{#headerParams}} + "{{baseName}}" to {{#isContainer}}{{{paramName}}}?.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this?.toString(){{/isContainer}}{{#hasMore}},{{/hasMore}} + {{/headerParams}} + ) - val localVariableConfig = RequestConfig( + val configOag = RequestConfig( RequestMethod.{{httpMethod}}, - "{{path}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", "${{{paramName}}}"){{/pathParams}}, - query = localVariableQuery, - headers = localVariableHeaders + "{{path}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", {{{paramName}}}.toString()){{/pathParams}}, + queries = queriesOag, + headers = headersOag ) return {{#hasBodyParam}}jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}multipartFormRequest{{/isMultipart}}{{^isMultipart}}urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}request{{/hasFormParams}}{{/hasBodyParam}}( - localVariableConfig, - localVariableBody, - localVariableAuthNames + configOag, + bodyOag, + authNamesOag ).{{#isListContainer}}wrap<{{operationIdCamelCase}}Response>().map { value{{^isList}}.toTypedArray(){{/isList}} }{{/isListContainer}}{{^isListContainer}}{{#isMapContainer}}wrap<{{operationIdCamelCase}}Response>().map { value }{{/isMapContainer}}{{^isMapContainer}}wrap(){{/isMapContainer}}{{/isListContainer}} } - {{#hasBodyParam}} + {{#bodyParam}} {{#isListContainer}}{{>serial_wrapper_request_list}}{{/isListContainer}}{{#isMapContainer}}{{>serial_wrapper_request_map}}{{/isMapContainer}} {{/bodyParam}} @@ -101,25 +115,6 @@ import kotlinx.serialization.internal.StringDescriptor {{#isMapContainer}} {{>serial_wrapper_response_map}} {{/isMapContainer}} - - {{/operation}} - - {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { - internal fun setMappers(serializer: KotlinxSerializer) { - {{#operation}} - {{#hasBodyParam}} - {{#bodyParam}} - {{#isListContainer}}serializer.setMapper({{operationIdCamelCase}}Request::class, {{operationIdCamelCase}}Request.serializer()){{/isListContainer}}{{#isMapContainer}}serializer.setMapper({{operationIdCamelCase}}Request::class, {{operationIdCamelCase}}Request.serializer()){{/isMapContainer}} - {{/bodyParam}} - {{/hasBodyParam}} - {{#isListContainer}} - serializer.setMapper({{operationIdCamelCase}}Response::class, {{operationIdCamelCase}}Response.serializer()) - {{/isListContainer}} - {{#isMapContainer}} - serializer.setMapper({{operationIdCamelCase}}Response::class, {{operationIdCamelCase}}Response.serializer()) - {{/isMapContainer}} - {{/operation}} - } - } +{{/operation}} } {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/ApiKeyAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/ApiKeyAuth.kt.mustache index 618fd7a88903..9141647d4a84 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/ApiKeyAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/ApiKeyAuth.kt.mustache @@ -1,16 +1,18 @@ package {{packageName}}.auth -class ApiKeyAuth(private val location: String, val paramName: String) : Authentication { +import {{packageName}}.infrastructure.Queries + +{{#nonPublicApi}}internal {{/nonPublicApi}}class ApiKeyAuth(private val location: String, val paramName: String) : Authentication { var apiKey: String? = null var apiKeyPrefix: String? = null - override fun apply(query: MutableMap>, headers: MutableMap) { - val key: String = apiKey ?: return - val prefix: String? = apiKeyPrefix - val value: String = if (prefix != null) "$prefix $key" else key - when (location) { - "query" -> query[paramName] = listOf(value) - "header" -> headers[paramName] = value + override fun apply(queries: Queries, headers: MutableMap) { + val key: String = apiKey ?: return + val prefix: String? = apiKeyPrefix + val value: String = if (prefix != null) "$prefix $key" else key + when (location) { + "query" -> queries.add(paramName, value) + "header" -> headers[paramName] = value + } } - } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/Authentication.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/Authentication.kt.mustache index 1aab9156d98b..1873652b11b9 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/Authentication.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/Authentication.kt.mustache @@ -1,13 +1,13 @@ package {{packageName}}.auth -interface Authentication { +import {{packageName}}.infrastructure.Queries +{{#nonPublicApi}}internal {{/nonPublicApi}}interface Authentication { /** * Apply authentication settings to header and query params. * - * @param query Query parameters. + * @param queries Query parameters. * @param headers Header parameters. */ - fun apply(query: MutableMap>, headers: MutableMap) - + fun apply(queries: Queries, headers: MutableMap) } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache index ef6c5888ae14..a9d6adabeabf 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache @@ -1,17 +1,16 @@ package {{packageName}}.auth -import io.ktor.util.InternalAPI -import io.ktor.util.encodeBase64 +import {{packageName}}.infrastructure.Queries +import {{packageName}}.infrastructure.toBase64 -class HttpBasicAuth : Authentication { +{{#nonPublicApi}}internal {{/nonPublicApi}}class HttpBasicAuth : Authentication { var username: String? = null var password: String? = null - @InternalAPI - override fun apply(query: MutableMap>, headers: MutableMap) { + override fun apply(queries: Queries, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") - val auth = str.encodeBase64() + val auth = str.toBase64() headers["Authorization"] = "Basic $auth" } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBearerAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBearerAuth.kt.mustache index 982389d09609..55806037e250 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBearerAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBearerAuth.kt.mustache @@ -1,9 +1,11 @@ package {{packageName}}.auth -class HttpBearerAuth(private val scheme: String?) : Authentication { +import {{packageName}}.infrastructure.Queries + +{{#nonPublicApi}}internal {{/nonPublicApi}}class HttpBearerAuth(private val scheme: String?) : Authentication { var bearerToken: String? = null - override fun apply(query: MutableMap>, headers: MutableMap) { + override fun apply(queries: Queries, headers: MutableMap) { val token: String = bearerToken ?: return headers["Authorization"] = (if (scheme != null) upperCaseBearer(scheme)!! + " " else "") + token } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/OAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/OAuth.kt.mustache index 98bb449a6096..b85b0226728e 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/OAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/OAuth.kt.mustache @@ -1,9 +1,11 @@ package {{packageName}}.auth -class OAuth : Authentication { +import {{packageName}}.infrastructure.Queries + +{{#nonPublicApi}}internal {{/nonPublicApi}}class OAuth : Authentication { var accessToken: String? = null - override fun apply(query: MutableMap>, headers: MutableMap) { + override fun apply(queries: Queries, headers: MutableMap) { val token: String = accessToken ?: return headers["Authorization"] = "Bearer $token" } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache new file mode 100644 index 000000000000..863decf65625 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache @@ -0,0 +1,123 @@ +plugins { + kotlin("multiplatform") version "1.4.0" + kotlin("plugin.serialization") version "1.4.0" +} + +group = "{{groupId}}" +version = "{{artifactVersion}}" + +val ktorVersion = "1.4.0" + +repositories { + jcenter() +} + +kotlin { + /* + * To find out how to configure the targets, please follow the link: + * https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets + */ + jvm { + val main by compilations.getting { + kotlinOptions { + // Setup the Kotlin compiler options for the 'main' compilation: + jvmTarget = "1.8" + } + } + } + ios { + binaries { + framework { + freeCompilerArgs = listOf("-Xobjc-generics") + } + } + } + js(BOTH) { + browser() + nodejs() + } + + sourceSets { + val commonMain by getting { + kotlin.srcDir("src/common/main") + + dependencies { + implementation(kotlin("stdlib-common")) + api("io.ktor:ktor-client-core:$ktorVersion") + api("io.ktor:ktor-client-json:$ktorVersion") + api("io.ktor:ktor-client-serialization:$ktorVersion") + } + } + + val commonTest by getting { + kotlin.srcDir("src/common/test") + + dependencies { + implementation(kotlin("test-common")) + implementation(kotlin("test-annotations-common")) + implementation("io.ktor:ktor-client-mock:$ktorVersion") + } + } + + val jvmMain by getting { + kotlin.srcDir("src/jvm/main") + + dependencies { + implementation(kotlin("stdlib-jdk8")) + api("io.ktor:ktor-client-core-jvm:$ktorVersion") + } + } + + val jvmTest by getting { + kotlin.srcDir("src/jvm/test") + + dependencies { + implementation(kotlin("test")) + implementation(kotlin("test-junit5")) + implementation("org.junit.jupiter:junit-jupiter:5.6.2") + implementation("io.ktor:ktor-client-apache:$ktorVersion") + implementation("io.ktor:ktor-client-mock-jvm:$ktorVersion") + } + } + + val iosMain by getting { + kotlin.srcDir("src/ios/main") + + dependencies { + implementation(kotlin("stdlib-native")) + api("io.ktor:ktor-client-ios:$ktorVersion") + } + } + + val iosTest by getting { + kotlin.srcDir("src/ios/test") + + dependencies { + implementation("io.ktor:ktor-client-mock-native:$ktorVersion") + } + } + + val jsMain by getting { + kotlin.srcDir("src/js/main") + + dependencies { + implementation(kotlin("stdlib-js")) + api("io.ktor:ktor-client-js:$ktorVersion") + } + } + + val jsTest by getting { + kotlin.srcDir("src/js/test") + + dependencies { + implementation("io.ktor:ktor-client-mock-js:$ktorVersion") + } + } + } +} + +tasks { + named("jvmTest") { + useJUnitPlatform() + } +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.mustache deleted file mode 100644 index dfc6736dc6d5..000000000000 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.mustache +++ /dev/null @@ -1,161 +0,0 @@ -apply plugin: 'kotlin-multiplatform' -apply plugin: 'kotlinx-serialization' - -group '{{groupId}}' -version '{{artifactVersion}}' - -ext { - kotlin_version = '1.3.50' - kotlinx_version = '1.1.0' - coroutines_version = '1.3.1' - serialization_version = '0.12.0' - ktor_version = '1.2.4' -} - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50" // $kotlin_version - classpath "org.jetbrains.kotlin:kotlin-serialization:1.3.50" // $kotlin_version - } -} - -repositories { - jcenter() -} - -kotlin { - jvm() - iosArm64() { binaries { framework { freeCompilerArgs.add("-Xobjc-generics") } } } - iosX64() { binaries { framework { freeCompilerArgs.add("-Xobjc-generics") } } } - js() - - sourceSets { - commonMain { - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version" - api "io.ktor:ktor-client-core:$ktor_version" - api "io.ktor:ktor-client-json:$ktor_version" - api "io.ktor:ktor-client-serialization:$ktor_version" - } - } - - commonTest { - dependencies { - implementation "org.jetbrains.kotlin:kotlin-test-common" - implementation "org.jetbrains.kotlin:kotlin-test-annotations-common" - implementation "io.ktor:ktor-client-mock:$ktor_version" - } - } - - jvmMain { - dependsOn commonMain - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version" - api "io.ktor:ktor-client-core-jvm:$ktor_version" - api "io.ktor:ktor-client-json-jvm:$ktor_version" - api "io.ktor:ktor-client-serialization-jvm:$ktor_version" - } - } - - jvmTest { - dependsOn commonTest - dependencies { - implementation "org.jetbrains.kotlin:kotlin-test" - implementation "org.jetbrains.kotlin:kotlin-test-junit" - implementation "io.ktor:ktor-client-mock-jvm:$ktor_version" - } - } - - iosMain { - dependsOn commonMain - dependencies { - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version" - api "io.ktor:ktor-client-ios:$ktor_version" - } - } - - iosTest { - dependsOn commonTest - dependencies { - implementation "io.ktor:ktor-client-mock-native:$ktor_version" - } - } - - iosArm64().compilations.main.defaultSourceSet { - dependsOn iosMain - dependencies { - api "io.ktor:ktor-client-ios-iosarm64:$ktor_version" - api "io.ktor:ktor-client-json-iosarm64:$ktor_version" - api "io.ktor:ktor-client-serialization-iosarm64:$ktor_version" - } - } - - iosArm64().compilations.test.defaultSourceSet { - dependsOn iosTest - } - - iosX64().compilations.main.defaultSourceSet { - dependsOn iosMain - dependencies { - api "io.ktor:ktor-client-ios-iosx64:$ktor_version" - api "io.ktor:ktor-client-json-iosx64:$ktor_version" - api "io.ktor:ktor-client-serialization-iosx64:$ktor_version" - } - } - - jsMain { - dependsOn commonMain - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version" - api "io.ktor:ktor-client-js:$ktor_version" - api "io.ktor:ktor-client-json-js:$ktor_version" - api "io.ktor:ktor-client-serialization-js:$ktor_version" - } - } - - jsTest { - dependsOn commonTest - dependencies { - implementation "io.ktor:ktor-client-mock-js:$ktor_version" - implementation "io.ktor:ktor-client-js:$ktor_version" - implementation "io.ktor:ktor-client-json:$ktor_version" - implementation "io.ktor:ktor-client-serialization-js:$ktor_version" - } - } - - iosX64().compilations.test.defaultSourceSet { - dependsOn iosTest - } - - all { - languageSettings { - useExperimentalAnnotation('kotlin.Experimental') - } - } - } -} - -task iosTest { - def device = project.findProperty("device")?.toString() ?: "iPhone 8" - dependsOn 'linkDebugTestIosX64' - group = JavaBasePlugin.VERIFICATION_GROUP - description = "Execute unit tests on ${device} simulator" - doLast { - def binary = kotlin.targets.iosX64.binaries.getTest('DEBUG') - exec { commandLine 'xcrun', 'simctl', 'spawn', device, binary.outputFile } - } -} - -configurations { // workaround for https://youtrack.jetbrains.com/issue/KT-27170 - compileClasspath -} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.jar index 2c6137b87896..490fda8577df 100644 Binary files a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.jar and b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.jar differ diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.properties.mustache index ce3ca77db54b..8f38dbc2bfd8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.properties.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradle-wrapper.properties.mustache @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradlew b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradlew new file mode 100755 index 000000000000..2fe81a7d95e4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradlew.bat b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradlew.bat new file mode 100644 index 000000000000..62bd9b9ccefe --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/gradlew.bat @@ -0,0 +1,103 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiAbstractions.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiAbstractions.kt.mustache new file mode 100644 index 000000000000..36f44ff217f4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiAbstractions.kt.mustache @@ -0,0 +1,51 @@ +package {{packageName}}.infrastructure + +{{#nonPublicApi}}internal {{/nonPublicApi}}fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" +} + +{{#nonPublicApi}}internal {{/nonPublicApi}}sealed class QueryParam { + data class Single(val value: String) : QueryParam() + data class Multi(val values: Iterable) : QueryParam() +} + +{{#nonPublicApi}}internal {{/nonPublicApi}}class Queries(val queries: MutableMap = mutableMapOf()) { + constructor(queries: MutableMap = mutableMapOf(), config: Queries.() -> Unit): this(queries) { + config(this) + } + + // Single + fun add(name: String, value: String?) { + if (value != null) { + queries[name] = QueryParam.Single(value) + } + } + + fun add(name: String, value: Any?) { + if (value != null) { + queries[name] = QueryParam.Single(value.toString()) + } + } + + // For Iterables + fun addMulti(name: String, values: Iterable, collectionFormat: String) { + val transformed = values.filterNotNull().map { it.toString() } + queries[name] = when (collectionFormat) { + "multi" -> QueryParam.Multi(transformed) + else -> QueryParam.Single(transformed.joinToString(separator = collectionDelimiter(collectionFormat))) + } + } + + // For Arrays + fun addMulti(name: String, values: Array, collectionFormat: String) = + addMulti(name, values.asIterable(), collectionFormat) + + // For Maps + fun addMap(values: Map) { + queries.putAll(values.filterValues { it != null }.mapValues { QueryParam.Single(it.value.toString()) }) + } +} 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/ApiClientBase.kt.mustache similarity index 61% rename from modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClient.kt.mustache rename to modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/ApiClientBase.kt.mustache index ae65921bb778..cf2c444566fb 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/ApiClientBase.kt.mustache @@ -2,74 +2,50 @@ package {{packageName}}.infrastructure import io.ktor.client.HttpClient import io.ktor.client.HttpClientConfig -import io.ktor.client.call.call import io.ktor.client.engine.HttpClientEngine import io.ktor.client.features.json.JsonFeature -import io.ktor.client.features.json.JsonSerializer import io.ktor.client.features.json.serializer.KotlinxSerializer -import io.ktor.client.request.accept import io.ktor.client.request.forms.FormDataContent import io.ktor.client.request.forms.MultiPartFormDataContent import io.ktor.client.request.header import io.ktor.client.request.parameter -import io.ktor.client.response.HttpResponse +import io.ktor.client.request.request +import io.ktor.client.statement.HttpResponse import io.ktor.client.utils.EmptyContent import io.ktor.http.* import io.ktor.http.content.OutgoingContent import io.ktor.http.content.PartData -import kotlinx.serialization.UnstableDefault import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonConfiguration -import {{apiPackage}}.* -import {{modelPackage}}.* import {{packageName}}.auth.* -{{#nonPublicApi}}internal {{/nonPublicApi}}open class ApiClient( +{{#nonPublicApi}}internal {{/nonPublicApi}}open class ApiClientBase( private val baseUrl: String, httpClientEngine: HttpClientEngine?, - serializer: KotlinxSerializer) { - - @UseExperimental(UnstableDefault::class) - constructor( - baseUrl: String, - httpClientEngine: HttpClientEngine?, - jsonConfiguration: JsonConfiguration) : - this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration))) - - private val serializer: JsonSerializer by lazy { - serializer.apply { setMappers(this) }.ignoreOutgoingContent() - } + json: Json = Json {} +) { + private val serializer = KotlinxSerializer(json) private val client: HttpClient by lazy { - val jsonConfig: JsonFeature.Config.() -> Unit = { this.serializer = this@ApiClient.serializer } + val jsonConfig: JsonFeature.Config.() -> Unit = { this.serializer = this@ApiClientBase.serializer } val clientConfig: (HttpClientConfig<*>) -> Unit = { it.install(JsonFeature, jsonConfig) } httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } {{#hasAuthMethods}} - private val authentications: kotlin.collections.Map by lazy { - mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + private val authentications: Map = mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}} "{{name}}" to HttpBasicAuth(){{/isBasicBasic}}{{^isBasicBasic}} "{{name}}" to HttpBearerAuth("{{scheme}}"){{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} "{{name}}" to ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}} - "{{name}}" to OAuth(){{/isOAuth}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}) - } + "{{name}}" to OAuth(){{/isOAuth}}{{#hasMore}}, {{/hasMore}}{{/authMethods}} + ) {{/hasAuthMethods}} + {{^hasAuthMethods}} - private val authentications: kotlin.collections.Map? = null + private val authentications: Map = mapOf() {{/hasAuthMethods}} {{#nonPublicApi}}internal {{/nonPublicApi}}companion object { protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) - - private fun setMappers(serializer: KotlinxSerializer) { - {{#apiInfo}}{{#apis}} - {{classname}}.setMappers(serializer) - {{/apis}}{{/apiInfo}} - {{#models}} - {{#model}}{{^isAlias}}serializer.setMapper({{modelPackage}}.{{classname}}::class, {{modelPackage}}.{{classname}}.{{#isEnum}}Serializer{{/isEnum}}{{^isEnum}}serializer(){{/isEnum}}){{/isAlias}}{{/model}} - {{/models}} - } } /** @@ -78,7 +54,7 @@ import {{packageName}}.auth.* * @param username Username */ fun setUsername(username: String) { - val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? ?: throw Exception("No HTTP basic authentication configured") auth.username = username } @@ -89,7 +65,7 @@ import {{packageName}}.auth.* * @param password Password */ fun setPassword(password: String) { - val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? ?: throw Exception("No HTTP basic authentication configured") auth.password = password } @@ -101,7 +77,7 @@ import {{packageName}}.auth.* * @param paramName The name of the API key parameter, or null or set the first key. */ fun setApiKey(apiKey: String, paramName: String? = null) { - val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? + val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? ?: throw Exception("No API key authentication configured") auth.apiKey = apiKey } @@ -113,7 +89,7 @@ import {{packageName}}.auth.* * @param paramName The name of the API key parameter, or null or set the first key. */ fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) { - val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? + val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? ?: throw Exception("No API key authentication configured") auth.apiKeyPrefix = apiKeyPrefix } @@ -124,7 +100,7 @@ import {{packageName}}.auth.* * @param accessToken Access token */ fun setAccessToken(accessToken: String) { - val auth = authentications?.values?.firstOrNull { it is OAuth } as OAuth? + val auth = authentications.values.firstOrNull { it is OAuth } as OAuth? ?: throw Exception("No OAuth2 authentication configured") auth.accessToken = accessToken } @@ -135,37 +111,40 @@ import {{packageName}}.auth.* * @param bearerToken The bearer token. */ fun setBearerToken(bearerToken: String) { - val auth = authentications?.values?.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? + val auth = authentications.values.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? ?: throw Exception("No Bearer authentication configured") auth.bearerToken = bearerToken } - protected suspend fun multipartFormRequest(requestConfig: RequestConfig, body: kotlin.collections.List?, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun multipartFormRequest(requestConfig: RequestConfig, body: List?, authNames: List): HttpResponse { return request(requestConfig, MultiPartFormDataContent(body ?: listOf()), authNames) } - protected suspend fun urlEncodedFormRequest(requestConfig: RequestConfig, body: Parameters?, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun urlEncodedFormRequest(requestConfig: RequestConfig, body: Parameters?, authNames: List): HttpResponse { return request(requestConfig, FormDataContent(body ?: Parameters.Empty), authNames) } - protected suspend fun jsonRequest(requestConfig: RequestConfig, body: Any? = null, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun jsonRequest(requestConfig: RequestConfig, body: Any? = null, authNames: List): HttpResponse { val contentType = (requestConfig.headers[HttpHeaders.ContentType]?.let { ContentType.parse(it) } ?: ContentType.Application.Json) return if (body != null) request(requestConfig, serializer.write(body, contentType), authNames) else request(requestConfig, authNames = authNames) } - protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent, authNames: List): HttpResponse { requestConfig.updateForAuth(authNames) val headers = requestConfig.headers - return client.call { + return client.request { this.url { this.takeFrom(URLBuilder(baseUrl)) appendPath(requestConfig.path.trimStart('/').split('/')) - requestConfig.query.forEach { query -> - query.value.forEach { value -> - parameter(query.key, value) + for ((name, value) in requestConfig.queries.queries) { + when (value) { + is QueryParam.Single -> parameter(name, value.value) + is QueryParam.Multi -> value.values.forEach { + parameter(name, it) + } } } } @@ -174,17 +153,17 @@ import {{packageName}}.auth.* if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH)) this.body = body - }.response + } } - private fun RequestConfig.updateForAuth(authNames: kotlin.collections.List) { + private fun RequestConfig.updateForAuth(authNames: List) { for (authName in authNames) { - val auth = authentications?.get(authName) ?: throw Exception("Authentication undefined: $authName") - auth.apply(query, headers) + val auth = authentications[authName] ?: throw Exception("Authentication undefined: $authName") + auth.apply(queries, headers) } } - private fun URLBuilder.appendPath(components: kotlin.collections.List): URLBuilder = apply { + private fun URLBuilder.appendPath(components: List): URLBuilder = apply { encodedPath = encodedPath.trimEnd('/') + components.joinToString("/", prefix = "/") { it.encodeURLQueryComponent() } } @@ -199,13 +178,3 @@ import {{packageName}}.auth.* RequestMethod.OPTIONS -> HttpMethod.Options } } - -// https://github.com/ktorio/ktor/issues/851 -private fun JsonSerializer.ignoreOutgoingContent() = IgnoreOutgoingContentJsonSerializer(this) - -private class IgnoreOutgoingContentJsonSerializer(private val delegate: JsonSerializer) : JsonSerializer by delegate { - override fun write(data: Any): OutgoingContent { - if (data is OutgoingContent) return data - return delegate.write(data) - } -} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache index 168cfc993c3b..d8042c19f764 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Base64ByteArray.kt.mustache @@ -1,15 +1,21 @@ package {{packageName}}.infrastructure -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder -@Serializable -class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) +@Serializable(with = Base64ByteArray.Companion::class) +{{#nonPublicApi}}internal {{/nonPublicApi}}class Base64ByteArray(val value: ByteArray) { companion object : KSerializer { - override val descriptor = StringDescriptor.withName("Base64ByteArray") - override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) - override fun deserialize(decoder: Decoder) = Base64ByteArray(decoder.decodeString().decodeBase64Bytes()) + override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: Base64ByteArray): Unit = + encoder.encodeString(value.value.encodeBase64()) + + override fun deserialize(decoder: Decoder): Base64ByteArray = + Base64ByteArray(decoder.decodeString().decodeBase64Bytes()) } override fun equals(other: Any?): Boolean { @@ -26,4 +32,4 @@ class Base64ByteArray(val value: ByteArray) { override fun toString(): String { return "Base64ByteArray(${hex(value)})" } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache index b85013e647b2..7cd7d14721db 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache @@ -1,6 +1,6 @@ package {{packageName}}.infrastructure -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import kotlin.experimental.and private val digits = "0123456789abcdef".toCharArray() @@ -14,7 +14,7 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it private fun Int.toBase64(): Char = BASE64_ALPHABET[this] private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64() -internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeStringUtf8(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes() +internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes() /** * Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes. @@ -32,7 +32,7 @@ internal fun hex(bytes: ByteArray): String { result[resultIndex++] = digits[b and 0x0f] } - return String(result) + return result.concatToString() } /** 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 87f27a5cf56f..a570d4a51389 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 @@ -4,8 +4,9 @@ import io.ktor.client.call.TypeInfo import io.ktor.client.call.typeInfo import io.ktor.http.Headers import io.ktor.http.isSuccess +import io.ktor.client.statement.HttpResponse as KtorHttpResponse -{{#nonPublicApi}}internal {{/nonPublicApi}}open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { +{{#nonPublicApi}}internal {{/nonPublicApi}}open class HttpResponse(val response: KtorHttpResponse, val provider: BodyProvider) { val status: Int = response.status.value val success: Boolean = response.status.isSuccess() val headers: Map> = response.headers.mapEntries() @@ -22,29 +23,30 @@ import io.ktor.http.isSuccess } {{#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 + suspend fun body(response: KtorHttpResponse): T + suspend fun typedBody(response: KtorHttpResponse, type: TypeInfo): V } {{#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 + override suspend fun body(response: KtorHttpResponse): T = + response.call.receive(type) as T @Suppress("UNCHECKED_CAST") - override suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V = - response.call.receive(type) as V + override suspend fun typedBody(response: KtorHttpResponse, type: TypeInfo): V = + response.call.receive(type) as V } -{{#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)) +{{#nonPublicApi}}internal {{/nonPublicApi}}class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : + BodyProvider { + override suspend fun body(response: KtorHttpResponse): T = + block(provider.body(response)) - override suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V = - provider.typedBody(response, type) + override suspend fun typedBody(response: KtorHttpResponse, type: TypeInfo): V = + provider.typedBody(response, type) } -{{#nonPublicApi}}internal {{/nonPublicApi}}inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = +{{#nonPublicApi}}internal {{/nonPublicApi}}inline fun KtorHttpResponse.wrap(): HttpResponse = HttpResponse(this, TypedBodyProvider(typeInfo())) {{#nonPublicApi}}internal {{/nonPublicApi}}fun HttpResponse.map(block: T.() -> V): HttpResponse = diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache index c23ac3ec0001..d6c10d8e5163 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/OctetByteArray.kt.mustache @@ -1,14 +1,17 @@ package {{packageName}}.infrastructure -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder -@Serializable -class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) +@Serializable(with = OctetByteArray.Companion::class) +{{#nonPublicApi}}internal {{/nonPublicApi}}class OctetByteArray(val value: ByteArray) { companion object : KSerializer { - override val descriptor = StringDescriptor.withName("OctetByteArray") - override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) + override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: OctetByteArray) = encoder.encodeString(hex(value.value)) override fun deserialize(decoder: Decoder) = OctetByteArray(hex(decoder.decodeString())) } @@ -26,4 +29,4 @@ class OctetByteArray(val value: ByteArray) { override fun toString(): String { return "OctetByteArray(${hex(value)})" } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/RequestConfig.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/RequestConfig.kt.mustache new file mode 100644 index 000000000000..37b76a9bac4c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/RequestConfig.kt.mustache @@ -0,0 +1,16 @@ +package {{packageName}}.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. + */ +{{#nonPublicApi}}internal {{/nonPublicApi}}data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val queries: Queries = Queries() +) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/encoding.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/encoding.kt.mustache new file mode 100644 index 000000000000..2ec8b39e3532 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/encoding.kt.mustache @@ -0,0 +1,3 @@ +package {{packageName}}.infrastructure + +fun String.toBase64() = encodeToByteArray().encodeBase64() diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/jvmTest/Coroutine.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/jvmTest/Coroutine.kt.mustache index 351c0120b7b1..5a4da4ee0f53 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/jvmTest/Coroutine.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/jvmTest/Coroutine.kt.mustache @@ -3,6 +3,7 @@ package util import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.runBlocking import kotlin.coroutines.EmptyCoroutineContext -internal actual fun runTest(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking(EmptyCoroutineContext, block) +internal actual fun runTest(block: suspend CoroutineScope.() -> T): T = runBlocking(EmptyCoroutineContext, 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 a44a242cbd2d..c387cdcaa186 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,10 +1,13 @@ - @Serializable + @Serializable(with = {{operationIdCamelCase}}Request.Companion::class) private class {{operationIdCamelCase}}Request(val value: List<{{#bodyParam}}{{baseType}}{{/bodyParam}}>) { - @Serializer({{operationIdCamelCase}}Request::class) {{#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) - override fun deserialize(decoder: Decoder) = {{operationIdCamelCase}}Request(serializer.deserialize(decoder)) + private val serializer = ListSerializer({{#bodyParam}}{{baseType}}{{/bodyParam}}.serializer()) + override val descriptor = PrimitiveSerialDescriptor("{{operationIdCamelCase}}Request", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: {{operationIdCamelCase}}Request): Unit = + serializer.serialize(encoder, value.value) + + override fun deserialize(decoder: Decoder): {{operationIdCamelCase}}Request = + {{operationIdCamelCase}}Request(serializer.deserialize(decoder)) } - } \ No newline at end of file + } 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 5dc6864aae82..011c57d6c662 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 @@ -3,8 +3,8 @@ @Serializer({{operationIdCamelCase}}Request::class) {{#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) + override val descriptor = PrimitiveDescriptor("{{operationIdCamelCase}}Request", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: {{operationIdCamelCase}}Request) = serializer.serialize(encoder, value.value) override fun deserialize(decoder: Decoder) = {{operationIdCamelCase}}Request(serializer.deserialize(decoder)) } } \ No newline at end of file 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 a4e70a219ca4..b12a8a184346 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,10 +1,13 @@ - @Serializable + @Serializable(with = {{operationIdCamelCase}}Response.Companion::class) private class {{operationIdCamelCase}}Response(val value: List<{{returnBaseType}}>) { - @Serializer({{operationIdCamelCase}}Response::class) {{#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) - override fun deserialize(decoder: Decoder) = {{operationIdCamelCase}}Response(serializer.deserialize(decoder)) + private val serializer = ListSerializer({{returnBaseType}}.serializer()) + override val descriptor = PrimitiveSerialDescriptor("{{operationIdCamelCase}}Response", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: {{operationIdCamelCase}}Response): Unit = + serializer.serialize(encoder, value.value) + + override fun deserialize(decoder: Decoder): {{operationIdCamelCase}}Response = + {{operationIdCamelCase}}Response(serializer.deserialize(decoder)) } - } \ No newline at end of file + } 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 8253dc1f1a1c..7c747b1e4257 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 @@ -3,8 +3,8 @@ @Serializer({{operationIdCamelCase}}Response::class) {{#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) + override val descriptor = PrimitiveDescriptor("{{operationIdCamelCase}}Response", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: {{operationIdCamelCase}}Response) = serializer.serialize(encoder, value.value) override fun deserialize(decoder: Decoder) = {{operationIdCamelCase}}Response(serializer.deserialize(decoder)) } } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/settings.gradle.kts.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/settings.gradle.kts.mustache new file mode 100644 index 000000000000..ba0114cb1764 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/settings.gradle.kts.mustache @@ -0,0 +1 @@ +rootProject.name = "{{artifactId}}" diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/licenseInfo.mustache index 3a547de74bb7..835764cfc729 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/licenseInfo.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/licenseInfo.mustache @@ -1,11 +1,11 @@ /** -* {{{appName}}} -* {{{appDescription}}} -* -* {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} -* {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ \ No newline at end of file + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache index 2a789fe8d043..cc08101c2a29 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/settings.gradle.mustache @@ -1,2 +1 @@ -{{#multiplatform}}enableFeaturePreview('GRADLE_METADATA'){{/multiplatform}} -rootProject.name = '{{artifactId}}' \ No newline at end of file +rootProject.name = '{{artifactId}}' diff --git a/samples/client/petstore/kotlin-gson/README.md b/samples/client/petstore/kotlin-gson/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-gson/README.md +++ b/samples/client/petstore/kotlin-gson/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-gson/docs/Order.md b/samples/client/petstore/kotlin-gson/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-gson/docs/Order.md +++ b/samples/client/petstore/kotlin-gson/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-gson/docs/Pet.md b/samples/client/petstore/kotlin-gson/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-gson/docs/Pet.md +++ b/samples/client/petstore/kotlin-gson/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-gson/settings.gradle b/samples/client/petstore/kotlin-gson/settings.gradle index 207bc66a067c..a36725d2cb61 100644 --- a/samples/client/petstore/kotlin-gson/settings.gradle +++ b/samples/client/petstore/kotlin-gson/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-gson' \ No newline at end of file +rootProject.name = 'kotlin-petstore-gson' diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..621943f0f01b 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 08822c67e32a..c42220e5f4cb 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 258a2540e9e8..df7073fbc886 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 54df813fceec..a98396451239 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -data class ApiResponse ( +data class ApiResponse( @SerializedName("code") val code: kotlin.Int? = null, @SerializedName("type") diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt index fdefa74fda0b..5924b79b155a 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -data class Category ( +data class Category( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("name") diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt index 049c89df3134..459785c81f8a 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.google.gson.annotations.SerializedName * @param complete */ -data class Order ( +data class Order( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("petId") @@ -33,7 +35,9 @@ data class Order ( val quantity: kotlin.Int? = null, @SerializedName("shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @SerializedName("status") val status: Order.Status? = null, @SerializedName("complete") @@ -41,10 +45,10 @@ data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @SerializedName(value = "placed") placed("placed"), @SerializedName(value = "approved") approved("approved"), diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt index af29ef2b61b7..da77e2c7872e 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.google.gson.annotations.SerializedName * @param status pet status in the store */ -data class Pet ( +data class Pet( @SerializedName("name") val name: kotlin.String, @SerializedName("photoUrls") @@ -37,16 +39,18 @@ data class Pet ( val category: Category? = null, @SerializedName("tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @SerializedName("status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @SerializedName(value = "available") available("available"), @SerializedName(value = "pending") pending("pending"), diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt index 28e82b1df685..c87b45c7c864 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -data class Tag ( +data class Tag( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("name") diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt index 62baf33e927e..8542cede7849 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.google.gson.annotations.SerializedName * @param userStatus User Status */ -data class User ( +data class User( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("username") @@ -41,7 +43,9 @@ data class User ( val password: kotlin.String? = null, @SerializedName("phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @SerializedName("userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-jackson/README.md b/samples/client/petstore/kotlin-jackson/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-jackson/README.md +++ b/samples/client/petstore/kotlin-jackson/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-jackson/docs/Order.md b/samples/client/petstore/kotlin-jackson/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-jackson/docs/Order.md +++ b/samples/client/petstore/kotlin-jackson/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jackson/docs/Pet.md b/samples/client/petstore/kotlin-jackson/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-jackson/docs/Pet.md +++ b/samples/client/petstore/kotlin-jackson/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jackson/settings.gradle b/samples/client/petstore/kotlin-jackson/settings.gradle index 28e8da587f0d..ef91c4caa687 100644 --- a/samples/client/petstore/kotlin-jackson/settings.gradle +++ b/samples/client/petstore/kotlin-jackson/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-jackson' \ No newline at end of file +rootProject.name = 'kotlin-petstore-jackson' diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..621943f0f01b 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 08822c67e32a..c42220e5f4cb 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 258a2540e9e8..df7073fbc886 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index c341f8ca321b..ad42c79cb683 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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.fasterxml.jackson.annotation.JsonProperty +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -data class ApiResponse ( +data class ApiResponse( @field:JsonProperty("code") val code: kotlin.Int? = null, @field:JsonProperty("type") diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Category.kt index 2ed5390c1f3a..5cb50779756e 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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.fasterxml.jackson.annotation.JsonProperty +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -data class Category ( +data class Category( @field:JsonProperty("id") val id: kotlin.Long? = null, @field:JsonProperty("name") diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt index c7df5b55614b..6efc679e7b28 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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.fasterxml.jackson.annotation.JsonProperty +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonProperty * @param complete */ -data class Order ( +data class Order( @field:JsonProperty("id") val id: kotlin.Long? = null, @field:JsonProperty("petId") @@ -33,7 +35,9 @@ data class Order ( val quantity: kotlin.Int? = null, @field:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @field:JsonProperty("status") val status: Order.Status? = null, @field:JsonProperty("complete") @@ -41,10 +45,10 @@ data class Order ( ) { /** - * Order Status - * Values: PLACED,APPROVED,DELIVERED - */ - + * Order Status + * + * Values: PLACED,APPROVED,DELIVERED + */ enum class Status(val value: kotlin.String){ @JsonProperty(value = "placed") PLACED("placed"), @JsonProperty(value = "approved") APPROVED("approved"), diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt index be5b168e2d8b..5808c80b6cf2 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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.fasterxml.jackson.annotation.JsonProperty +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.fasterxml.jackson.annotation.JsonProperty * @param status pet status in the store */ -data class Pet ( +data class Pet( @field:JsonProperty("name") val name: kotlin.String, @field:JsonProperty("photoUrls") @@ -37,16 +39,18 @@ data class Pet ( val category: Category? = null, @field:JsonProperty("tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @field:JsonProperty("status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: AVAILABLE,PENDING,SOLD - */ - + * pet status in the store + * + * Values: AVAILABLE,PENDING,SOLD + */ enum class Status(val value: kotlin.String){ @JsonProperty(value = "available") AVAILABLE("available"), @JsonProperty(value = "pending") PENDING("pending"), diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Tag.kt index 7243f42ed7d8..ffbb7f0955bf 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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.fasterxml.jackson.annotation.JsonProperty +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -data class Tag ( +data class Tag( @field:JsonProperty("id") val id: kotlin.Long? = null, @field:JsonProperty("name") diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/User.kt index e8f639e50928..fe416122d7f1 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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.fasterxml.jackson.annotation.JsonProperty +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.fasterxml.jackson.annotation.JsonProperty * @param userStatus User Status */ -data class User ( +data class User( @field:JsonProperty("id") val id: kotlin.Long? = null, @field:JsonProperty("username") @@ -41,7 +43,9 @@ data class User ( val password: kotlin.String? = null, @field:JsonProperty("phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @field:JsonProperty("userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-json-request-string/README.md b/samples/client/petstore/kotlin-json-request-string/README.md index 971d17b1e244..ed9b800a0f17 100644 --- a/samples/client/petstore/kotlin-json-request-string/README.md +++ b/samples/client/petstore/kotlin-json-request-string/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-json-request-string/docs/Order.md b/samples/client/petstore/kotlin-json-request-string/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/Order.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-json-request-string/docs/Pet.md b/samples/client/petstore/kotlin-json-request-string/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/Pet.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-json-request-string/settings.gradle b/samples/client/petstore/kotlin-json-request-string/settings.gradle index 24764e682e75..dedd56bdccd0 100644 --- a/samples/client/petstore/kotlin-json-request-string/settings.gradle +++ b/samples/client/petstore/kotlin-json-request-string/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-json-request-string' \ No newline at end of file +rootProject.name = 'kotlin-petstore-json-request-string' diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 584c6ef06867..fb60b108c955 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 08822c67e32a..c42220e5f4cb 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 258a2540e9e8..df7073fbc886 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index fafca8738f66..2f46a69fd3ef 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -data class ApiResponse ( +data class ApiResponse( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Category.kt index a4c17c3b49dd..e7fe5b524430 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -data class Category ( +data class Category( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt index a66c335904e7..63853cde7b09 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.squareup.moshi.Json * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -33,7 +35,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -41,10 +45,10 @@ data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt index a3df06cb6eb3..fe32421ec09c 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -37,16 +39,18 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Tag.kt index 6e619023a5c9..d7b7334c9b2c 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -data class Tag ( +data class Tag( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/User.kt index af1e270325de..faa11fc9e716 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -41,7 +43,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle index 6ca85294a549..47dee9b11801 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-okhttp4-coroutines-client' \ No newline at end of file +rootProject.name = 'kotlin-petstore-okhttp4-coroutines-client' diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 1cff24913d64..f1f3c09d6310 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index deb7ba6cf49f..2ba42eb5ab72 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 6494674c7f3d..bf66ae623488 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index fc89bf34e7fc..195b2c34e45a 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,28 +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. -*/ + * 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.google.gson.annotations.SerializedName import java.io.Serializable +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -data class ApiResponse ( +data class ApiResponse( @SerializedName("code") val code: kotlin.Int? = null, @SerializedName("type") diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Category.kt index b483bee69b3e..cf9fe898a3da 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName import java.io.Serializable +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -data class Category ( +data class Category( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("name") diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Order.kt index d6bacf867c47..1ba287a17319 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName import java.io.Serializable +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -25,7 +27,7 @@ import java.io.Serializable * @param complete */ -data class Order ( +data class Order( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("petId") @@ -34,7 +36,9 @@ data class Order ( val quantity: kotlin.Int? = null, @SerializedName("shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @SerializedName("status") val status: Order.Status? = null, @SerializedName("complete") @@ -45,10 +49,10 @@ data class Order ( } /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @SerializedName(value = "placed") placed("placed"), @SerializedName(value = "approved") approved("approved"), diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Pet.kt index afa65785d387..6222414ab912 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 @@ -16,9 +16,11 @@ import org.openapitools.client.models.Tag import com.google.gson.annotations.SerializedName import java.io.Serializable +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -27,7 +29,7 @@ import java.io.Serializable * @param status pet status in the store */ -data class Pet ( +data class Pet( @SerializedName("name") val name: kotlin.String, @SerializedName("photoUrls") @@ -38,7 +40,9 @@ data class Pet ( val category: Category? = null, @SerializedName("tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @SerializedName("status") val status: Pet.Status? = null ) : Serializable { @@ -47,10 +51,10 @@ data class Pet ( } /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @SerializedName(value = "available") available("available"), @SerializedName(value = "pending") pending("pending"), diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Tag.kt index a1a282cb38df..708b6d47648c 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName import java.io.Serializable +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -data class Tag ( +data class Tag( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("name") diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/User.kt index 59ba0254f603..dbb6b2ca364d 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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.google.gson.annotations.SerializedName import java.io.Serializable +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -27,7 +29,7 @@ import java.io.Serializable * @param userStatus User Status */ -data class User ( +data class User( @SerializedName("id") val id: kotlin.Long? = null, @SerializedName("username") @@ -42,7 +44,9 @@ data class User ( val password: kotlin.String? = null, @SerializedName("phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @SerializedName("userStatus") val userStatus: kotlin.Int? = null ) : Serializable { diff --git a/samples/client/petstore/kotlin-moshi-codegen/README.md b/samples/client/petstore/kotlin-moshi-codegen/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/README.md +++ b/samples/client/petstore/kotlin-moshi-codegen/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md b/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md b/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-moshi-codegen/settings.gradle b/samples/client/petstore/kotlin-moshi-codegen/settings.gradle index 692eb84d7e19..a49864cc295c 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/settings.gradle +++ b/samples/client/petstore/kotlin-moshi-codegen/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-moshi-codegen' \ No newline at end of file +rootProject.name = 'kotlin-petstore-moshi-codegen' diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 60f72b51af95..621943f0f01b 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 08822c67e32a..c42220e5f4cb 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 258a2540e9e8..df7073fbc886 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 18d2ce3dbbe7..0c4c09637972 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,28 +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. -*/ + * 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 import com.squareup.moshi.JsonClass +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ @JsonClass(generateAdapter = true) -data class ApiResponse ( +data class ApiResponse( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Category.kt index 8396fa423574..eee91ac9906f 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import com.squareup.moshi.JsonClass +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ @JsonClass(generateAdapter = true) -data class Category ( +data class Category( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Order.kt index d7091dd4c0c2..27f142a13faa 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import com.squareup.moshi.JsonClass +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -25,7 +27,7 @@ import com.squareup.moshi.JsonClass * @param complete */ @JsonClass(generateAdapter = true) -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -34,7 +36,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -42,10 +46,10 @@ data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Pet.kt index 8b4e6b44d4cc..f1fb3fbb862c 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 @@ -16,9 +16,11 @@ import org.openapitools.client.models.Tag import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -27,7 +29,7 @@ import com.squareup.moshi.JsonClass * @param status pet status in the store */ @JsonClass(generateAdapter = true) -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -38,16 +40,18 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Tag.kt index e7cdab2bb5df..453a6d419bec 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import com.squareup.moshi.JsonClass +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ @JsonClass(generateAdapter = true) -data class Tag ( +data class Tag( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/User.kt index 1bfad8449046..a6a8094f04cb 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import com.squareup.moshi.JsonClass +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -27,7 +29,7 @@ import com.squareup.moshi.JsonClass * @param userStatus User Status */ @JsonClass(generateAdapter = true) -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -42,7 +44,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-multiplatform/.openapi-generator-ignore b/samples/client/petstore/kotlin-multiplatform/.openapi-generator-ignore index 93eeb6b49403..7484ee590a38 100644 --- a/samples/client/petstore/kotlin-multiplatform/.openapi-generator-ignore +++ b/samples/client/petstore/kotlin-multiplatform/.openapi-generator-ignore @@ -1,5 +1,23 @@ # OpenAPI Generator Ignore -gradle/wrapper/gradle-wrapper.jar -gradle/wrapper/gradle-wrapper.properties -gradlew -gradlew.bat +# 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-multiplatform/.openapi-generator/FILES b/samples/client/petstore/kotlin-multiplatform/.openapi-generator/FILES index e79293ae5715..5fe12725ed2e 100644 --- a/samples/client/petstore/kotlin-multiplatform/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-multiplatform/.openapi-generator/FILES @@ -1,5 +1,5 @@ README.md -build.gradle +build.gradle.kts docs/ApiResponse.md docs/Category.md docs/Order.md @@ -9,30 +9,37 @@ docs/StoreApi.md docs/Tag.md docs/User.md docs/UserApi.md -settings.gradle -src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt -src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt -src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt -src/commonMain/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt -src/commonMain/kotlin/org/openapitools/client/auth/Authentication.kt -src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt -src/commonMain/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt -src/commonMain/kotlin/org/openapitools/client/auth/OAuth.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt -src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt -src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt -src/commonMain/kotlin/org/openapitools/client/models/Category.kt -src/commonMain/kotlin/org/openapitools/client/models/Order.kt -src/commonMain/kotlin/org/openapitools/client/models/Pet.kt -src/commonMain/kotlin/org/openapitools/client/models/Tag.kt -src/commonMain/kotlin/org/openapitools/client/models/User.kt -src/commonTest/kotlin/util/Coroutine.kt -src/iosTest/kotlin/util/Coroutine.kt -src/jsTest/kotlin/util/Coroutine.kt -src/jvmTest/kotlin/util/Coroutine.kt +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +settings.gradle.kts +src/common/main/org/openapitools/client/ApiClient.kt +src/common/main/org/openapitools/client/apis/PetApi.kt +src/common/main/org/openapitools/client/apis/StoreApi.kt +src/common/main/org/openapitools/client/apis/UserApi.kt +src/common/main/org/openapitools/client/auth/ApiKeyAuth.kt +src/common/main/org/openapitools/client/auth/Authentication.kt +src/common/main/org/openapitools/client/auth/HttpBasicAuth.kt +src/common/main/org/openapitools/client/auth/HttpBearerAuth.kt +src/common/main/org/openapitools/client/auth/OAuth.kt +src/common/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +src/common/main/org/openapitools/client/infrastructure/ApiClientBase.kt +src/common/main/org/openapitools/client/infrastructure/Base64ByteArray.kt +src/common/main/org/openapitools/client/infrastructure/Bytes.kt +src/common/main/org/openapitools/client/infrastructure/HttpResponse.kt +src/common/main/org/openapitools/client/infrastructure/OctetByteArray.kt +src/common/main/org/openapitools/client/infrastructure/RequestConfig.kt +src/common/main/org/openapitools/client/infrastructure/RequestMethod.kt +src/common/main/org/openapitools/client/infrastructure/encoding.kt +src/common/main/org/openapitools/client/models/ApiResponse.kt +src/common/main/org/openapitools/client/models/Category.kt +src/common/main/org/openapitools/client/models/Order.kt +src/common/main/org/openapitools/client/models/Pet.kt +src/common/main/org/openapitools/client/models/Tag.kt +src/common/main/org/openapitools/client/models/User.kt +src/common/test/util/Coroutine.kt +src/ios/test/util/Coroutine.kt +src/js/test/util/Coroutine.kt +src/jvm/test/util/Coroutine.kt diff --git a/samples/client/petstore/kotlin-multiplatform/README.md b/samples/client/petstore/kotlin-multiplatform/README.md index 308e8b1c99ef..a5b79d8bbbba 100644 --- a/samples/client/petstore/kotlin-multiplatform/README.md +++ b/samples/client/petstore/kotlin-multiplatform/README.md @@ -2,7 +2,7 @@ ## Requires -* Kotlin 1.3.50 +* Kotlin 1.3.72 ## Build @@ -19,7 +19,7 @@ This runs all tests and packages the library. * Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. - + ## Documentation for API Endpoints All URIs are relative to *http://petstore.swagger.io/v2* @@ -48,7 +48,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -59,17 +59,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-multiplatform/build.gradle b/samples/client/petstore/kotlin-multiplatform/build.gradle deleted file mode 100644 index 47045bb577e1..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/build.gradle +++ /dev/null @@ -1,161 +0,0 @@ -apply plugin: 'kotlin-multiplatform' -apply plugin: 'kotlinx-serialization' - -group 'org.openapitools' -version '1.0.0' - -ext { - kotlin_version = '1.3.50' - kotlinx_version = '1.1.0' - coroutines_version = '1.3.1' - serialization_version = '0.12.0' - ktor_version = '1.2.4' -} - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50" // $kotlin_version - classpath "org.jetbrains.kotlin:kotlin-serialization:1.3.50" // $kotlin_version - } -} - -repositories { - jcenter() -} - -kotlin { - jvm() - iosArm64() { binaries { framework { freeCompilerArgs.add("-Xobjc-generics") } } } - iosX64() { binaries { framework { freeCompilerArgs.add("-Xobjc-generics") } } } - js() - - sourceSets { - commonMain { - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version" - api "io.ktor:ktor-client-core:$ktor_version" - api "io.ktor:ktor-client-json:$ktor_version" - api "io.ktor:ktor-client-serialization:$ktor_version" - } - } - - commonTest { - dependencies { - implementation "org.jetbrains.kotlin:kotlin-test-common" - implementation "org.jetbrains.kotlin:kotlin-test-annotations-common" - implementation "io.ktor:ktor-client-mock:$ktor_version" - } - } - - jvmMain { - dependsOn commonMain - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version" - api "io.ktor:ktor-client-core-jvm:$ktor_version" - api "io.ktor:ktor-client-json-jvm:$ktor_version" - api "io.ktor:ktor-client-serialization-jvm:$ktor_version" - } - } - - jvmTest { - dependsOn commonTest - dependencies { - implementation "org.jetbrains.kotlin:kotlin-test" - implementation "org.jetbrains.kotlin:kotlin-test-junit" - implementation "io.ktor:ktor-client-mock-jvm:$ktor_version" - } - } - - iosMain { - dependsOn commonMain - dependencies { - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version" - api "io.ktor:ktor-client-ios:$ktor_version" - } - } - - iosTest { - dependsOn commonTest - dependencies { - implementation "io.ktor:ktor-client-mock-native:$ktor_version" - } - } - - iosArm64().compilations.main.defaultSourceSet { - dependsOn iosMain - dependencies { - api "io.ktor:ktor-client-ios-iosarm64:$ktor_version" - api "io.ktor:ktor-client-json-iosarm64:$ktor_version" - api "io.ktor:ktor-client-serialization-iosarm64:$ktor_version" - } - } - - iosArm64().compilations.test.defaultSourceSet { - dependsOn iosTest - } - - iosX64().compilations.main.defaultSourceSet { - dependsOn iosMain - dependencies { - api "io.ktor:ktor-client-ios-iosx64:$ktor_version" - api "io.ktor:ktor-client-json-iosx64:$ktor_version" - api "io.ktor:ktor-client-serialization-iosx64:$ktor_version" - } - } - - jsMain { - dependsOn commonMain - dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version" - api "io.ktor:ktor-client-js:$ktor_version" - api "io.ktor:ktor-client-json-js:$ktor_version" - api "io.ktor:ktor-client-serialization-js:$ktor_version" - } - } - - jsTest { - dependsOn commonTest - dependencies { - implementation "io.ktor:ktor-client-mock-js:$ktor_version" - implementation "io.ktor:ktor-client-js:$ktor_version" - implementation "io.ktor:ktor-client-json:$ktor_version" - implementation "io.ktor:ktor-client-serialization-js:$ktor_version" - } - } - - iosX64().compilations.test.defaultSourceSet { - dependsOn iosTest - } - - all { - languageSettings { - useExperimentalAnnotation('kotlin.Experimental') - } - } - } -} - -task iosTest { - def device = project.findProperty("device")?.toString() ?: "iPhone 8" - dependsOn 'linkDebugTestIosX64' - group = JavaBasePlugin.VERIFICATION_GROUP - description = "Execute unit tests on ${device} simulator" - doLast { - def binary = kotlin.targets.iosX64.binaries.getTest('DEBUG') - exec { commandLine 'xcrun', 'simctl', 'spawn', device, binary.outputFile } - } -} - -configurations { // workaround for https://youtrack.jetbrains.com/issue/KT-27170 - compileClasspath -} diff --git a/samples/client/petstore/kotlin-multiplatform/build.gradle.kts b/samples/client/petstore/kotlin-multiplatform/build.gradle.kts new file mode 100644 index 000000000000..67d8bdfbeb9b --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/build.gradle.kts @@ -0,0 +1,123 @@ +plugins { + kotlin("multiplatform") version "1.4.0" + kotlin("plugin.serialization") version "1.4.0" +} + +group = "org.openapitools" +version = "1.0.0" + +val ktorVersion = "1.4.0" + +repositories { + jcenter() +} + +kotlin { + /* + * To find out how to configure the targets, please follow the link: + * https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets + */ + jvm { + val main by compilations.getting { + kotlinOptions { + // Setup the Kotlin compiler options for the 'main' compilation: + jvmTarget = "1.8" + } + } + } + ios { + binaries { + framework { + freeCompilerArgs = listOf("-Xobjc-generics") + } + } + } + js(BOTH) { + browser() + nodejs() + } + + sourceSets { + val commonMain by getting { + kotlin.srcDir("src/common/main") + + dependencies { + implementation(kotlin("stdlib-common")) + api("io.ktor:ktor-client-core:$ktorVersion") + api("io.ktor:ktor-client-json:$ktorVersion") + api("io.ktor:ktor-client-serialization:$ktorVersion") + } + } + + val commonTest by getting { + kotlin.srcDir("src/common/test") + + dependencies { + implementation(kotlin("test-common")) + implementation(kotlin("test-annotations-common")) + implementation("io.ktor:ktor-client-mock:$ktorVersion") + } + } + + val jvmMain by getting { + kotlin.srcDir("src/jvm/main") + + dependencies { + implementation(kotlin("stdlib-jdk8")) + api("io.ktor:ktor-client-core-jvm:$ktorVersion") + } + } + + val jvmTest by getting { + kotlin.srcDir("src/jvm/test") + + dependencies { + implementation(kotlin("test")) + implementation(kotlin("test-junit5")) + implementation("org.junit.jupiter:junit-jupiter:5.6.2") + implementation("io.ktor:ktor-client-apache:$ktorVersion") + implementation("io.ktor:ktor-client-mock-jvm:$ktorVersion") + } + } + + val iosMain by getting { + kotlin.srcDir("src/ios/main") + + dependencies { + implementation(kotlin("stdlib-native")) + api("io.ktor:ktor-client-ios:$ktorVersion") + } + } + + val iosTest by getting { + kotlin.srcDir("src/ios/test") + + dependencies { + implementation("io.ktor:ktor-client-mock-native:$ktorVersion") + } + } + + val jsMain by getting { + kotlin.srcDir("src/js/main") + + dependencies { + implementation(kotlin("stdlib-js")) + api("io.ktor:ktor-client-js:$ktorVersion") + } + } + + val jsTest by getting { + kotlin.srcDir("src/js/test") + + dependencies { + implementation("io.ktor:ktor-client-mock-js:$ktorVersion") + } + } + } +} + +tasks { + named("jvmTest") { + useJUnitPlatform() + } +} diff --git a/samples/client/petstore/kotlin-multiplatform/docs/Order.md b/samples/client/petstore/kotlin-multiplatform/docs/Order.md index 4683c14c1cbe..25e712e47289 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/Order.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-multiplatform/docs/Pet.md b/samples/client/petstore/kotlin-multiplatform/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/Pet.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-multiplatform/gradle.properties b/samples/client/petstore/kotlin-multiplatform/gradle.properties new file mode 100644 index 000000000000..29e08e8ca88f --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official \ No newline at end of file diff --git a/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar index cc4fdc293d0e..61b67b54bbb7 100644 Binary files a/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties index 6ce793f21e85..8f38dbc2bfd8 100644 --- a/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Tue May 17 23:08:05 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip diff --git a/samples/client/petstore/kotlin-multiplatform/gradlew b/samples/client/petstore/kotlin-multiplatform/gradlew old mode 100755 new mode 100644 index 2fe81a7d95e4..9d82f7891513 --- a/samples/client/petstore/kotlin-multiplatform/gradlew +++ b/samples/client/petstore/kotlin-multiplatform/gradlew @@ -1,20 +1,4 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +#!/usr/bin/env bash ############################################################################## ## @@ -22,38 +6,20 @@ ## ############################################################################## -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn () { +warn ( ) { echo "$*" } -die () { +die ( ) { echo echo "$*" echo @@ -64,7 +30,6 @@ die () { cygwin=false msys=false darwin=false -nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -75,11 +40,26 @@ case "`uname`" in MINGW* ) msys=true ;; - NONSTOP* ) - nonstop=true - ;; esac +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -105,7 +85,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -125,8 +105,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -154,30 +134,27 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=`expr $i + 1` + i=$((i+1)) done case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -exec "$JAVACMD" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/client/petstore/kotlin-multiplatform/gradlew.bat b/samples/client/petstore/kotlin-multiplatform/gradlew.bat index 9618d8d9607c..5f192121eb4f 100644 --- a/samples/client/petstore/kotlin-multiplatform/gradlew.bat +++ b/samples/client/petstore/kotlin-multiplatform/gradlew.bat @@ -1,19 +1,3 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -24,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -65,6 +49,7 @@ goto fail @rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -75,6 +60,11 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/samples/client/petstore/kotlin-multiplatform/pom.xml b/samples/client/petstore/kotlin-multiplatform/pom.xml deleted file mode 100644 index bf62ae66e66c..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - 4.0.0 - io.swagger - KotlinMultiPlatformClientTests - pom - 1.0-SNAPSHOT - Kotlin MultiPlatform Petstore Client - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - bundle-test - integration-test - - exec - - - /bin/bash - - gradlew - build - - - - - - - - diff --git a/samples/client/petstore/kotlin-multiplatform/settings.gradle b/samples/client/petstore/kotlin-multiplatform/settings.gradle deleted file mode 100644 index b000833f485c..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -enableFeaturePreview('GRADLE_METADATA') -rootProject.name = 'kotlin-client-petstore-multiplatform' \ No newline at end of file diff --git a/samples/client/petstore/kotlin-multiplatform/settings.gradle.kts b/samples/client/petstore/kotlin-multiplatform/settings.gradle.kts new file mode 100644 index 000000000000..bbbfee48d652 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "kotlin-client-petstore-multiplatform" diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/ApiClient.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/ApiClient.kt new file mode 100644 index 000000000000..6a75c16160a0 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/ApiClient.kt @@ -0,0 +1,90 @@ +package org.openapitools.client + +import io.ktor.client.engine.HttpClientEngine +import kotlinx.serialization.json.Json +import org.openapitools.client.apis.* +import org.openapitools.client.infrastructure.ApiClientBase + +class ApiClient( + baseUrl: String = "http://petstore.swagger.io/v2", + httpClientEngine: HttpClientEngine? = null, + json: Json = Json {} +) { + val `pet` = PetApi(baseUrl, httpClientEngine, json) + val `store` = StoreApi(baseUrl, httpClientEngine, json) + val `user` = UserApi(baseUrl, httpClientEngine, json) + + val allClients: Set = setOf( + `pet`, + `store`, + `user`, + ) + + /** + * Set the username for the first HTTP basic authentication for all apis. + * + * @param username Username + */ + fun setUsername(username: String) { + for (client in allClients) { + client.setUsername(username) + } + } + + /** + * Set the password for the first HTTP basic authentication for all apis. + * + * @param password Password + */ + fun setPassword(password: String) { + for (client in allClients) { + client.setPassword(password) + } + } + + /** + * Set the API key value for the first API key authentication for all apis. + * + * @param apiKey API key + * @param paramName The name of the API key parameter, or null or set the first key. + */ + fun setApiKey(apiKey: String, paramName: String? = null) { + for (client in allClients) { + client.setApiKey(apiKey, paramName) + } + } + + /** + * Set the API key prefix for the first API key authentication for all apis. + * + * @param apiKeyPrefix API key prefix + * @param paramName The name of the API key parameter, or null or set the first key. + */ + fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) { + for (client in allClients) { + client.setApiKeyPrefix(apiKeyPrefix, paramName) + } + } + + /** + * Set the access token for the first OAuth2 authentication for all apis. + * + * @param accessToken Access token + */ + fun setAccessToken(accessToken: String) { + for (client in allClients) { + client.setAccessToken(accessToken) + } + } + + /** + * Set the access token for the first Bearer authentication for all apis. + * + * @param bearerToken The bearer token. + */ + fun setBearerToken(bearerToken: String) { + for (client in allClients) { + client.setBearerToken(bearerToken) + } + } +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/PetApi.kt new file mode 100644 index 000000000000..14bfb6665452 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/PetApi.kt @@ -0,0 +1,356 @@ +/** + * 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.* +import io.ktor.client.request.forms.formData +import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.request.forms.FormPart +import io.ktor.client.utils.EmptyContent +import kotlinx.serialization.json.Json +import io.ktor.http.ParametersBuilder +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.builtins.list +import kotlinx.serialization.builtins.serializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +class PetApi constructor( + baseUrl: kotlin.String = "http://petstore.swagger.io/v2", + httpClientEngine: HttpClientEngine? = null, + json: Json = Json {}, +) : ApiClientBase(baseUrl, httpClientEngine, json) { + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + * @return void + */ + suspend fun addPet( + body: Pet + ): HttpResponse { + val authNamesOag = listOf("petstore_auth") + + val bodyOag = body + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.POST, + "/pet", + queries = queriesOag, + headers = headersOag + ) + + return jsonRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + + + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey (optional) + * @return void + */ + suspend fun deletePet( + petId: kotlin.Long, + apiKey: kotlin.String? = null + ): HttpResponse { + val authNamesOag = listOf("petstore_auth") + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + "api_key" to this?.toString() + ) + + val configOag = RequestConfig( + RequestMethod.DELETE, + "/pet/{petId}".replace("{" + "petId" + "}", petId.toString()), + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * 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.collections.List + */ + @Suppress("UNCHECKED_CAST") + suspend fun findPetsByStatus( + status: kotlin.collections.List + ): HttpResponse> { + val authNamesOag = listOf("petstore_auth") + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + addMulti("status", status, "csv") + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/pet/findByStatus", + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap().map { value } + } + @Serializable(with = FindPetsByStatusResponse.Companion::class) + private class FindPetsByStatusResponse(val value: List) { + companion object : KSerializer { + private val serializer = ListSerializer(Pet.serializer()) + override val descriptor = PrimitiveSerialDescriptor("FindPetsByStatusResponse", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: FindPetsByStatusResponse): Unit = + serializer.serialize(encoder, value.value) + + override fun deserialize(decoder: Decoder): FindPetsByStatusResponse = + FindPetsByStatusResponse(serializer.deserialize(decoder)) + } + } + + /** + * 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.collections.List + */ + @Suppress("UNCHECKED_CAST") + suspend fun findPetsByTags( + tags: kotlin.collections.List + ): HttpResponse> { + val authNamesOag = listOf("petstore_auth") + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + addMulti("tags", tags, "csv") + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/pet/findByTags", + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap().map { value } + } + @Serializable(with = FindPetsByTagsResponse.Companion::class) + private class FindPetsByTagsResponse(val value: List) { + companion object : KSerializer { + private val serializer = ListSerializer(Pet.serializer()) + override val descriptor = PrimitiveSerialDescriptor("FindPetsByTagsResponse", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: FindPetsByTagsResponse): Unit = + serializer.serialize(encoder, value.value) + + override fun deserialize(decoder: Decoder): FindPetsByTagsResponse = + FindPetsByTagsResponse(serializer.deserialize(decoder)) + } + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return + * @return Pet + */ + @Suppress("UNCHECKED_CAST") + suspend fun getPetById( + petId: kotlin.Long + ): HttpResponse { + val authNamesOag = listOf("api_key") + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/pet/{petId}".replace("{" + "petId" + "}", petId.toString()), + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + * @return void + */ + suspend fun updatePet( + body: Pet + ): HttpResponse { + val authNamesOag = listOf("petstore_auth") + + val bodyOag = body + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.PUT, + "/pet", + queries = queriesOag, + headers = headersOag + ) + + return jsonRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + + + /** + * 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 + */ + suspend fun updatePetWithForm( + petId: kotlin.Long, + name: kotlin.String? = null, + status: kotlin.String? = null + ): HttpResponse { + val authNamesOag = listOf("petstore_auth") + + val bodyOag = + ParametersBuilder().also { + name?.apply { it.append("name", name.toString()) } + status?.apply { it.append("status", status.toString()) } + }.build() + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.POST, + "/pet/{petId}".replace("{" + "petId" + "}", petId.toString()), + queries = queriesOag, + headers = headersOag + ) + + return urlEncodedFormRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * 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") + suspend fun uploadFile( + petId: kotlin.Long, + additionalMetadata: kotlin.String? = null, + file: io.ktor.client.request.forms.InputProvider? = null + ): HttpResponse { + val authNamesOag = listOf("petstore_auth") + + val bodyOag = + formData { + additionalMetadata?.let { append(FormPart("additionalMetadata", additionalMetadata)) } + file?.let { append(FormPart("file", file)) } + } + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.POST, + "/pet/{petId}/uploadImage".replace("{" + "petId" + "}", petId.toString()), + queries = queriesOag, + headers = headersOag + ) + + return multipartFormRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/StoreApi.kt new file mode 100644 index 000000000000..71017f5322ba --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/StoreApi.kt @@ -0,0 +1,182 @@ +/** + * 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.* +import io.ktor.client.request.forms.formData +import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.request.forms.FormPart +import io.ktor.client.utils.EmptyContent +import kotlinx.serialization.json.Json +import io.ktor.http.ParametersBuilder +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.builtins.list +import kotlinx.serialization.builtins.serializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +class StoreApi constructor( + baseUrl: kotlin.String = "http://petstore.swagger.io/v2", + httpClientEngine: HttpClientEngine? = null, + json: Json = Json {}, +) : ApiClientBase(baseUrl, httpClientEngine, json) { + /** + * 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 + */ + suspend fun deleteOrder( + orderId: kotlin.String + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.DELETE, + "/store/order/{orderId}".replace("{" + "orderId" + "}", orderId.toString()), + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return kotlin.collections.Map + */ + @Suppress("UNCHECKED_CAST") + suspend fun getInventory( + ): HttpResponse> { + val authNamesOag = listOf("api_key") + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/store/inventory", + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap().map { value } + } + @Serializable + private class GetInventoryResponse(val value: Map) { + @Serializer(GetInventoryResponse::class) + companion object : KSerializer { + private val serializer: KSerializer> = (kotlin.String.serializer() to kotlin.Int.serializer()).map + override val descriptor = PrimitiveDescriptor("GetInventoryResponse", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: GetInventoryResponse) = serializer.serialize(encoder, value.value) + override fun deserialize(decoder: Decoder) = GetInventoryResponse(serializer.deserialize(decoder)) + } + } + /** + * 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") + suspend fun getOrderById( + orderId: kotlin.Long + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/store/order/{orderId}".replace("{" + "orderId" + "}", orderId.toString()), + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + * @return Order + */ + @Suppress("UNCHECKED_CAST") + suspend fun placeOrder( + body: Order + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = body + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.POST, + "/store/order", + queries = queriesOag, + headers = headersOag + ) + + return jsonRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + + +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/UserApi.kt new file mode 100644 index 000000000000..1743a993b8b3 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/apis/UserApi.kt @@ -0,0 +1,338 @@ +/** + * 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.* +import io.ktor.client.request.forms.formData +import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.request.forms.FormPart +import io.ktor.client.utils.EmptyContent +import kotlinx.serialization.json.Json +import io.ktor.http.ParametersBuilder +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.builtins.list +import kotlinx.serialization.builtins.serializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +class UserApi constructor( + baseUrl: kotlin.String = "http://petstore.swagger.io/v2", + httpClientEngine: HttpClientEngine? = null, + json: Json = Json {}, +) : ApiClientBase(baseUrl, httpClientEngine, json) { + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + * @return void + */ + suspend fun createUser( + body: User + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = body + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.POST, + "/user", + queries = queriesOag, + headers = headersOag + ) + + return jsonRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + + + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ + suspend fun createUsersWithArrayInput( + body: kotlin.collections.List + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = CreateUsersWithArrayInputRequest(body) + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.POST, + "/user/createWithArray", + queries = queriesOag, + headers = headersOag + ) + + return jsonRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + + @Serializable(with = CreateUsersWithArrayInputRequest.Companion::class) + private class CreateUsersWithArrayInputRequest(val value: List) { + companion object : KSerializer { + private val serializer = ListSerializer(User.serializer()) + override val descriptor = PrimitiveSerialDescriptor("CreateUsersWithArrayInputRequest", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: CreateUsersWithArrayInputRequest): Unit = + serializer.serialize(encoder, value.value) + + override fun deserialize(decoder: Decoder): CreateUsersWithArrayInputRequest = + CreateUsersWithArrayInputRequest(serializer.deserialize(decoder)) + } + } + + /** + * Creates list of users with given input array + * + * @param body List of user object + * @return void + */ + suspend fun createUsersWithListInput( + body: kotlin.collections.List + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = CreateUsersWithListInputRequest(body) + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.POST, + "/user/createWithList", + queries = queriesOag, + headers = headersOag + ) + + return jsonRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + + @Serializable(with = CreateUsersWithListInputRequest.Companion::class) + private class CreateUsersWithListInputRequest(val value: List) { + companion object : KSerializer { + private val serializer = ListSerializer(User.serializer()) + override val descriptor = PrimitiveSerialDescriptor("CreateUsersWithListInputRequest", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: CreateUsersWithListInputRequest): Unit = + serializer.serialize(encoder, value.value) + + override fun deserialize(decoder: Decoder): CreateUsersWithListInputRequest = + CreateUsersWithListInputRequest(serializer.deserialize(decoder)) + } + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @return void + */ + suspend fun deleteUser( + username: kotlin.String + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.DELETE, + "/user/{username}".replace("{" + "username" + "}", username.toString()), + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + */ + @Suppress("UNCHECKED_CAST") + suspend fun getUserByName( + username: kotlin.String + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/user/{username}".replace("{" + "username" + "}", username.toString()), + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * 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") + suspend fun loginUser( + username: kotlin.String, + password: kotlin.String + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + add("username", username) + add("password", password) + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/user/login", + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * Logs out current logged in user session + * + * @return void + */ + suspend fun logoutUser( + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = + EmptyContent + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.GET, + "/user/logout", + queries = queriesOag, + headers = headersOag + ) + + return request( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + /** + * 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 + */ + suspend fun updateUser( + username: kotlin.String, + body: User + ): HttpResponse { + val authNamesOag = listOf() + + val bodyOag = body + + val queriesOag = Queries { + } + + val headersOag = mutableMapOf( + ) + + val configOag = RequestConfig( + RequestMethod.PUT, + "/user/{username}".replace("{" + "username" + "}", username.toString()), + queries = queriesOag, + headers = headersOag + ) + + return jsonRequest( + configOag, + bodyOag, + authNamesOag + ).wrap() + } + + +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/ApiKeyAuth.kt new file mode 100644 index 000000000000..2eda3b4c837b --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/ApiKeyAuth.kt @@ -0,0 +1,18 @@ +package org.openapitools.client.auth + +import org.openapitools.client.infrastructure.Queries + +class ApiKeyAuth(private val location: String, val paramName: String) : Authentication { + var apiKey: String? = null + var apiKeyPrefix: String? = null + + override fun apply(queries: Queries, headers: MutableMap) { + val key: String = apiKey ?: return + val prefix: String? = apiKeyPrefix + val value: String = if (prefix != null) "$prefix $key" else key + when (location) { + "query" -> queries.add(paramName, value) + "header" -> headers[paramName] = value + } + } +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/Authentication.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/Authentication.kt similarity index 54% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/Authentication.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/Authentication.kt index 2c5dfb4acc56..b96b9d7d5c78 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/Authentication.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/Authentication.kt @@ -1,13 +1,13 @@ package org.openapitools.client.auth -interface Authentication { +import org.openapitools.client.infrastructure.Queries +interface Authentication { /** * Apply authentication settings to header and query params. * - * @param query Query parameters. + * @param queries Query parameters. * @param headers Header parameters. */ - fun apply(query: MutableMap>, headers: MutableMap) - + fun apply(queries: Queries, headers: MutableMap) } diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/HttpBasicAuth.kt similarity index 58% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/HttpBasicAuth.kt index 5f0a52c19515..8df0175fe7a1 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBasicAuth.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/HttpBasicAuth.kt @@ -1,17 +1,16 @@ package org.openapitools.client.auth -import io.ktor.util.InternalAPI -import io.ktor.util.encodeBase64 +import org.openapitools.client.infrastructure.Queries +import org.openapitools.client.infrastructure.toBase64 class HttpBasicAuth : Authentication { var username: String? = null var password: String? = null - @InternalAPI - override fun apply(query: MutableMap>, headers: MutableMap) { + override fun apply(queries: Queries, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") - val auth = str.encodeBase64() + val auth = str.toBase64() headers["Authorization"] = "Basic $auth" } } diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/HttpBearerAuth.kt similarity index 77% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/HttpBearerAuth.kt index a6fb285af5c3..b5de1bc19a50 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/HttpBearerAuth.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/HttpBearerAuth.kt @@ -1,9 +1,11 @@ package org.openapitools.client.auth +import org.openapitools.client.infrastructure.Queries + class HttpBearerAuth(private val scheme: String?) : Authentication { var bearerToken: String? = null - override fun apply(query: MutableMap>, headers: MutableMap) { + override fun apply(queries: Queries, headers: MutableMap) { val token: String = bearerToken ?: return headers["Authorization"] = (if (scheme != null) upperCaseBearer(scheme)!! + " " else "") + token } diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/OAuth.kt similarity index 61% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/OAuth.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/OAuth.kt index 08b289c29442..1fcb9c77229c 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/OAuth.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/auth/OAuth.kt @@ -1,9 +1,11 @@ package org.openapitools.client.auth +import org.openapitools.client.infrastructure.Queries + class OAuth : Authentication { var accessToken: String? = null - override fun apply(query: MutableMap>, headers: MutableMap) { + override fun apply(queries: Queries, headers: MutableMap) { val token: String = accessToken ?: return headers["Authorization"] = "Bearer $token" } diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 000000000000..96a5b698e6d4 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,51 @@ +package org.openapitools.client.infrastructure + +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" +} + +sealed class QueryParam { + data class Single(val value: String) : QueryParam() + data class Multi(val values: Iterable) : QueryParam() +} + +class Queries(val queries: MutableMap = mutableMapOf()) { + constructor(queries: MutableMap = mutableMapOf(), config: Queries.() -> Unit): this(queries) { + config(this) + } + + // Single + fun add(name: String, value: String?) { + if (value != null) { + queries[name] = QueryParam.Single(value) + } + } + + fun add(name: String, value: Any?) { + if (value != null) { + queries[name] = QueryParam.Single(value.toString()) + } + } + + // For Iterables + fun addMulti(name: String, values: Iterable, collectionFormat: String) { + val transformed = values.filterNotNull().map { it.toString() } + queries[name] = when (collectionFormat) { + "multi" -> QueryParam.Multi(transformed) + else -> QueryParam.Single(transformed.joinToString(separator = collectionDelimiter(collectionFormat))) + } + } + + // For Arrays + fun addMulti(name: String, values: Array, collectionFormat: String) = + addMulti(name, values.asIterable(), collectionFormat) + + // For Maps + fun addMap(values: Map) { + queries.putAll(values.filterValues { it != null }.mapValues { QueryParam.Single(it.value.toString()) }) + } +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/ApiClientBase.kt similarity index 56% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/ApiClientBase.kt index fe8434be2100..44d3c57a7c73 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/ApiClientBase.kt @@ -2,74 +2,43 @@ package org.openapitools.client.infrastructure import io.ktor.client.HttpClient import io.ktor.client.HttpClientConfig -import io.ktor.client.call.call import io.ktor.client.engine.HttpClientEngine import io.ktor.client.features.json.JsonFeature -import io.ktor.client.features.json.JsonSerializer import io.ktor.client.features.json.serializer.KotlinxSerializer -import io.ktor.client.request.accept import io.ktor.client.request.forms.FormDataContent import io.ktor.client.request.forms.MultiPartFormDataContent import io.ktor.client.request.header import io.ktor.client.request.parameter -import io.ktor.client.response.HttpResponse +import io.ktor.client.request.request +import io.ktor.client.statement.HttpResponse import io.ktor.client.utils.EmptyContent import io.ktor.http.* import io.ktor.http.content.OutgoingContent import io.ktor.http.content.PartData -import kotlinx.serialization.UnstableDefault import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonConfiguration -import org.openapitools.client.apis.* -import org.openapitools.client.models.* import org.openapitools.client.auth.* -open class ApiClient( +open class ApiClientBase( private val baseUrl: String, httpClientEngine: HttpClientEngine?, - serializer: KotlinxSerializer) { - - @UseExperimental(UnstableDefault::class) - constructor( - baseUrl: String, - httpClientEngine: HttpClientEngine?, - jsonConfiguration: JsonConfiguration) : - this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration))) - - private val serializer: JsonSerializer by lazy { - serializer.apply { setMappers(this) }.ignoreOutgoingContent() - } + json: Json = Json {} +) { + private val serializer = KotlinxSerializer(json) private val client: HttpClient by lazy { - val jsonConfig: JsonFeature.Config.() -> Unit = { this.serializer = this@ApiClient.serializer } + val jsonConfig: JsonFeature.Config.() -> Unit = { this.serializer = this@ApiClientBase.serializer } val clientConfig: (HttpClientConfig<*>) -> Unit = { it.install(JsonFeature, jsonConfig) } httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } - private val authentications: kotlin.collections.Map by lazy { - mapOf( + private val authentications: Map = mapOf( "api_key" to ApiKeyAuth("header", "api_key"), - "petstore_auth" to OAuth()) - } + "petstore_auth" to OAuth() + ) + companion object { protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) - - private fun setMappers(serializer: KotlinxSerializer) { - - PetApi.setMappers(serializer) - - StoreApi.setMappers(serializer) - - UserApi.setMappers(serializer) - - serializer.setMapper(org.openapitools.client.models.ApiResponse::class, org.openapitools.client.models.ApiResponse.serializer()) - serializer.setMapper(org.openapitools.client.models.Category::class, org.openapitools.client.models.Category.serializer()) - serializer.setMapper(org.openapitools.client.models.Order::class, org.openapitools.client.models.Order.serializer()) - serializer.setMapper(org.openapitools.client.models.Pet::class, org.openapitools.client.models.Pet.serializer()) - serializer.setMapper(org.openapitools.client.models.Tag::class, org.openapitools.client.models.Tag.serializer()) - serializer.setMapper(org.openapitools.client.models.User::class, org.openapitools.client.models.User.serializer()) - } } /** @@ -78,7 +47,7 @@ open class ApiClient( * @param username Username */ fun setUsername(username: String) { - val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? ?: throw Exception("No HTTP basic authentication configured") auth.username = username } @@ -89,7 +58,7 @@ open class ApiClient( * @param password Password */ fun setPassword(password: String) { - val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? ?: throw Exception("No HTTP basic authentication configured") auth.password = password } @@ -101,7 +70,7 @@ open class ApiClient( * @param paramName The name of the API key parameter, or null or set the first key. */ fun setApiKey(apiKey: String, paramName: String? = null) { - val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? + val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? ?: throw Exception("No API key authentication configured") auth.apiKey = apiKey } @@ -113,7 +82,7 @@ open class ApiClient( * @param paramName The name of the API key parameter, or null or set the first key. */ fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) { - val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? + val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? ?: throw Exception("No API key authentication configured") auth.apiKeyPrefix = apiKeyPrefix } @@ -124,7 +93,7 @@ open class ApiClient( * @param accessToken Access token */ fun setAccessToken(accessToken: String) { - val auth = authentications?.values?.firstOrNull { it is OAuth } as OAuth? + val auth = authentications.values.firstOrNull { it is OAuth } as OAuth? ?: throw Exception("No OAuth2 authentication configured") auth.accessToken = accessToken } @@ -135,37 +104,40 @@ open class ApiClient( * @param bearerToken The bearer token. */ fun setBearerToken(bearerToken: String) { - val auth = authentications?.values?.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? + val auth = authentications.values.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? ?: throw Exception("No Bearer authentication configured") auth.bearerToken = bearerToken } - protected suspend fun multipartFormRequest(requestConfig: RequestConfig, body: kotlin.collections.List?, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun multipartFormRequest(requestConfig: RequestConfig, body: List?, authNames: List): HttpResponse { return request(requestConfig, MultiPartFormDataContent(body ?: listOf()), authNames) } - protected suspend fun urlEncodedFormRequest(requestConfig: RequestConfig, body: Parameters?, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun urlEncodedFormRequest(requestConfig: RequestConfig, body: Parameters?, authNames: List): HttpResponse { return request(requestConfig, FormDataContent(body ?: Parameters.Empty), authNames) } - protected suspend fun jsonRequest(requestConfig: RequestConfig, body: Any? = null, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun jsonRequest(requestConfig: RequestConfig, body: Any? = null, authNames: List): HttpResponse { val contentType = (requestConfig.headers[HttpHeaders.ContentType]?.let { ContentType.parse(it) } ?: ContentType.Application.Json) return if (body != null) request(requestConfig, serializer.write(body, contentType), authNames) else request(requestConfig, authNames = authNames) } - protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent, authNames: kotlin.collections.List): HttpResponse { + protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent, authNames: List): HttpResponse { requestConfig.updateForAuth(authNames) val headers = requestConfig.headers - return client.call { + return client.request { this.url { this.takeFrom(URLBuilder(baseUrl)) appendPath(requestConfig.path.trimStart('/').split('/')) - requestConfig.query.forEach { query -> - query.value.forEach { value -> - parameter(query.key, value) + for ((name, value) in requestConfig.queries.queries) { + when (value) { + is QueryParam.Single -> parameter(name, value.value) + is QueryParam.Multi -> value.values.forEach { + parameter(name, it) + } } } } @@ -174,17 +146,17 @@ open class ApiClient( if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH)) this.body = body - }.response + } } - private fun RequestConfig.updateForAuth(authNames: kotlin.collections.List) { + private fun RequestConfig.updateForAuth(authNames: List) { for (authName in authNames) { - val auth = authentications?.get(authName) ?: throw Exception("Authentication undefined: $authName") - auth.apply(query, headers) + val auth = authentications[authName] ?: throw Exception("Authentication undefined: $authName") + auth.apply(queries, headers) } } - private fun URLBuilder.appendPath(components: kotlin.collections.List): URLBuilder = apply { + private fun URLBuilder.appendPath(components: List): URLBuilder = apply { encodedPath = encodedPath.trimEnd('/') + components.joinToString("/", prefix = "/") { it.encodeURLQueryComponent() } } @@ -199,13 +171,3 @@ open class ApiClient( RequestMethod.OPTIONS -> HttpMethod.Options } } - -// https://github.com/ktorio/ktor/issues/851 -private fun JsonSerializer.ignoreOutgoingContent() = IgnoreOutgoingContentJsonSerializer(this) - -private class IgnoreOutgoingContentJsonSerializer(private val delegate: JsonSerializer) : JsonSerializer by delegate { - override fun write(data: Any): OutgoingContent { - if (data is OutgoingContent) return data - return delegate.write(data) - } -} diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/Base64ByteArray.kt new file mode 100644 index 000000000000..cb4eeb475ab7 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/Base64ByteArray.kt @@ -0,0 +1,35 @@ +package org.openapitools.client.infrastructure + +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +@Serializable(with = Base64ByteArray.Companion::class) +class Base64ByteArray(val value: ByteArray) { + companion object : KSerializer { + override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: Base64ByteArray): Unit = + encoder.encodeString(value.value.encodeBase64()) + + override fun deserialize(decoder: Decoder): Base64ByteArray = + Base64ByteArray(decoder.decodeString().decodeBase64Bytes()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + other as Base64ByteArray + return value.contentEquals(other.value) + } + + override fun hashCode(): Int { + return value.contentHashCode() + } + + override fun toString(): String { + return "Base64ByteArray(${hex(value)})" + } +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/Bytes.kt similarity index 95% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/Bytes.kt index 8a222416cf2d..dea7d43223ab 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/Bytes.kt @@ -1,6 +1,6 @@ package org.openapitools.client.infrastructure -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import kotlin.experimental.and private val digits = "0123456789abcdef".toCharArray() @@ -14,7 +14,7 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it private fun Int.toBase64(): Char = BASE64_ALPHABET[this] private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64() -internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeStringUtf8(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes() +internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes() /** * Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes. @@ -32,7 +32,7 @@ internal fun hex(bytes: ByteArray): String { result[resultIndex++] = digits[b and 0x0f] } - return String(result) + return result.concatToString() } /** diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/HttpResponse.kt similarity index 54% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/HttpResponse.kt index c457eb4bce0b..2be6e02070f6 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/HttpResponse.kt @@ -4,8 +4,9 @@ import io.ktor.client.call.TypeInfo import io.ktor.client.call.typeInfo import io.ktor.http.Headers import io.ktor.http.isSuccess +import io.ktor.client.statement.HttpResponse as KtorHttpResponse -open class HttpResponse(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider) { +open class HttpResponse(val response: KtorHttpResponse, val provider: BodyProvider) { val status: Int = response.status.value val success: Boolean = response.status.isSuccess() val headers: Map> = response.headers.mapEntries() @@ -22,29 +23,30 @@ open class HttpResponse(val response: io.ktor.client.response.HttpRespo } interface BodyProvider { - suspend fun body(response: io.ktor.client.response.HttpResponse): T - suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V + suspend fun body(response: KtorHttpResponse): T + suspend fun typedBody(response: KtorHttpResponse, type: TypeInfo): V } 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 + override suspend fun body(response: KtorHttpResponse): T = + response.call.receive(type) as T @Suppress("UNCHECKED_CAST") - override suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V = - response.call.receive(type) as V + override suspend fun typedBody(response: KtorHttpResponse, type: TypeInfo): V = + response.call.receive(type) as V } -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)) +class MappedBodyProvider(private val provider: BodyProvider, private val block: S.() -> T) : + BodyProvider { + override suspend fun body(response: KtorHttpResponse): T = + block(provider.body(response)) - override suspend fun typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V = - provider.typedBody(response, type) + override suspend fun typedBody(response: KtorHttpResponse, type: TypeInfo): V = + provider.typedBody(response, type) } -inline fun io.ktor.client.response.HttpResponse.wrap(): HttpResponse = +inline fun KtorHttpResponse.wrap(): HttpResponse = HttpResponse(this, TypedBodyProvider(typeInfo())) fun HttpResponse.map(block: T.() -> V): HttpResponse = diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/OctetByteArray.kt similarity index 54% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/OctetByteArray.kt index 735e4e6e3f66..f2083a69000f 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/OctetByteArray.kt @@ -1,14 +1,17 @@ package org.openapitools.client.infrastructure -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor +import kotlinx.serialization.Serializable +import kotlinx.serialization.KSerializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder -@Serializable +@Serializable(with = OctetByteArray.Companion::class) class OctetByteArray(val value: ByteArray) { - @Serializer(OctetByteArray::class) companion object : KSerializer { - override val descriptor = StringDescriptor.withName("OctetByteArray") - override fun serialize(encoder: Encoder, obj: OctetByteArray) = encoder.encodeString(hex(obj.value)) + override val descriptor = PrimitiveSerialDescriptor("OctetByteArray", PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: OctetByteArray) = encoder.encodeString(hex(value.value)) override fun deserialize(decoder: Decoder) = OctetByteArray(hex(decoder.decodeString())) } @@ -26,4 +29,4 @@ class OctetByteArray(val value: ByteArray) { override fun toString(): String { return "OctetByteArray(${hex(value)})" } -} \ No newline at end of file +} diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/RequestConfig.kt similarity index 65% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/RequestConfig.kt index 9c22257e223a..e3583b9edfeb 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/RequestConfig.kt @@ -5,12 +5,12 @@ package org.openapitools.client.infrastructure * 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 + * NOTE: Headers is a Map because rfc2616 defines * multi-valued headers as csv-only. */ data class RequestConfig( val method: RequestMethod, val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf() -) \ No newline at end of file + val headers: MutableMap = mutableMapOf(), + val queries: Queries = Queries() +) diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/RequestMethod.kt similarity index 100% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt rename to samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/RequestMethod.kt diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/encoding.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/encoding.kt new file mode 100644 index 000000000000..45ccc4036bff --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/infrastructure/encoding.kt @@ -0,0 +1,3 @@ +package org.openapitools.client.infrastructure + +fun String.toBase64() = encodeToByteArray().encodeBase64() diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/ApiResponse.kt new file mode 100644 index 000000000000..559137b61575 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/ApiResponse.kt @@ -0,0 +1,34 @@ +/** + * 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 kotlinx.serialization.* +import kotlin.collections.* + +/** + * Describes the result of uploading an image resource + * + * @param code + * @param type + * @param message + */ +@Serializable +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/common/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Category.kt new file mode 100644 index 000000000000..34d23d1bbe6e --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Category.kt @@ -0,0 +1,31 @@ +/** + * 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 kotlinx.serialization.* +import kotlin.collections.* + +/** + * A category for a pet + * + * @param id + * @param name + */ +@Serializable +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/common/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Order.kt new file mode 100644 index 000000000000..a82a581e7e8a --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Order.kt @@ -0,0 +1,61 @@ +/** + * 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 kotlinx.serialization.* +import kotlin.collections.* + +/** + * An order for a pets from the pet store + * + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status Order Status + * @param complete + */ +@Serializable +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, + @SerialName(value = "shipDate") + val shipDate: kotlin.String? = null, + /** + * Order Status + */ + @SerialName(value = "status") + val status: Order.Status? = null, + @SerialName(value = "complete") + val complete: kotlin.Boolean? = null +) { + + /** + * Order Status + * + * Values: placed,approved,delivered + */ + enum class Status(val value: kotlin.String){ + @Json(name = "placed") placed("placed"), + @SerialName(value = "placed") placed("placed"), + @Json(name = "approved") approved("approved"), + @SerialName(value = "approved") approved("approved"), + @Json(name = "delivered") delivered("delivered"); + @SerialName(value = "delivered") delivered("delivered"); + } +} + diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Pet.kt new file mode 100644 index 000000000000..53d66b54cae9 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Pet.kt @@ -0,0 +1,65 @@ +/** + * 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 kotlinx.serialization.* +import kotlin.collections.* + +/** + * A pet for sale in the pet store + * + * @param name + * @param photoUrls + * @param id + * @param category + * @param tags + * @param status pet status in the store + */ +@Serializable +data class Pet( + @SerialName(value = "name") + @Required + val name: kotlin.String, + @SerialName(value = "photoUrls") + @Required + val photoUrls: kotlin.collections.List, + @SerialName(value = "id") + val id: kotlin.Long? = null, + @SerialName(value = "category") + val category: Category? = null, + @SerialName(value = "tags") + val tags: kotlin.collections.List? = null, + /** + * pet status in the store + */ + @SerialName(value = "status") + val status: Pet.Status? = null +) { + + /** + * pet status in the store + * + * Values: available,pending,sold + */ + enum class Status(val value: kotlin.String){ + @Json(name = "available") available("available"), + @SerialName(value = "available") available("available"), + @Json(name = "pending") pending("pending"), + @SerialName(value = "pending") pending("pending"), + @Json(name = "sold") sold("sold"); + @SerialName(value = "sold") sold("sold"); + } +} + diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Tag.kt new file mode 100644 index 000000000000..2aca7b098db0 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/Tag.kt @@ -0,0 +1,31 @@ +/** + * 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 kotlinx.serialization.* +import kotlin.collections.* + +/** + * A tag for a pet + * + * @param id + * @param name + */ +@Serializable +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/common/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/User.kt new file mode 100644 index 000000000000..09cfe50c7f59 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/main/org/openapitools/client/models/User.kt @@ -0,0 +1,52 @@ +/** + * 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 kotlinx.serialization.* +import kotlin.collections.* + +/** + * 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 + */ +@Serializable +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, + @SerialName(value = "lastName") + val lastName: kotlin.String? = null, + @SerialName(value = "email") + val email: kotlin.String? = null, + @SerialName(value = "password") + val password: kotlin.String? = null, + @SerialName(value = "phone") + val phone: kotlin.String? = null, + /** + * User Status + */ + @SerialName(value = "userStatus") + val userStatus: kotlin.Int? = null +) + diff --git a/samples/client/petstore/kotlin-multiplatform/src/common/test/util/Coroutine.kt b/samples/client/petstore/kotlin-multiplatform/src/common/test/util/Coroutine.kt new file mode 100644 index 000000000000..841397635c1b --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/common/test/util/Coroutine.kt @@ -0,0 +1,23 @@ +/** + * 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 util + +import kotlinx.coroutines.CoroutineScope + +/** +* Block the current thread until execution of the given coroutine is complete. +* +* @param block The coroutine code. +* @return The result of the coroutine. +*/ +internal expect fun runTest(block: suspend CoroutineScope.() -> T): T 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 deleted file mode 100644 index e164a6cf4d06..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,344 +0,0 @@ -/** -* 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.* -import io.ktor.client.request.forms.formData -import kotlinx.serialization.UnstableDefault -import io.ktor.client.engine.HttpClientEngine -import io.ktor.client.features.json.serializer.KotlinxSerializer -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonConfiguration -import io.ktor.http.ParametersBuilder -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor - -class PetApi @UseExperimental(UnstableDefault::class) constructor( - baseUrl: kotlin.String = "http://petstore.swagger.io/v2", - httpClientEngine: HttpClientEngine? = null, - serializer: KotlinxSerializer -) : ApiClient(baseUrl, httpClientEngine, serializer) { - - @UseExperimental(UnstableDefault::class) - constructor( - baseUrl: kotlin.String = "http://petstore.swagger.io/v2", - httpClientEngine: HttpClientEngine? = null, - jsonConfiguration: JsonConfiguration = JsonConfiguration.Default - ) : this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration))) - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - */ - suspend fun addPet(body: Pet): HttpResponse { - - val localVariableAuthNames = listOf("petstore_auth") - - val localVariableBody = body - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return jsonRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - */ - suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): HttpResponse { - - val localVariableAuthNames = listOf("petstore_auth") - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/pet/{petId}".replace("{" + "petId" + "}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * 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.collections.List - */ - @Suppress("UNCHECKED_CAST") - suspend fun findPetsByStatus(status: kotlin.collections.List): HttpResponse> { - - val localVariableAuthNames = listOf("petstore_auth") - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - status?.apply { localVariableQuery["status"] = toMultiValue(this, "csv") } - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap().map { value } - } - - @Serializable - private class FindPetsByStatusResponse(val value: List) { - @Serializer(FindPetsByStatusResponse::class) - companion object : KSerializer { - private val serializer: KSerializer> = Pet.serializer().list - override val descriptor = StringDescriptor.withName("FindPetsByStatusResponse") - override fun serialize(encoder: Encoder, obj: FindPetsByStatusResponse) = serializer.serialize(encoder, obj.value) - override fun deserialize(decoder: Decoder) = FindPetsByStatusResponse(serializer.deserialize(decoder)) - } - } - - /** - * 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.collections.List - */ - @Suppress("UNCHECKED_CAST") - suspend fun findPetsByTags(tags: kotlin.collections.List): HttpResponse> { - - val localVariableAuthNames = listOf("petstore_auth") - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - tags?.apply { localVariableQuery["tags"] = toMultiValue(this, "csv") } - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap().map { value } - } - - @Serializable - private class FindPetsByTagsResponse(val value: List) { - @Serializer(FindPetsByTagsResponse::class) - companion object : KSerializer { - private val serializer: KSerializer> = Pet.serializer().list - override val descriptor = StringDescriptor.withName("FindPetsByTagsResponse") - override fun serialize(encoder: Encoder, obj: FindPetsByTagsResponse) = serializer.serialize(encoder, obj.value) - override fun deserialize(decoder: Decoder) = FindPetsByTagsResponse(serializer.deserialize(decoder)) - } - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - */ - @Suppress("UNCHECKED_CAST") - suspend fun getPetById(petId: kotlin.Long): HttpResponse { - - val localVariableAuthNames = listOf("api_key") - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/pet/{petId}".replace("{" + "petId" + "}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - */ - suspend fun updatePet(body: Pet): HttpResponse { - - val localVariableAuthNames = listOf("petstore_auth") - - val localVariableBody = body - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/pet", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return jsonRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - - /** - * 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 - */ - suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): HttpResponse { - - val localVariableAuthNames = listOf("petstore_auth") - - val localVariableBody = - ParametersBuilder().also { - name?.apply { it.append("name", name.toString()) } - status?.apply { it.append("status", status.toString()) } - }.build() - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}".replace("{" + "petId" + "}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return urlEncodedFormRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * 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") - suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.ktor.client.request.forms.InputProvider?): HttpResponse { - - val localVariableAuthNames = listOf("petstore_auth") - - val localVariableBody = - formData { - additionalMetadata?.apply { append("additionalMetadata", additionalMetadata) } - file?.apply { append("file", file) } - } - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/pet/{petId}/uploadImage".replace("{" + "petId" + "}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return multipartFormRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - - companion object { - internal fun setMappers(serializer: KotlinxSerializer) { - - serializer.setMapper(FindPetsByStatusResponse::class, FindPetsByStatusResponse.serializer()) - serializer.setMapper(FindPetsByTagsResponse::class, FindPetsByTagsResponse.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 deleted file mode 100644 index 8ca30e8ca3a3..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,187 +0,0 @@ -/** -* 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.* -import io.ktor.client.request.forms.formData -import kotlinx.serialization.UnstableDefault -import io.ktor.client.engine.HttpClientEngine -import io.ktor.client.features.json.serializer.KotlinxSerializer -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonConfiguration -import io.ktor.http.ParametersBuilder -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor - -class StoreApi @UseExperimental(UnstableDefault::class) constructor( - baseUrl: kotlin.String = "http://petstore.swagger.io/v2", - httpClientEngine: HttpClientEngine? = null, - serializer: KotlinxSerializer -) : ApiClient(baseUrl, httpClientEngine, serializer) { - - @UseExperimental(UnstableDefault::class) - constructor( - baseUrl: kotlin.String = "http://petstore.swagger.io/v2", - httpClientEngine: HttpClientEngine? = null, - jsonConfiguration: JsonConfiguration = JsonConfiguration.Default - ) : this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration))) - - /** - * 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 - */ - suspend fun deleteOrder(orderId: kotlin.String): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/store/order/{orderId}".replace("{" + "orderId" + "}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - */ - @Suppress("UNCHECKED_CAST") - suspend fun getInventory(): HttpResponse> { - - val localVariableAuthNames = listOf("api_key") - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap().map { value } - } - - @Serializable - private class GetInventoryResponse(val value: Map) { - @Serializer(GetInventoryResponse::class) - companion object : KSerializer { - private val serializer: KSerializer> = (kotlin.String.serializer() to kotlin.Int.serializer()).map - override val descriptor = StringDescriptor.withName("GetInventoryResponse") - override fun serialize(encoder: Encoder, obj: GetInventoryResponse) = serializer.serialize(encoder, obj.value) - override fun deserialize(decoder: Decoder) = GetInventoryResponse(serializer.deserialize(decoder)) - } - } - - /** - * 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") - suspend fun getOrderById(orderId: kotlin.Long): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/store/order/{orderId}".replace("{" + "orderId" + "}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - */ - @Suppress("UNCHECKED_CAST") - suspend fun placeOrder(body: Order): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = body - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/store/order", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return jsonRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - - - 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 deleted file mode 100644 index 88474dc9ef80..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,328 +0,0 @@ -/** -* 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.* -import io.ktor.client.request.forms.formData -import kotlinx.serialization.UnstableDefault -import io.ktor.client.engine.HttpClientEngine -import io.ktor.client.features.json.serializer.KotlinxSerializer -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonConfiguration -import io.ktor.http.ParametersBuilder -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor - -class UserApi @UseExperimental(UnstableDefault::class) constructor( - baseUrl: kotlin.String = "http://petstore.swagger.io/v2", - httpClientEngine: HttpClientEngine? = null, - serializer: KotlinxSerializer -) : ApiClient(baseUrl, httpClientEngine, serializer) { - - @UseExperimental(UnstableDefault::class) - constructor( - baseUrl: kotlin.String = "http://petstore.swagger.io/v2", - httpClientEngine: HttpClientEngine? = null, - jsonConfiguration: JsonConfiguration = JsonConfiguration.Default - ) : this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration))) - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - */ - suspend fun createUser(body: User): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = body - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return jsonRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - */ - suspend fun createUsersWithArrayInput(body: kotlin.collections.List): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = CreateUsersWithArrayInputRequest(body) - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return jsonRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - @Serializable - private class CreateUsersWithArrayInputRequest(val value: List) { - @Serializer(CreateUsersWithArrayInputRequest::class) - companion object : KSerializer { - private val serializer: KSerializer> = User.serializer().list - override val descriptor = StringDescriptor.withName("CreateUsersWithArrayInputRequest") - override fun serialize(encoder: Encoder, obj: CreateUsersWithArrayInputRequest) = serializer.serialize(encoder, obj.value) - override fun deserialize(decoder: Decoder) = CreateUsersWithArrayInputRequest(serializer.deserialize(decoder)) - } - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - */ - suspend fun createUsersWithListInput(body: kotlin.collections.List): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = CreateUsersWithListInputRequest(body) - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return jsonRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - @Serializable - private class CreateUsersWithListInputRequest(val value: List) { - @Serializer(CreateUsersWithListInputRequest::class) - companion object : KSerializer { - private val serializer: KSerializer> = User.serializer().list - override val descriptor = StringDescriptor.withName("CreateUsersWithListInputRequest") - override fun serialize(encoder: Encoder, obj: CreateUsersWithListInputRequest) = serializer.serialize(encoder, obj.value) - override fun deserialize(decoder: Decoder) = CreateUsersWithListInputRequest(serializer.deserialize(decoder)) - } - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - */ - suspend fun deleteUser(username: kotlin.String): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/user/{username}".replace("{" + "username" + "}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - */ - @Suppress("UNCHECKED_CAST") - suspend fun getUserByName(username: kotlin.String): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/{username}".replace("{" + "username" + "}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * 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") - suspend fun loginUser(username: kotlin.String, password: kotlin.String): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - username?.apply { localVariableQuery["username"] = listOf("$username") } - password?.apply { localVariableQuery["password"] = listOf("$password") } - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/login", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * Logs out current logged in user session - * - * @return void - */ - suspend fun logoutUser(): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = - io.ktor.client.utils.EmptyContent - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders - ) - - return request( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - /** - * 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 - */ - suspend fun updateUser(username: kotlin.String, body: User): HttpResponse { - - val localVariableAuthNames = listOf() - - val localVariableBody = body - - val localVariableQuery = mutableMapOf>() - - val localVariableHeaders = mutableMapOf() - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/user/{username}".replace("{" + "username" + "}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders - ) - - return jsonRequest( - localVariableConfig, - localVariableBody, - localVariableAuthNames - ).wrap() - } - - - - - companion object { - internal fun setMappers(serializer: KotlinxSerializer) { - - serializer.setMapper(CreateUsersWithArrayInputRequest::class, CreateUsersWithArrayInputRequest.serializer()) - serializer.setMapper(CreateUsersWithListInputRequest::class, CreateUsersWithListInputRequest.serializer()) - - } - } -} diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt deleted file mode 100644 index 8bd8b59a8f82..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.auth - -class ApiKeyAuth(private val location: String, val paramName: String) : Authentication { - var apiKey: String? = null - var apiKeyPrefix: String? = null - - override fun apply(query: MutableMap>, headers: MutableMap) { - val key: String = apiKey ?: return - val prefix: String? = apiKeyPrefix - val value: String = if (prefix != null) "$prefix $key" else key - when (location) { - "query" -> query[paramName] = listOf(value) - "header" -> headers[paramName] = value - } - } -} 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 deleted file mode 100644 index ef7a8f1e1a62..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -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 { - 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-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt deleted file mode 100644 index 4bc1197cf00d..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Base64ByteArray.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor - -@Serializable -class Base64ByteArray(val value: ByteArray) { - @Serializer(Base64ByteArray::class) - companion object : KSerializer { - override val descriptor = StringDescriptor.withName("Base64ByteArray") - override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.encodeBase64()) - override fun deserialize(decoder: Decoder) = Base64ByteArray(decoder.decodeString().decodeBase64Bytes()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this::class != other::class) return false - other as Base64ByteArray - return value.contentEquals(other.value) - } - - override fun hashCode(): Int { - return value.contentHashCode() - } - - override fun toString(): String { - return "Base64ByteArray(${hex(value)})" - } -} \ 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 deleted file mode 100644 index a035628a8f93..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,30 +0,0 @@ -/** -* 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 kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ -@Serializable -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 deleted file mode 100644 index d5f9a45fd4de..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,28 +0,0 @@ -/** -* 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 kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer - -/** - * A category for a pet - * @param id - * @param name - */ -@Serializable -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 deleted file mode 100644 index f1bd6ce4d0b8..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,51 +0,0 @@ -/** -* 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 kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ -@Serializable -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, - @SerialName(value = "shipDate") val shipDate: kotlin.String? = null, - /* Order Status */ - @SerialName(value = "status") val status: Order.Status? = null, - @SerialName(value = "complete") val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - @Serializable(with = Status.Serializer::class) - enum class Status(val value: kotlin.String){ - placed("placed"), - approved("approved"), - delivered("delivered"); - - object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value.toString() }.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 deleted file mode 100644 index 473cbaa959ac..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,53 +0,0 @@ -/** -* 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 kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ -@Serializable -data class Pet ( - @SerialName(value = "name") @Required val name: kotlin.String, - @SerialName(value = "photoUrls") @Required val photoUrls: kotlin.collections.List, - @SerialName(value = "id") val id: kotlin.Long? = null, - @SerialName(value = "category") val category: Category? = null, - @SerialName(value = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @SerialName(value = "status") val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - @Serializable(with = Status.Serializer::class) - enum class Status(val value: kotlin.String){ - available("available"), - pending("pending"), - sold("sold"); - - object Serializer : CommonEnumSerializer("Status", values(), values().map { it.value.toString() }.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 deleted file mode 100644 index 6116e50d3f92..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,28 +0,0 @@ -/** -* 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 kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer - -/** - * A tag for a pet - * @param id - * @param name - */ -@Serializable -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 deleted file mode 100644 index 97b53a049c1d..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,41 +0,0 @@ -/** -* 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 kotlinx.serialization.* -import kotlinx.serialization.internal.CommonEnumSerializer - -/** - * 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 - */ -@Serializable -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, - @SerialName(value = "lastName") val lastName: kotlin.String? = null, - @SerialName(value = "email") val email: kotlin.String? = null, - @SerialName(value = "password") val password: kotlin.String? = null, - @SerialName(value = "phone") val phone: kotlin.String? = null, - /* User Status */ - @SerialName(value = "userStatus") val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonTest/kotlin/util/Coroutine.kt b/samples/client/petstore/kotlin-multiplatform/src/commonTest/kotlin/util/Coroutine.kt deleted file mode 100644 index fcff288bfef6..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/commonTest/kotlin/util/Coroutine.kt +++ /dev/null @@ -1,23 +0,0 @@ -/** -* 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 util - -import kotlinx.coroutines.CoroutineScope - -/** -* Block the current thread until execution of the given coroutine is complete. -* -* @param block The coroutine code. -* @return The result of the coroutine. -*/ -internal expect fun runTest(block: suspend CoroutineScope.() -> T): T diff --git a/samples/client/petstore/kotlin-multiplatform/src/ios/test/util/Coroutine.kt b/samples/client/petstore/kotlin-multiplatform/src/ios/test/util/Coroutine.kt new file mode 100644 index 000000000000..d13344446fbd --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/ios/test/util/Coroutine.kt @@ -0,0 +1,18 @@ +/** + * 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 util + +import kotlinx.coroutines.CoroutineScope +import kotlin.coroutines.EmptyCoroutineContext + +internal actual fun runTest(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking(EmptyCoroutineContext, block) diff --git a/samples/client/petstore/kotlin-multiplatform/src/iosTest/kotlin/util/Coroutine.kt b/samples/client/petstore/kotlin-multiplatform/src/iosTest/kotlin/util/Coroutine.kt deleted file mode 100644 index b8b36f3f7596..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/iosTest/kotlin/util/Coroutine.kt +++ /dev/null @@ -1,18 +0,0 @@ -/** -* 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 util - -import kotlinx.coroutines.CoroutineScope -import kotlin.coroutines.EmptyCoroutineContext - -internal actual fun runTest(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking(EmptyCoroutineContext, block) diff --git a/samples/client/petstore/kotlin-multiplatform/src/jsTest/kotlin/util/Coroutine.kt b/samples/client/petstore/kotlin-multiplatform/src/js/test/util/Coroutine.kt similarity index 100% rename from samples/client/petstore/kotlin-multiplatform/src/jsTest/kotlin/util/Coroutine.kt rename to samples/client/petstore/kotlin-multiplatform/src/js/test/util/Coroutine.kt diff --git a/samples/client/petstore/kotlin-multiplatform/src/jvm/test/util/Coroutine.kt b/samples/client/petstore/kotlin-multiplatform/src/jvm/test/util/Coroutine.kt new file mode 100644 index 000000000000..0976adca3ca6 --- /dev/null +++ b/samples/client/petstore/kotlin-multiplatform/src/jvm/test/util/Coroutine.kt @@ -0,0 +1,19 @@ +/** + * 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 util + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.runBlocking +import kotlin.coroutines.EmptyCoroutineContext + +internal actual fun runTest(block: suspend CoroutineScope.() -> T): T = runBlocking(EmptyCoroutineContext, block) diff --git a/samples/client/petstore/kotlin-multiplatform/src/jvmTest/kotlin/util/Coroutine.kt b/samples/client/petstore/kotlin-multiplatform/src/jvmTest/kotlin/util/Coroutine.kt deleted file mode 100644 index b8b36f3f7596..000000000000 --- a/samples/client/petstore/kotlin-multiplatform/src/jvmTest/kotlin/util/Coroutine.kt +++ /dev/null @@ -1,18 +0,0 @@ -/** -* 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 util - -import kotlinx.coroutines.CoroutineScope -import kotlin.coroutines.EmptyCoroutineContext - -internal actual fun runTest(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking(EmptyCoroutineContext, block) diff --git a/samples/client/petstore/kotlin-nonpublic/README.md b/samples/client/petstore/kotlin-nonpublic/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-nonpublic/README.md +++ b/samples/client/petstore/kotlin-nonpublic/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Order.md b/samples/client/petstore/kotlin-nonpublic/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/Order.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-nonpublic/docs/Pet.md b/samples/client/petstore/kotlin-nonpublic/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/Pet.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-nonpublic/settings.gradle b/samples/client/petstore/kotlin-nonpublic/settings.gradle index b6d700d5a984..b12e60cec24c 100644 --- a/samples/client/petstore/kotlin-nonpublic/settings.gradle +++ b/samples/client/petstore/kotlin-nonpublic/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-nonpublic' \ No newline at end of file +rootProject.name = 'kotlin-petstore-nonpublic' 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 index 5e930e963956..626ea070711f 100644 --- 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 index 4f8898adf9b3..56e7b38aa6ff 100644 --- 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 index 725b36b01060..c7db5a7be870 100644 --- 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 a695278dfa3c..aad4f0e01f01 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 @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -internal data class ApiResponse ( +internal data class ApiResponse( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") 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 376994a9b250..cb45a5cc7c39 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 @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -internal data class Category ( +internal data class Category( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") 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 a943b97c1ea3..86305c782846 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 @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.squareup.moshi.Json * @param complete */ -internal data class Order ( +internal data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -33,7 +35,9 @@ internal data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -41,10 +45,10 @@ internal data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ internal enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), 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 544fab20f5a7..dd545eece845 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 @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -internal data class Pet ( +internal data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -37,16 +39,18 @@ internal data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * 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"), 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 d9b84e93eafd..295aeee71098 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 @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -internal data class Tag ( +internal data class Tag( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") 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 e0e821cd7e38..f0339f39c437 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 @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -internal data class User ( +internal data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -41,7 +43,9 @@ internal data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-nullable/README.md b/samples/client/petstore/kotlin-nullable/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-nullable/README.md +++ b/samples/client/petstore/kotlin-nullable/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-nullable/docs/Order.md b/samples/client/petstore/kotlin-nullable/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-nullable/docs/Order.md +++ b/samples/client/petstore/kotlin-nullable/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-nullable/docs/Pet.md b/samples/client/petstore/kotlin-nullable/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-nullable/docs/Pet.md +++ b/samples/client/petstore/kotlin-nullable/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-nullable/settings.gradle b/samples/client/petstore/kotlin-nullable/settings.gradle index 1022b496fedf..229267927ecf 100644 --- a/samples/client/petstore/kotlin-nullable/settings.gradle +++ b/samples/client/petstore/kotlin-nullable/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-nullable' \ No newline at end of file +rootProject.name = 'kotlin-petstore-nullable' diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 4b9faa2a2c46..900a6aff8e73 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index b9dd7b38f59b..bc3501e75745 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 2ae5998489dd..78829641794e 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index 7d40c8efbc2f..4449603d2bc0 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,28 +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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -data class ApiResponse ( +data class ApiResponse( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Category.kt index ceb0fbc8fe60..9cd04452a72c 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -data class Category ( +data class Category( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Order.kt index ed8f8b13a43b..ccd49c6145ba 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -25,7 +27,7 @@ import java.io.Serializable * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -34,7 +36,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -45,10 +49,10 @@ data class Order ( } /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Pet.kt index 105f485f021d..28cb9742ec20 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 @@ -16,9 +16,11 @@ import org.openapitools.client.models.Tag import com.squareup.moshi.Json import java.io.Serializable +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -27,7 +29,7 @@ import java.io.Serializable * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -38,7 +40,9 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) : Serializable { @@ -47,10 +51,10 @@ data class Pet ( } /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Tag.kt index 944b1cd0a141..2670c541fbb6 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -data class Tag ( +data class Tag( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/User.kt index 9697f07d5bf8..4f2256930bff 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -27,7 +29,7 @@ import java.io.Serializable * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -42,7 +44,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) : Serializable { diff --git a/samples/client/petstore/kotlin-okhttp3/README.md b/samples/client/petstore/kotlin-okhttp3/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-okhttp3/README.md +++ b/samples/client/petstore/kotlin-okhttp3/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-okhttp3/docs/Order.md b/samples/client/petstore/kotlin-okhttp3/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/Order.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-okhttp3/docs/Pet.md b/samples/client/petstore/kotlin-okhttp3/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/Pet.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-okhttp3/settings.gradle b/samples/client/petstore/kotlin-okhttp3/settings.gradle index a18186278ecb..92b4e7026195 100644 --- a/samples/client/petstore/kotlin-okhttp3/settings.gradle +++ b/samples/client/petstore/kotlin-okhttp3/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-okhttp3' \ No newline at end of file +rootProject.name = 'kotlin-petstore-okhttp3' 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 60f72b51af95..621943f0f01b 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 08822c67e32a..c42220e5f4cb 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 258a2540e9e8..df7073fbc886 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 fafca8738f66..2f46a69fd3ef 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 @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -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 a4c17c3b49dd..e7fe5b524430 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 @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -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 a66c335904e7..63853cde7b09 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 @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.squareup.moshi.Json * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -33,7 +35,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -41,10 +45,10 @@ data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), 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 a3df06cb6eb3..fe32421ec09c 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 @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -37,16 +39,18 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), 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 6e619023a5c9..d7b7334c9b2c 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 @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -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 af1e270325de..faa11fc9e716 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 @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -41,7 +43,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/README.md b/samples/client/petstore/kotlin-retrofit2-rx3/README.md index f374ed0b99f3..a56262d04c2a 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/README.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/settings.gradle b/samples/client/petstore/kotlin-retrofit2-rx3/settings.gradle index df63a0a713ce..b24c7c5b8e4d 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/settings.gradle +++ b/samples/client/petstore/kotlin-retrofit2-rx3/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-retrofit2-rx3' \ No newline at end of file +rootProject.name = 'kotlin-petstore-retrofit2-rx3' diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index fafca8738f66..2f46a69fd3ef 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -data class ApiResponse ( +data class ApiResponse( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Category.kt index a4c17c3b49dd..e7fe5b524430 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -data class Category ( +data class Category( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Order.kt index a66c335904e7..63853cde7b09 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.squareup.moshi.Json * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -33,7 +35,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -41,10 +45,10 @@ data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Pet.kt index a3df06cb6eb3..fe32421ec09c 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -37,16 +39,18 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Tag.kt index 6e619023a5c9..d7b7334c9b2c 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -data class Tag ( +data class Tag( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/User.kt index af1e270325de..faa11fc9e716 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -41,7 +43,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-retrofit2/README.md b/samples/client/petstore/kotlin-retrofit2/README.md index f374ed0b99f3..a56262d04c2a 100644 --- a/samples/client/petstore/kotlin-retrofit2/README.md +++ b/samples/client/petstore/kotlin-retrofit2/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-retrofit2/docs/Order.md b/samples/client/petstore/kotlin-retrofit2/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin-retrofit2/docs/Order.md +++ b/samples/client/petstore/kotlin-retrofit2/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2/docs/Pet.md b/samples/client/petstore/kotlin-retrofit2/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-retrofit2/docs/Pet.md +++ b/samples/client/petstore/kotlin-retrofit2/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-retrofit2/settings.gradle b/samples/client/petstore/kotlin-retrofit2/settings.gradle index 24c556e079c1..01c60542d300 100644 --- a/samples/client/petstore/kotlin-retrofit2/settings.gradle +++ b/samples/client/petstore/kotlin-retrofit2/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-retrofit2' \ No newline at end of file +rootProject.name = 'kotlin-petstore-retrofit2' diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt index fafca8738f66..2f46a69fd3ef 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -data class ApiResponse ( +data class ApiResponse( @Json(name = "code") val code: kotlin.Int? = null, @Json(name = "type") diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Category.kt index a4c17c3b49dd..e7fe5b524430 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Category.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -data class Category ( +data class Category( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Order.kt index a66c335904e7..63853cde7b09 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Order.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Order.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.squareup.moshi.Json * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -33,7 +35,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -41,10 +45,10 @@ data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Pet.kt index a3df06cb6eb3..fe32421ec09c 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -37,16 +39,18 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Tag.kt index 6e619023a5c9..d7b7334c9b2c 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Tag.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -data class Tag ( +data class Tag( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "name") diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/User.kt index af1e270325de..faa11fc9e716 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/User.kt @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -41,7 +43,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin-string/README.md b/samples/client/petstore/kotlin-string/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-string/README.md +++ b/samples/client/petstore/kotlin-string/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-string/docs/Order.md b/samples/client/petstore/kotlin-string/docs/Order.md index 4683c14c1cbe..25e712e47289 100644 --- a/samples/client/petstore/kotlin-string/docs/Order.md +++ b/samples/client/petstore/kotlin-string/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-string/docs/Pet.md b/samples/client/petstore/kotlin-string/docs/Pet.md index 73963abeb042..9d2211c363fc 100644 --- a/samples/client/petstore/kotlin-string/docs/Pet.md +++ b/samples/client/petstore/kotlin-string/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-string/settings.gradle b/samples/client/petstore/kotlin-string/settings.gradle index 9699edc87133..9742263a6a20 100644 --- a/samples/client/petstore/kotlin-string/settings.gradle +++ b/samples/client/petstore/kotlin-string/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-string' \ No newline at end of file +rootProject.name = 'kotlin-petstore-string' 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 c95dd04f915e..bdd47b48d453 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 08822c67e32a..c42220e5f4cb 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 258a2540e9e8..df7073fbc886 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 7d40c8efbc2f..4449603d2bc0 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 @@ -1,28 +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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -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 ceb0fbc8fe60..9cd04452a72c 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 @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -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 ec768d1acefd..bdb011f6c787 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 @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -25,7 +27,7 @@ import java.io.Serializable * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -34,7 +36,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: kotlin.String? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -45,10 +49,10 @@ data class Order ( } /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), 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 66667bf07cd1..388b62b62905 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 @@ -16,9 +16,11 @@ import org.openapitools.client.models.Tag import com.squareup.moshi.Json import java.io.Serializable +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param id * @param category * @param name @@ -27,7 +29,7 @@ import java.io.Serializable * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "category") @@ -38,7 +40,9 @@ data class Pet ( val photoUrls: kotlin.collections.List, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) : Serializable { @@ -47,10 +51,10 @@ data class Pet ( } /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), 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 944b1cd0a141..2670c541fbb6 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 @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -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 9697f07d5bf8..4f2256930bff 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 @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -27,7 +29,7 @@ import java.io.Serializable * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -42,7 +44,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) : Serializable { diff --git a/samples/client/petstore/kotlin-threetenbp/README.md b/samples/client/petstore/kotlin-threetenbp/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin-threetenbp/README.md +++ b/samples/client/petstore/kotlin-threetenbp/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin-threetenbp/docs/Order.md b/samples/client/petstore/kotlin-threetenbp/docs/Order.md index 776e0ddc2f02..a7c1d9ae6bcf 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/Order.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-threetenbp/docs/Pet.md b/samples/client/petstore/kotlin-threetenbp/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/Pet.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin-threetenbp/settings.gradle b/samples/client/petstore/kotlin-threetenbp/settings.gradle index 1f071e0d3ca6..307a3980c2ef 100644 --- a/samples/client/petstore/kotlin-threetenbp/settings.gradle +++ b/samples/client/petstore/kotlin-threetenbp/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-threetenbp' \ No newline at end of file +rootProject.name = 'kotlin-petstore-threetenbp' 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 60f72b51af95..621943f0f01b 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 08822c67e32a..c42220e5f4cb 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 258a2540e9e8..df7073fbc886 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 fafca8738f66..2f46a69fd3ef 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 @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -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 a4c17c3b49dd..e7fe5b524430 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 @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -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 300f94d8545f..a4ad6377b698 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 @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -24,7 +26,7 @@ import com.squareup.moshi.Json * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -33,7 +35,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: org.threeten.bp.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -41,10 +45,10 @@ data class Order ( ) { /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), 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 a3df06cb6eb3..fe32421ec09c 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 @@ -1,23 +1,25 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -37,16 +39,18 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) { /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), 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 6e619023a5c9..d7b7334c9b2c 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 @@ -1,26 +1,28 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -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 af1e270325de..faa11fc9e716 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 @@ -1,21 +1,23 @@ /** -* 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. -*/ + * 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 +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -26,7 +28,7 @@ import com.squareup.moshi.Json * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -41,7 +43,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) diff --git a/samples/client/petstore/kotlin/README.md b/samples/client/petstore/kotlin/README.md index 8166d4aadbac..492b00fc1d80 100644 --- a/samples/client/petstore/kotlin/README.md +++ b/samples/client/petstore/kotlin/README.md @@ -28,7 +28,7 @@ This runs all tests and packages the library. * 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* @@ -57,7 +57,7 @@ Class | Method | HTTP request | Description *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - + ## Documentation for Models - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) @@ -68,17 +68,17 @@ Class | Method | HTTP request | Description - [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 diff --git a/samples/client/petstore/kotlin/docs/Order.md b/samples/client/petstore/kotlin/docs/Order.md index 5112f08958d5..5044b96bb06e 100644 --- a/samples/client/petstore/kotlin/docs/Order.md +++ b/samples/client/petstore/kotlin/docs/Order.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **complete** | **kotlin.Boolean** | | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin/docs/Pet.md b/samples/client/petstore/kotlin/docs/Pet.md index c82844b5ee80..665ecfa69c69 100644 --- a/samples/client/petstore/kotlin/docs/Pet.md +++ b/samples/client/petstore/kotlin/docs/Pet.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **status** | [**inline**](#StatusEnum) | pet status in the store | [optional] - + ## Enum: status Name | Value ---- | ----- diff --git a/samples/client/petstore/kotlin/settings.gradle b/samples/client/petstore/kotlin/settings.gradle index 7540d01de36c..5a53369817d7 100644 --- a/samples/client/petstore/kotlin/settings.gradle +++ b/samples/client/petstore/kotlin/settings.gradle @@ -1,2 +1 @@ - -rootProject.name = 'kotlin-petstore-client' \ No newline at end of file +rootProject.name = 'kotlin-petstore-client' 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 60f72b51af95..621943f0f01b 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 08822c67e32a..c42220e5f4cb 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 258a2540e9e8..df7073fbc886 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 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 7d40c8efbc2f..4449603d2bc0 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 @@ -1,28 +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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * Describes the result of uploading an image resource + * * @param code * @param type * @param message */ -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 ceb0fbc8fe60..9cd04452a72c 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 @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A category for a pet + * * @param id * @param name */ -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 ed8f8b13a43b..ccd49c6145ba 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 @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * An order for a pets from the pet store + * * @param id * @param petId * @param quantity @@ -25,7 +27,7 @@ import java.io.Serializable * @param complete */ -data class Order ( +data class Order( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "petId") @@ -34,7 +36,9 @@ data class Order ( val quantity: kotlin.Int? = null, @Json(name = "shipDate") val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ + /** + * Order Status + */ @Json(name = "status") val status: Order.Status? = null, @Json(name = "complete") @@ -45,10 +49,10 @@ data class Order ( } /** - * Order Status - * Values: placed,approved,delivered - */ - + * Order Status + * + * Values: placed,approved,delivered + */ enum class Status(val value: kotlin.String){ @Json(name = "placed") placed("placed"), @Json(name = "approved") approved("approved"), 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 105f485f021d..28cb9742ec20 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 @@ -1,14 +1,14 @@ /** -* 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. -*/ + * 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 @@ -16,9 +16,11 @@ import org.openapitools.client.models.Tag import com.squareup.moshi.Json import java.io.Serializable +import kotlin.collections.* /** * A pet for sale in the pet store + * * @param name * @param photoUrls * @param id @@ -27,7 +29,7 @@ import java.io.Serializable * @param status pet status in the store */ -data class Pet ( +data class Pet( @Json(name = "name") val name: kotlin.String, @Json(name = "photoUrls") @@ -38,7 +40,9 @@ data class Pet ( val category: Category? = null, @Json(name = "tags") val tags: kotlin.collections.List? = null, - /* pet status in the store */ + /** + * pet status in the store + */ @Json(name = "status") val status: Pet.Status? = null ) : Serializable { @@ -47,10 +51,10 @@ data class Pet ( } /** - * pet status in the store - * Values: available,pending,sold - */ - + * pet status in the store + * + * Values: available,pending,sold + */ enum class Status(val value: kotlin.String){ @Json(name = "available") available("available"), @Json(name = "pending") pending("pending"), 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 944b1cd0a141..2670c541fbb6 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 @@ -1,27 +1,29 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A tag for a pet + * * @param id * @param name */ -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 9697f07d5bf8..4f2256930bff 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 @@ -1,22 +1,24 @@ /** -* 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. -*/ + * 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 import java.io.Serializable +import kotlin.collections.* /** * A User who is purchasing from the pet store + * * @param id * @param username * @param firstName @@ -27,7 +29,7 @@ import java.io.Serializable * @param userStatus User Status */ -data class User ( +data class User( @Json(name = "id") val id: kotlin.Long? = null, @Json(name = "username") @@ -42,7 +44,9 @@ data class User ( val password: kotlin.String? = null, @Json(name = "phone") val phone: kotlin.String? = null, - /* User Status */ + /** + * User Status + */ @Json(name = "userStatus") val userStatus: kotlin.Int? = null ) : Serializable {