Merge remote-tracking branch 'origin/master' into 6.0.x

This commit is contained in:
William Cheng
2021-02-12 18:48:20 +08:00
750 changed files with 34048 additions and 10711 deletions

View File

@@ -2,12 +2,12 @@ group 'org.openapitools'
version '1.0.0'
wrapper {
gradleVersion = '4.9'
gradleVersion = '6.8.2'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.4.20'
repositories {
maven { url "https://repo1.maven.org/maven2" }
@@ -30,8 +30,7 @@ test {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "com.squareup.moshi:moshi-kotlin:1.9.2"
compile "com.squareup.moshi:moshi-adapters:1.9.2"
compile "com.squareup.okhttp3:okhttp:4.2.2"
testCompile "io.kotlintest:kotlintest-runner-junit5:3.1.0"
compile "com.squareup.moshi:moshi-kotlin:1.11.0"
compile "com.squareup.okhttp3:okhttp:4.9.0"
testCompile "io.kotlintest:kotlintest-runner-junit5:3.4.2"
}

View File

@@ -27,7 +27,7 @@
<version>1.2.1</version>
<executions>
<execution>
<id>bundle-test</id>
<id>bundle-install</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
@@ -35,7 +35,20 @@
<configuration>
<executable>gradle</executable>
<arguments>
<argument>test</argument>
<argument>wrapper</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>bundle-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./gradlew</executable>
<arguments>
<argument>build</argument>
</arguments>
</configuration>
</execution>

View File

@@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun addPet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = addPetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation addPet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun addPetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Deletes a pet
*
@@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deletePet
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return RequestConfig
*/
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@@ -129,21 +158,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
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,
"/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -161,6 +179,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation findPetsByTags
*
* @param tags Tags to filter by
* @return RequestConfig
*/
@Deprecated(message = "This operation is deprecated.")
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
val localVariableBody: kotlin.Any? = null
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(
method = RequestMethod.GET,
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get all pets
*
@@ -173,23 +217,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List<Pet> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
if (lastUpdated != null) {
put("lastUpdated", listOf(parseDateToQueryString(lastUpdated)))
}
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/getAll",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated)
val localVarResponse = request<kotlin.collections.List<Pet>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -207,6 +238,33 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getAllPets
*
* @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional)
* @return RequestConfig
*/
fun getAllPetsRequestConfig(lastUpdated: java.time.OffsetDateTime?) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
.apply {
if (lastUpdated != null) {
put("lastUpdated", listOf(parseDateToQueryString(lastUpdated)))
}
}
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/getAll",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find pet by ID
* Returns a single pet
@@ -219,18 +277,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getPetById(petId: kotlin.Long) : Pet {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
val localVarResponse = request<Pet>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -248,6 +298,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getPetById
*
* @param petId ID of pet to return
* @return RequestConfig
*/
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Update an existing pet
*
@@ -259,18 +331,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updatePet(body: Pet) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/pet",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -288,6 +352,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePet
*
* @param body Pet object that needs to be added to the store
* @return RequestConfig
*/
fun updatePetRequestConfig(body: Pet) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updates a pet in the store with form data
*
@@ -301,18 +387,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
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 = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -330,6 +408,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updatePetWithForm
*
* @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 RequestConfig
*/
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* uploads an image
*
@@ -344,18 +446,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
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 = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
val localVarResponse = request<ApiResponse>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -373,4 +467,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation uploadFile
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return RequestConfig
*/
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteOrder(orderId: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation deleteOrder
*
* @param orderId ID of the order that needs to be deleted
* @return RequestConfig
*/
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getInventoryRequestConfig()
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getInventory
*
* @return RequestConfig
*/
fun getInventoryRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getOrderById(orderId: kotlin.Long) : Order {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation getOrderById
*
* @param orderId ID of pet that needs to be fetched
* @return RequestConfig
*/
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Place an order for a pet
*
@@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun placeOrder(body: Order) : Order {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/store/order",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = placeOrderRequestConfig(body = body)
val localVarResponse = request<Order>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
}
}
/**
* To obtain the request config of the operation placeOrder
*
* @param body order placed for purchasing the pet
* @return RequestConfig
*/
fun placeOrderRequestConfig(body: Order) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUser(body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUserRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUser
*
* @param body Created user object
* @return RequestConfig
*/
fun createUserRequestConfig(body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Creates list of users with given input array
*
@@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.POST,
"/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation createUsersWithListInput
*
* @param body List of user object
* @return RequestConfig
*/
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Delete user
* This can only be done by the logged in user.
@@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun deleteUser(username: kotlin.String) : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.DELETE,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = deleteUserRequestConfig(username = username)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation deleteUser
*
* @param username The name that needs to be deleted
* @return RequestConfig
*/
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.DELETE,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Get user by user name
*
@@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun getUserByName(username: kotlin.String) : User {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = getUserByNameRequestConfig(username = username)
val localVarResponse = request<User>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation getUserByName
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return RequestConfig
*/
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs user into the system
*
@@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
val localVariableBody: kotlin.Any? = null
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,
"/user/login",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
val localVarResponse = request<kotlin.String>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation loginUser
*
* @param username The user name for login
* @param password The password for login in clear text
* @return RequestConfig
*/
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
val localVariableBody: kotlin.Any? = null
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(
method = RequestMethod.GET,
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Logs out current logged in user session
*
@@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun logoutUser() : Unit {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.GET,
"/user/logout",
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = logoutUserRequestConfig()
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation logoutUser
*
* @return RequestConfig
*/
fun logoutUserRequestConfig() : RequestConfig {
val localVariableBody: kotlin.Any? = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.GET,
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
/**
* Updated user
* This can only be done by the logged in user.
@@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
*/
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
fun updateUser(username: kotlin.String, body: User) : Unit {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
RequestMethod.PUT,
"/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders
)
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
val localVarResponse = request<Any?>(
localVariableConfig,
localVariableBody
localVariableConfig
)
return when (localVarResponse.responseType) {
@@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
}
}
/**
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
* @param body Updated user object
* @return RequestConfig
*/
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
val localVariableBody: kotlin.Any? = body
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
val localVariableConfig = RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
return localVariableConfig
}
}

View File

@@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
}
}
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
// take authMethod from operation
@@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
val request = when (requestConfig.method) {
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}.apply {
headers.forEach { header -> addHeader(header.key, header.value) }

View File

@@ -12,5 +12,6 @@ data class RequestConfig(
val method: RequestMethod,
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf()
val query: MutableMap<String, List<String>> = mutableMapOf(),
val body: kotlin.Any? = null
)

View File

@@ -1,14 +1,12 @@
package org.openapitools.client.infrastructure
import com.squareup.moshi.Moshi
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import java.util.Date
object Serializer {
@JvmStatic
val moshiBuilder: Moshi.Builder = Moshi.Builder()
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
.add(OffsetDateTimeAdapter())
.add(LocalDateTimeAdapter())
.add(LocalDateAdapter())