Kotlin multiplatform auth (#4284)

* Includes support for the Javascript platform

* Fixes enum serialization with non-string values

* Updates to expose api dependencies to consumers

* Uses explicit class name for Kotlin collection classes

* Maps unknown object type to Kotlin String

The Kotlinx serialization library uses reflectionless serialization and
requires compile-time serialization declarations. As a result, unknown
objects are mapped to Kotlin String instances to enable compilation
where object types are not explicitly defined.

* Improves support for binary objects

Previously, objects that contained binary data were assigned the
InputProvider data type. This was suitable for a binary input form
parameter, but unsuitable for Base64 or octet binary strings. These
binary strings are now assigned a more suitable object.

* Includes Kotlin Multiplatform auth classes

Includes support for:
- api key
- http basic
- http bearer
- oauth (partial support)

https://github.com/OpenAPITools/openapi-generator/issues/4283

* Updates Kotlin samples
This commit is contained in:
Andrew Emery
2019-10-28 19:03:49 +11:00
committed by William Cheng
parent 0f2272d9a4
commit d92d84bb12
154 changed files with 1858 additions and 533 deletions

View File

@@ -36,7 +36,7 @@ class AnotherFakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2
@Suppress("UNCHECKED_CAST")
fun call123testSpecialTags(client: Client) : Client {
val localVariableBody: kotlin.Any? = client
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PATCH,

View File

@@ -35,7 +35,7 @@ class DefaultApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") :
@Suppress("UNCHECKED_CAST")
fun fooGet() : InlineResponseDefault {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,

View File

@@ -39,7 +39,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun fakeHealthGet() : HealthCheckResult {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -70,7 +70,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun fakeOuterBooleanSerialize(body: kotlin.Boolean?) : kotlin.Boolean {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -101,7 +101,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun fakeOuterCompositeSerialize(outerComposite: OuterComposite?) : OuterComposite {
val localVariableBody: kotlin.Any? = outerComposite
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -132,7 +132,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun fakeOuterNumberSerialize(body: java.math.BigDecimal?) : java.math.BigDecimal {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -163,7 +163,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun fakeOuterStringSerialize(body: kotlin.String?) : kotlin.String {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -193,7 +193,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass) : Unit {
val localVariableBody: kotlin.Any? = fileSchemaTestClass
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
@@ -224,7 +224,10 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testBodyWithQueryParams(query: kotlin.String, user: User) : Unit {
val localVariableBody: kotlin.Any? = user
val localVariableQuery: MultiValueMap = mapOf("query" to listOf("$query"))
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("query", listOf(query.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
@@ -255,7 +258,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun testClientModel(client: Client) : Client {
val localVariableBody: kotlin.Any? = client
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PATCH,
@@ -298,7 +301,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testEndpointParameters(number: java.math.BigDecimal, double: kotlin.Double, patternWithoutDelimiter: kotlin.String, byte: kotlin.ByteArray, integer: kotlin.Int?, int32: kotlin.Int?, int64: kotlin.Long?, float: kotlin.Float?, string: kotlin.String?, binary: java.io.File?, date: java.time.LocalDate?, dateTime: java.time.LocalDateTime?, password: kotlin.String?, paramCallback: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("integer" to "$integer", "int32" to "$int32", "int64" to "$int64", "number" to "$number", "float" to "$float", "double" to "$double", "string" to "$string", "pattern_without_delimiter" to "$patternWithoutDelimiter", "byte" to "$byte", "binary" to "$binary", "date" to "$date", "dateTime" to "$dateTime", "password" to "$password", "callback" to "$paramCallback")
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -335,7 +338,21 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testEnumParameters(enumHeaderStringArray: kotlin.Array<kotlin.String>?, enumHeaderString: kotlin.String?, enumQueryStringArray: kotlin.Array<kotlin.String>?, enumQueryString: kotlin.String?, enumQueryInteger: kotlin.Int?, enumQueryDouble: kotlin.Double?, enumFormStringArray: kotlin.Array<kotlin.String>?, enumFormString: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("enum_form_string_array" to "$enumFormStringArray", "enum_form_string" to "$enumFormString")
val localVariableQuery: MultiValueMap = mapOf("enumQueryStringArray" to toMultiValue(enumQueryStringArray.toList(), "multi"), "enumQueryString" to listOf("$enumQueryString"), "enumQueryInteger" to listOf("$enumQueryInteger"), "enumQueryDouble" to listOf("$enumQueryDouble"))
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
if (enumQueryStringArray != null) {
put("enumQueryStringArray", toMultiValue(enumQueryStringArray.toList(), "multi"))
}
if (enumQueryString != null) {
put("enumQueryString", listOf(enumQueryString.toString()))
}
if (enumQueryInteger != null) {
put("enumQueryInteger", listOf(enumQueryInteger.toString()))
}
if (enumQueryDouble != null) {
put("enumQueryDouble", listOf(enumQueryDouble.toString()))
}
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "", "enum_header_string_array" to enumHeaderStringArray.joinToString(separator = collectionDelimiter("csv")), "enum_header_string" to enumHeaderString.toString())
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -370,7 +387,17 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testGroupParameters(requiredStringGroup: kotlin.Int, requiredBooleanGroup: kotlin.Boolean, requiredInt64Group: kotlin.Long, stringGroup: kotlin.Int?, booleanGroup: kotlin.Boolean?, int64Group: kotlin.Long?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf("requiredStringGroup" to listOf("$requiredStringGroup"), "requiredInt64Group" to listOf("$requiredInt64Group"), "stringGroup" to listOf("$stringGroup"), "int64Group" to listOf("$int64Group"))
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("requiredStringGroup", listOf(requiredStringGroup.toString()))
put("requiredInt64Group", listOf(requiredInt64Group.toString()))
if (stringGroup != null) {
put("stringGroup", listOf(stringGroup.toString()))
}
if (int64Group != null) {
put("int64Group", listOf(int64Group.toString()))
}
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("required_boolean_group" to requiredBooleanGroup.toString(), "boolean_group" to booleanGroup.toString())
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
@@ -400,7 +427,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testInlineAdditionalProperties(requestBody: kotlin.collections.Map<kotlin.String, kotlin.String>) : Unit {
val localVariableBody: kotlin.Any? = requestBody
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -431,7 +458,7 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testJsonFormData(param: kotlin.String, param2: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = mapOf("param" to "$param", "param2" to "$param2")
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "")
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -465,7 +492,14 @@ class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun testQueryParameterCollectionFormat(pipe: kotlin.Array<kotlin.String>, ioutil: kotlin.Array<kotlin.String>, http: kotlin.Array<kotlin.String>, url: kotlin.Array<kotlin.String>, context: kotlin.Array<kotlin.String>) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf("pipe" to toMultiValue(pipe.toList(), "multi"), "ioutil" to toMultiValue(ioutil.toList(), "csv"), "http" to toMultiValue(http.toList(), "space"), "url" to toMultiValue(url.toList(), "csv"), "context" to toMultiValue(context.toList(), "multi"))
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("pipe", toMultiValue(pipe.toList(), "multi"))
put("ioutil", toMultiValue(ioutil.toList(), "csv"))
put("http", toMultiValue(http.toList(), "space"))
put("url", toMultiValue(url.toList(), "csv"))
put("context", toMultiValue(context.toList(), "multi"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,

View File

@@ -36,7 +36,7 @@ class FakeClassnameTags123Api(basePath: kotlin.String = "http://petstore.swagger
@Suppress("UNCHECKED_CAST")
fun testClassname(client: Client) : Client {
val localVariableBody: kotlin.Any? = client
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PATCH,

View File

@@ -36,7 +36,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
*/
fun addPet(pet: Pet) : Unit {
val localVariableBody: kotlin.Any? = pet
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -67,7 +67,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
*/
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("api_key" to apiKey.toString())
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
@@ -98,7 +98,10 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
@Suppress("UNCHECKED_CAST")
fun findPetsByStatus(status: kotlin.Array<kotlin.String>) : kotlin.Array<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf("status" to toMultiValue(status.toList(), "csv"))
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("status", toMultiValue(status.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -129,7 +132,10 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
@Suppress("UNCHECKED_CAST")
fun findPetsByTags(tags: kotlin.Array<kotlin.String>) : kotlin.Array<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf("tags" to toMultiValue(tags.toList(), "csv"))
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("tags", toMultiValue(tags.toList(), "csv"))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -160,7 +166,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
@Suppress("UNCHECKED_CAST")
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -190,7 +196,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
*/
fun updatePet(pet: Pet) : Unit {
val localVariableBody: kotlin.Any? = pet
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
@@ -222,7 +228,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
*/
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = mapOf("name" to "$name", "status" to "$status")
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -255,7 +261,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
@Suppress("UNCHECKED_CAST")
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to "$additionalMetadata", "file" to "$file")
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -288,7 +294,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Api
@Suppress("UNCHECKED_CAST")
fun uploadFileWithRequiredFile(petId: kotlin.Long, requiredFile: java.io.File, additionalMetadata: kotlin.String?) : ApiResponse {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to "$additionalMetadata", "requiredFile" to "$requiredFile")
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "")
val localVariableConfig = RequestConfig(
RequestMethod.POST,

View File

@@ -35,7 +35,7 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
*/
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
@@ -65,7 +65,7 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
@Suppress("UNCHECKED_CAST")
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -96,7 +96,7 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
@Suppress("UNCHECKED_CAST")
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -127,7 +127,7 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : A
@Suppress("UNCHECKED_CAST")
fun placeOrder(order: Order) : Order {
val localVariableBody: kotlin.Any? = order
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,

View File

@@ -35,7 +35,7 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun createUser(user: User) : Unit {
val localVariableBody: kotlin.Any? = user
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -65,7 +65,7 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun createUsersWithArrayInput(user: kotlin.Array<User>) : Unit {
val localVariableBody: kotlin.Any? = user
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -95,7 +95,7 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun createUsersWithListInput(user: kotlin.Array<User>) : Unit {
val localVariableBody: kotlin.Any? = user
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
@@ -125,7 +125,7 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
@@ -156,7 +156,7 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -188,7 +188,11 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
@Suppress("UNCHECKED_CAST")
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf("username" to listOf("$username"), "password" to listOf("$password"))
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
put("username", listOf(username.toString()))
put("password", listOf(password.toString()))
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -217,7 +221,7 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
@@ -248,7 +252,7 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : Ap
*/
fun updateUser(username: kotlin.String, user: User) : Unit {
val localVariableBody: kotlin.Any? = user
val localVariableQuery: MultiValueMap = mapOf()
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,

View File

@@ -1,6 +1,6 @@
package org.openapitools.client.infrastructure
typealias MultiValueMap = Map<String,List<String>>
typealias MultiValueMap = MutableMap<String,List<String>>
fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
"csv" -> ","

View File

@@ -92,13 +92,21 @@ open class ApiClient(val baseUrl: String) {
}
}
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
requestConfig.headers[Authorization] = "Bearer " + accessToken
accessToken?.let { accessToken ->
requestConfig.headers[Authorization] = "Bearer " + accessToken
}
}
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
requestConfig.headers[Authorization] = Credentials.basic(username, password)
username?.let { username ->
password?.let { password ->
requestConfig.headers[Authorization] = Credentials.basic(username, password)
}
}
}
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
requestConfig.headers[Authorization] = "Bearer " + accessToken
accessToken?.let { accessToken ->
requestConfig.headers[Authorization] = "Bearer " + accessToken
}
}
}

View File

@@ -12,5 +12,5 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: Map<String, List<String>> = mapOf()
val query: MutableMap<String, List<String>> = mutableMapOf()
)

View File

@@ -20,7 +20,7 @@ import java.io.Serializable
*/
data class SpecialModelname (
@Json(name = "$special[property.name]")
@Json(name = "\$special[property.name]")
val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null
)
: Serializable