mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 09:36:13 +00:00
Merge remote-tracking branch 'origin/5.1.x' into 6.0.x
This commit is contained in:
@@ -1,278 +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.
|
||||
*
|
||||
* OpenAPI spec version: 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.*
|
||||
|
||||
class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) {
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
fun addPet(body: Pet) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey (optional, default to null)
|
||||
* @return void
|
||||
*/
|
||||
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String) : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf("api_key" to apiKey.toString())
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return kotlin.Array<Pet>
|
||||
*/
|
||||
@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 localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/findByStatus",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<kotlin.Array<Pet>>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Pet>
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param tags Tags to filter by
|
||||
* @return kotlin.Array<Pet>
|
||||
*/
|
||||
@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 localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/findByTags",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<kotlin.Array<Pet>>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Pet>
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a single pet
|
||||
* @param petId ID of pet to return
|
||||
* @return Pet
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun getPetById(petId: kotlin.Long) : Pet {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Pet>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as Pet
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
fun updatePet(body: Pet) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
"/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, default to null)
|
||||
* @param status Updated status of the pet (optional, default to null)
|
||||
* @return void
|
||||
*/
|
||||
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String, status: kotlin.String) : Unit {
|
||||
val localVariableBody: kotlin.Any? = mapOf("name" to "$name", "status" to "$status")
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf("Content-Type" to "multipart/form-data")
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param file file to upload (optional, default to null)
|
||||
* @return ApiResponse
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String, file: java.io.File) : ApiResponse {
|
||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to "$additionalMetadata", "file" to "$file")
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf("Content-Type" to "multipart/form-data")
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<ApiResponse>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as ApiResponse
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,146 +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.
|
||||
*
|
||||
* OpenAPI spec version: 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.*
|
||||
|
||||
class StoreApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) {
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational reponses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Rediration responses.")
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
* @return kotlin.collections.Map<kotlin.String, kotlin.Int>
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/store/inventory",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
* @return Order
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun getOrderById(orderId: kotlin.Long) : Order {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Order>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as Order
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return Order
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun placeOrder(body: Order) : Order {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/store/order",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Order>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as Order
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,271 +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.
|
||||
*
|
||||
* OpenAPI spec version: 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.*
|
||||
|
||||
class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) {
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
* @param body Created user object
|
||||
* @return void
|
||||
*/
|
||||
fun createUser(body: User) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
fun createUsersWithArrayInput(body: kotlin.Array<User>) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user/createWithArray",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
fun createUsersWithListInput(body: kotlin.Array<User>) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user/createWithList",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
* @param username The name that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
fun deleteUser(username: kotlin.String) : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun getUserByName(username: kotlin.String) : User {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<User>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as User
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
* @return kotlin.String
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf("username" to listOf("$username"), "password" to listOf("$password"))
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/login",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<kotlin.String>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> (response as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
fun logoutUser() : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/logout",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
* @return void
|
||||
*/
|
||||
fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mapOf()
|
||||
val localVariableHeaders: kotlin.collections.Map<kotlin.String,kotlin.String> = mapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val response = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
)
|
||||
|
||||
return when (response.responseType) {
|
||||
ResponseType.Success -> Unit
|
||||
ResponseType.Informational -> TODO()
|
||||
ResponseType.Redirection -> TODO()
|
||||
ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error")
|
||||
ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error")
|
||||
else -> throw kotlin.IllegalStateException("Undefined ResponseType.")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
typealias MultiValueMap = Map<String,List<String>>
|
||||
|
||||
fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
|
||||
"csv" -> ","
|
||||
"tsv" -> "\t"
|
||||
"pipes" -> "|"
|
||||
"ssv" -> " "
|
||||
else -> ""
|
||||
}
|
||||
|
||||
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
|
||||
|
||||
fun <T: Any?> toMultiValue(items: List<T>, collectionFormat: String, map: (item: Any?) -> String = defaultMultiValueConverter): List<String> {
|
||||
return when(collectionFormat) {
|
||||
"multi" -> items.map(map)
|
||||
else -> listOf(items.map(map).joinToString(separator = collectionDelimiter(collectionFormat)))
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.ToJson
|
||||
import okhttp3.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
open class ApiClient(val baseUrl: String) {
|
||||
companion object {
|
||||
protected const val ContentType = "Content-Type"
|
||||
protected const val Accept = "Accept"
|
||||
protected const val JsonMediaType = "application/json"
|
||||
protected const val FormDataMediaType = "multipart/form-data"
|
||||
protected const val XmlMediaType = "application/xml"
|
||||
|
||||
@JvmStatic
|
||||
val client by lazy {
|
||||
builder.build()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
val builder: OkHttpClient.Builder = OkHttpClient.Builder()
|
||||
|
||||
@JvmStatic
|
||||
var defaultHeaders: Map<String, String> by ApplicationDelegates.setOnce(mapOf(ContentType to JsonMediaType, Accept to JsonMediaType))
|
||||
|
||||
@JvmStatic
|
||||
val jsonHeaders: Map<String, String> = mapOf(ContentType to JsonMediaType, Accept to JsonMediaType)
|
||||
}
|
||||
|
||||
protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
|
||||
when {
|
||||
content is File -> RequestBody.create(
|
||||
MediaType.parse(mediaType), content
|
||||
)
|
||||
mediaType == FormDataMediaType -> {
|
||||
var builder = FormBody.Builder()
|
||||
// content's type *must* be Map<String, Any>
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(content as Map<String,String>).forEach { key, value ->
|
||||
builder = builder.add(key, value)
|
||||
}
|
||||
builder.build()
|
||||
}
|
||||
mediaType == JsonMediaType -> RequestBody.create(
|
||||
MediaType.parse(mediaType), Serializer.moshi.adapter(T::class.java).toJson(content)
|
||||
)
|
||||
mediaType == XmlMediaType -> TODO("xml not currently supported.")
|
||||
// TODO: this should be extended with other serializers
|
||||
else -> TODO("requestBody currently only supports JSON body and File body.")
|
||||
}
|
||||
|
||||
protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String = JsonMediaType): T? {
|
||||
if(body == null) return null
|
||||
return when(mediaType) {
|
||||
JsonMediaType -> Moshi.Builder().add(object {
|
||||
@ToJson
|
||||
fun toJson(uuid: UUID) = uuid.toString()
|
||||
@FromJson
|
||||
fun fromJson(s: String) = UUID.fromString(s)
|
||||
})
|
||||
.add(ByteArrayAdapter())
|
||||
.build().adapter(T::class.java).fromJson(body.source())
|
||||
else -> TODO()
|
||||
}
|
||||
}
|
||||
|
||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
|
||||
val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
|
||||
|
||||
var urlBuilder = httpUrl.newBuilder()
|
||||
.addPathSegments(requestConfig.path.trimStart('/'))
|
||||
|
||||
requestConfig.query.forEach { query ->
|
||||
query.value.forEach { queryValue ->
|
||||
urlBuilder = urlBuilder.addQueryParameter(query.key, queryValue)
|
||||
}
|
||||
}
|
||||
|
||||
val url = urlBuilder.build()
|
||||
val headers = requestConfig.headers + defaultHeaders
|
||||
|
||||
if(headers[ContentType] ?: "" == "") {
|
||||
throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
|
||||
}
|
||||
|
||||
if(headers[Accept] ?: "" == "") {
|
||||
throw kotlin.IllegalStateException("Missing Accept header. This is required.")
|
||||
}
|
||||
|
||||
// TODO: support multiple contentType,accept options here.
|
||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
||||
val accept = (headers[Accept] as String).substringBefore(";").toLowerCase()
|
||||
|
||||
var request : Request.Builder = when (requestConfig.method) {
|
||||
RequestMethod.DELETE -> Request.Builder().url(url).delete()
|
||||
RequestMethod.GET -> Request.Builder().url(url)
|
||||
RequestMethod.HEAD -> Request.Builder().url(url).head()
|
||||
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
|
||||
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
|
||||
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
|
||||
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
|
||||
}
|
||||
|
||||
headers.forEach { header -> request = request.addHeader(header.key, header.value) }
|
||||
|
||||
val realRequest = request.build()
|
||||
val response = client.newCall(realRequest).execute()
|
||||
|
||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||
when {
|
||||
response.isRedirect -> return Redirection(
|
||||
response.code(),
|
||||
response.headers().toMultimap()
|
||||
)
|
||||
response.isInformational -> return Informational(
|
||||
response.message(),
|
||||
response.code(),
|
||||
response.headers().toMultimap()
|
||||
)
|
||||
response.isSuccessful -> return Success(
|
||||
responseBody(response.body(), accept),
|
||||
response.code(),
|
||||
response.headers().toMultimap()
|
||||
)
|
||||
response.isClientError -> return ClientError(
|
||||
response.body()?.string(),
|
||||
response.code(),
|
||||
response.headers().toMultimap()
|
||||
)
|
||||
else -> return ServerError(
|
||||
null,
|
||||
response.body()?.string(),
|
||||
response.code(),
|
||||
response.headers().toMultimap()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
enum class ResponseType {
|
||||
Success, Informational, Redirection, ClientError, ServerError
|
||||
}
|
||||
|
||||
abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType) {
|
||||
abstract val statusCode: Int
|
||||
abstract val headers: Map<String,List<String>>
|
||||
}
|
||||
|
||||
class Success<T>(
|
||||
val data: T,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
): ApiInfrastructureResponse<T>(ResponseType.Success)
|
||||
|
||||
class Informational<T>(
|
||||
val statusText: String,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.Informational)
|
||||
|
||||
class Redirection<T>(
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
|
||||
|
||||
class ClientError<T>(
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
|
||||
|
||||
class ServerError<T>(
|
||||
val message: String? = null,
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>>
|
||||
): ApiInfrastructureResponse<T>(ResponseType.ServerError)
|
||||
@@ -1,29 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
object ApplicationDelegates {
|
||||
/**
|
||||
* Provides a property delegate, allowing the property to be set once and only once.
|
||||
*
|
||||
* If unset (no default value), a get on the property will throw [IllegalStateException].
|
||||
*/
|
||||
fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
|
||||
|
||||
private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
|
||||
private var isSet = false
|
||||
private var value: T? = defaultValue
|
||||
|
||||
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
||||
return value ?: throw IllegalStateException("${property.name} not initialized")
|
||||
}
|
||||
|
||||
override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
|
||||
if (!isSet) {
|
||||
this.value = value
|
||||
isSet = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
|
||||
class ByteArrayAdapter {
|
||||
@ToJson
|
||||
fun toJson(data: ByteArray): String = String(data)
|
||||
|
||||
@FromJson
|
||||
fun fromJson(data: String): ByteArray = data.toByteArray()
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
@file:Suppress("unused")
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import java.lang.RuntimeException
|
||||
|
||||
open class ClientException : RuntimeException {
|
||||
|
||||
/**
|
||||
* Constructs an [ClientException] with no detail message.
|
||||
*/
|
||||
constructor() : super()
|
||||
|
||||
/**
|
||||
* Constructs an [ClientException] with the specified detail message.
|
||||
|
||||
* @param message the detail message.
|
||||
*/
|
||||
constructor(message: kotlin.String) : super(message)
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123L
|
||||
}
|
||||
}
|
||||
|
||||
open class ServerException : RuntimeException {
|
||||
|
||||
/**
|
||||
* Constructs an [ServerException] with no detail message.
|
||||
*/
|
||||
constructor() : super()
|
||||
|
||||
/**
|
||||
* Constructs an [ServerException] with the specified detail message.
|
||||
|
||||
* @param message the detail message.
|
||||
*/
|
||||
constructor(message: kotlin.String) : super(message)
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 456L
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
/**
|
||||
* Defines a config object for a given request.
|
||||
* NOTE: This object doesn't include 'body' because it
|
||||
* allows for caching of the constructed object
|
||||
* for many request definitions.
|
||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||
* multi-valued headers as csv-only.
|
||||
*/
|
||||
data class RequestConfig(
|
||||
val method: RequestMethod,
|
||||
val path: String,
|
||||
val headers: Map<String, String> = mapOf(),
|
||||
val query: Map<String, List<String>> = mapOf()
|
||||
)
|
||||
@@ -1,8 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
/**
|
||||
* Provides enumerated HTTP verbs
|
||||
*/
|
||||
enum class RequestMethod {
|
||||
GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import okhttp3.Response
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 1xx code
|
||||
*/
|
||||
val Response.isInformational : Boolean get() = this.code() in 100..199
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 3xx code
|
||||
*/
|
||||
val Response.isRedirect : Boolean get() = this.code() in 300..399
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 4xx code
|
||||
*/
|
||||
val Response.isClientError : Boolean get() = this.code() in 400..499
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
|
||||
*/
|
||||
val Response.isServerError : Boolean get() = this.code() in 500..999
|
||||
@@ -1,14 +0,0 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.KotlinJsonAdapterFactory
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.Rfc3339DateJsonAdapter
|
||||
import java.util.*
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshi: Moshi = Moshi.Builder()
|
||||
.add(KotlinJsonAdapterFactory())
|
||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||
.build()
|
||||
}
|
||||
@@ -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.
|
||||
*
|
||||
* OpenAPI spec version: 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
|
||||
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
* @param code
|
||||
* @param type
|
||||
* @param message
|
||||
*/
|
||||
data class ApiResponse (
|
||||
val code: kotlin.Int? = null,
|
||||
val type: kotlin.String? = null,
|
||||
val message: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +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.
|
||||
*
|
||||
* OpenAPI spec version: 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
|
||||
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
data class Category (
|
||||
val id: kotlin.Long? = null,
|
||||
val name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,50 +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.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
* @param id
|
||||
* @param petId
|
||||
* @param quantity
|
||||
* @param shipDate
|
||||
* @param status Order Status
|
||||
* @param complete
|
||||
*/
|
||||
data class Order (
|
||||
val id: kotlin.Long? = null,
|
||||
val petId: kotlin.Long? = null,
|
||||
val quantity: kotlin.Int? = null,
|
||||
val shipDate: java.time.LocalDateTime? = null,
|
||||
/* Order Status */
|
||||
val status: Order.Status? = null,
|
||||
val complete: kotlin.Boolean? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
* Values: placed,approved,delivered
|
||||
*/
|
||||
enum class Status(val value: kotlin.String){
|
||||
|
||||
@Json(name = "placed") placed("placed"),
|
||||
|
||||
@Json(name = "approved") approved("approved"),
|
||||
|
||||
@Json(name = "delivered") delivered("delivered");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,52 +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.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
import org.openapitools.client.models.Category
|
||||
import org.openapitools.client.models.Tag
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
* @param id
|
||||
* @param category
|
||||
* @param name
|
||||
* @param photoUrls
|
||||
* @param tags
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
data class Pet (
|
||||
val name: kotlin.String,
|
||||
val photoUrls: kotlin.Array<kotlin.String>,
|
||||
val id: kotlin.Long? = null,
|
||||
val category: Category? = null,
|
||||
val tags: kotlin.Array<Tag>? = null,
|
||||
/* pet status in the store */
|
||||
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"),
|
||||
|
||||
@Json(name = "pending") pending("pending"),
|
||||
|
||||
@Json(name = "sold") sold("sold");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +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.
|
||||
*
|
||||
* OpenAPI spec version: 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
|
||||
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
data class Tag (
|
||||
val id: kotlin.Long? = null,
|
||||
val name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,39 +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.
|
||||
*
|
||||
* OpenAPI spec version: 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
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
data class User (
|
||||
val id: kotlin.Long? = null,
|
||||
val username: kotlin.String? = null,
|
||||
val firstName: kotlin.String? = null,
|
||||
val lastName: kotlin.String? = null,
|
||||
val email: kotlin.String? = null,
|
||||
val password: kotlin.String? = null,
|
||||
val phone: kotlin.String? = null,
|
||||
/* User Status */
|
||||
val userStatus: kotlin.Int? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user