kotlin-server: Add support for Javalin (#17596)

* kotlin-server: Add support for Javalin

* kotlin-server: Add Javalin generated sample code

* Add output from build scripts

* Address MR feedback

* Update CI to include new Javalin sample
This commit is contained in:
Dennis Ameling
2024-01-15 13:22:20 +01:00
committed by GitHub
parent 36e4e4f316
commit 13edc5d494
44 changed files with 1362 additions and 45 deletions

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,20 @@
README.md
build.gradle.kts
gradle.properties
settings.gradle
src/main/kotlin/org/openapitools/server/Main.kt
src/main/kotlin/org/openapitools/server/apis/PetApi.kt
src/main/kotlin/org/openapitools/server/apis/PetApiService.kt
src/main/kotlin/org/openapitools/server/apis/PetApiServiceImpl.kt
src/main/kotlin/org/openapitools/server/apis/StoreApi.kt
src/main/kotlin/org/openapitools/server/apis/StoreApiService.kt
src/main/kotlin/org/openapitools/server/apis/StoreApiServiceImpl.kt
src/main/kotlin/org/openapitools/server/apis/UserApi.kt
src/main/kotlin/org/openapitools/server/apis/UserApiService.kt
src/main/kotlin/org/openapitools/server/apis/UserApiServiceImpl.kt
src/main/kotlin/org/openapitools/server/models/Category.kt
src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt
src/main/kotlin/org/openapitools/server/models/Order.kt
src/main/kotlin/org/openapitools/server/models/Pet.kt
src/main/kotlin/org/openapitools/server/models/Tag.kt
src/main/kotlin/org/openapitools/server/models/User.kt

View File

@@ -0,0 +1 @@
7.3.0-SNAPSHOT

View File

@@ -0,0 +1,101 @@
# org.openapitools.server - Kotlin Server library for 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.
Generated by OpenAPI Generator 7.3.0-SNAPSHOT.
## Build
First, create the gradle wrapper script:
```
gradle wrapper
```
Then, run:
```
./gradlew check assemble
```
This runs all tests and packages the library.
## Running
The server builds as a fat jar with a main entrypoint. To start the service, run `java -jar ./build/libs/kotlin-server.jar`.
You may also run in docker:
```
docker build -t kotlin-server .
docker run -p 8080:8080 kotlin-server
```
## Features/Implementation Notes
* Supports JSON inputs/outputs, File inputs, and Form inputs (see ktor documentation for more info).
* ~Supports collection formats for query parameters: csv, tsv, ssv, pipes.~
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
<a id="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a id="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.server.models.Category](docs/Category.md)
- [org.openapitools.server.models.ModelApiResponse](docs/ModelApiResponse.md)
- [org.openapitools.server.models.Order](docs/Order.md)
- [org.openapitools.server.models.Pet](docs/Pet.md)
- [org.openapitools.server.models.Tag](docs/Tag.md)
- [org.openapitools.server.models.User](docs/User.md)
<a id="documentation-for-authorization"></a>
## Documentation for Authorization
Authentication schemes defined for the API:
<a id="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets
<a id="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

View File

@@ -0,0 +1,35 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.9.21"
}
group = "org.openapitools"
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
dependencies {
implementation("io.javalin:javalin:5.6.3")
implementation("io.javalin.community.routing:routing-core:5.6.2-RC.1")
implementation("io.javalin.community.routing:routing-dsl:5.6.2-RC.1")
implementation("com.fasterxml.jackson.core:jackson-databind:2.16.1")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.16.1")
implementation("org.slf4j:slf4j-simple:2.0.7")
testImplementation("org.jetbrains.kotlin:kotlin-test")
}
tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(17)
}

View File

@@ -0,0 +1 @@
org.gradle.caching=true

View File

@@ -0,0 +1 @@
rootProject.name = 'kotlin-server'

View File

@@ -0,0 +1,48 @@
package org.openapitools.server
import io.javalin.Javalin
import io.javalin.community.routing.dsl.routing
import org.openapitools.server.apis.PetApi
import org.openapitools.server.apis.PetApiServiceImpl
import org.openapitools.server.apis.StoreApi
import org.openapitools.server.apis.StoreApiServiceImpl
import org.openapitools.server.apis.UserApi
import org.openapitools.server.apis.UserApiServiceImpl
fun main() {
val PetApi = PetApi(PetApiServiceImpl())
val StoreApi = StoreApi(StoreApiServiceImpl())
val UserApi = UserApi(UserApiServiceImpl())
val app = Javalin
.create { config ->
config.routing {
post("/pet", PetApi::addPet)
delete("/pet/{petId}", PetApi::deletePet)
get("/pet/findByStatus", PetApi::findPetsByStatus)
get("/pet/findByTags", PetApi::findPetsByTags)
get("/pet/{petId}", PetApi::getPetById)
put("/pet", PetApi::updatePet)
post("/pet/{petId}", PetApi::updatePetWithForm)
post("/pet/{petId}/uploadImage", PetApi::uploadFile)
delete("/store/order/{orderId}", StoreApi::deleteOrder)
get("/store/inventory", StoreApi::getInventory)
get("/store/order/{orderId}", StoreApi::getOrderById)
post("/store/order", StoreApi::placeOrder)
post("/user", UserApi::createUser)
post("/user/createWithArray", UserApi::createUsersWithArrayInput)
post("/user/createWithList", UserApi::createUsersWithListInput)
delete("/user/{username}", UserApi::deleteUser)
get("/user/{username}", UserApi::getUserByName)
get("/user/login", UserApi::loginUser)
get("/user/logout", UserApi::logoutUser)
put("/user/{username}", UserApi::updateUser)
}
}
app.start()
}

View File

@@ -0,0 +1,89 @@
package org.openapitools.server.apis
import io.javalin.http.Context
import io.javalin.http.bodyAsClass
import io.javalin.http.pathParamAsClass
import io.javalin.http.queryParamAsClass
import org.openapitools.server.models.ModelApiResponse
import org.openapitools.server.models.Pet
class PetApi(private val service: PetApiService) {
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store
*/
fun addPet(ctx: Context) {
ctx.status(200).json(service.addPet(ctx.bodyAsClass<Pet>()))
}
/**
* Deletes a pet
*
* @param petId Pet id to delete
* @param apiKey (optional)
*/
fun deletePet(ctx: Context) {
ctx.status(200).json(service.deletePet(ctx.pathParamAsClass<kotlin.Long>("petId").get(), ctx.header("api_key")))
}
/**
* 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
*/
fun findPetsByStatus(ctx: Context) {
ctx.status(200).json(service.findPetsByStatus(ctx.queryParams("status")))
}
/**
* 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
*/
fun findPetsByTags(ctx: Context) {
ctx.status(200).json(service.findPetsByTags(ctx.queryParams("tags")))
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
*/
fun getPetById(ctx: Context) {
ctx.status(200).json(service.getPetById(ctx.pathParamAsClass<kotlin.Long>("petId").get()))
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store
*/
fun updatePet(ctx: Context) {
ctx.status(200).json(service.updatePet(ctx.bodyAsClass<Pet>()))
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
*/
fun updatePetWithForm(ctx: Context) {
ctx.status(200).json(service.updatePetWithForm(ctx.pathParamAsClass<kotlin.Long>("petId").get(), ctx.formParam("name"), ctx.formParam("status")))
}
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
*/
fun uploadFile(ctx: Context) {
ctx.status(200).json(service.uploadFile(ctx.pathParamAsClass<kotlin.Long>("petId").get(), ctx.formParam("additionalMetadata"), ctx.uploadedFile("file")))
}
}

View File

@@ -0,0 +1,103 @@
package org.openapitools.server.apis
import org.openapitools.server.models.ModelApiResponse
import org.openapitools.server.models.Pet
interface PetApiService {
/**
* POST /pet : Add a new pet to the store
*
*
* @param pet Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid input (status code 405)
* @see PetApi#addPet
*/
fun addPet(pet: Pet): Pet
/**
* DELETE /pet/{petId} : Deletes a pet
*
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @return Invalid pet value (status code 400)
* @see PetApi#deletePet
*/
fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit
/**
* GET /pet/findByStatus : 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 (required)
* @return successful operation (status code 200)
* or Invalid status value (status code 400)
* @see PetApi#findPetsByStatus
*/
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): List<Pet>
/**
* GET /pet/findByTags : 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 (required)
* @return successful operation (status code 200)
* or Invalid tag value (status code 400)
* @deprecated
* @see PetApi#findPetsByTags
*/
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>
/**
* GET /pet/{petId} : Find pet by ID
* Returns a single pet
*
* @param petId ID of pet to return (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Pet not found (status code 404)
* @see PetApi#getPetById
*/
fun getPetById(petId: kotlin.Long): Pet
/**
* PUT /pet : Update an existing pet
*
*
* @param pet Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Pet not found (status code 404)
* or Validation exception (status code 405)
* API documentation for the updatePet operation
* @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a>
* @see PetApi#updatePet
*/
fun updatePet(pet: Pet): Pet
/**
* POST /pet/{petId} : Updates a pet in the store with form data
*
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return Invalid input (status code 405)
* @see PetApi#updatePetWithForm
*/
fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit
/**
* POST /pet/{petId}/uploadImage : uploads an image
*
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return successful operation (status code 200)
* @see PetApi#uploadFile
*/
fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.javalin.http.UploadedFile?): ModelApiResponse
}

View File

@@ -0,0 +1,39 @@
package org.openapitools.server.apis
import org.openapitools.server.models.ModelApiResponse
import org.openapitools.server.models.Pet
class PetApiServiceImpl : PetApiService {
override fun addPet(pet: Pet): Pet {
TODO("Implement me")
}
override fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit {
TODO("Implement me")
}
override fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): List<Pet> {
TODO("Implement me")
}
override fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet> {
TODO("Implement me")
}
override fun getPetById(petId: kotlin.Long): Pet {
TODO("Implement me")
}
override fun updatePet(pet: Pet): Pet {
TODO("Implement me")
}
override fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit {
TODO("Implement me")
}
override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.javalin.http.UploadedFile?): ModelApiResponse {
TODO("Implement me")
}
}

View File

@@ -0,0 +1,46 @@
package org.openapitools.server.apis
import io.javalin.http.Context
import io.javalin.http.bodyAsClass
import io.javalin.http.pathParamAsClass
import io.javalin.http.queryParamAsClass
import org.openapitools.server.models.Order
class StoreApi(private val service: StoreApiService) {
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
*/
fun deleteOrder(ctx: Context) {
ctx.status(200).json(service.deleteOrder(ctx.pathParamAsClass<kotlin.String>("orderId").get()))
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
*/
fun getInventory(ctx: Context) {
ctx.status(200).json(service.getInventory())
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched
*/
fun getOrderById(ctx: Context) {
ctx.status(200).json(service.getOrderById(ctx.pathParamAsClass<kotlin.Long>("orderId").get()))
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet
*/
fun placeOrder(ctx: Context) {
ctx.status(200).json(service.placeOrder(ctx.bodyAsClass<Order>()))
}
}

View File

@@ -0,0 +1,49 @@
package org.openapitools.server.apis
import org.openapitools.server.models.Order
interface StoreApiService {
/**
* DELETE /store/order/{orderId} : Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
* @param orderId ID of the order that needs to be deleted (required)
* @return Invalid ID supplied (status code 400)
* or Order not found (status code 404)
* @see StoreApi#deleteOrder
*/
fun deleteOrder(orderId: kotlin.String): Unit
/**
* GET /store/inventory : Returns pet inventories by status
* Returns a map of status codes to quantities
*
* @return successful operation (status code 200)
* @see StoreApi#getInventory
*/
fun getInventory(): Map<String, kotlin.Int>
/**
* GET /store/order/{orderId} : Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
*
* @param orderId ID of pet that needs to be fetched (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Order not found (status code 404)
* @see StoreApi#getOrderById
*/
fun getOrderById(orderId: kotlin.Long): Order
/**
* POST /store/order : Place an order for a pet
*
*
* @param order order placed for purchasing the pet (required)
* @return successful operation (status code 200)
* or Invalid Order (status code 400)
* @see StoreApi#placeOrder
*/
fun placeOrder(order: Order): Order
}

View File

@@ -0,0 +1,22 @@
package org.openapitools.server.apis
import org.openapitools.server.models.Order
class StoreApiServiceImpl : StoreApiService {
override fun deleteOrder(orderId: kotlin.String): Unit {
TODO("Implement me")
}
override fun getInventory(): Map<String, kotlin.Int> {
TODO("Implement me")
}
override fun getOrderById(orderId: kotlin.Long): Order {
TODO("Implement me")
}
override fun placeOrder(order: Order): Order {
TODO("Implement me")
}
}

View File

@@ -0,0 +1,84 @@
package org.openapitools.server.apis
import io.javalin.http.Context
import io.javalin.http.bodyAsClass
import io.javalin.http.pathParamAsClass
import io.javalin.http.queryParamAsClass
import org.openapitools.server.models.User
class UserApi(private val service: UserApiService) {
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object
*/
fun createUser(ctx: Context) {
ctx.status(200).json(service.createUser(ctx.bodyAsClass<User>()))
}
/**
* Creates list of users with given input array
*
* @param user List of user object
*/
fun createUsersWithArrayInput(ctx: Context) {
ctx.status(200).json(service.createUsersWithArrayInput(ctx.bodyAsClass<List<User>>()))
}
/**
* Creates list of users with given input array
*
* @param user List of user object
*/
fun createUsersWithListInput(ctx: Context) {
ctx.status(200).json(service.createUsersWithListInput(ctx.bodyAsClass<List<User>>()))
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
*/
fun deleteUser(ctx: Context) {
ctx.status(200).json(service.deleteUser(ctx.pathParamAsClass<kotlin.String>("username").get()))
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
*/
fun getUserByName(ctx: Context) {
ctx.status(200).json(service.getUserByName(ctx.pathParamAsClass<kotlin.String>("username").get()))
}
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
*/
fun loginUser(ctx: Context) {
ctx.status(200).json(service.loginUser(ctx.queryParamAsClass<String>("username").get(), ctx.queryParamAsClass<String>("password").get()))
}
/**
* Logs out current logged in user session
*
*/
fun logoutUser(ctx: Context) {
ctx.status(200).json(service.logoutUser())
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param user Updated user object
*/
fun updateUser(ctx: Context) {
ctx.status(200).json(service.updateUser(ctx.pathParamAsClass<kotlin.String>("username").get(), ctx.bodyAsClass<User>()))
}
}

View File

@@ -0,0 +1,92 @@
package org.openapitools.server.apis
import org.openapitools.server.models.User
interface UserApiService {
/**
* POST /user : Create user
* This can only be done by the logged in user.
*
* @param user Created user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUser
*/
fun createUser(user: User): Unit
/**
* POST /user/createWithArray : Creates list of users with given input array
*
*
* @param user List of user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUsersWithArrayInput
*/
fun createUsersWithArrayInput(user: kotlin.collections.List<User>): Unit
/**
* POST /user/createWithList : Creates list of users with given input array
*
*
* @param user List of user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUsersWithListInput
*/
fun createUsersWithListInput(user: kotlin.collections.List<User>): Unit
/**
* DELETE /user/{username} : Delete user
* This can only be done by the logged in user.
*
* @param username The name that needs to be deleted (required)
* @return Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#deleteUser
*/
fun deleteUser(username: kotlin.String): Unit
/**
* GET /user/{username} : Get user by user name
*
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return successful operation (status code 200)
* or Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#getUserByName
*/
fun getUserByName(username: kotlin.String): User
/**
* GET /user/login : Logs user into the system
*
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return successful operation (status code 200)
* or Invalid username/password supplied (status code 400)
* @see UserApi#loginUser
*/
fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String
/**
* GET /user/logout : Logs out current logged in user session
*
*
* @return successful operation (status code 200)
* @see UserApi#logoutUser
*/
fun logoutUser(): Unit
/**
* PUT /user/{username} : Updated user
* This can only be done by the logged in user.
*
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @return Invalid user supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#updateUser
*/
fun updateUser(username: kotlin.String, user: User): Unit
}

View File

@@ -0,0 +1,38 @@
package org.openapitools.server.apis
import org.openapitools.server.models.User
class UserApiServiceImpl : UserApiService {
override fun createUser(user: User): Unit {
TODO("Implement me")
}
override fun createUsersWithArrayInput(user: kotlin.collections.List<User>): Unit {
TODO("Implement me")
}
override fun createUsersWithListInput(user: kotlin.collections.List<User>): Unit {
TODO("Implement me")
}
override fun deleteUser(username: kotlin.String): Unit {
TODO("Implement me")
}
override fun getUserByName(username: kotlin.String): User {
TODO("Implement me")
}
override fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String {
TODO("Implement me")
}
override fun logoutUser(): Unit {
TODO("Implement me")
}
override fun updateUser(username: kotlin.String, user: User): Unit {
TODO("Implement me")
}
}

View File

@@ -0,0 +1,24 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.server.models
/**
* A category for a pet
* @param id
* @param name
*/
data class Category(
val id: kotlin.Long? = null,
val name: kotlin.String? = null
)

View File

@@ -0,0 +1,26 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.server.models
/**
* Describes the result of uploading an image resource
* @param code
* @param type
* @param message
*/
data class ModelApiResponse(
val code: kotlin.Int? = null,
val type: kotlin.String? = null,
val message: kotlin.String? = null
)

View File

@@ -0,0 +1,44 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.server.models
/**
* 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.OffsetDateTime? = null,
/* Order Status */
val status: Order.Status? = null,
val complete: kotlin.Boolean? = false
)
{
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String){
placed("placed"),
approved("approved"),
delivered("delivered");
}
}

View File

@@ -0,0 +1,46 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.server.models
import org.openapitools.server.models.Category
import org.openapitools.server.models.Tag
/**
* A pet for sale in the pet store
* @param name
* @param photoUrls
* @param id
* @param category
* @param tags
* @param status pet status in the store
*/
data class Pet(
val name: kotlin.String,
val photoUrls: kotlin.collections.List<kotlin.String>,
val id: kotlin.Long? = null,
val category: Category? = null,
val tags: kotlin.collections.List<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){
available("available"),
pending("pending"),
sold("sold");
}
}

View File

@@ -0,0 +1,24 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.server.models
/**
* A tag for a pet
* @param id
* @param name
*/
data class Tag(
val id: kotlin.Long? = null,
val name: kotlin.String? = null
)

View File

@@ -0,0 +1,37 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.server.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
)