forked from loafle/openapi-generator-original
sync master, update doc
This commit is contained in:
@@ -33,10 +33,14 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun addPet(body: Pet) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
@@ -64,10 +68,14 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey (optional)
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -94,11 +102,18 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return kotlin.Array<Pet>
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -125,11 +140,18 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param tags Tags to filter by
|
||||
* @return kotlin.Array<Pet>
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -156,11 +178,15 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
* Returns a single pet
|
||||
* @param petId ID of pet to return
|
||||
* @return Pet
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -187,10 +213,14 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun updatePet(body: Pet) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
@@ -219,10 +249,14 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
* @param name Updated name of the pet (optional)
|
||||
* @param status Updated status of the pet (optional)
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@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 = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "")
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
@@ -251,11 +285,15 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
||||
* @param additionalMetadata Additional data to pass to server (optional)
|
||||
* @param file file to upload (optional)
|
||||
* @return ApiResponse
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@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 = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "")
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
|
||||
@@ -32,10 +32,14 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiC
|
||||
* 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
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -61,11 +65,15 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiC
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
* @return kotlin.collections.Map<kotlin.String, kotlin.Int>
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@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 = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
@@ -92,11 +100,15 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiC
|
||||
* 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
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -123,11 +135,15 @@ class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiC
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return Order
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun placeOrder(body: Order) : Order {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
|
||||
@@ -32,10 +32,14 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
* This can only be done by the logged in user.
|
||||
* @param body Created user object
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun createUser(body: User) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
@@ -62,10 +66,14 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun createUsersWithArrayInput(body: kotlin.Array<User>) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
@@ -92,10 +100,14 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun createUsersWithListInput(body: kotlin.Array<User>) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
@@ -122,10 +134,14 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
* This can only be done by the logged in user.
|
||||
* @param username The name that needs to be deleted
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -152,11 +168,15 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -184,11 +204,19 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
* @return kotlin.String
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@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 = 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,
|
||||
@@ -214,10 +242,14 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
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,
|
||||
@@ -245,10 +277,14 @@ class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCl
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
* @return void
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
typealias MultiValueMap = Map<String,List<String>>
|
||||
typealias MultiValueMap = MutableMap<String,List<String>>
|
||||
|
||||
fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
|
||||
"csv" -> ","
|
||||
"tsv" -> "\t"
|
||||
"pipes" -> "|"
|
||||
"ssv" -> " "
|
||||
"pipe" -> "|"
|
||||
"space" -> " "
|
||||
else -> ""
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,9 @@ open class ApiClient(val baseUrl: String) {
|
||||
}
|
||||
}
|
||||
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
|
||||
requestConfig.headers[Authorization] = "Bearer " + accessToken
|
||||
accessToken?.let { accessToken ->
|
||||
requestConfig.headers[Authorization] = "Bearer " + accessToken
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
)
|
||||
Reference in New Issue
Block a user